// JavaScript Document
/*------------------------------------------------------------------------
Deveoped By - Vivek Davey
Date of Creation - 24/1/03
Date of Modification - 10/06/03
Description - This Js file contains all the possbile validation for a
              Data entry form and some other function which are used to
			  handle the custom controls.
--------------------------------------------------------------------------*/

//URL for Remotescripting
//strRepURL="http://cs17/ticor_New/";
strRepURL="http://www.ticoremarketing.com/";

//Validation for Form
function f(val)
{
	document.location.href=val;
}
function submit1_onclick(objForm)
{
	//alert("Hello");
	var blExit=false;
	for(var intCounter=0;intCounter<objForm.length && blExit==false;intCounter++)
	{
		var strTemp=""
		strTemp=objForm[intCounter].alt.split("|");
		if(strTemp[0]=="REQ")
		{
			if(strTemp[1]=="TEXT")
			{
				Trim(objForm[intCounter])
				if(strTemp[2]=="")
				{
					if(objForm[intCounter].value=="")
					{
						alert(strTemp[3]);
						//alert("Hi");
						//objForm[intCounter].BackColor='Yellow';
						objForm[intCounter].style.backgroundColor="yellow";
						//alert("Hi");
						objForm[intCounter].focus();
						
						blExit=true;
					}
					else
					{
					objForm[intCounter].style.backgroundColor="white";
					}
				}
				else if(strTemp[2]=="NUMERIC")
				{
					if(IsNumeric(objForm[intCounter])==false)
					{
						alert(strTemp[3]);
						objForm[intCounter].style.backgroundColor="yellow";
						objForm[intCounter].focus();
						blExit=true;
					}
					else
					{
					objForm[intCounter].style.backgroundColor="white";
					}
				}
				else if(strTemp[2]=="STRING")
				{
					if(IsCharacter(objForm[intCounter])==false)
					{
						alert(strTemp[3]);
						objForm[intCounter].focus();
						blExit=true;
					}
				}
				else if(strTemp[2]=="IP")
				{
					if(IsIP(objForm[intCounter])==false)
					{
						alert(strTemp[3]);
						objForm[intCounter].focus();
						blExit=true;
					}
				}
				else if(strTemp[2]=="EMAIL")
				{
					if(IsEmail(objForm[intCounter])==false)
					{
						objForm[intCounter].focus();
						objForm[intCounter].style.backgroundColor="yellow";
						blExit=true;
					}
					else
					{
					objForm[intCounter].style.backgroundColor="white";
					}
				}
				else if(strTemp[2]=="PATH")
				{
					if(IsPath(objForm[intCounter])==false)
					{
						objForm[intCounter].focus();
						blExit=true;
					}
				}
				else if(strTemp[2]=="NOSPL")
				{
					if(IsSpl(objForm[intCounter])==false)
					{
						alert(strTemp[3]);
						objForm[intCounter].focus();
						blExit=true;
					}
				}
				else if(strTemp[2]=="NOSPLWITHQ")
				{
					if(IsSplWithQuote(objForm[intCounter])==false)
					{
						alert(strTemp[3]);
						objForm[intCounter].focus();
						blExit=true;
					}
				}
				else if(strTemp[2]=="NUMCOMMA")
				{
					if(IsNumComma(objForm[intCounter])==false)
					{
						alert(strTemp[3]);
						objForm[intCounter].focus();
						blExit=true;
					}
				}
				else if(strTemp[2]=="INT")
				{
					if(IsInt(objForm[intCounter])==false)
					{
						alert(strTemp[3]);
						objForm[intCounter].style.backgroundColor="yellow";
						objForm[intCounter].focus();
						blExit=true;
					}
					else
					{
					objForm[intCounter].style.backgroundColor="white";
					}
				}
			}
			else if(strTemp[1]=="CHECK")
			{
				
				if(objForm[intCounter].checked==false)
				{
					
					alert(strTemp[3]);
					objForm[intCounter].style.backgroundColor="yellow";
					//alert("Hi checked");
					objForm[intCounter].focus();
					blExit=true;
				}
				else
					{
					objForm[intCounter].style.backgroundColor="white";
					}
			}
			else if(strTemp[1]=="SELECT")
			{
				Trim(objForm[intCounter])
				if(strTemp[2]=="")
				{
					if(objForm[intCounter].value=="")
					{
						alert(strTemp[3]);
						objForm[intCounter].selectedIndex=0;
						objForm[intCounter].style.backgroundColor="yellow";
						objForm[intCounter].focus();
						blExit=true;
					}
					else
					{
					objForm[intCounter].style.backgroundColor="white";
					}
				}
			}
			else if(strTemp[1]=="HIDDEN")
			{
				Trim(objForm[intCounter])
				if(strTemp[2]=="")
				{
					if(objForm[intCounter].value=="")
					{
						alert(strTemp[3]);
						objForm[intCounter].selectedIndex=0;
						blExit=true;
					}
				}
			}
		}
		else if(strTemp[0]=="NOTREQ")
		{
			Trim(objForm[intCounter])
			if(objForm[intCounter].value!="")
			{
				if(strTemp[1]=="TEXT")
				{
					if(strTemp[2]=="")
					{
						if(objForm[intCounter].value=="")
						{
							alert(strTemp[3]);
							objForm[intCounter].focus();
							blExit=true;
						}
					}
					else if(strTemp[2]=="NUMERIC")
					{
						if(IsNumeric(objForm[intCounter])==false)
						{
							alert(strTemp[3]);
							objForm[intCounter].focus();
							blExit=true;
						}
					}
					else if(strTemp[2]=="STRING")
					{
						if(IsCharacter(objForm[intCounter])==false)
						{
							alert(strTemp[3]);
							objForm[intCounter].focus();
							blExit=true;
						}
					}
					else if(strTemp[2]=="IP")
					{
						if(IsIP(objForm[intCounter])==false)
						{
							alert(strTemp[3]);
							objForm[intCounter].focus();
							blExit=true;
						}
					}
					else if(strTemp[2]=="EMAIL")
					{
						if(IsEmail(objForm[intCounter])==false)
						{
							objForm[intCounter].focus();
							blExit=true;
						}
					}
					else if(strTemp[2]=="PATH")
					{
						if(IsPath(objForm[intCounter])==false)
						{
							objForm[intCounter].focus();
							blExit=true;
						}
					}
					else if(strTemp[2]=="NOSPL")
					{
						if(IsSpl(objForm[intCounter])==false)
						{
							alert(strTemp[3]);
							objForm[intCounter].focus();
							blExit=true;
						}
					}
				}
			}
		}
	}
	if(blExit==false)
	{
		//alert("blExit"+blExit);
		return true;
	}
	else
	{
		//alert("blExit:"+ blExit);
		return false;
	}
}

//This function works as Trim function of VB
function Trim(item)
{
  var tmp = "";
  var item_length = item.value.length;
  var item_length_minus_1 = item.value.length - 1;
  for (index = 0; index < item_length; index++)
  {
    if (item.value.charAt(index) != ' ')
    {
      tmp += item.value.charAt(index);
    }
    else
    {
      if (tmp.length > 0)
      {
        if (item.value.charAt(index+1) != ' ' && index != item_length_minus_1)
        {
          tmp += item.value.charAt(index);
        }
      }
    }
  }
  item.value = tmp;
}

//  check for valid numeric strings	
function IsNumeric(oObject)
{
   var strValidChars = "0123456789.";
   var strChar;
   var blnResult = true;
   var strString=oObject.value;	
   if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
}

//check specifically for Tax
function IsNumComma(oObject)
{
   var strValidChars = "0123456789,";
   var strChar;
   var blnResult = true;
   var strString=oObject.value;	
   if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
   {
      strChar = strString.charAt(i);
      if(strValidChars.indexOf(strChar) == -1)
      {
         blnResult = false;
      }
   }
   return blnResult;
}

//check specifically for Integer Data
function IsInt(oObject)
{
   var strValidChars = "0123456789";
   var strChar;
   var blnResult = true;
   var strString=oObject.value;	
   if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
   {
      strChar = strString.charAt(i);
      if(strValidChars.indexOf(strChar) == -1)
      {
         blnResult = false;
      }
   }
   return blnResult;
}

//  check for valid strings	
function IsCharacter(oObject)
{
   var strValidChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ,./<>?;':{}[]`1234567890-=~!@#$%^&*()_+|";
   var strChar;
   var blnResult = true;
   var strString=oObject.value;	
   if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
}

//Validation for Proper Ip Address
function IsIP (oObject) {
var IPvalue=oObject.value;
errorString = "";
theName = "IPaddress";

var ipPattern = /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;
var ipArray = IPvalue.match(ipPattern); 

if (IPvalue == "0.0.0.0")
errorString = errorString + theName + ': '+IPvalue+' is a special IP address and cannot be used here.';
else if (IPvalue == "255.255.255.255")
errorString = errorString + theName + ': '+IPvalue+' is a special IP address and cannot be used here.';
if (ipArray == null)
errorString = errorString + theName + ': '+IPvalue+' is not a valid IP address.';
else {
for (i = 0; i < 4; i++) {
thisSegment = ipArray[i];
if (thisSegment > 255) {
errorString = errorString + theName + ': '+IPvalue+' is not a valid IP address.';
i = 4;
}
if ((i == 0) && (thisSegment > 255)) {
errorString = errorString + theName + ': '+IPvalue+' is a special IP address and cannot be used here.';
i = 4;
      }
   }
}
extensionLength = 3;
if (errorString == "")
return true;
else
return false;
}

//Validation for proper Email address
function IsEmail(oObject) 
{
var emailStr=oObject.value;
var emailPat=/^(.+)@(.+)$/;
var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]";
var validChars="\[^\\s" + specialChars + "\]";
var quotedUser="(\"[^\"]*\")";
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
var atom=validChars + '+';
var word="(" + atom + "|" + quotedUser + ")";
var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");

var matchArray=emailStr.match(emailPat)
if (matchArray==null) 
{
	alert("Email address seems incorrect (check @ and .'s)");
	return false;
}
var user=matchArray[1];
var domain=matchArray[2];

if (user.match(userPat)==null)
 {
    alert("The username doesn't seem to be valid. Please check or register fresh");
    return false;
}
var IPArray=domain.match(ipDomainPat);
if (IPArray!=null) {
	  for (var i=1;i<=4;i++) {
	    if (IPArray[i]>255) {
	        alert("Destination IP address is invalid!");
		return false;
	    }
    }
    return true;
}

var domainArray=domain.match(domainPat);
if (domainArray==null) {
	alert("The domain name doesn't seem to be valid.");
    return false;
}
var atomPat=new RegExp(atom,"g");
var domArr=domain.match(atomPat);
var len=domArr.length;
if (domArr[domArr.length-1].length<2 || 
    domArr[domArr.length-1].length>3) {
   alert("The EMail Address must end in a three-letter domain, or two letter country.");
   return false;
}

if (len<2) {
   var errStr="This EMail Address is missing a hostname!";
   alert(errStr);
   return false;
}
return true;
}
//validation for  Email without doucment.form.txtname.value
function IsEmailDirect(emailStr) 
{
//alert(emailStr);

//var emailStr=oObject.value;
var emailPat=/^(.+)@(.+)$/;
var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]";
var validChars="\[^\\s" + specialChars + "\]";
var quotedUser="(\"[^\"]*\")";
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
var atom=validChars + '+';
var word="(" + atom + "|" + quotedUser + ")";
var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");

var matchArray=emailStr.match(emailPat)
if (matchArray==null) 
{
	alert("Email address seems incorrect (check @ and .'s).\n Correct Format : support@ticoremarketing.com ");
	return false;
}
var user=matchArray[1];
var domain=matchArray[2];

if (user.match(userPat)==null)
 {
    alert("The Email doesn't seem to be valid. Please check or register fresh");
    return false;
}
var IPArray=domain.match(ipDomainPat);
if (IPArray!=null) {
	  for (var i=1;i<=4;i++) {
	    if (IPArray[i]>255) {
	        alert("Destination Email is invalid!");
		return false;
	    }
    }
    return true;
}

var domainArray=domain.match(domainPat);
if (domainArray==null) {
	alert("The domain name doesn't seem to be valid.");
    return false;
}
var atomPat=new RegExp(atom,"g");
var domArr=domain.match(atomPat);
var len=domArr.length;
if (domArr[domArr.length-1].length<2 || 
    domArr[domArr.length-1].length>3) {
   alert("The EMail Address must end in a three-letter domain, or two letter country.");
   return false;
}

if (len<2) {
   var errStr="This EMail Address is missing a hostname!";
   alert(errStr);
   return false;
}
return true;
}
//Validation for proper directory path
function IsPath(oObject)
{
	strPath=oObject.value;
	var strValidChars = "abcdefghigklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
	if(strPath=="")
	{
		alert("Enter proper path");
	}
	var strChar=strPath.charAt(0);
	if (strValidChars.indexOf(strChar) == -1)
	{
		alert("Drive letter is missing")
		return false;
	}
	strChar=strPath.charAt(1);
	if(strChar!=":")
	{
		alert(": missing after drive letter");
		return false;
	}
	strChar=strPath.charAt(2);
	if(strChar!="\\")
	{
		alert("\\ slash is missing after drive letter")
		return false;
	}
	strChar=strPath.charAt(strPath.length-1);
	if(strChar=="\\")
	{
		strChar="";
		for(var intI=0;intI<(strPath.length-1);intI++)
		{
			strChar=strChar + strPath.charAt(intI);
		}
		strPath=strChar;
		oObject.value=strPath;
	}
	return true;
}
//  check for valid strings	
function IsSpl(oObject)
{
   var strValidChars = "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_. ,";
   var strChar;
   var blnResult = true;
   var strString=oObject.value;	
   //if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
}


function IsSplWithQuote(oObject)
{
   var strValidChars = "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_. ,'";
   var strChar;
   var blnResult = true;
   var strString=oObject.value;	
   if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
}

//This function is used to delete the records
function delete_onclick(oObject)
{
	if(confirm("Are your sure that you want to delete this record ?"))
	{
		oObject.value="delete";
		return true;
	}
	else
	{
		return false;
	}
}

//This function is used for adding the values in selection List control
function AddValue(oObject,oObject1)
{
	if(oObject.selectedIndex!=-1)
	{
		oObject1.options[oObject1.length]=new Option(oObject.options[oObject.selectedIndex].text,oObject.options[oObject.selectedIndex].value)
		oObject.options[oObject.selectedIndex]=null;
	}
}
//This function is used for deleting the values in selection List control
function DeleteValue(oObject,oObject1)
{
	if(oObject1.selectedIndex!=-1)
	{
		oObject.options[oObject.length]=new Option(oObject1.options[oObject1.selectedIndex].text,oObject1.options[oObject1.selectedIndex].value)
		oObject1.options[oObject1.selectedIndex]=null;
	}
}

//This function is used for deleting selected values from selection List control
function DeleteSelected(oObject,oObject1)
{
	var strSelectValue="";
	var strSelectText="";
    var strSelectValueArr = new Array;
    var strSelectTextArr = new Array;
    var counter = 0;
	for(var intCounter=0;intCounter<oObject1.options.length;intCounter++)
    {
        if(oObject1.options[intCounter].selected==true)
        {
            strSelectValueArr[counter] =oObject1.options[intCounter].value;
            strSelectTextArr[counter] =oObject1.options[intCounter].text;
            counter++;
        }
    }
	for(var i=0;i<strSelectValueArr.length;i++)
	{
		strSelectValue=strSelectValueArr[i];
		strSelectText=strSelectTextArr[i];                                                        
		oObject.options[oObject.length]=new Option(strSelectText,strSelectValue)               
	}
	for(intCounter=0;intCounter<oObject.options.length;intCounter++)
    {
		for(var intCounter1=0;intCounter1<oObject1.options.length;intCounter1++)
		{
			if(oObject1.options[intCounter1].value==oObject.options[intCounter].value)
			{
				oObject1.options[intCounter1]=null;
			}
		}
    }
}

//This function is used for adding selected values in selection List control
function AddSelected(oObject,oObject1)
{
	var strSelectValue="";
	var strSelectText="";
    var strSelectValueArr = new Array;
    var strSelectTextArr = new Array;
    var counter = 0;
	for(var intCounter=0;intCounter<oObject.options.length;intCounter++)
    {
        if(oObject.options[intCounter].selected==true)
        {
            strSelectValueArr[counter] =oObject.options[intCounter].value;
            strSelectTextArr[counter] =oObject.options[intCounter].text;
            counter++;
        }
    }
        
	for(var i=0;i<strSelectValueArr.length;i++)
	{
		strSelectValue=strSelectValueArr[i];
		strSelectText=strSelectTextArr[i];                                                        
		oObject1.options[oObject1.length]=new Option(strSelectText,strSelectValue)            
	}
	for(intCounter=0;intCounter<oObject1.options.length;intCounter++)
    {
		for(var intCounter1=0;intCounter1<oObject.options.length;intCounter1++)
		{
			if(oObject.options[intCounter1].value==oObject1.options[intCounter].value)
			{
				oObject.options[intCounter1]=null;
			}
		}
    }
}
//This function is used for adding all the values in selection List control
function AddAll(oObject,oObject1)
{
	var intPos=oObject.options.length-1;
	for(var intCounter=oObject.options.length-1;intCounter>=0;intCounter--)
	{
		intPos=intPos-intCounter;
		oObject1.options[oObject1.length]=new Option(oObject.options[intPos].text,oObject.options[intPos].value)
		oObject.options[intPos]=null;
		intPos=oObject.options.length-1;
	}
}
//This function is used for deleting all the values in selection List control
function DeleteAll(oObject,oObject1)
{
	var intPos=oObject1.options.length-1;
	for(var intCounter=oObject1.options.length-1;intCounter>=0;intCounter--)
	{
		intPos=intPos-intCounter;
		oObject.options[oObject.length]=new Option(oObject1.options[intPos].text,oObject1.options[intPos].value)
		oObject1.options[intPos]=null;
		intPos=oObject1.options.length-1;
	}
}

//This function is used for changing the postion of values in selection List control
function LevelUp(oObject)
{
	if(oObject.selectedIndex>0)
	{
		var strValue=oObject.options[oObject.selectedIndex].value;
		var strText=oObject.options[oObject.selectedIndex].text;
		oObject.options[oObject.selectedIndex].value=oObject.options[oObject.selectedIndex-1].value;
		oObject.options[oObject.selectedIndex].text=oObject.options[oObject.selectedIndex-1].text;
		oObject.options[oObject.selectedIndex-1].value=strValue;
		oObject.options[oObject.selectedIndex-1].text=strText;
		oObject.selectedIndex=oObject.selectedIndex-1;
	}	
}

//This function is used for changing the postion of values in selection List control
function LevelDown(oObject)
{
	if(oObject.selectedIndex<oObject.options.length-1 && oObject.selectedIndex!=-1)
	{
		var strValue=oObject.options[oObject.selectedIndex].value;
		var strText=oObject.options[oObject.selectedIndex].text;
		oObject.options[oObject.selectedIndex].value=oObject.options[oObject.selectedIndex+1].value;
		oObject.options[oObject.selectedIndex].text=oObject.options[oObject.selectedIndex+1].text;
		oObject.options[oObject.selectedIndex+1].value=strValue;
		oObject.options[oObject.selectedIndex+1].text=strText;
		oObject.selectedIndex=oObject.selectedIndex+1;
	}	
}

function AddBoth(oObject,oObject1)
{
	var intPos=oObject.options.length-1;
	for(var intCounter=oObject.options.length-1;intCounter>=0;intCounter--)
	{
		intPos=intPos-intCounter;
		oObject1.options[oObject1.length]=new Option(oObject.options[intPos].text,oObject.options[intPos].value)
		//oObject.options[intPos]=null;
		intPos=oObject.options.length-1;
		//intPos=intPos-1;
	}
}

//This function select all the values in SelectionList control
function SelectAllSelection(objList)
{
	objList.multiple=true;
	if (objList.options.length!=-1)
	{
    	if(objList.options.length>=1)
    	{
			for(var intCounter=0;intCounter<objList.options.length;intCounter++)
       		{
				objList.options[intCounter].selected=true;
       		}
    	}
	}
  	else
  	{
      objList.options[0].selected=true;
   	}
}

//This function checks for the limit of Characters entered by the user
function LimitChar(objField,intLimit)
{
	if(objField.value.length>intLimit)
	{
		alert("You cannot enter more then " + intLimit + " characters in this field !");
		objField.value=objField.value.substring(0,intLimit);
		objField.focus();
	}
}

//this function selects all the checkboxes in grid
function SelectAllCheckbox(oParent,oChild)
{
	if(oParent.checked==true)
	{
		if(oChild!=null)
		{
			if(oChild.length!=null)
			{
				for(var intCounter=0;intCounter<oChild.length;intCounter++)
				{
					oChild[intCounter].checked=true;
				}
			}
			else
			{
				oChild.checked=true;
			}
		}
	}
	else if(oParent.checked==false)
	{
		if(oChild!=null)
		{
			if(oChild.length!=null)
			{
				for(var intCounter=0;intCounter<oChild.length;intCounter++)
				{
					oChild[intCounter].checked=false;
				}
			}
			else
			{
				oChild.checked=false;
			}
		}
	}
}

function StartProcess(id)
{
		var strFeatures;
		strFeatures = "toolbar=no,directories=no,menubar=no,scrollbars=no,resizable=no,height=100,width=200";
		
		window.open('../../Component/ProgressBar.aspx?id=' + id, 'Progress', strFeatures);
}
function ReplaceEnter(val)
					{
							var strData=val
							strData=strData.replace(/[\n\r\s]+/,"","g");
							strData=strData.replace(" ","","g");
							strData=TrimValue(strData);
							if(strData.length==0)
							{
								//alert("Please enter value in Messages");
								return false;
							}
							return true;
					}
					function TrimValue(strValue)
					{
					var tmp = "";
					var item_length = strValue.length;
					var item_length_minus_1 = strValue.length - 1;
					for (index = 0; index < item_length; index++)
					{
							if (strValue.charAt(index) != " ")
							{
							tmp += strValue.charAt(index);
							}
							else
							{
							if (tmp.length > 0)
							{
									if (strValue.charAt(index+1) != " " && index != item_length_minus_1)
									{
									tmp += strValue.charAt(index);
									}
							}
							}
					}
					strValue = tmp;
					return strValue;
					}
					
					