function isDate(strdt)
	{
		dt=new Date(strdt)
		if (isNaN(dt))
		{
			return false;
		}
		else
		{
			return true;
		}			
	}
	
	
	function onlyNumbers(oThis)
	{	if (document.layers)
			Key = e.which;
		else
			Key = window.event.keyCode;
						 
						  
	
						  
       
		if ((Key < 46 || Key > 57 || Key == 47 )|| (oThis.value.indexOf('.') != -1 && Key==46)  )	
			if (document.layers)
				e.which = 0;	  
			else
				window.event.keyCode = 0;
	
	}

	
	//alert(isValidDate("1.1.02"))
	function isLeapYear(yr)
	{
		yr=parseInt(yr,10);
		if ((yr%4)==0)
		{
			if ((yr%100)==0)
			{
				if ((yr%400)==0)
				{
					return true;
				}
				else
				{
					return false;
				}
			}
			else
			{
				return true;
			}
		}
		else
		{
			return false;
		}
	}
	function ConvertYear(yr)
	{
		if (yr.length==2)
		{
			yr="20"+yr;
			return yr;
		}
		else
		{
			return yr;
		}
	}

	function comparetime(StartObj, EndObj, starthr, startmin, endhr, endmin, lblStart, lblEnd)
	{
		var intElementNr;
		var strStartDateArray;
		var strEndDateArray;
		var strSDay;
		var strSMonth;
		var strSYear;
		var strEDay;
		var strEMonth;
		var strEYear;
		var booFound;
		var Startdatefield = StartObj.value;
		var Enddatefield = EndObj.value;
		var shr = starthr.value;
		var smin = startmin.value;
		var ehr = endhr.value;
		var emin = endmin.value;
		var strSeparatorArray = new Array("-"," ","/",".");
		for (intElementNr = 0; intElementNr < strSeparatorArray.length; intElementNr++) 
		{
			if (Startdatefield.indexOf(strSeparatorArray[intElementNr]) != -1) 
			{
				strStartDateArray = Startdatefield.split(strSeparatorArray[intElementNr]);
				if (strStartDateArray.length != 3) 
				{
					err = 1;
					return(false);
				}
				else 
				{
					strSMonth = parseInt(strStartDateArray[0], 10);
					strSDay = parseInt(strStartDateArray[1], 10);
					strSYear = parseInt(strStartDateArray[2], 10);
				}
					booFound = true;
			}
			if (Enddatefield.indexOf(strSeparatorArray[intElementNr]) != -1) 
			{
				strEndDateArray = Enddatefield.split(strSeparatorArray[intElementNr]);
				if (strEndDateArray.length != 3) 
				{
					err = 1;
					return(false);
				}
				else 
				{
					strEMonth = parseInt(strEndDateArray[0], 10);
					strEDay = parseInt(strEndDateArray[1], 10);
					strEYear = parseInt(strEndDateArray[2], 10);
				}
					booFound = true;
			}
		}
		if ((strEDay == strSDay) && (strEMonth == strSMonth) && (strEYear == strSYear))
		{
			if (ehr < shr)
			{
				alert (lblEnd + " cannot be earlier to " + lblStart);
				//endhr.focus();
				return(false);
			}
			if ((emin < smin) && (shr == ehr))
			{
				alert (lblEnd + " cannot be earlier to " + lblStart);
				//endmin.focus();
				return(false);
			}
			if ((emin == smin) && (shr == ehr))
			{
				if (confirm(lblEnd + " and " + lblStart + " are same. Are you sure to continue?"))
					return(true);
				else
				{
					//endmin.focus();
					return(false);
				}
			}
			return(true);
		}
		else
		{
			return(true);
		}
	}

	function isValidDate(valDate)
	{
		var dt;
		if (!isDate(valDate)) 
		{
			return false;
		}
		else
		{
			valDate=valDate.replace('-','/');
			valDate=valDate.replace('-','/');
			valDate=valDate.replace('.','/');
			valDate=valDate.replace('.','/');
			valDate=valDate.replace(' ','/'); // sanjay 8 sep 2005
			
			arrDT=valDate.split("/")
			var yr=arrDT[2];
			if (yr.length==2)
			{
				if (yr<79)
				{
					yr=20+yr;
				}
				else
				{
					yr=19+yr;
				}
			}
			if (isNaN(arrDT[0]))
			{
				return false;
			}
			if (parseInt(arrDT[1],10)>12||parseInt(arrDT[1],10)<=0||parseInt(arrDT[0],10)>31||parseInt(arrDT[0],10)<=0||parseInt(yr,10)>2078||parseInt(yr,10)<=1900)
			{
				
				return false;
			}
			else
			{
				if (parseInt(arrDT[1],10)==2)
				{	
					if (isLeapYear(parseInt(yr,10)))
					{
						if (parseInt(arrDT[0],10)>29)
						{
							return false;
						}
					}
					else
					{
						if (parseInt(arrDT[0],10)>28)
						{
							return false;
						}
					}
				}
				else
				{
					if (parseInt(arrDT[1],10)==4||parseInt(arrDT[1],10)==6||parseInt(arrDT[1],10)==9||parseInt(arrDT[1],10)==11)
					{
						if (parseInt(arrDT[0],10)>30)		
						{
							//alert(parseInt(arrDT[0],10));
							return false;
						}
					}
				}					
			}
			return true;
		}
	}
	
	
	function round (n) 
	{
    n = Math.round(n * 100) / 100;
    n = (n + 0.001) + '';
    return n.substring(0, n.indexOf('.') + 3);
	}

	//var strNum=1.49959
	//alert(round(strNum));
	

	function ReverseDate(dt)
	{
		if (isValidDate(dt))
		{
			revDT=dt.split("/");
			dtDay=revDT[0];
			dtMonth=revDT[1];
			dtYear=revDT[2];
			temp=dtMonth + "/" + dtDay + "/" + dtYear;
			return temp;
		}
	}
	function AppendOption(val,text)
	{
		var op=new Option();
		op.value=val;
		op.text=text;
		document.frmOrder.ado_InsertionIssue.options[document.frmOrder.ado_InsertionIssue.options.length] = op;
	}
	
	function SortD(box)  
	{
		var temp_opts = new Array();
		var temp = new Object();
		var tempX;
		var tempY;
		for(var i=0; i<box.options.length; i++)  
		{
			temp_opts[i] = box.options[i];
		}
		for(var x=1; x<temp_opts.length-1; x++)  
		{
			for(var y=(x+1); y<temp_opts.length; y++)  
			{
				tempX = new Date(ReverseDate(temp_opts[x].text));
				tempY = new Date(ReverseDate(temp_opts[y].text));
				if(tempX > tempY)  
				{
					temp = temp_opts[x].text;
					temp_opts[x].text = temp_opts[y].text;
					temp_opts[y].text = temp;
					temp = temp_opts[x].value;
					temp_opts[x].value = temp_opts[y].value;
					temp_opts[y].value = temp;
				}
			}
		}
		for(var i=0; i<box.options.length; i++)  
		{
			box.options[i].value = temp_opts[i].value;
			box.options[i].text = temp_opts[i].text;
		}
	}	
	
	

	//This Function is Used for Normal TextFields
	function IsEntered(InputField,InputLabel)
	{
		InputField.value = trim(InputField.value);	
		if((InputField.value==null) || (InputField.value == "") || (InputField.value==''))
		{
			alert(InputLabel + " is required.");
			InputField.focus();
			return false;
		}
		else { return true;}
	}

	function IsNumeric(InputField,InputLabel)
	{
		if (isNaN(InputField.value))
		{
			alert("Please enter a numeric value for " + InputLabel + ".");
			InputField.select();
			InputField.focus();
			return false;
		}
		return true;
	}

	function setFocus(setField)
	{
		setField.focus();
	}
	
	function help(url)
	{
		//alert(url);
		window.open(url ,'', 'scrollbars=yes,resizable=yes,height=300,WIDTH=500');
	}
	
	
	function CompareDates(StartObj, EndObj)
	{
		var intElementNr;
		var strStartDateArray;
		var strEndDateArray;
		var strSDay;
		var strSMonth;
		var strSYear;
		var strEDay;
		var strEMonth;
		var strEYear;
		var booFound;
		var Startdatefield = StartObj.value;
		var Enddatefield = EndObj.value;
		var strSeparatorArray = new Array("-"," ","/",".");
		for (intElementNr = 0; intElementNr < strSeparatorArray.length; intElementNr++) 
		{
			if (Startdatefield.indexOf(strSeparatorArray[intElementNr]) != -1) 
			{
				strStartDateArray = Startdatefield.split(strSeparatorArray[intElementNr]);
				if (strStartDateArray.length != 3) 
				{
					err = 1;
					return false;
				}
				else 
				{
					strSDay = parseInt(strStartDateArray[0], 10);
					strSMonth = parseInt(strStartDateArray[1], 10);
					strSYear = parseInt(strStartDateArray[2], 10);
				}
					booFound = true;
			}
			if (Enddatefield.indexOf(strSeparatorArray[intElementNr]) != -1) 
			{
				strEndDateArray = Enddatefield.split(strSeparatorArray[intElementNr]);
				if (strEndDateArray.length != 3) 
				{
					err = 1;
					return false;
				}
				else 
				{
					strEDay = parseInt(strEndDateArray[0], 10);
					strEMonth = parseInt(strEndDateArray[1], 10);
					strEYear = parseInt(strEndDateArray[2], 10);
				}
					booFound = true;
			}
		}
		if ((strEYear < strSYear) || ((strEMonth < strSMonth) && (strEYear == strSYear)) || ((strEDay < strSDay) && (strEMonth == strSMonth) && (strEYear == strSYear)))
		{
			EndObj.select();
			alert ("End date is smaller than Start date.");
			EndObj.focus();
			return(false);
		}
		else
		{
			return(true);
		}
	}


	function CompareDateValues(StartObj, EndObj, lblStart, lblStop)
	{
		var intElementNr;
		var strStartDateArray;
		var strEndDateArray;
		var strSDay;
		var strSMonth;
		var strSYear;
		var strEDay;
		var strEMonth;
		var strEYear;
		var booFound;
		var Startdatefield = StartObj.value;
		var Enddatefield = EndObj.value;
		var strSeparatorArray = new Array("-"," ","/",".");
//		alert(Startdatefield+' * '+Enddatefield);
		for (intElementNr = 0; intElementNr < strSeparatorArray.length; intElementNr++) 
		{
			if (Startdatefield.indexOf(strSeparatorArray[intElementNr]) != -1) 
			{
				strStartDateArray = Startdatefield.split(strSeparatorArray[intElementNr]);
				if (strStartDateArray.length != 3) 
				{
					err = 1;
					return(false);
				}
				else 
				{
					strSDay = parseInt(strStartDateArray[0], 10);
					strSMonth = parseInt(strStartDateArray[1], 10);
					strSYear = parseInt(strStartDateArray[2], 10);
				}
					booFound = true;
			}
			if (Enddatefield.indexOf(strSeparatorArray[intElementNr]) != -1) 
			{
				strEndDateArray = Enddatefield.split(strSeparatorArray[intElementNr]);
				if (strEndDateArray.length != 3) 
				{
					err = 1;
					return(false);
				}
				else 
				{
					strEDay = parseInt(strEndDateArray[0], 10);
					strEMonth = parseInt(strEndDateArray[1], 10);
					strEYear = parseInt(strEndDateArray[2], 10);
				}
					booFound = true;
			}
		}
		/*
		alert(strEYear +' '+ strSYear)
		alert(strEMonth +' '+ strSMonth)
		alert(strEDay +' '+ strSDay)*/
		if ((strEYear < strSYear) || ((strEMonth < strSMonth) && (strEYear == strSYear)) || ((strEDay < strSDay) && (strEMonth == strSMonth) && (strEYear == strSYear)))
		{
			alert (lblStop + " is smaller than " + lblStart);
			return(false);
		}
//		else
//		{
			return(true);
//		}
	}
	function SetDateTime(theform,theText,theDropHr,theDropMin)
	{
		var thedate=new Date();
		var theYear=thedate.getYear();
		var thDay=thedate.getDate();
		var theMonth=thedate.getMonth();
		var theHr=thedate.getHours();
		//alert(theHr);
		var theMinutes=thedate.getMinutes();
		//var AmPm=1;
		theHr=theHr+1;
		theMonth=theMonth+1;
		var displaydate=thDay+"/"+theMonth+"/"+theYear;
		if(theMinutes%5==0)
		{
			theDropMin.selectedIndex=(theMinutes/5)+1;
		}
		else
		{
			theDropMin.selectedIndex=Math.floor(theMinutes/5)+1;
		}
		
		theText.value=displaydate;
		theDropHr.selectedIndex=parseInt(theHr,10);
	}
	
	

	function trim(strText) 
 { 
    // this will get rid of leading spaces 
    while (strText.substring(0,1) == ' ') 
        strText = strText.substring(1, strText.length);

    // this will get rid of trailing spaces 
    while (strText.substring(strText.length-1,strText.length) == ' ')
        strText = strText.substring(0, strText.length-1);

   return strText;
} 

	
/*	function trim(strText1) 	
	{ 
		strText = String(strText1);
	   // this will get rid of leading spaces 
		while (strText.substring(0,1) == ' ') 
			strText = strText.substring(1, strText.length);

	   // this will get rid of trailing spaces 
		while (strText.substring(strText.length-1,strText.length) == ' ')
		strText = strText.substring(0, strText.length-1);

		return strText;
	} 
	
*/	
	function CountCharacter (str,ch)
{
	if (str.length > 0 && ch.length > 0)
	{
		if (str.indexOf(ch) != -1)
		{
			cnt = 0
			while(str.length > 0)
			{
				if (str.indexOf(ch) == -1)
				{
					str = "";
				}
				else
				{
					cnt++;
				}
				str = str.substring(str.indexOf(ch)+ch.length,str.length)
			}
			return(cnt);
		}
		else
		{
			return (0)
		}
	}
}
/*This function is added to see speacial characters in email */
var symbols = " !\"#$%&'()*+'-./0123456789:;<=>?@";
function toAscii (chr)  
{
var loAZ = "abcdefghijklmnopqrstuvwxyz";
symbols+= loAZ.toUpperCase();
symbols+= "[\\]^_`";
symbols+= loAZ;
symbols+= "{|}~";
var loc;
loc = symbols.indexOf(chr);
if (loc >-1) 
{ 
Ascii_Decimal = 32 + loc;
return (32 + loc);
}
return(0); 
}

function isValidEmail(eml)
{
	//alert(toAscii("-"))
	if (eml.length == 0 || CountCharacter(eml,"@") == 0 || CountCharacter(eml,".") == 0 || CountCharacter(eml,"@") > 1 || CountCharacter(eml,".@") > 0 ||CountCharacter(eml,"@.") > 0)
	{
		return(false);
	}
	if (eml.indexOf(".") == 0 || eml.indexOf("@") == 0)
	{
		return(false);
	}
	if (eml.indexOf(".") + 1 == eml.length || eml.indexOf("@") + 1 == eml.length ||eml.indexOf(".")==" ")
	{
		return(false);
	}
	for (i=0;i<eml.length;i++)
	{
		//alert(eml.substring(i,i+1))
		/*
			48-57 == 0->9
			97-122 == a->z
			65-90 == A->Z
			46 == .
			64 == @
			95 == _
		*/
		CharAscii = toAscii(eml.substring(i,i+1));
		if (!((CharAscii >= 48 && CharAscii <= 57)||(CharAscii>=97 && CharAscii <= 122) || (CharAscii >= 65 && CharAscii <= 90) || CharAscii == 46 || CharAscii == 64 || CharAscii == 95 || CharAscii == 45))
		{
			return false;
		}
		
		if (!(InEmailCheckForDoubleDots(eml)))
		{
			//alert('Check for double dots')
			return false;
		}
	}
	return(true);
}

//The function below was added by Kuldeep on 28/06/2004
//The function will return an error in the following case:-
//kuldeep@rhealsoft..com
function InEmailCheckForDoubleDots(eml)
	{
		var i,boolSingleDot,boolDoubleDots,posiOfDots,strText,lenOfEml;
		
		lenOfEml=eml.length;
		boolSingleDot=false;
		boolDoubleDots=false;
		
		for (i=0;i < lenOfEml;i++)
		{
			strText=eml.charAt(i);
			if ((strText==".") && (boolSingleDot==true))
			{
				boolDoubleDots=true;
			}
			else if ((strText==".") && (boolSingleDot==false))
			{
				boolSingleDot=true;
			}
			else
			{
				//boolDoubleDots=false;
				boolSingleDot=false;
			}
			
		}
		
		if (boolDoubleDots==true)
		{
			//alert('Double Dots Found');
			return false;
		}	
		else
		{
			//alert('Single Dot Found');
			return true;
		}
				
	}

function Repl(expr,find,repl)
		{
			var temp=expr;
			while(temp.indexOf(find)!=-1)
				temp=temp.replace(find,repl);
	
			return temp;
	
		}

function checkEqualDates(Date1, Date2)
{
	var arrDt1 = Date1.split("/");
	var arrDt2 = Date2.split("/");
	if (arrDt1.length < 3 || arrDt2.length < 3)
	{
//		alert("Please enter valid dates.");
		return(false);
	}
	if (arrDt1[0] != arrDt2[0])
		return(false);
	if (arrDt1[1] != arrDt2[1])
		return(false);
	if (arrDt1[2].length == 2)
	{
		if (parseInt(arrDt1[2],0) <= 40)
			arrDt1[2] = parseInt(arrDt1[2], 0) + 2000;
		else
			arrDt1[2] = parseInt(arrDt1[2], 0) + 1900;
	}
	if (arrDt2[2].length == 2)
	{
		if (parseInt(arrDt2[2],0) <= 40)
			arrDt2[2] = parseInt(arrDt2[2], 0) + 2000;
		else
			arrDt2[2] = parseInt(arrDt2[2], 0) + 1900;
	}
	if(arrDt1[2] != arrDt2[2])
		return(false);
	
	return(true);
}

var chkDatelen = 0;	//This variable is used in the Clients.asp for the validation.
function hlpDate(strObj)
{//alert(event.keyCode);
	var strDate = strObj.value;
	if ((event.keyCode > 46 && event.keyCode < 58) || (event.keyCode > 95 && event.keyCode < 106) || (event.keyCode == 111))
	{
		var chkOcc = 0;
		chkDatelen = 0;
		var strLastChar = strDate.substring(strDate.length-1, strDate.length);
		var strLastTwoChar;
		if (strDate.length >= 2)
		{
			strLastTwoChar = strDate.substring(strDate.length-2, strDate.length);
	//		alert(strLastTwoChar == '//');
			if (strLastTwoChar == '//')
				strObj.value = strDate.substring(0, strDate.length-1);
		}
	//	alert(strLastTwoChar);
		if (isNaN(strLastChar))
		{
			if (strLastChar != "/")
			{
				alert("Please enter a valid date.");
				strObj.value = strDate.substring(0, strDate.length-1);
				strDate = strDate.substring(0, strDate.length-1);
			}
		}
		if (strDate.length < 10)
		{
			if (((strDate.length == 2) || (strDate.length == 5)) && (chkOcc < 2))
			{
				strObj.value = strObj.value + '/';
				strObj.focus();
				chkOcc = chkOcc + 1;
			}
		}
		if (strDate.length >=8)
			chkDatelen = 1;
	}
	else
	{
		if (isNaN(strDate.substring(strDate.length-1, strDate.length)))
			strObj.value = strDate.substring(0, strDate.length-1);
	}
}

//Mortgage Functions to check for unsaved data.
function markChange()
{
	chkChange = 1;
}
function chkChangedData(strHref, intTarget)
{
	if (chkChange == 1)
	{
		if (confirm("You have entered changes to these details. \nIf you choose \'OK\' the changes will be saved, if you choose \'Cancel\' the changes will not be saved!"))
		{
			if (validateMe())
			{
				eval("document." + strFrmName + ".redUrl.value = '" + strHref + "'");
				eval("document." + strFrmName + ".target.value = '" + intTarget + "'");
				eval("document." + strFrmName + ".submit()");
			}
			else
			{
				chkChange = 1;
				return(false);
			}
		}
		else
		{
			if (intTarget == 1)
				window.top.location.href = strHref;
			else
				self.location.href = strHref;
		}
	}
	else
		self.location.href = strHref;
}


	function manString(inStr)
	{
		newStr = inStr.value;
		tempStr = newStr.substring(0,1);
		k = "";
		for(i=0;i<newStr.length;i++)
		{
			j = newStr.charAt(i);
			if(i == 0)
			{
				j = j.toUpperCase();
			}
			if(newStr.charAt(i-1) == ' ')
			{
				j = j.toUpperCase();
			}
			k = k + j
		}
		inStr.value=k;
		
		while(''+inStr.value.charAt(0) == ' ')
		{
			inStr.value=inStr.value.substring(1,inStr.value.length);
		}
	}
function handleEnterQuickSearch (field, event,ControlType) 
	{
	    var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
		if (keyCode == 13) 
			{
				if (ControlType == 'A')
					{
						gosearchresult();
						return true;
					}
			}
	}
function IsNumeric1(str,label)
	{
		var n = new String();
		n = str.value;
		var flag;
		flag=0;
		l = parseInt((n.length)-1) 
		for(i=0;i<n.length;i++)
			{
				if((n.charAt(0)=='£')&&(i=="0")&&(n.charCodeAt(1)!="44"))
				    {flag=1;}	
				else if( ((n.charCodeAt(i)>="48")&&(n.charCodeAt(i)<="57"))||((n.charCodeAt(i)=="44") && (i!="0") && (n.charCodeAt(l)!="44")) )
					{flag=1;}
				else{
						flag=0;
						alert(''+label+' should be contain digits from (0-9)');
						str.focus();
						return false;
					}	 
			}
		 return true;
	}
function pn_getobject(obj) 
	{ 
		if (document.getElementById) 
			{
             	return document.getElementById(obj) 
			} 
		else if (document.all) 
			{
				return document.all[obj] 
			}
	}	
function frmReset()
{
var i;
for(i=0;i<document.aspnetForm.elements.length;i++)
	{
		if(document.aspnetForm.elements[i].type=="text")
			{
				document.aspnetForm.elements[i].value="";
			}
		if(document.aspnetForm.elements[i].type=="select-one")
			{
				document.aspnetForm.elements[i].selectedIndex=0;
			}	
		if(document.aspnetForm.elements[i].type=="select-multiple")
			{
				document.aspnetForm.elements[i].length=null;
			}		
		if(document.aspnetForm.elements[i].type=="radio")
			{
				document.aspnetForm.elements[i].checked=false;
			}	
		if(document.aspnetForm.elements[i].type=="checkbox")
			{
				document.aspnetForm.elements[i].checked=false;
			}		
	  }
    return false;	
}
function compareprice(min,max)
	{//Changed this function by snehal on 17-may-2006 for removing an error WST 228
	
	min = min.replace(/,/g,''); //added by snehal
	max = max.replace(/,/g,''); //added by snehal
	
		if(parseInt(min) > parseInt(max))
			{
				alert("Please put min price less than max price \n to display the require search result.")
				//Obj.focus();				
				return false;
			} 		
		return true;	
	}	
	
function IsNumericnew(str,label)
	{
		var n = new String();
		n = str.value;
		var flag;
		flag=0;
		n = n.replace(/\./g,'');
		l = parseInt((n.length)-1); 
		for(i=0;i<n.length;i++)
			{
				//if((n.charAt(0)=='£')&&(i=="0")&&(n.charCodeAt(1)!="44")&&(n.charCodeAt(1)!="46"))
				if((n.charAt(0)=='£')&&(i=="0")&&(n.charCodeAt(1)!="44"))
				    {	flag=1;	}	
				//else if( ((n.charCodeAt(i)>="48")&&(n.charCodeAt(i)<="57"))||((n.charCodeAt(i)=="44") && (i!="0") && (n.charCodeAt(l)!="44")) ||((n.charCodeAt(i)=="46") && (i!="0") && (n.charCodeAt(l)!="46")))
				else if(((n.charCodeAt(i)>="48")&&(n.charCodeAt(i)<="57"))||((n.charCodeAt(i)=="44") && (i!="0") && (n.charCodeAt(l)!="44")))
					{	flag=1;	}
				else{
						flag=0;
						alert(''+label+' should only contain digits from (0-9)');
						str.focus();
						return false;
						event.returnValue = false;
					}	 
			}
		 str.value = n; 	
		 return true;
	}
	//This function is used to set the background color for GSPC and ESPC area
	function SetAreaResultsColor()
        {             
          
          
          var ObjArea = pn_getobject(MasterContentId+"DDlArea")           
          //var ObjArea = pn_getobject('<%=DDlArea.ClientID.ToString%>')  
          //alert(document.getElementById('<%=DDlArea.ClientID.ToString%>').value)
          
          //var ObjArea = document.getElementById('<%=DDlArea.ClientID.ToString%>').value        
          
          var optlen = ObjArea.length
            for(j=0;j<optlen;j++)
            {
                
                
                if (ObjArea.options[j].value.indexOf('E') < 0)
                { 
                    ObjArea.options[j].style.backgroundColor =  '#66ccff'  
                } 
                if (ObjArea.options[j].value.indexOf('G') < 0)
                { 
                    ObjArea.options[j].style.backgroundColor =  'palegoldenrod'  
                }     
                //Rameshwar : change blank option background color as a white
                if (ObjArea.options[j].value=="0")
                { 
                    ObjArea.options[j].style.backgroundColor =  '#ffffff';  
                } 
                
            }	
          }  
          
//     function CallColorSetting()
//        {
//             var MasterContentId = "ctl00_ContentPage_"
//            //This function is used to set the background color for GSPC and ESPC area 
//            window.onload = SetAreaResultsColor(MasterContentId); 
//        }     
//*****************************WST 240-************************************
numberoftimes = 0;
function UnderConstruction() {
	var themessage = "Sorry.  That facility is not available yet.";
    alert(themessage);
    return false;
}

var isReady = false;
function doSaveAs(){
if (document.execCommand)
  {
	if (isReady){document.execCommand("SaveAs", true, "export.txt");}
	}else{
	alert('Feature available only in Internet Exlorer 4.0 and later.');
	}
  }
  
 


function IsNumeric(InputField,InputLabel)
{
	if (isNaN(InputField.value))
	{
		alert("Please enter a valid value for " + InputLabel + ".");
		InputField.select();
		InputField.focus();
		return false;
	}
	return true;
}

function setFocus(setField)
{
	setField.focus();
}

//*****************************************************************

//added the following function by snehal wst 228
/*typeAhead() is used to locate the Option in the DDL corresponding to the keywords type on the DDL*/
/* typeAheadInfo is global variable. DO NOT ALTER VARIABLES. values can be altered as per requirement*/

function typeAhead(field, myEvent,ControlType) {

var flg;

var keyCode = myEvent.keyCode ? myEvent.keyCode : myEvent.which ? myEvent.which : myEvent.charCode;
//alert(keyCode);
   if (myEvent && !myEvent.ctrlKey  && (myEvent.keyCode !=9) && (myEvent.keyCode !=38) && (myEvent.keyCode !=40) ) {
      var now = new Date();
	  
    //  if (typeAheadInfo.currentString == "" || now - typeAheadInfo.last < typeAheadInfo.delay) {
 if (typeAheadInfo.currentString == "" ) {
   //      var myEvent = window.event;
         var selectElement = field;         
	//	  alert(selectElement + '1');
  //       var keyCode = myEvent.keyCode;

		 // The NumPad returns slightly differant keyCodes then the numbers on the type of the keyboard.
		 // If we subtract 48 it will return the correct keyCode.
	
		// if (keyCode >= 96 && keyCode <=105) {
		// keyCode = keyCode - 48;
		// }         
         
         var newChar =  String.fromCharCode(keyCode).toUpperCase();
         typeAheadInfo.currentString += newChar;
//alert(typeAheadInfo.currentString);
         var selectOptions = selectElement.options;
       if (typeAheadInfo.lastindex == selectOptions.length) typeAheadInfo.lastindex = 0;
         var txt, nearest;
         for (var i = typeAheadInfo.lastindex; i < selectOptions.length; i++) {
            // change this from .text to .value to use the value of the item instead of the visual text if desired
            
            txt = selectOptions[i].text.toUpperCase();
            if (txt != 'GSPC AREAS' && txt != 'ESPC AREAS' && txt != 'ANY' && txt != '  ')
            {
            txt = txt.substr(2);
            }
            //alert(txt);
            nearest = (typeAheadInfo.currentString > 
                       txt.substr(0, typeAheadInfo.currentString.length)) ? i : nearest;

            if (txt.indexOf(typeAheadInfo.currentString) == 0) {
             //  alert('got');
               clearTimeout(typeAheadInfo.timeout);
               typeAheadInfo.last = now;
               typeAheadInfo.timeout = setTimeout("typeAheadInfo.reset()", typeAheadInfo.delay);
               selectElement.selectedIndex = i;
               if (i == selectOptions.length)
               {typeAheadInfo.lastindex  = 0; flg=true; }
               else
               	typeAheadInfo.lastindex = i + 1;
			
               myEvent.cancelBubble = true;
               myEvent.returnValue = false;
            
             
               
				if (field.getAttribute("onchange") != null)
				{
		 			 field.onchange();
				}
			

               return false;   
            }            
        //
        var j;
        j = i + 1;
        
        if (j == selectOptions.length ) {flg = true;}
        
         }
         
         if (nearest != null) {
          
         }
      } else {
         clearTimeout(typeAheadInfo.timeout);
      }
      typeAheadInfo.reset();
    
   }   

     if (flg == true) {typeAheadInfo.lastindex = 0;flg = false;}
    if  (isNaN(selectElement) != true){
	if (selectElement.getAttribute("onchange") != null)
	{
	selectElement.onchange();
	}}
	
	
   return true;
   
}
/*typeAhead() is used to locate the Option in the DDL corresponding to the keywords type on the DDL*/

//end for wst 228.


//Rameshwar : For maintaining cookies of public website search images  
//--------------------------------------------------------------------
 function createCookie(name,value,days)
        {
            if (days)
                {
	                var date = new Date();
	                date.setTime(date.getTime()+(days*24*60*60*1000));
	                var expires = "; expires="+date.toGMTString();
                }
            else var expires = "";
            document.cookie = name+"="+value+expires+"; path=/";
        }

    function readCookie(name)
        {
            var nameEQ = name + "=";
            var ca = document.cookie.split(';');
            for(var i=0;i <ca.length;i++)
                {
	                var c = ca[i];
	                while (c.charAt(0)==' ') c = c.substring(1,c.length);
	                if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
                }
            return null;
        }

    function eraseCookie(name)
        {
            createCookie(name,"",-1);
        }

    
    
    function fnMINMAX(str,ObjImgPnl,PgSearch,imgpath)
        {
            
            if (document.getElementById(str).style.display!='none') 
                {
                    document.getElementById(str).style.display='none';
                    ObjImgPnl.src = imgpath+"/plus.gif";
                    if (PgSearch == 'Cls')
	                    {
		                    createCookie('PnlSearchState','OFF',0);
		                    
	                    }
                    else
	                    {
		                    createCookie('PnlPageOptState','OFF',0);
	                    }
                }
            else
                {
                    document.getElementById(str).style.display='inline';
                    ObjImgPnl.src = imgpath+"/minus.gif";
                    if (PgSearch == 'Cls')
	                    {
		                    createCookie('PnlSearchState','ON',0);
	                    }
                    else
	                    {		                    
		                    createCookie('PnlPageOptState','ON',0);
	                    }
                }
        }    
//--------------------------------------------------------------------        
//Rameshawr : On 25Jan2007 : To display the main jpg image for all sws as well as public website

    function setMainPic(imgPath)
		{	
			var mainImg = document.getElementById('mainImage')
			document.getElementById('mainImage').src = imgPath.replace('/thumbnails','');
			resize(mainImg);
		}
	function resize(mainImg)  
		{
			mainImg.width = 425;		
			if  (mainImg.width > 425)
				mainImg.width = 425;
		}
		

	function winVTour(ref)
	    {
		    var filepath;
		    filepath = "<%=Tools.filesubpath()%>/forsale/VTour.aspx?ref="+ref
		    window.open(filepath,"","toolbar=no,height=253,width=390");
	    }	
	    
	    