var postcodeLucene="";
var statusvar = "";
Array.prototype.jsonClass=function(){
	var x=this;
	var constr=function(){
		var a=arguments; var u;
		for(var i=0;i<x.length;i++){
			if(typeof x[i]=="object"){
				for(var j in x[i]){this[j]=this[j]!=u?this[j]:x[i][j]}
			};
			if(typeof x[i]!="string" || a[i]===u){continue};
			this[x[i]]=a[i];
		}
	};
	var nextProto=false;
	for(var i=0;i<=x.length;i++){
		var a=x[i]||constr;
		if(typeof a=="function"){
			a.prototype=nextProto||a.prototype;
			nextProto=new a();
		}
	};
	constr.addMembers=function(obj){
		for(var i in obj){constr.prototype[i]=obj[i]}
	};
	return constr
};
function trimAll( strValue ) {
/************************************************
DESCRIPTION: Removes leading and trailing spaces.

PARAMETERS: Source string from which spaces will
  be removed;

RETURNS: Source string with whitespaces removed.
*************************************************/ 
 var objRegExp = /^(\s*)$/;

    //check for all spaces
    if(objRegExp.test(strValue)) {
       strValue = strValue.replace(objRegExp, '');
       if( strValue.length == 0)
          return strValue;
    }
    
   //check for leading & trailing spaces
   objRegExp = /^(\s*)([\W\w]*)(\b\s*$)/;
   if(objRegExp.test(strValue)) {
       //remove leading and trailing whitespace characters
       strValue = strValue.replace(objRegExp, '$2');
    }
  return strValue;
}
function validateNotEmpty( strValue ) {
/************************************************
DESCRIPTION: Validates that a string is not all
  blank (whitespace) characters.
    
PARAMETERS:
   strValue - String to be tested for validity
   
RETURNS:
   True if valid, otherwise false.
*************************************************/
   var strTemp = strValue;
   strTemp = trimAll(strTemp);
   if(strTemp.length > 0){
     return true;
   }  
   return false;
}

Array.prototype.jsonClass=function(){
	var x=this;
	var constr=function(){
		var a=arguments; var u;
		for(var i=0;i<x.length;i++){
			if(typeof x[i]=="object"){
				for(var j in x[i]){this[j]=this[j]!=u?this[j]:x[i][j]}
			};
			if(typeof x[i]!="string" || a[i]===u){continue};
			this[x[i]]=a[i];
		}
	};
	var nextProto=false;
	for(var i=0;i<=x.length;i++){
		var a=x[i]||constr;
		if(typeof a=="function"){
			a.prototype=nextProto||a.prototype;
			nextProto=new a();
		}
	};
	constr.addMembers=function(obj){
		for(var i in obj){constr.prototype[i]=obj[i]}
	};
	return constr
};
function validateEmail(str)
{
	    var str=trim(str);    //balu on 07/01/09
		var at="@";
		var dot=".";
		var lat=str.indexOf(at);
		var lstr=str.length;
		var ldot=str.indexOf(dot);
		
		if (str.indexOf(at)==-1){
		//   alert("Invalid E-mail ID");
		   return false;
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		 //  alert("Invalid E-mail ID");
		   return false;
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		  //  alert("Invalid E-mail ID");
		    return false;
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		 //   alert("Invalid E-mail ID");
		    return false;
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		 //   alert("Invalid E-mail ID");
		    return false;
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		  //  alert("Invalid E-mail ID");
		    return false;
		 }
		
		 if (str.indexOf(" ")!=-1){
		 //   alert("Invalid E-mail ID");
		    return false;
		 }

 		 return true;				
}
function RestaurantTypesIN(restType)
{
	 divid=restType;
	 document.getElementById("restSelectFormMain").takeaway1.checked=false;
	 document.getElementById("restSelectFormMain").delivery1.checked=false;
	 document.getElementById("restSelectFormMain").onlinecol1.checked=false;
	 document.getElementById("restSelectFormMain").onlinedel1.checked=false;
	 document.getElementById("restSelectFormMain").restaurant1.checked=false;
	 document.forms["RestaurantSelectionForm"].takeaway1.value="false";
	 new Ajax.Updater('locationsDivID', "home.do?homeordfor="+divid, {onComplete:function(){},asynchronous:false, evalScripts:true});	 
}
function partyrdersHomeLink()
{
  new Ajax.Updater('col', "jsp/jsp/partyOrdersHome.jsp", {onComplete:function(){},asynchronous:false, evalScripts:true});
}
function viewFunctionHallLoginPageHome()
{
    document.forms[0].action="./Order.do?order=FunctionHallCustomerHomePage";
    document.forms[0].submit();
}
function funEnterIn(a,e,type)
{
	var key;
 	if(window.event){
          key = window.event.keyCode;}
     else{
          key = e.which;}
	if(key== 13)
	{
		e.Handled=true;
	  searchNewResType(a,type);
	 return false;
	}
}
function searchNewResType(a,type)
{
	if(document.getElementById("citiesIn")!=null && document.getElementById("citiesIn").value=="select")
	{
		alert("Please Select Your City");
		document.getElementById("citiesIn").focus();
		
	}else if(document.getElementById("cityLocationsIn")!=null && document.getElementById("cityLocationsIn").value=="select")
	{
		alert("Please Select Your Location");
		document.getElementById("cityLocationsIn").focus();
		
	}else	
	if(document.getElementById("postin")!=null && document.getElementById("postin").value!="")
	{
		if(type=='TakeAway')
		{
		  document.forms["RestaurantSelectionForm"].orderFor.value="Collection";	
		  document.getElementById("restSelectFormMain").takeaway1.checked=true;
		  document.getElementById("restSelectFormMain").onlinecol1.checked=true;
		  
		}else if(type=='Delivery')
		{
			document.forms["RestaurantSelectionForm"].orderFor.value="Delivery";
		   document.getElementById("restSelectFormMain").delivery1.checked=true;
		   document.getElementById("restSelectFormMain").onlinedel1.checked=true;
		}else if(type=='Eatin')
		{
			document.forms["RestaurantSelectionForm"].orderFor.value="Eatin";
		   document.getElementById("restSelectFormMain").restaurant1.checked=true;
		}
	    document.getElementById("restSelectFormMain").searchPostcode.value=document.getElementById("postin").value; 
	    $("citiesID").value=$("citiesIn").value;
	    $("cityLocationsID").value=$("cityLocationsIn").value;
	    searchNewInd(a,'restaurants');
	}else
	{
		alert("Please Enter Your Postcode");
		document.getElementById("postin").focus();
	}
}	
function funEnterGgy(a,e,type)
{
	var key;
 	if(window.event){
          key = window.event.keyCode;}
     else{
          key = e.which;}
	if(key== 13)
	{
		e.Handled=true;
	  searchNewResTypeGgy(a,type);
	 return false;
	}
}
function searchNewResTypeGgy(a,type)
{
   	if( document.getElementById("sc").options[ document.getElementById("sc").selectedIndex].text=='Select')
		{
			alert("please select the country");
		    document.getElementById("sc").focus();
		    return;
		}		
	if(document.getElementById("postin")!=null && document.getElementById("postin").value!="")
	{
		if(type=='TakeAway')
		{
		  document.forms["RestaurantSelectionForm"].orderFor.value="Collection";	
		  document.getElementById("restSelectFormMain").takeaway1.checked=true;
		  document.getElementById("restSelectFormMain").onlinecol1.checked=true;
		}else if(type=='Delivery')
		{
			document.forms["RestaurantSelectionForm"].orderFor.value="Delivery";
		   document.getElementById("restSelectFormMain").delivery1.checked=true;
		   document.getElementById("restSelectFormMain").onlinedel1.checked=true;
		}else if(type=='Eatin')
		{
			document.forms["RestaurantSelectionForm"].orderFor.value="Eatin";
		   document.getElementById("restSelectFormMain").restaurant1.checked=true;
		}
	    document.getElementById("restSelectFormMain").searchPostcode.value=document.getElementById("postin").value; 
//	    document.getElementById("searchPCText").value=document.getElementById("postin").value;
	    searchNew(a,'restaurants',1);
	}else
	{
		alert("Please Enter Your Postcode");
		document.getElementById("postin").focus();
		return;
	}
}	
function loginClicked1(a)
{
	 var visitortime = new Date();
	 var tz=(visitortime.getTimezoneOffset()/60)*(-1);
	 var sloc="";
	  if(document.forms[0].blocationName!=null)
	  {
		 sloc=document.forms[0].blocationName[document.forms[0].blocationName.selectedIndex].text;
	  }
	if(a=="login")
	{
		var mikExp = /[$\\@\\\#%\^\&\*\(\)\[\]\+\_\{\}\`\~\=\.\,\;\'\"\:\[0-9]|]/;
		if(document.forms["LoginInfoForm"].userName.value == "")	
			{
				alert("Please enter UserName.");
				document.forms["LoginInfoForm"].userName.focus();
			}
		else 
		if(document.forms["LoginInfoForm"].password.value == "")
		{
			alert("Please enter Password.");
			document.forms["LoginInfoForm"].password.focus();
		}
		else
		if(mikExp.test(document.forms["LoginInfoForm"].userName.value.substring(0,1))&& !(document.forms["LoginInfoForm"].userName.value == ""))
		{
			alert("User Id   -- First letter should be character");
			document.forms["LoginInfoForm"].userName.focus();
		}
		else
		{
			if(document.forms["LoginInfoForm"].checkRemind.checked)
			{
				 var days=20;
	 			 var expires = new Date ();
    		    expires.setTime(expires.getTime() + days * (24 * 60 * 60 * 1000)); 
				var date= new Date();
				date.setYear(parseInt(date.getYear(),10)+2);
				var name=encrypt( document.forms["LoginInfoForm"].password.value,"123456789123");
				SetCookie('cacUser',document.forms["LoginInfoForm"].userName.value,expires,"/");
				SetCookie('cacPassword',encrypt( document.forms["LoginInfoForm"].password.value,"123456789123"),expires,"/");
			}
			document.forms["LoginInfoForm"].ordertype.value=a;
			document.forms["LoginInfoForm"].timezone.value=tz;
			//document.forms[0].action='Order.do?ordertype='+a+'&timezone='+tz;
			document.forms[0].action='home.do?ordertype='+a+'&timezone='+tz;
			document.forms["LoginInfoForm"].submit();
		}
	}
   /*  if(a=="allSearch")
	{
	   var rstp="";
	   var searchWith="";
	   var message="";
		var cuisine=document.forms[0].cuisine[document.forms[0].cuisine.selectedIndex].value;
		var dish=document.forms[0].dish.value;
		var restName=document.forms[0].restName.value;
		if(document.forms[0].takeaway.checked){
			rstp =1+"|";}
	    if(document.forms[0].delivery.checked){
	        rstp +=2+"|";}
		if(document.forms[0].online.checked){
			rstp +=3+"|";}
		if(document.forms[0].restaurant.checked){
			rstp +=4+"|";}
		if(rstp==""){
		rstp='1|2|3|4|';}
	    if(document.forms[0].restCountry[document.forms[0].restCountry.selectedIndex].text=='Select')
		{
			alert("please select the country");
		    message="not Valid";
		}
			if(document.forms[0].postcode.value=="" && document.forms[0].searchName.value=="")
			{
				alert("Please Enter a Postcode or a Place");
				message="not valid";
			}
			if(document.forms[0].postcode.value!="" && document.forms[0].searchName.value!="")
			{
				alert("Please Search by One Parameter either postcode or place");
					message='not valid';
			}
		if(message=="")
		{
			if(document.forms[0].searchName.value!=""){
				 searchWith='place';}
			if(document.forms[0].postcode.value!="" ){
				searchWith='postcode';}
		}
		if(message=="" && searchWith!="")
		{
			document.forms[0].action="Order.do?ordertype="+a+"&timezone="+tz+"&shippingLoc="+sloc+"&resttype="+rstp+"&cuisine="+cuisine+"&searchWith="+searchWith+"&dish="+dish+'&restName='+restName;
			document.forms[0].submit();
		}
	}
	if(a=="postcode" || a=="dish" || a=="cuisine" || a=='sct'  )
	{
      var rstp="";
	  var status='true';
	  var dish="";
	  var statecitytown="";
	  var searchWith="";
	  if(document.forms[0].restCountry[document.forms[0].restCountry.selectedIndex].text=='Select')
		{
			alert("please select the country");
		   status='false';
		}	
		if(document.forms[0].takeaway.checked){
			rstp =1+"|";}
	    if(document.forms[0].delivery.checked){
	        rstp +=2+"|";}
		if(document.forms[0].online.checked){
			rstp +=3+"|";}
		if(document.forms[0].restaurant.checked){
			rstp +=4+"|";}
      var cuisine=document.forms[0].cuisine[document.forms[0].cuisine.selectedIndex].value;
		if(a=="dish")
		{
			if(document.forms[0].dish.value == "")
			{
				clearOrder();
				alert("Please enter dish.");
				document.forms[0].dish.focus();
				status='false';
			}
			else
			{
				dish=document.forms[0].dish.value;
			}
		}
		if(a!='sct' && document.forms[0].postcode.value == "")
		{
			alert("Please enter postcode.");
			document.forms[0].postcode.focus();
			status='false';
		}
		if(a=='sct')
		{
           statecitytown=document.forms[0].searchName.value;
		}
		if(a!='sct')
		if(document.forms[0].postcode!=null || document.forms[0].searchName!=null)
			{
				if(document.forms[0].postcode.value=="" && document.forms[0].searchName.value=="")
				{
					alert("Please Enter a Postcode or a Place");
					message="not valid";
				}
				if(document.forms[0].postcode.value!="" && document.forms[0].searchName.value!="")
				{
					alert("Please Search by One Parameter either postcode or place");
						message='not valid';
				}
				if(document.forms[0].searchName.value!="" && document.forms[0].postcode=="")
					 searchWith='place';
				if(document.forms[0].postcode!="" && document.forms[0].searchName.value=="")
					searchWith='postcode';
			}
		if(status=='true' && searchWith!="")
		{
			clearOrder();
			if(a=='dish'){
			document.forms[0].action="Order.do?ordertype="+a+"&searchValue="+dish+"&timezone="+tz+"&shippingLoc="+sloc+"&resttype="+rstp+"&cuisine="+cuisine+"&searchWith="+searchWith;
			}
			if(a=='sct'){
				document.forms[0].action="Order.do?ordertype="+a+"&searchValue="+statecitytown+"&timezone="+tz+"&shippingLoc="+sloc+"&resttype="+rstp+"&cuisine="+cuisine+"&searchWith="+searchWith;
			}
			else{
			document.forms[0].action="Order.do?ordertype="+a+"&searchValue="+cuisine+"&timezone="+tz+"&shippingLoc="+sloc+"&resttype="+rstp+"&cuisine="+cuisine+"&searchWith="+searchWith;
			}
			document.forms[0].submit();
		}
	} */
}
function clearUserName()
	{
		userName=document.forms["LoginInfoForm"].elements['userName'].value;
		if(userName=="username" || userName=="Username")
		document.forms["LoginInfoForm"].elements['userName'].value="";
	}
function getUserName()
{
	if(document.forms["LoginInfoForm"].elements['userName'].value=='')
	document.forms["LoginInfoForm"].elements['userName'].value="Username";
}
function clearPassword()
{
	userPassword=document.forms["LoginInfoForm"].elements['password'].value;
	if(userPassword=="password")
	document.forms["LoginInfoForm"].elements['password'].value="";
}
function getPassword()
{
	if(document.forms["LoginInfoForm"].elements['password'].value=='')
	document.forms["LoginInfoForm"].elements['password'].value="password";
}
function invalidUser()
{	
			document.forms["LoginInfoForm"].userName.value="user name";
			document.forms["LoginInfoForm"].password.value="password";
}  
function funEnter(a,e)
{
	var key;
 	if(window.event){
          key = window.event.keyCode;
		  }
     else{
          key = e.which;
	 }
	if(key== 13)
	{
		e.Handled=true;
	  loginClicked1(a);
	 return false;
	}
}
function loginClicked(a)
	{
	 var visitortime = new Date();
	 var tz=(visitortime.getTimezoneOffset()/60)*(-1);
	 var sloc="";
	  if(document.forms[0].blocationName!=null)
	  {
		 sloc=document.forms[0].blocationName[document.forms[0].blocationName.selectedIndex].text;
	  }
	if(a=="login")
	{
		var mikExp = /[$\\@\\\#%\^\&\*\(\)\[\]\+\_\{\}\`\~\=\.\,\;\'\"\:\[0-9]|]/;
		if(document.forms[1].userName.value == "" || document.forms[1].userName.value==null)	
			{
				alert("Please enter UserName.");
				document.forms[1].userName.focus();
			}
		else 
		if(document.forms[1].password.value == "" || document.forms[1].password.value==null)
		{
			alert("Please enter Password.");
			document.forms[1].password.focus();
		}
		else
		if(mikExp.test(document.forms[1].userName.value.substring(0,1))&& !(document.forms[1].userName.value == "")&&!(document.forms[1].userName.value == null))
		{
			alert("User Id   -- First letter should be character");
			document.forms[1].userName.focus();
		}
		else
		{
			if(document.forms[1].checkRemind.checked)
			{
				 var days=20;
	 			 var expires = new Date ();
    		    expires.setTime(expires.getTime() + days * (24 * 60 * 60 * 1000)); 
				var date= new Date();
				date.setYear(parseInt(date.getYear(),10)+2);
				var name=encrypt( document.forms[1].password.value,"123456789123");
				SetCookie('cacUser',document.forms[1].userName.value,expires,"/");
				SetCookie('cacPassword',encrypt( document.forms[1].password.value,"123456789123"),expires,"/");
			}
			document.forms[1].ordertype.value=a;
			document.forms[1].timezone.value=tz;
			document.forms[1].action='Order.do?login=true';
			document.forms[1].submit();
		}
	}
  
     if(a=="allSearch")
	{
	   var rstp="";
	   var searchWith="";
	   var message="";
		var cuisine=document.forms[0].cuisine[document.forms[0].cuisine.selectedIndex].value;
		var dish=document.forms[0].dish.value;
		var restName=document.forms[0].restName.value;
		if(document.forms[0].takeaway.checked){
			rstp =1+"|";}
	    if(document.forms[0].delivery.checked){
	        rstp +=2+"|";}
		if(document.forms[0].online.checked){
			rstp +=3+"|";}
		if(document.forms[0].restaurant.checked){
			rstp +=4+"|";}
		if(rstp==""){
		rstp='1|2|3|4|';}
	if(document.forms[0].restCountry[document.forms[0].restCountry.selectedIndex].text=='Select')
		{
			alert("please select the country");
		    message="not Valid";
		}
			if(document.forms[0].postcode.value=="" && document.forms[0].searchName.value=="")
			{
				alert("Please Enter a Postcode or a Place");
				message="not valid";
			}
			if(document.forms[0].postcode.value!="" && document.forms[0].searchName.value!="")
			{
				alert("Please Search by One Parameter either postcode or place");
					message='not valid';
			}
		if(message=="")
		{
			if(document.forms[0].searchName.value!=""){
				 searchWith='place';}
			if(document.forms[0].postcode.value!="" ){
				searchWith='postcode';}
		}
		if(message=="" && searchWith!="")
		{
			document.forms[0].action="Order.do?ordertype="+a+"&timezone="+tz+"&shippingLoc="+sloc+"&resttype="+rstp+"&cuisine="+cuisine+"&searchWith="+searchWith+"&dish="+dish+'&restName='+restName;
			document.forms[0].submit();
		}
	}
	if(a=="postcode" || a=="dish" || a=="cuisine" || a=='sct'  )
	{
      var rstp="";
	  var status='true';
	  var dish="";
	  var statecitytown="";
	  var searchWith="";
	  if(document.forms[0].restCountry[document.forms[0].restCountry.selectedIndex].text=='Select')
		{
			alert("please select the country");
		   status='false';
		}	
		if(document.forms[0].takeaway.checked){
			rstp =1+"|";}
	    if(document.forms[0].delivery.checked){
	        rstp +=2+"|";}
		if(document.forms[0].online.checked){
			rstp +=3+"|";}
		if(document.forms[0].restaurant.checked){
			rstp +=4+"|";}
      var cuisine=document.forms[0].cuisine[document.forms[0].cuisine.selectedIndex].value;
		if(a=="dish")
		{
			if(document.forms[0].dish.value == "")
			{
				clearOrder();
				alert("Please enter dish.");
				document.forms[0].dish.focus();
				status='false';
			}
			else
			{
				dish=document.forms[0].dish.value;
			}
		}
		if(a!='sct' && document.forms[0].postcode.value == "")
		{
			alert("Please enter postcode.");
			document.forms[0].postcode.focus();
			status='false';
		}
		if(a=='sct')
		{
           statecitytown=document.forms[0].searchName.value;
		}
		if(a!='sct')
		if(document.forms[0].postcode!=null || document.forms[0].searchName!=null)
			{
				if(document.forms[0].postcode.value=="" && document.forms[0].searchName.value=="")
				{
					alert("Please Enter a Postcode or a Place");
					message="not valid";
				}
				if(document.forms[0].postcode.value!="" && document.forms[0].searchName.value!="")
				{
					alert("Please Search by One Parameter either postcode or place");
						message='not valid';
				}
				if(document.forms[0].searchName.value!="" && document.forms[0].postcode==""){
					 searchWith='place';}
				if(document.forms[0].postcode!="" && document.forms[0].searchName.value==""){
					searchWith='postcode';}
			}
	  if(status=='true' && searchWith!="")
		{
			clearOrder();
			if(a=='dish')
			document.forms[0].action="Order.do?ordertype="+a+"&searchValue="+dish+"&timezone="+tz+"&shippingLoc="+sloc+"&resttype="+rstp+"&cuisine="+cuisine+"&searchWith="+searchWith;
			if(a=='sct'){
				document.forms[0].action="Order.do?ordertype="+a+"&searchValue="+statecitytown+"&timezone="+tz+"&shippingLoc="+sloc+"&resttype="+rstp+"&cuisine="+cuisine+"&searchWith="+searchWith;
		  	}
			else{
			document.forms[0].action="Order.do?ordertype="+a+"&searchValue="+cuisine+"&timezone="+tz+"&shippingLoc="+sloc+"&resttype="+rstp+"&cuisine="+cuisine+"&searchWith="+searchWith;
			}
			document.forms[0].submit();
		}
	}
}	
function forgotPassword1()
{
	pwdwindow=window.open('forgotpw.do?first=first','Logon','fullscreen=no,toolbar=no,status=yes,menubar=no,scrollbars=no,resizable=no,directories=no,location=no,width=375,height=300');
	pwdwindow.moveTo(20,20);
} 
 function funRegister(type) 
{
//	document.forms[0].action="register.do?newUser=new&registertype="+type;
//	document.forms[0].submit();
	
	loginparamsjson = new loginParamsObj("new",type,"");
	loginParamsObj = Object.toJSON(loginparamsjson);
	document.forms[0].loginParamJson.value = loginParamsObj;
	document.forms[0].action="register.do";
	document.forms[0].submit();
		
}  
function voucherSelection()  
{
    var searchCountry="";
    if(document.forms[0].searchCountry!=null)
    searchCountry=document.forms[0].searchCountry.value;
	document.forms[0].action='vouchers.do?param=tempSelect&searchCountry='+searchCountry;
	document.forms[0].submit();
}
function getLocations()
{
	if($("citiesID").value!="select")
	{
		document.forms["RestaurantSelectionForm"].city.value=document.forms["RestaurantSelectionForm"].cities[document.forms["RestaurantSelectionForm"].cities.selectedIndex].text;
		restparamsjson=new restparamsObj("","","","","","","","","","","",$("citiesID").value,"");		
		restparams=Object.toJSON(restparamsjson);
		document.forms["RestaurantSelectionForm"].restParamJson.value=restparams;
		new Ajax.Updater('locationListID', 'locations.do?param=locations', {
			onComplete:function()
			{ 
				new Ajax.Updater('locationsDivID1', 'locations.do?param=locations&param1=cityWise', {
			 onComplete:function()
			 { 
			 	 $("searchPostcodeID").value="";     
			   }  ,parameters:Form.serialize(document.forms[0]),asynchronous:true,evalScripts:true});		
			       
			  }  ,parameters:Form.serialize(document.forms[0]),asynchronous:true,evalScripts:true});
	}
	else
	{
		$("cityLocationsID").value="select";
		$("searchPostcodeID").value="";
	}
}	
function funpopulatePostcode()
{ 
	 if($("cityLocationsID").value!='select'){
	  $("searchPostcodeID").value=$("cityLocationsID").value;
	   }
	 else{
	  $("searchPostcodeID").value="";	  
	  }
}	
function funhomepopulatePostcode()
{ 
	 if($("cityLocationsIn").value!='select'){
	   $("postin").value=$("cityLocationsIn").value;
	  }
	 else{
	  $("postin").value="";	  
	  }
}
function onEnter(param,e,val)
{
	var keyNo="";
	if(window.event){
		keyNo=window.event.keyCode;}
	else{
		keyNo=e.which;}
	if(keyNo==13)
	{   
		if(param=='allSearch')
		{
			   searchNew(param,'restaurants',val);
			   if(statusvar=="")
			   		postcodeLucene="postcode";  //mu160909			  		
			   ChangeLocation();
		}
		if(param=='allSearchnew')
		{	
				document.forms["RestaurantSelectionForm"].searchCountry.value=document.getElementById("searchCountrynew").value;
				document.forms["RestaurantSelectionForm"].searchPostcode.value=document.getElementById("middlesearchPostcode").value;				   
			
		    searchNew('allSearch','restaurants',val);
		    ChangeLocation();
		}
		if(param=='allSearchnew1')
		{
				document.forms["RestaurantSelectionForm"].searchCountry.value=document.getElementById("searchCountrynew1").value;
				document.forms["RestaurantSelectionForm"].searchPostcode.value=document.getElementById("middlesearchPostcode1").value;
				searchNew('allSearch','restaurants',val);
		    	ChangeLocation();
		}
	   if(param=='sortItems')
			getSortedItems();
	  
	   if(param=='allSearchInd')
		{
			   searchNewInd('allSearch','restaurants');
			   if(statusvar=="")
			   		postcodeLucene="postcode";  //k.mu250609			  					  
		}	
	}
}
function searchNew(a,parameter,th)
{
	
	var formType="restaurantForm";
	var rstp="";
	var message="";
	var word="";
	var searchWith="";
	var postcode="";
	var place="";
	var dish="";
	var country="";
	var restName="";
	var searchlocations="";
	errorMessage1="";
	errorMessage=errorMessage1;
	var	status=true;
	var visitortime = new Date();
    var timezone=(visitortime.getTimezoneOffset()/60)*(-1);
	var cuisine= document.getElementById("restSelectFormMain").cuisineTypes.value;
	
	if(document.getElementById("restSelectFormMain").dishValue.value!="" && document.getElementById("restSelectFormMain").dishValue.value!=null && document.getElementById("restSelectFormMain").dishValue.value!="Item Name")
		{dish= document.getElementById("restSelectFormMain").dishValue.value.replace(/'/,"");}
	if(document.getElementById("restSelectFormMain").dishValue.value=="Item Name")
		{document.forms[0].dishValue.value="";	}
	if(document.getElementById("restSelectFormMain").searchRest.value!="" && document.getElementById("restSelectFormMain").searchRest.value!=null && document.getElementById("restSelectFormMain").searchRest.value!="Restaurant Name")
		{restName= document.getElementById("restSelectFormMain").searchRest.value;}
	if(document.getElementById("restSelectFormMain").searchRest.value=="Restaurant Name")	
		{document.forms[0].searchRest.value="";}
//	if(document.getElementById("dishText").value!="" && document.getElementById("dishText").value!=null && document.getElementById("dishText").value!="Item Name")
//		{dish= document.getElementById("dishText").value.replace(/'/,"");}
//	if(document.getElementById("txt").value!="" && document.getElementById("txt").value!=null && document.getElementById("txt").value!='Restaurant Name')
//	   {restName= document.getElementById("txt").value;}
	if(document.getElementById("restSelectFormMain").takeaway1.checked==true){
			rstp =1+"|";
			 document.getElementById("takeaway1").value=true;
	}
	else{
		 document.getElementById("takeaway1").value=false;}
	
	if( document.getElementById("restSelectFormMain").delivery1.checked==true){
			rstp +=2+"|";
		 document.getElementById("delivery1").value=true;
	}
	else{
		 document.getElementById("delivery1").value=false;}

	if( document.getElementById("restSelectFormMain").restaurant1.checked==true)
	{		rstp +=3+"|";
	 document.getElementById("restaurant1").value=true;
	}
	else{
		 document.getElementById("restaurant1").value=false;}
		if(document.getElementById("restSelectFormMain").onlinedel1!=null && document.getElementById("restSelectFormMain").onlinedel1.checked==true){
				rstp +=4+"|";
				document.getElementById("onlinedel1").value=true;
		}
		else
			{ document.getElementById("onlinedel1").value=false;}
			 
        if(document.getElementById("restSelectFormMain").onlinecol1!=null && document.getElementById("restSelectFormMain").onlinecol1.checked==true){
				rstp +=5+"|";
				document.getElementById("onlinecol1").value=true;
		}
		else
			 document.getElementById("onlinecol1").value=false;

	
	if(valueIsFrom==1)  //mu050310 for domain flow in auto suggest
	{
		if(currentDomain != "")
		{
			var protocol=window.location.protocol;       
		    var host=window.location.hostname;
		    var port=window.location.port;
		    var pathname=window.location.pathname;
		    var pname=pathname.split("/");
		    var domainurl="";
		    domainurl=protocol+"//"+host+":"+port+"/"+pname[1];
//for local			var finalDomainName = domainurl+"/RestaurantSelection.do?formType=cuisineForm&domain="+currentDomain
			var finalDomainName = "http://www."+currentDomain+".bringmefood.com";
			document.location.href = finalDomainName;
			return;
		}
	}

	if(rstp=="")
		rstp='1|2|3|4|5';
//	 document.getElementById("restSelectFormMain").restaurantsType.value=rstp;
	if(document.getElementById("restSelectFormMain").shipLocName!=null)
	{
		country= document.getElementById("restSelectFormMain").shipLocName.value;
   		searchlocations = document.getElementById("restSelectFormMain").shipLocName.value;
     }
    
      if(document.getElementById("restSelectFormMain").searchCountry!=null)
//      if(document.getElementById("searchCountry")!=null)
    {
   	if( document.getElementById("restSelectFormMain").searchCountry[ document.getElementById("restSelectFormMain").searchCountry.selectedIndex].text=='Select')
//   	if(document.getElementById("searchCountry")[document.getElementById("searchCountry").selectedIndex].text=='Select')
		{
			errorMessage+="please select the country\n";	
		  if(status)
					{
						status=false;
					}
		  message="not valid";
		}
		else
		country= document.getElementById("searchCountry").value;
      }
      if(th=="1")
      {	
		if(trim(document.getElementById("restSelectFormMain").searchPostcode.value)=="" &&  document.getElementById("restSelectFormMain").stateCityTown.value=="" && (document.getElementById("searchPCText").value=="" || document.getElementById("searchPCText").value=="Enter your postcode"))
		{
			errorMessage+="Please Enter a Postcode\n";
			if(status && trim(document.getElementById("restSelectFormMain").searchPostcode.value)=="")
				{
					document.getElementById("restSelectFormMain").searchPostcode.value="";
					document.getElementById("restSelectFormMain").searchPostcode.focus();	
					status=false;
				}		
			if(status)
				{
				if(document.getElementById("restSelectFormMain").formType!=null)
					{
						if(document.getElementById("restSelectFormMain").formType.value!="cuisineForm")
						{	
							document.getElementById("restSelectFormMain").searchPostcode.focus();
							status=false;
						}
					}else
					{
						document.getElementById("restSelectFormMain").searchPostcode.focus();
						status=false;
					}
				}
			message="not valid";
		}
      }
      else if(th=="3")
      {	
		if(trim(document.getElementById("restSelectFormMain").searchPostcode.value)=="" ||  trim(restName)=="")
		{
				if(status)
					{
					if(document.getElementById("restSelectFormMain").searchPostcode.value=="")
						{
							errorMessage+="Please Enter a Postcode\n";
							document.getElementById("restSelectFormMain").searchPostcode.value="";
							document.getElementById("restSelectFormMain").searchPostcode.focus();
							status=false;
						}
					if(trim(restName)=="")
						{
							errorMessage+="Please Enter a RestaurantName\n";	
							document.getElementById("restSelectFormMain").searchRest.value="";
							document.getElementById("restSelectFormMain").searchRest.focus();
							status=false;
						}	
					}
			message="not valid";
		}
      }
      else
      {
      	if(trim(document.getElementById("restSelectFormMain").searchPostcode.value)=="" &&  document.getElementById("restSelectFormMain").stateCityTown.value=="" && (document.getElementById("searchPCText").value=="" || document.getElementById("searchPCText").value=="Enter your postcode"))
		{
			if(status)
				{
				if(document.getElementById("restSelectFormMain").formType!=null)
					{
						if(document.getElementById("restSelectFormMain").formType.value!="cuisineForm")
						{	
							document.getElementById("searchPCText").focus();	
							status=false;
						}
					}else
					{
						document.getElementById("searchPCText").focus();	
						status=false;
					}
				}
			message="not valid";
		}
      }
		if( document.getElementById("restSelectFormMain").searchPostcode.value!=""||(document.getElementById("searchPCText").value!=""&&document.getElementById("searchPCText").value!="Postcode"))
//		if(document.getElementById("searchPCText").value!="")
		{
			var pcode = ""; 
//			var pcode=document.getElementById("searchPCText").value;
			if(th=="1"||th=="3")	
			{	
				pcode = document.getElementById("restSelectFormMain").searchPostcode.value;
				if(pcode!="Enter your postcode")
				{
					pcode = pcode.toUpperCase();
				} 
				document.getElementById("restSelectFormMain").searchPostcode.value = pcode;
			}
			else
			{
				pcode = document.getElementById("searchPCText").value;
				if(pcode!="Enter your postcode")
				{
					pcode = pcode.toUpperCase();
				}  
				document.getElementById("searchPCText").value = pcode;
			}
			var plength=pcode.length;
			if(plength<2)
			errorMessage+="Please Enter atleast 2 (PostCode)Characters to Search\n";	
			if(status)
					{
						if(document.getElementById("restSelectFormMain").formType!=null)
						{
							if(document.getElementById("restSelectFormMain").formType.value!="cuisineForm")
							{
							if(th=="1"||th=="3")	
								document.getElementById("restSelectFormMain").searchPostcode.focus();
							else
								document.getElementById("searchPCText").focus();	
							status=false;
							}
						}else
						{
							if(th=="1"||th=="3")	
								document.getElementById("restSelectFormMain").searchPostcode.focus();
							else
								document.getElementById("searchPCText").focus();
							status=false;
						}
					}
		}
		if( document.getElementsByName("searchPostcode")[0].value!="" &&  document.getElementsByName("stateCityTown")[0].value!="")
//		if(document.getElementById("searchPCText").value!="" && document.getElementsByName("stateCityTown")[0].value!="")
		{
			alert("Please Search by One Parameter either postcode or place");
				message='not valid';
		}
	var stateCityTown="";
		if(message=="")
		{
			if( document.getElementById("restSelectFormMain").stateCityTown.value!="" && document.getElementById("restSelectFormMain").stateCityTown.value!=null)
			{
				place= document.getElementById("restSelectFormMain").stateCityTown.value;
				 searchWith='place';
				 stateCityTown=document.getElementById("restSelectFormMain").stateCityTown.value;
			}
			if( document.getElementById("restSelectFormMain").searchPostcode.value!="" ||document.getElementById("searchPCText").value!="")
//			if(document.getElementById("searchPCText").value!="" )
			{
				if(th=="1"||th=="3")	
					postcode = document.getElementById("restSelectFormMain").searchPostcode.value;
				else
					postcode =document.getElementById("searchPCText").value;
//				postcode= document.getElementById("searchPCText").value;
				searchWith='postcode';
			}
		}
	if(errorMessage!=errorMessage1)
		  {
			alert(errorMessage);
			statusvar = "false";
		  }
	else if(message=="" && searchWith!="")
	{
		//mu160909 start
		var lucene="";

		if(postcodeLucene=="postcode"){
			lucene="";
			postcodeLucene="";
		}
        else{
      	lucene="lucene";
        }
		//mu160909 end
		document.forms["RestaurantSelectionForm"].luceneSearch.value=lucene;
		
		searchType="allSearch";
		searchValue ="allSearch";		
		restparamsjson=new restparamsObj(searchValue,'success',searchType,formType,timezone,cuisine,dish,rstp,restName,country,postcode,"","");		
		restparams=Object.toJSON(restparamsjson);
		document.forms["RestaurantSelectionForm"].restParamJson.value=restparams;
		//var strURL = 'RestaurantSelection.do?stateCityTown='+stateCityTown+'&searchValue='+searchValue+'&msg=success&searchType='+searchType+'&formType='+formType+'&timezone='+timezone+'&cuisineType='+cuisine+'&dishValue='+dish+'&restaurantsType='+rstp+'&searchRest='+restName+'&searchCountry='+country+"&searchPostcode="+postcode;
		var strURL = 'RestaurantSelection.do?view='+parameter;
		if(document.getElementById("mainPage") != null) 
		{
			document.getElementById("restSelectFormMain").action=strURL;
	   		document.getElementById("restSelectFormMain").submit();
		}
		else 
			{
				if(document.getElementById("restaurants")!=null) 
				 {
				 	viewModule("searchCriteria");
			     	new Ajax.Updater("restaurants",strURL+"&pageType=half&nextValnew=0&billShipAddressId="+searchlocations,{onComplete:function(){fillCartBlock();setOpenDays("restaurantDesc");},parameters:Form.serialize(document.forms[1]),asynchronous:false, evalScripts:true});
			     }
				 else
				 {
				 	document.getElementById("restSelectFormMain").action=strURL;
  		   			document.getElementById("restSelectFormMain").submit();
				 }
			}
	}
	

}
function ChangeLocation()
{
	if(document.forms["RestaurantSelectionForm"].shipLocName!=null)
		document.forms["RestaurantSelectionForm"].shipLocName.value="select";
}
function getSortedItems(str)
{
	pageValue=0;
	  var sortType=document.getElementById("restSelectFormMain").itemSortType[document.getElementById("restSelectFormMain").itemSortType.selectedIndex].value;
	  var compare=document.getElementById("restSelectFormMain").compareCombo[document.getElementById("restSelectFormMain").compareCombo.selectedIndex].value;
	  var sortWith=document.getElementById("restSelectFormMain").itemSortWith.value;
	  if(sortWith=="")
	  {
		  alert("please enter the value");
		  return;
	  }
	  var ordfor=GetCookie("OrderFor");
  var strURL="ItemsSelectionNew.do?sort=sort&sortWith="+sortWith+"&sortType="+sortType+"&compare="+compare+"&orderfor="+ordfor;
  getTotalPagesModule(strURL);
}
function searchNewInd(a,param)
{	
	var formType="restaurantForm";
	var rstp="";
	var message="";
	var word="";
	var searchWith="";
	var postcode="";
	var place="";
	var dish="";
	var country="";
	var restName="";
	var searchlocations="";
	errorMessage1="";
	errorMessage=errorMessage1;
	var	status=true;
	var visitortime = new Date();
    var timezone=(visitortime.getTimezoneOffset()/60)*(-1);
    var cuisine="";
    var cities=document.getElementById("restSelectFormMain").cities.options[document.getElementById("restSelectFormMain").cities.selectedIndex].text;  //k.mu250609
	var cuisine= document.getElementById("restSelectFormMain").cuisineTypes.value;
	if(document.getElementById("restSelectFormMain").dishValue.value!="" && document.getElementById("restSelectFormMain").dishValue.value!=null)
		{dish= document.getElementById("restSelectFormMain").dishValue.value.replace(/'/,"");}
	if(document.getElementById("restSelectFormMain").searchRest.value!="" && document.getElementById("restSelectFormMain").searchRest.value!=null)
	   {restName= document.getElementById("restSelectFormMain").searchRest.value;}
	if(document.getElementById("restSelectFormMain").takeaway1.checked==true){
		{	rstp =1+"|";}
			 document.getElementById("takeaway1").value=true;
	}
	else{
		 document.getElementById("takeaway1").value=false;}
	
	if( document.getElementById("restSelectFormMain").delivery1.checked==true){
			rstp +=2+"|";
		 document.getElementById("delivery1").value=true;
	}
	else{
		 document.getElementById("delivery1").value=false;}

	if( document.getElementById("restSelectFormMain").restaurant1.checked==true)
	{		rstp +=3+"|";
	 document.getElementById("restaurant1").value=true;
	}
	else{
		 document.getElementById("restaurant1").value=false;}
		
	if( document.getElementById("restSelectFormMain").onlinedel1.checked==true){
			rstp +=4+"|";
			document.getElementById("onlinedel1").value=true;
	}
	else{
		 document.getElementById("onlinedel1").value=false;}
	if( document.getElementById("restSelectFormMain").onlinecol1.checked==true){
			rstp +=5+"|";
			document.getElementById("onlinecol1").value=true;
	}
	else{
		 document.getElementById("onlinecol1").value=false;}

	if(rstp==""){
		rstp='1|2|3|4|5';}
//	 document.getElementById("restSelectFormMain").restaurantsType.value=rstp;		
    if(document.getElementById("restSelectFormMain").searchCountry!=null)
    {
   	   if( document.getElementById("restSelectFormMain").cities[ document.getElementById("restSelectFormMain").cities.selectedIndex].text=='select')
		{
			errorMessage+="please select the City\n\n";	
		  if(status)
			{
				document.getElementById("restSelectFormMain").cities.focus();
				status=false;
			}			
		}			
      }
//		if((document.getElementById("restSelectFormMain").searchPostcode.value=="" &&  document.getElementById("restSelectFormMain").cityLocations.value=="select")&& !validateNotEmpty(document.getElementById("restSelectFormMain").searchRest.value))
		if((document.getElementById("restSelectFormMain").searchPostcode.value=="" &&  document.getElementById("restSelectFormMain").cityLocations.value=="select"))
		{
			errorMessage+="Please Enter a Location or a Postcode\n\n";	
//			errorMessage+="Please Enter a Location or a Postcode or enter a key word in the business text field\n";	
			if(status)
			{	
				document.getElementById("restSelectFormMain").searchPostcode.focus();
				status=false;							
			 }			
		}
		if( document.getElementById("restSelectFormMain").searchPostcode.value!="")
		{
			var pcode=document.getElementById("restSelectFormMain").searchPostcode.value; 
			var plength=pcode.length;
			if(plength<2)
			errorMessage+="Please Enter atleast 2 (PostCode)Characters to Search\n";	
			if(status)
			{
				if(document.getElementById("restSelectFormMain").formType!=null)
				{
					document.getElementById("restSelectFormMain").searchPostcode.focus();
					status=false;
				}
			 }
		}
	if(errorMessage!=errorMessage1)
	  {
		alert(errorMessage);
		statusvar = "false";
	  }
	else 
	{
		//k.mu250609 start
		var lucene="";

		if(postcodeLucene=="postcode"){
			lucene="";
			postcodeLucene="";
		}
        else{
      	lucene="lucene";
        }
		//k.mu250609 end
		document.forms["RestaurantSelectionForm"].luceneSearch.value=lucene;
		
		searchType="allSearch";
		searchValue ="allSearch";			
		country='IND';
		//document.forms["restSelectFormMain"].cityId.value=$("citiesID").value;		
		postcode=document.getElementById("restSelectFormMain").searchPostcode.value;

    	restparamsjson=new restparamsObj(searchValue,'success',searchType,formType,timezone,cuisine,dish,rstp,restName,country,postcode,$("citiesID").value,"");
//mu	restparamsjson=new restparamsObj(searchValue,'success',searchType,formType,timezone,cuisine,dish,rstp,restName,country,postcode,lucene,$("citiesID").value,"");			
		restparams=Object.toJSON(restparamsjson);
		document.forms["RestaurantSelectionForm"].restParamJson.value=restparams;
		//var strURL = 'RestaurantSelection.do?searchValue='+searchValue+'&msg=success&searchType='+searchType+'&formType='+formType+'&timezone='+timezone+'&cuisineType='+cuisine+'&dishValue='+dish+'&restaurantsType='+rstp+'&searchRest='+restName+'&searchCountry='+country+"&searchPostcode="+postcode;
//mu	var strURL = 'RestaurantSelection.do?lucene='+lucene+'&city='+cities;	
		var strURL = 'RestaurantSelection.do?city='+cities+'&view='+param;		
		document.getElementById("restSelectFormMain").action=strURL;
   		document.getElementById("restSelectFormMain").submit();		
	}
}
function viewModule(module)
{
 	if(module == "cuisineCat")
 	{
	 	document.getElementById("cuisineCat").style.display="block";
	 	document.getElementById("searchCriteria").style.display="none";
	 	}
 	else if(module == "searchCriteria")
 	{
	 	document.getElementById("cuisineCat").style.display="none";
	 	document.getElementById("searchCriteria").style.display="block";
	}
 	else if(module == "none")
 	{
	 	document.getElementById("cuisineCat").style.display="none";
	 	document.getElementById("searchCriteria").style.display="none";
 	}
}
function GetCookie(key) {

   var arg = key + "=";
   var alen = arg.length;
   var clen = document.cookie.length;
   var i = 0;
 if(key.substring(0,6)=="Order." || key == "ServerNumberOrdered" || key=="NumberOrdered" || key=="userType"){
	 if(typeof(parent.obj) != "undefined" && parent.obj != null && parent.obj.order != null){
	 	if(key.substring(0,13) == "Order.Server."){
	 		return parent.obj.reorder[parseInt(key.substring(13),10)-1];}
	 	else if(key.substring(0,6) == "Order."){
	 		return parent.obj.order[parseInt(key.substring(6),10)-1];}
	 	else if(key == "ServerNumberOrdered"){
	 		return parent.obj.serverOrdered;}
	 	else if(key == "NumberOrdered"){
	 		return parent.obj.order.length;}
	 	else{
	 		return parent.obj.key;}
	 }
     else{
     	return "";
     }
     
   }
   while ( i < clen ) {
      var j = i + alen;
      if ( document.cookie.substring(i, j) == arg ) 
      {
      	return(getCookieVal (j));
      }
      i = document.cookie.indexOf(" ", i) + 1;
      if ( i == 0 ) break;
   }
   return(null);
}
function getTotalPagesModule(strURL)
{
	new Ajax.Updater('restaurants', strURL, {onComplete:function(){},asynchronous:false,parameters:Form.serialize('restSelectFormMain'),evalScripts:true});				
}
function setpostCodeLoc(pcode)
{
	$('locationListID').value=pcode;
	document.forms[0].searchPostcode.value =pcode;
//	postcodeLucene="postcode";  //k.mu250609
	$("cityLocationsID").value=pcode;
	searchNewInd('allsearch');
}
function checkEnquiryForm()
{
 document.forms[0].action="enquiry.do";
 document.forms[0].submit();
}
var suggest="";
function funSuggestRestaurant()
{
	var	status=true;
	var errorMessage1="There were problem with one or more of your entries\n";	
	var errorMessage=errorMessage1;
	if(!validateNotEmpty($("suggestName").value))
	{
		errorMessage+="Your Name is required\n";
		if(status)
		{
			$("suggestName").focus();
			status=false;
		}
	 }
	 if(!validateNotEmpty($("suggestEmail").value))
	{
		errorMessage+="Your Email is required\n";
		if(status)
		{
			$("suggestEmail").focus();
			status=false;
		}
	 }
	else
	{
		if(!validateEmail($("suggestEmail").value))
		{
			errorMessage+="Email is not valid\n";
			if(status)
			{
				$("suggestEmail").focus();
				status=false;
			}
		}							
	}
	if(!validateNotEmpty($("restNameId").value))
	{
		errorMessage+="Restaurant Name is required\n";
		if(status)
		{
			$("restNameId").focus();
			status=false;
		}
	 }
	 if(!validateNotEmpty($("restAddressId").value))
	{
		errorMessage+="Restaurant Address is required\n";
		if(status)
		{
			$("restAddressId").focus();
			status=false;
		}
	 }
	if(errorMessage!=errorMessage1)
	{
		alert(errorMessage);
	}
	else
	{
		suggestjson=new suggestRestObj($("suggestName").value,$("suggestEmail").value,$("restNameId").value,$("restAddressId").value,$("restPhoneId").value,$("restCommentId").value);
		suggest=Object.toJSON(suggestjson);
		new Ajax.Updater('suggestID', 'suggest.do?param='+suggest, {onComplete:function(){
		},asynchronous:true,evalScripts:true});
		new Ajax.PeriodicalUpdater("suggestID", "jsp/suggestSuccess.jsp", {		  	
			frequency : 10,
			decay : 2
			});
	}
}
function DescriptionsInd(des)
{
	if(des!=null && des=='aboutus'){
	new Ajax.Updater('locationsDivID', "jsp/aboutUsInd.jsp", {onComplete:function(){},asynchronous:false, evalScripts:true});}
	else if(des!=null && des=='custhiworks'){
	new Ajax.Updater('locationsDivID', "jsp/customerHowItWorksInd.jsp", {onComplete:function(){},asynchronous:false, evalScripts:true});}
	else if(des!=null && des=='vendorhiworks'){
	new Ajax.Updater('locationsDivID', "jsp/vendorHowItWorksInd.jsp", {onComplete:function(){},asynchronous:false, evalScripts:true});}
	else if(des!=null && des=='faq'){
	new Ajax.Updater('locationsDivID', "jsp/FaqInd.jsp", {onComplete:function(){},asynchronous:false, evalScripts:true});}
	else if(des!=null && des=='businessowners'){
	new Ajax.Updater('locationsDivID', "jsp/BusinessOwnersInd.jsp", {onComplete:function(){},asynchronous:false, evalScripts:true});}
	else if(des!=null && des=='tellafriend'){
	new Ajax.Updater('tellafriendlight', "jsp/TellaFriendInd.jsp", {onComplete:function(){},asynchronous:false, evalScripts:true});
	Popup.showModal('tellafriendlight');
	}
	else if(des!=null && des=='jobs'){
	new Ajax.Updater('locationsDivID', "jsp/jobsInd.jsp", {onComplete:function(){},asynchronous:false, evalScripts:true});}
	else if(des!=null && des=='contactus'){
	new Ajax.Updater('locationsDivID', "jsp/contactUsInd.jsp", {onComplete:function(){},asynchronous:false, evalScripts:true});}
	else if(des!=null && des=='agreement'){
	new Ajax.Updater('locationsDivID', "jsp/userAgreementInd.jsp", {onComplete:function(){},asynchronous:false, evalScripts:true});}
	else if(des!=null && des=='privacypolicy'){
	new Ajax.Updater('locationsDivID', "jsp/PrivacyPolicyInd.jsp", {onComplete:function(){},asynchronous:false, evalScripts:true});}
}
function DescriptionsGgy(des)
{
	if(des!=null && des=='aboutus'){
	new Ajax.Updater('locationsDivID', "jsp/aboutUsGgy.jsp", {onComplete:function(){},asynchronous:false, evalScripts:true});}
	else if(des!=null && des=='custhiworks'){
	new Ajax.Updater('locationsDivID', "jsp/customerHowItWorksGgy.jsp", {onComplete:function(){},asynchronous:false, evalScripts:true});}
	else if(des!=null && des=='vendorhiworks'){
	new Ajax.Updater('locationsDivID', "jsp/vendorHowItWorksGgy.jsp", {onComplete:function(){},asynchronous:false, evalScripts:true});}
	else if(des!=null && des=='faq'){
	new Ajax.Updater('locationsDivID', "jsp/FaqGgy.jsp", {onComplete:function(){},asynchronous:false, evalScripts:true});}
	else if(des!=null && des=='businessowners'){
	new Ajax.Updater('locationsDivID', "jsp/BusinessOwnersGgy.jsp", {onComplete:function(){},asynchronous:false, evalScripts:true});}
	else if(des!=null && des=='tellafriend'){
	new Ajax.Updater('tellafriendlight', "jsp/TellaFriendGgy.jsp", {onComplete:function(){},asynchronous:false, evalScripts:true});
	Popup.showModal('tellafriendlight');
	}
	else if(des!=null && des=='jobs'){
	new Ajax.Updater('locationsDivID', "jsp/jobsGgy.jsp", {onComplete:function(){},asynchronous:false, evalScripts:true});}
	else if(des!=null && des=='contactus'){
	new Ajax.Updater('locationsDivID', "jsp/contactUsGgy.jsp", {onComplete:function(){},asynchronous:false, evalScripts:true});}
	else if(des!=null && des=='agreement'){
	new Ajax.Updater('locationsDivID', "jsp/userAgreementGgy.jsp", {onComplete:function(){},asynchronous:false, evalScripts:true});}
	else if(des!=null && des=='privacypolicy'){
	new Ajax.Updater('locationsDivID', "jsp/PrivacyPolicyGgy.jsp", {onComplete:function(){},asynchronous:false, evalScripts:true});}
}
function funGetMore(k)
{
	if(document.forms["RestaurantSelectionForm"].cities[document.forms["RestaurantSelectionForm"].cities.selectedIndex].text=='select')
	{
		alert("please select city and then click more\n");
	}
	else
	{
		document.forms["RestaurantSelectionForm"].city.value=document.forms["RestaurantSelectionForm"].cities[document.forms["RestaurantSelectionForm"].cities.selectedIndex].text;
		restparamsjson=new restparamsObj("","","","","","","","","","","",$("citiesID").value,"");		
		restparams=Object.toJSON(restparamsjson);
		document.forms["RestaurantSelectionForm"].restParamJson.value=restparams;
		new Ajax.Updater('locationsDivID', 'locations.do?param=locations&param1=more', {
		onComplete:function()
		{      
		  }  ,parameters:Form.serialize(document.forms[0]),asynchronous:true,evalScripts:true});		
	}           
}
function logoff()
{
	document.forms[1].action="logoff.do";
	document.forms[1].submit();
}
function getOrdersPage()
{
	var visitortime = new Date();
	var tz=(visitortime.getTimezoneOffset()/60)*(-1);	
	//document.forms[0].action="Order.do?ordertype=login&login=true&timezone="+tz;
	//document.forms[0].action="home.do?ordertype=login&timezone="+tz;
	document.forms[0].action="home.do";
	document.forms[0].submit();	
}	
function vendorDescription(indexval)
{	
	if(indexval!=null && indexval=='1')
	new Ajax.Updater('locationsDivID', "jsp/vendorHowItWorksInd.jsp", {onComplete:function(){},asynchronous:false, evalScripts:true});
	else if(indexval!=null && indexval=='2')
	new Ajax.Updater('locationsDivID', "jsp/vendorHowItWorksInd2.jsp", {onComplete:function(){},asynchronous:false, evalScripts:true});
	else if(indexval!=null && indexval=='3')
	new Ajax.Updater('locationsDivID', "jsp/vendorHowItWorksInd3.jsp", {onComplete:function(){},asynchronous:false, evalScripts:true});
}
function vendorDescriptionGgy(indexval)
{	
	if(indexval!=null && indexval=='1')
	new Ajax.Updater('locationsDivID', "jsp/vendorHowItWorksGgy.jsp", {onComplete:function(){},asynchronous:false, evalScripts:true});
	else if(indexval!=null && indexval=='2')
	new Ajax.Updater('locationsDivID', "jsp/vendorHowItWorksGgy2.jsp", {onComplete:function(){},asynchronous:false, evalScripts:true});
	else if(indexval!=null && indexval=='3')
	new Ajax.Updater('locationsDivID', "jsp/vendorHowItWorksGgy3.jsp", {onComplete:function(){},asynchronous:false, evalScripts:true});
}
function funSubmitEnquiryForm()
{
var errorMessage="";
var errorMessage1="";
errorMessage= errorMessage1;
	var	status=true;
if(!validateNotEmpty(document.forms["EnquiryForm"].venname.value))
			{
					errorMessage+=nameRequired;
					if(status)
					{
						document.forms["EnquiryForm"].venname.focus();
						status=false;
					}
			}
if(validateNotEmpty(document.forms["EnquiryForm"].phone.value))
	{
if(!validatePhone(document.forms["EnquiryForm"].phone.value))
 {		
   errorMessage+=pnoEnterNos;
						if(status)
						{
							document.forms["EnquiryForm"].phone.focus();
							status=false;
						}
}
}
if(document.forms["EnquiryForm"].years[document.forms["EnquiryForm"].years.selectedIndex].text!="Select")
	{
if(!validatePhone(document.forms["EnquiryForm"].years[document.forms["EnquiryForm"].years.selectedIndex].text))
 {		
   errorMessage+=yearEnterNos;
						if(status)
						{
							document.forms["EnquiryForm"].years.focus();
							status=false;
						}
}
}
if(validateNotEmpty(document.forms["EnquiryForm"].turnover.value))
	{
        var cha = document.forms["EnquiryForm"].turnover.value;
		var splChar = new Array();
		splChar = "~a`a!a@a#a$a%a^a&a*a(a)a+a=a{a}a[a]a<a>a/a?a:a;a\"a-a " ;
		var splChars=splChar.split("a");
		var strVal="";
		var errorChar="";
		for(var i=0;i<splChars.length-1;i++)
		{
			strVal=strVal+"\n"+splChars[i];
			var splCharTest=cha.split(""+splChars[i]);
			if(splCharTest.length > 1)
			{
				errorChar=errorChar+splChars[i]+" ";
			}
		}
		if(errorChar!="")
		{
			errorMessage+="please enter the turnover properly\n";
			if(status)
			{
				document.forms["EnquiryForm"].turnover.focus();
				status=false;
			}
		}
}
if(validateNotEmpty(document.forms["EnquiryForm"].email.value))
	{
if(!validateEmail(document.forms["EnquiryForm"].email.value))
		{
			errorMessage+=emailNotValid;	
			if(status)
				{
					document.forms["EnquiryForm"].email.focus();
					status=false;
				}
		}
}	
if(errorMessage!=errorMessage1)
			  {
            	alert(errorMessage);
			  }
			  else
			  {
			   if(document.forms["EnquiryForm"].years[document.forms["EnquiryForm"].years.selectedIndex].text!="select")
			    {document.forms["EnquiryForm"].noofyears.value=document.forms["EnquiryForm"].years[document.forms["EnquiryForm"].years.selectedIndex].text;}
			    if(document.forms["EnquiryForm"].country[document.forms["EnquiryForm"].country.selectedIndex].text!="select")
			    { document.forms["EnquiryForm"].cntry.value=document.forms["EnquiryForm"].country[document.forms["EnquiryForm"].country.selectedIndex].text;}
			   if(document.getElementById("bustype").checked)
			   { document.forms["EnquiryForm"].business.value="true";}
			   if(document.getElementById("storetype").checked)
			        {document.forms["EnquiryForm"].store.value="true";}
			        if(document.getElementById("delivery").checked)
			        {document.forms["EnquiryForm"].delivery.value=true;}
			        if(document.getElementById("takeaway").checked)
			        {document.forms["EnquiryForm"].takeaway.value=true;}
			        if(document.getElementById("eatin").checked)
			        {document.forms["EnquiryForm"].eatin.value=true;}	
			  	document.forms["EnquiryForm"].action="enquiry.do";
				document.forms["EnquiryForm"].submit();			 	
              }
}
function funResetEnquiryform()
{
	document.forms["EnquiryForm"].venname.value="";
	$("bustype").checked=false;
	$("storetype").checked=false;
	$("takeaway").checked=false;
	$("delivery").checked=false;
	$("eatin").checked=false;
	document.forms["EnquiryForm"].address1.value="";
	document.forms["EnquiryForm"].address2.value="";
	document.forms["EnquiryForm"].city.value="";
	document.forms["EnquiryForm"].state.value="";
	document.forms["EnquiryForm"].country.value="";
	document.forms["EnquiryForm"].postcode.value="";
	document.forms["EnquiryForm"].phone.value="";
	document.forms["EnquiryForm"].mobile.value="";
	document.forms["EnquiryForm"].email.value="";
	document.forms["EnquiryForm"].filepath.value="";
	document.forms["EnquiryForm"].years.value="";
	document.forms["EnquiryForm"].turnover.value="";	
}


function funMore(k)
{
	  var cntry=document.forms["RestaurantSelectionForm"].searchCountry.value;
	  new Ajax.Updater("countrypostcodes","home.do?paramx=totalpostcodes&searchCountry="+cntry,{onComplete:function(){document.getElementById("morebut").style.display="none";},asynchronous:false, evalScripts:true});           
}
	
function setpostcode(pcode)
{
		document.forms["RestaurantSelectionForm"].searchPostcode.value =pcode;
//		document.getElementById("searchPCText").value=pcode;
		searchNew('allsearch','restaurants',1);
}	
function indexChangeLocation(val)
{
//mu241009	var cntry=document.forms["RestaurantSelectionForm"].searchCountry.value;
	var cntry="";
	if(val==1)
	{
		if(document.getElementById("searchCountryMiddle")!=null)
			document.getElementById("searchCountryMiddle").value = document.getElementById("searchCountry").value;
		cntry=document.getElementById("searchCountry").value;
	}
	else
	{
		
		document.getElementById("searchCountry").value = document.getElementById("searchCountryMiddle").value;
		cntry=document.getElementById("searchCountryMiddle").value;
	}
	 
//	if(cntry!=null)var country="";
     var countrycode="";
	if(document.forms[0].searchCountry!=null)
    countrycode=document.forms[0].searchCountry.value;
//	{
//		new Ajax.Updater("countrypostcodes", "home.do?countrysearch="+cntry, {onComplete:function(){
//		//new Ajax.Updater("cmsListID", "home.do?param=cmslist&country="+cntry, {onComplete:function(){},asynchronous:false, evalScripts:true});	
//			
//		},asynchronous:false, evalScripts:true});
//	}
	document.forms["LoginInfoForm"].action="home.do?param=cms&country="+cntry+"&countrycode="+countrycode;
	document.forms["LoginInfoForm"].submit();
}
function getCurrency()
{
	var country="";
	if(document.forms["EnquiryForm"].country[document.forms["EnquiryForm"].country.selectedIndex].text!="select")
	 country=document.forms["EnquiryForm"].country[document.forms["EnquiryForm"].country.selectedIndex].text;
	if(currencies!=null && country!="" && currencies[country]!=null && currencies[country]!='undefined')
	{
		document.forms["EnquiryForm"].currency.value=currencies[country].symbol;
		document.getElementById("curr").innerHTML=currencies[country].symbol;
	}else
	{
		document.getElementById("curr").innerHTML="";
	}

}
var Util = {'$VERSION':1.06};
function isArray(o) {
	return (o!=null && typeof(o)=="object" && typeof(o.length)=="number" && (o.length==0 || defined(o[0])));
};
function isObject(o) {
	return (o!=null && typeof(o)=="object" && defined(o.constructor) && o.constructor==Object && !defined(o.nodeName));
};
function defined(o) {
	return (typeof(o)!="undefined");
};
function map(func) {
	var i,j,o;
	var results = [];
	if (typeof(func)=="string") {
		func = new Function('$_',func);
	}
	for (i=1; i<arguments.length; i++) {
		o = arguments[i];
		if (isArray(o)) {
			for (j=0; j<o.length; j++) {
				results[results.length] = func(o[j]);
			}
		}
		else if (isObject(o)) {
			for (j in o) {
				results[results.length] = func(o[j]);
			}
		}
		else {
			results[results.length] = func(o);
		}
	}
	return results;
};
function setDefaultValues(o,values) {
	if (!defined(o) || o==null) {
		o = {};
	}
	if (!defined(values) || values==null) {
		return o;
	}
	for (var val in values) {
		if (!defined(o[val])) {
			o[val] = values[val];
		}
	}
	return o;
};
Array.prototype.contains = function(o) {
	var i,l;
	if (!(l = this.length)) { return false; }
	for (i=0; i<l; i++) {
		if (o==this[i]) {
			return true;
		}
	}
};
var DOM = (function() { 
	var dom = {};
	dom.getParentByTagName = function(o,tagNames) {
		if(o==null) { return null; }
		if (isArray(tagNames)) {
			tagNames = map("return $_.toUpperCase()",tagNames);
			while (o=o.parentNode) {
				if (o.nodeName && tagNames.contains(o.nodeName)) {
					return o;
				}
			}
		}
		else {
			tagNames = tagNames.toUpperCase();
			while (o=o.parentNode) {
				if (o.nodeName && tagNames==o.nodeName) {
					return o;
				}
			}
		}
		return null;
	};
	dom.removeNode = function(o) {
		if (o!=null && o.parentNode && o.parentNode.removeChild) {
			for (var i in o) {
				if (typeof(o[i])=="function") {
					o[i] = null;
				}
			}
			o.parentNode.removeChild(o);
			return true;
		}
		return false;
	};
	dom.getOuterWidth = function(o) {
		if (defined(o.offsetWidth)) {
			return o.offsetWidth;
		}
		return null;
	};
	dom.getOuterHeight = function(o) {
		if (defined(o.offsetHeight)) {
			return o.offsetHeight;
		}
		return null;
	};
	dom.resolve = function() {
		var results = new Array();
		var i,j,o;
		for (var i=0; i<arguments.length; i++) {
			var o = arguments[i];
			if (o==null) {
				if (arguments.length==1) {
					return null;
				}
				results[results.length] = null;
			}
			else if (typeof(o)=='string') {
				if (document.getElementById) {
					o = document.getElementById(o);
				}
				else if (document.all) {
					o = document.all[o];
				}
				if (arguments.length==1) {
					return o;
				}
				results[results.length] = o;
			}
			else if (isArray(o)) {
				for (j=0; j<o.length; j++) {
					results[results.length] = o[j];
				}
			}
			else if (isObject(o)) {
				for (j in o) {
					results[results.length] = o[j];
				}
			}
			else if (arguments.length==1) {
				return o;
			}
			else {
				results[results.length] = o;
			}
	  }
	  return results;
	};
	dom.$ = dom.resolve;
	return dom;
})();
var CSS = (function(){
	var css = {};
	css.rgb2hex = function(rgbString) {
		if (typeof(rgbString)!="string" || !defined(rgbString.match)) { return null; }
		var result = rgbString.match(/^\s*rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*/);
		if (result==null) { return rgbString; }
		var rgb = +result[1] << 16 | +result[2] << 8 | +result[3];
		var hex = "";
		var digits = "0123456789abcdef";
		while(rgb!=0) { 
			hex = digits.charAt(rgb&0xf)+hex; 
			rgb>>>=4; 
		} 
		while(hex.length<6) { hex='0'+hex; }
		return "#" + hex;
	};
	css.hyphen2camel = function(property) {
		if (!defined(property) || property==null) { return null; }
		if (property.indexOf("-")<0) { return property; }
		var str = "";
		var c = null;
		var l = property.length;
		for (var i=0; i<l; i++) {
			c = property.charAt(i);
			str += (c!="-")?c:property.charAt(++i).toUpperCase();
		}
		return str;
	};
	css.hasClass = function(obj,className) {
		if (!defined(obj) || obj==null || !RegExp) { return false; }
		var re = new RegExp("(^|\\s)" + className + "(\\s|$)");
		if (typeof(obj)=="string") {
			return re.test(obj);
		}
		else if (typeof(obj)=="object" && obj.className) {
			return re.test(obj.className);
		}
		return false;
	};
	css.addClass = function(obj,className) {
		if (typeof(obj)!="object" || obj==null || !defined(obj.className)) { return false; }
		if (obj.className==null || obj.className=='') { 
			obj.className = className; 
			return true; 
		}
		if (css.hasClass(obj,className)) { return true; }
		obj.className = obj.className + " " + className;
		return true;
	};
	css.removeClass = function(obj,className) {
		if (typeof(obj)!="object" || obj==null || !defined(obj.className) || obj.className==null) { return false; }
		if (!css.hasClass(obj,className)) { return false; }
		var re = new RegExp("(^|\\s+)" + className + "(\\s+|$)");
		obj.className = obj.className.replace(re,' ');
		return true;
	};
	css.replaceClass = function(obj,className,newClassName) {
		if (typeof(obj)!="object" || obj==null || !defined(obj.className) || obj.className==null) { return false; }
		css.removeClass(obj,className);
		css.addClass(obj,newClassName);
		return true;
	};
	css.getStyle = function(o, property) {
		if (o==null) { return null; }
		var val = null;
		var camelProperty = css.hyphen2camel(property);
		if (property=="float") {
			val = css.getStyle(o,"cssFloat");
			if (val==null) { 
				val = css.getStyle(o,"styleFloat"); 
			}
		}
		else if (o.currentStyle && defined(o.currentStyle[camelProperty])) {
			val = o.currentStyle[camelProperty];
		}
		else if (window.getComputedStyle) {
			val = window.getComputedStyle(o,null).getPropertyValue(property);
		}
		else if (o.style && defined(o.style[camelProperty])) {
			val = o.style[camelProperty];
		}
		if (/^\s*rgb\s*\(/.test(val)) {
			val = css.rgb2hex(val);
		}
		if (/^#/.test(val)) {
			val = val.toLowerCase();
		}
		return val;
	};
	css.get = css.getStyle;
	css.setStyle = function(o, property, value) {
		if (o==null || !defined(o.style) || !defined(property) || property==null || !defined(value)) { return false; }
		if (property=="float") {
			o.style["cssFloat"] = value;
			o.style["styleFloat"] = value;
		}
		else if (property=="opacity") {
			o.style['-moz-opacity'] = value;
			o.style['-khtml-opacity'] = value;
			o.style.opacity = value;
			if (defined(o.style.filter)) {
				o.style.filter = "alpha(opacity=" + value*100 + ")";
			}
		}
		else {
			o.style[css.hyphen2camel(property)] = value;
		}
		return true;
	};
	css.set = css.setStyle;
	css.uniqueIdNumber=1000;
	css.createId = function(o) {
		if (defined(o) && o!=null && defined(o.id) && o.id!=null && o.id!="") { 
			return o.id;
		}
		var id = null;
		while (id==null || document.getElementById(id)!=null) {
			id = "ID_"+(css.uniqueIdNumber++);
		}
		if (defined(o) && o!=null && (!defined(o.id)||o.id=="")) {
			o.id = id;
		}
		return id;
	};
	
	return css;
})();
var Event = (function(){
	var ev = {};
	ev.resolve = function(e) {
		if (!defined(e) && defined(window.event)) {
			e = window.event;
		}
		return e;
	};
	ev.add = function( obj, type, fn, capture ) {
		if (obj.addEventListener) {
			obj.addEventListener( type, fn, capture );
			return true;
		}
		else if (obj.attachEvent) {
			obj.attachEvent( "on"+type, fn );
			return true;
		}
		return false;
	};
	ev.getMouseX = function(e) {
		e = ev.resolve(e);
		if (defined(e.pageX)) {
			return e.pageX;
		}
		if (defined(e.clientX)) {
			return e.clientX+Screen.getScrollLeft();
		}
		return null;
	};
	ev.getMouseY = function(e) {
		e = ev.resolve(e);
		if (defined(e.pageY)) {
			return e.pageY;
		}
		if (defined(e.clientY)) {
			return e.clientY+Screen.getScrollTop();
		}
		return null;
	};
	ev.cancelBubble = function(e) {
		e = ev.resolve(e);
		if (typeof(e.stopPropagation)=="function") { e.stopPropagation(); } 
		if (defined(e.cancelBubble)) { e.cancelBubble = true; }
	};
	ev.stopPropagation = ev.cancelBubble;
	ev.preventDefault = function(e) {
		e = ev.resolve(e);
		if (typeof(e.preventDefault)=="function") { e.preventDefault(); } 
		if (defined(e.returnValue)) { e.returnValue = false; }
	};
	
	return ev;
})();
var Screen = (function() {
	var screen = {};
	screen.getBody = function() {
		if (document.body) {
			return document.body;
		}
		if (document.getElementsByTagName) {
			var bodies = document.getElementsByTagName("BODY");
			if (bodies!=null && bodies.length>0) {
				return bodies[0];
			}
		}
		return null;
	};
	screen.getScrollTop = function() {
		if (document.documentElement && defined(document.documentElement.scrollTop) && document.documentElement.scrollTop>0) {
			return document.documentElement.scrollTop;
		}
		if (document.body && defined(document.body.scrollTop)) {
			return document.body.scrollTop;
		}
		return null;
	};
	screen.getScrollLeft = function() {
		if (document.documentElement && defined(document.documentElement.scrollLeft) && document.documentElement.scrollLeft>0) {
			return document.documentElement.scrollLeft;
		}
		if (document.body && defined(document.body.scrollLeft)) {
			return document.body.scrollLeft;
		}
		return null;
	};
	screen.zero = function(n) {
		return (!defined(n) || isNaN(n))?0:n;
	};
	screen.getDocumentWidth = function() {
		var width = 0;
		var body = screen.getBody();
		if (document.documentElement && (!document.compatMode || document.compatMode=="CSS1Compat")) {
		    var rightMargin = parseInt(CSS.get(body,'marginRight'),10) || 0;
		    var leftMargin = parseInt(CSS.get(body,'marginLeft'), 10) || 0;
			width = Math.max(body.offsetWidth + leftMargin + rightMargin, document.documentElement.clientWidth);
		}
		else {
			width =  Math.max(body.clientWidth, body.scrollWidth);
		}
		if (isNaN(width) || width==0) {
			width = screen.zero(self.innerWidth);
		}
		return width;
	};
	screen.getDocumentHeight = function() {
		var body = screen.getBody();
		var innerHeight = (defined(self.innerHeight)&&!isNaN(self.innerHeight))?self.innerHeight:0;
		if (document.documentElement && (!document.compatMode || document.compatMode=="CSS1Compat")) {
		    var topMargin = parseInt(CSS.get(body,'marginTop'),10) || 0;
		    var bottomMargin = parseInt(CSS.get(body,'marginBottom'), 10) || 0;
			return Math.max(body.offsetHeight + topMargin + bottomMargin, document.documentElement.clientHeight, document.documentElement.scrollHeight, screen.zero(self.innerHeight));
		}
		return Math.max(body.scrollHeight, body.clientHeight, screen.zero(self.innerHeight));
	};
	screen.getViewportWidth = function() {
		if (document.documentElement && (!document.compatMode || document.compatMode=="CSS1Compat")) {
			return document.documentElement.clientWidth;
		}
		else if (document.compatMode && document.body) {
			return document.body.clientWidth;
		}
		return screen.zero(self.innerWidth);
	};
	screen.getViewportHeight = function() {
		if (!window.opera && document.documentElement && (!document.compatMode || document.compatMode=="CSS1Compat")) {
			return document.documentElement.clientHeight;
		}
		else if (document.compatMode && !window.opera && document.body) {
			return document.body.clientHeight;
		}
		return screen.zero(self.innerHeight);
	};

	return screen;
})();var Sort = (function(){
	var sort = {};
	sort.AlphaNumeric = function(a,b) {
		if (a==b) { return 0; }
		if (a<b) { return -1; }
		return 1;
	};
	sort.Default = sort.AlphaNumeric;
	sort.NumericConversion = function(val) {
		if (typeof(val)!="number") {
			if (typeof(val)=="string") {
				val = parseFloat(val.replace(/,/g,''));
				if (isNaN(val) || val==null) { val=0; }
			}
			else {
				val = 0;
			}
		}
		return val;
	};
	sort.Numeric = function(a,b) {
		return sort.NumericConversion(a)-sort.NumericConversion(b);
	};
	sort.IgnoreCaseConversion = function(val) {
		if (val==null) { val=""; }
		return (""+val).toLowerCase();
	};

	sort.IgnoreCase = function(a,b) {
		return sort.AlphaNumeric(sort.IgnoreCaseConversion(a),sort.IgnoreCaseConversion(b));
	};
	sort.CurrencyConversion = function(val) {
		if (typeof(val)=="string") {
			val = val.replace(/^[^\d\.]/,'');
		}
		return sort.NumericConversion(val);
	};
	sort.Currency = function(a,b) {
		return sort.Numeric(sort.CurrencyConversion(a),sort.CurrencyConversion(b));
	};
	sort.DateConversion = function(val) {
		function getdate(str) {
			function fixYear(yr) {
				yr = +yr;
				if (yr<50) { yr += 2000; }
				else if (yr<100) { yr += 1900; }
				return yr;
			};
			var ret;
			if (ret=str.match(/(\d{2,4})-(\d{1,2})-(\d{1,2})/)) {
				return (fixYear(ret[1])*10000) + (ret[2]*100) + (+ret[3]);
			}
			if (ret=str.match(/(\d{1,2})[\/-](\d{1,2})[\/-](\d{2,4})/)) {
				return (fixYear(ret[3])*10000) + (ret[1]*100) + (+ret[2]);
			}
			return 99999999; 
		};
		return getdate(val);
	};
	sort.Date = function(a,b) {
		return sort.Numeric(sort.DateConversion(a),sort.DateConversion(b));
	};
	return sort;
})();

var Position = (function() {
	function resolveObject(s) {
		if (document.getElementById && document.getElementById(s)!=null) {
			return document.getElementById(s);
		}
		else if (document.all && document.all[s]!=null) {
			return document.all[s];
		}
		else if (document.anchors && document.anchors.length && document.anchors.length>0 && document.anchors[0].x) {
			for (var i=0; i<document.anchors.length; i++) {
				if (document.anchors[i].name==s) { 
					return document.anchors[i]
				}
			}
		}
	}
	var pos = {};
	pos.$VERSION = 1.0;
	pos.set = function(o,left,top) {
		if (typeof(o)=="string") {
			o = resolveObject(o);
		}
		if (o==null || !o.style) {
			return false;
		}
		if (typeof(left)=="object") {
			var pos = left;
			left = pos.left;
			top = pos.top;
		}
		
		o.style.left = left + "px";
		o.style.top = top + "px";
		return true;
	};
	pos.get = function(o) {
		var fixBrowserQuirks = true;
		if (typeof(o)=="string") {
			o = resolveObject(o);
		}
		
		if (o==null) {
			return null;
		}
		var left = 0;
		var top = 0;
		var width = 0;
		var height = 0;
		var parentNode = null;
		var offsetParent = null;
		offsetParent = o.offsetParent;
		var originalObject = o;
		var el = o; 
		while (el.parentNode!=null) {
			el = el.parentNode;
			if (el.offsetParent==null) {
			}
			else {
				var considerScroll = true;
				if (fixBrowserQuirks && window.opera) {
					if (el==originalObject.parentNode || el.nodeName=="TR") {
						considerScroll = false;
					}
				}
				if (considerScroll) {
					if (el.scrollTop && el.scrollTop>0) {
						top -= el.scrollTop;
					}
					if (el.scrollLeft && el.scrollLeft>0) {
						left -= el.scrollLeft;
					}
				}
			}
			if (el == offsetParent) {
				left += o.offsetLeft;
				if (el.clientLeft && el.nodeName!="TABLE") { 
					left += el.clientLeft;
				}
				top += o.offsetTop;
				if (el.clientTop && el.nodeName!="TABLE") {
					top += el.clientTop;
				}
				o = el;
				if (o.offsetParent==null) {
					if (o.offsetLeft) {
						left += o.offsetLeft;
					}
					if (o.offsetTop) {
						top += o.offsetTop;
					}
				}
				offsetParent = o.offsetParent;
			}
		}
		if (originalObject.offsetWidth) {
			width = originalObject.offsetWidth;
		}
		if (originalObject.offsetHeight) {
			height = originalObject.offsetHeight;
		}
		
		return {'left':left, 'top':top, 'width':width, 'height':height
				};
	};
	pos.getCenter = function(o) {
		var c = this.get(o);
		if (c==null) { return null; }
		c.left = c.left + (c.width/2);
		c.top = c.top + (c.height/2);
		return c;
	};
	
	return pos;
})();
var Popup = function(div, options) {
	this.div = defined(div)?div:null;
	this.index = Popup.maxIndex++;
	this.ref = "Popup.objects["+this.index+"]";
	Popup.objects[this.index] = this;
	if (typeof(this.div)=="string") {
		Popup.objectsById[this.div] = this;
	}
	if (defined(this.div) && this.div!=null && defined(this.div.id)) {
		Popup.objectsById[this.div.id] = this.div.id;
	}
	if (defined(options) && options!=null && typeof(options)=="object") {
		for (var i in options) {
			this[i] = options[i];
		}
	}
	return this;
};
Popup.maxIndex = 0;
Popup.objects = {};
Popup.objectsById = {};
Popup.minZIndex = 101;
Popup.screenClass = "PopupScreen";
Popup.iframeClass = "PopupIframe";
Popup.screenIframeClass = "PopupScreenIframe";
Popup.hideAll = function() {
	for (var i in Popup.objects) {
		var p = Popup.objects[i];
		if (!p.modal && p.autoHide) {
			p.hide();
		}
	}
};
Event.add(document, "mouseup", Popup.hideAll, false);
Popup.show = function(divObject, referenceObject, position, options, modal) {
	var popup;
	if (defined(divObject)) { 
		popup = new Popup(divObject);
	}
	else {
		popup = new Popup();
		popup.destroyDivOnHide = true;
	}
	if (defined(referenceObject)) { popup.reference = DOM.resolve(referenceObject); }
	if (defined(position)) { popup.position = position; }
	if (defined(options) && options!=null && typeof(options)=="object") {
		for (var i in options) {
			popup[i] = options[i];
		}
	}
	if (typeof(modal)=="boolean") {
		popup.modal = modal;
	}
	popup.destroyObjectsOnHide = true;
	popup.show();
	return popup;
};
Popup.showModal = function(divObject, referenceObject, position, options) {
	Popup.show(divObject, referenceObject, position, options, true);
};
Popup.get = function(divId) {
	if (defined(Popup.objectsById[divId])) {
		return Popup.objectsById[divId];
	}
	return null;
};
Popup.hide = function(divId) {
	var popup = Popup.get(divId);
	if (popup!=null) {
		popup.hide();
	}
};
Popup.prototype.content = null;
Popup.prototype.className = "PopupDiv";
Popup.prototype.style = null;
Popup.prototype.width = null;
Popup.prototype.height = null;
Popup.prototype.top = null;
Popup.prototype.left = null;
Popup.prototype.offsetLeft = 0;
Popup.prototype.offsetTop = 0;
Popup.prototype.constrainToScreen = true;
Popup.prototype.autoHide = true;
Popup.prototype.useIframeShim = false; 
Popup.prototype.iframe = null;
Popup.prototype.position = null; 
Popup.prototype.reference = null;
Popup.prototype.modal = false;
Popup.prototype.destroyDivOnHide = false;
Popup.prototype.destroyObjectsOnHide = false;
Popup.prototype.screen = null;
Popup.prototype.screenIframeShim = null;
Popup.prototype.screenOpacity=.8;
Popup.prototype.screenColor="#000000";
Popup.prototype.show = function(options, modal) {
	this.modal = this.modal || (typeof(modal)=="boolean" && modal);
	if (defined(options) && options!=null && typeof(options)=="object") {
		for (var i in options) {
			this[i] = options[i];
		}
	}
	this.div = DOM.resolve(this.div);
	CSS.setStyle(this.div,'position','absolute');
	if (this.div==null) {
		this.div = this.createDiv();
	}
	if (this.content!=null) {
		this.div.innerHTML = this.content;
		this.content = null;
	}
	if (this.className!=null) {
		this.div.className = this.className;
	}
	if (this.style!=null) {
		this.applyStyle();
	}
	if (this.width!=null) {
		this.div.style.width = this.width+"px";
		this.div.style.overflowX="auto";
	}
	if (this.height!=null) {
		this.div.style.height = this.height+"px";
		this.div.style.overflowY="auto";
	}
	this.transition();
	this.div.onclick = function(e) { 
		Event.cancelBubble(Event.resolve(e));
	};
	this.div.onmouseup = this.div.onclick;
	if (this.modal && this.div.focus) {
		this.div.focus();
	}
};
Popup.prototype.transition = function() {
	if (this.modal) {
		this.addScreen();
	}
	CSS.setStyle(this.div,'visibility','hidden');
	CSS.setStyle(this.div,'display','block');
	this.setPosition();
	if (this.useIframeShim) {
		this.addIframeShim();
	}
	this.div.style.zIndex = Popup.minZIndex++;
	CSS.setStyle(this.div,'display','block');
	CSS.setStyle(this.div,'visibility','visible');
};
Popup.prototype.showModal = function(options) {
	this.show(options,true);
};
Popup.prototype.applyStyle = function() {
	if (this.div!=null && this.style!=null && typeof(this.style)=="object") {
		for (var i in this.style) {
			this.div.style[i] = this.style[i];
		}
	}
};
Popup.prototype.hide = function() {
	if (this.destroyDivOnHide) {
		DOM.removeNode(this.div);
		this.div = null;
		delete Popup.objects[this.id];
	}
	else if (this.div!=null) {
		CSS.setStyle(this.div,'display','none');
	}
	if (this.destroyObjectsOnHide) {
		DOM.removeNode(this.iframe);
		DOM.removeNode(this.screen);
		DOM.removeNode(this.screenIframeShim);
	}
	else {
		if (this.iframe!=null) {
			this.iframe.style.display = "none";
		}
		if (this.screen!=null) {
			this.screen.style.display = "none";
		}
		if (this.screenIframeShim!=null) {
			this.screenIframeShim.style.display = "none";
		}
	}
};
Popup.prototype.setTop = function(top) {
	this.div.style.top = top+"px";
};
Popup.prototype.setLeft = function(left) {
	this.div.style.left = left+"px";
};
Popup.prototype.getTop = function() {
	return parseInt(CSS.getStyle(this.div,"top"),10);
};
Popup.prototype.getLeft = function() {
	return parseInt(CSS.getStyle(this.div,"left"),10);
};
Popup.prototype.setPosition = function() {
	if (this.position!=null) {
		var m = this.position.match(/^(\S+)\s+(\S+)/); 
		if (m!=null && m.length==3) {
			var v = m[1];
			var h = m[2];
			var ref = this.reference;
			if (ref==null) { ref = Screen.getBody(); }
			var p = Position.get(ref);
			var refTop = p.top;
			var refLeft = p.left;
			var refWidth = DOM.getOuterWidth(ref);
			var refHeight = DOM.getOuterHeight(ref);
			var width = DOM.getOuterWidth(this.div);
			var height = DOM.getOuterHeight(this.div);
			var scrollLeft = Screen.getScrollLeft();
			var scrollTop = Screen.getScrollTop();
			if (v=="above") { this.setTop(refTop-height+this.offsetTop); }
			else if (v=="top") { this.setTop(refTop+this.offsetTop); }
			else if (v=="center") { this.setTop(refTop+(refHeight/2)-(height/2)+this.offsetTop); }
			else if (v=="bottom") { this.setTop(refTop+refHeight-height+this.offsetTop); }
			else if (v=="below") { this.setTop(refTop+refHeight+this.offsetTop); }
			if (h=="adjacent-left") { this.setLeft(refLeft-width+this.offsetLeft); }
			else if (h=="left") { this.setLeft(refLeft+this.offsetLeft); }
			else if (h=="center") { this.setLeft(refLeft+(refWidth/2)-(width/2)+this.offsetLeft); }
			else if (h=="right") { this.setLeft(refLeft+refWidth-width+this.offsetLeft); }
			else if (h=="adjacent-right") { this.setLeft(refLeft+refWidth+this.offsetLeft); }
		}
	}
	else if (this.top==null && this.left==null) {
		this.center();
	}
	else {
		if (this.top==null) { this.top=0; }
		if (this.left==null) { this.left=0; }
		this.div.style.top = this.top+this.offsetTop+"px";
		this.div.style.left = this.left+this.offsetLeft+"px";
	}
	if (this.constrainToScreen) {
		this.fitToScreen();
	}
};
Popup.prototype.appendToBody = function(o) {
	var body = Screen.getBody();
	if (body && body.appendChild) {
		body.appendChild(o);
	}
};
Popup.prototype.createDiv = function() {
	if (document.createElement) {
		var d = document.createElement("DIV");
		d.style.position="absolute";
		d.style.display="block";
		d.style.visibility="hidden";
		this.appendToBody(d);
		return d;
	}
	alert("ERROR: Couldn't create DIV element in Popup.prototype.createDiv()");
	return null;
};
Popup.prototype.createIframe = function() {
	if (document.createElement) {
		var i= document.createElement("IFRAME");
		i.style.position="absolute";
		i.style.display="block";
		i.style.visibility="hidden";
		i.style.background="none";
		this.appendToBody(i);
		return i;
	}
	else {
		alert("ERROR: Couldn't create IFRAME object in Popup.prototype.createIframe()");
	}
};
Popup.prototype.addIframeShim = function() {
	if (this.iframe==null) {
		this.iframe = this.createIframe();
	}
	this.iframe.className = Popup.iframeClass;
	CSS.setStyle(this.iframe,'top',this.getTop()+"px");
	CSS.setStyle(this.iframe,'left',this.getLeft()+"px");
	CSS.setStyle(this.iframe,'width',DOM.getOuterWidth(this.div) + "px");
	CSS.setStyle(this.iframe,'height',DOM.getOuterHeight(this.div) + "px");
	CSS.setStyle(this.iframe,'zIndex',Popup.minZIndex++);
	CSS.setStyle(this.iframe,'opacity',0);
	CSS.setStyle(this.iframe,'visibility','visible');
	CSS.setStyle(this.iframe,'display','block');
};
Popup.prototype.addScreen = function() {
	if (this.screen==null) {
		this.screen = this.createDiv();
		this.screen.style.top="0px";
		this.screen.style.left="0px";
		this.screen.style.backgroundColor = this.screenColor;
		this.screen.className=Popup.screenClass;;
		CSS.setStyle(this.screen,"opacity",this.screenOpacity);
		this.screen.onclick = function(e) { Event.cancelBubble(Event.resolve(e)); }
	}
	if (this.screenIframeShim==null) {
		this.screenIframeShim = this.createIframe();
		this.screenIframeShim.style.top="0px";
		this.screenIframeShim.style.left="0px";
		this.screenIframeShim.className=Popup.screenIframeClass;
		CSS.setStyle(this.screenIframeShim,"opacity",0);
	}
	this.screen.style.width = Screen.getDocumentWidth()+"px";
	this.screen.style.height = Screen.getDocumentHeight()+"px";
	this.screenIframeShim.style.width = Screen.getDocumentWidth()+"px";
	this.screenIframeShim.style.height = Screen.getDocumentHeight()+"px";
	this.screenIframeShim.style.zIndex = Popup.minZIndex++;
	this.screenIframeShim.style.visibility="visible";
	this.screenIframeShim.style.display="block";
	this.screen.style.zIndex = Popup.minZIndex++;
	this.screen.style.visibility="visible";
	this.screen.style.display="block";
};
Popup.prototype.fitToScreen = function() {
	var width = DOM.getOuterWidth(this.div);
	var height = DOM.getOuterHeight(this.div);
	var top = this.getTop();
	var left = this.getLeft();
	var clientWidth = Screen.getViewportWidth();
	var clientHeight = Screen.getViewportHeight();
	var scrollLeft = Screen.getScrollLeft();
	var scrollTop = Screen.getScrollTop();
	if (top-scrollTop+height>clientHeight) {
		top = top - ((top+height) - (scrollTop+clientHeight));
		this.div.style.top = top + "px";
	}
	if (left-scrollLeft+width>clientWidth) {
		left = left - ((left+width) - (scrollLeft+clientWidth));
		this.div.style.left = left + "px";
	}
	if (top<scrollTop) {
		this.div.style.top=scrollTop+"px";
	}
	if (left<scrollLeft) {
		this.div.style.left=scrollLeft+"px";
	}
};
Popup.prototype.center = function() {
	var left = DOM.getOuterWidth(this.div);
	var top = DOM.getOuterHeight(this.div);
	if (isNaN(left)) { left=0; }
	if (isNaN(top)) { top=0; }	
	var clientW = Screen.getViewportWidth();
	var clientH = Screen.getViewportHeight();
	if (clientW!=null && clientH!=null) {
		top = (clientH-top)/2;
		left = (clientW-left)/2;
	}
	top += Screen.getScrollTop();
	left += Screen.getScrollLeft();
	
	this.div.style.top = top+this.offsetTop+"px";
	this.div.style.left = left+this.offsetLeft+"px";
};

function getItemName(th)
{
	if(th.value=='')
	{
	th.className="blur";
	th.value="Item Name";
	}
}
function clearItemName(th)
{
	if(th.value=='Item Name')
	{
	th.value="";
	th.className="real";
	}
}
function getRestName(th)
{
	if(th.value=='')
	{
	th.className="blur";
	th.value="Restaurant Name";
	}
}
function clearRestName(th)
{
	valueIsFrom = 0;
	if(th.value=='Restaurant Name')
	{
	th.value="";
	th.className="real";
	}
	th.focus();
}
function clearPostcode(th)
{
	if(th.value=='Enter your postcode')
	{
	th.value="";
	th.className="textareaboxBig real";
	}
}
function getPostcode(th)
{
	if(th.value=='')
	{
	th.className="textareaboxBig blur";
	th.value="Enter your postcode";
	}
}

//mu241009 autosuggest code start
 function autoCompleteDB()
 {
    this.aNames=new Array();
 }
 
 autoCompleteDB.prototype.assignArray=function(aList)
 {
    this.aNames=aList;
 };
 
 autoCompleteDB.prototype.getMatches=function(str,aList,maxSize)
 {
    /* debug */ //alert(maxSize+"ok getmatches");
    var ctr=0;
//    for(var u in this.aNames)
for(var u=0;u<this.aNames.length;u++)
    {	 if(u=="jsonClass")  //mu241009
    		break;
       if(this.aNames[u].toLowerCase().indexOf(str.toLowerCase())==0) /*looking for case insensitive matches */
       {
       
          aList.push(this.aNames[u]);
          ctr++;
       }
       if(ctr==(maxSize-1)) /* counter to limit no of matches to maxSize */
          break;
    }
 };
 
 function autoComplete(aNames,oText,oDiv,maxSize)
 {
 
    this.oText=oText;
    this.oDiv=oDiv;
    this.maxSize=maxSize;
    this.cur=-1;
 
    
    /*debug here */
    //alert(oText+","+this.oDiv);
    
    this.db=new autoCompleteDB();
    this.db.assignArray(aNames);
    
    oText.onkeyup=this.keyUp;
    oText.onkeydown=this.keyDown;
    oText.autoComplete=this;
    oText.onblur=this.hideSuggest;
 }
 
 autoComplete.prototype.hideSuggest=function()
 {
    this.autoComplete.oDiv.style.visibility="hidden";
 };
 
 autoComplete.prototype.selectText=function(iStart,iEnd)
 {
    if(this.oText.createTextRange) /* For IE */
    {
       var oRange=this.oText.createTextRange();
       oRange.moveStart("character",iStart);
       oRange.moveEnd("character",iEnd-this.oText.value.length);
       oRange.select();
    }
    else if(this.oText.setSelectionRange) /* For Mozilla */
    {
       this.oText.setSelectionRange(iStart,iEnd);
    }
    this.oText.focus();
 };
 
 autoComplete.prototype.textComplete=function(sFirstMatch)
 {
    if(this.oText.createTextRange || this.oText.setSelectionRange)
    {
       var iStart=this.oText.value.length;
//mu261009       this.oText.value=sFirstMatch;  //to display corousponding text in the current text box.
       this.selectText(iStart,sFirstMatch.length);
    }
 };
 
 autoComplete.prototype.keyDown=function(oEvent)
 {
    oEvent=window.event || oEvent;
    iKeyCode=oEvent.keyCode;
 
    switch(iKeyCode)
    {
       case 38: //up arrow
          this.autoComplete.moveUp();
          break;
       case 40: //down arrow
          this.autoComplete.moveDown();
          break;
       case 13: //return key
       	  window.focus();
          break;
    }
 };
 
 autoComplete.prototype.moveDown=function()
 {
    if(this.oDiv.childNodes.length>0 && this.cur<(this.oDiv.childNodes.length-1))
    {
       ++this.cur;
       for(var i=0;i<this.oDiv.childNodes.length;i++)
       {
          if(i==this.cur)
          {
             this.oDiv.childNodes[i].className="over";
             this.oText.value=this.oDiv.childNodes[i].innerHTML;
//             this.oText.childNodes[0].value=this.oDiv.childNodes[i].innerHTML;
          }
          else
          {
             this.oDiv.childNodes[i].className="";
          }
       }
    }
 };
 
 autoComplete.prototype.moveUp=function()
 {
    if(this.oDiv.childNodes.length>0 && this.cur>0)
    {
       --this.cur;
       for(var i=0;i<this.oDiv.childNodes.length;i++)
       {
          if(i==this.cur)
          {
             this.oDiv.childNodes[i].className="over";
             this.oText.value=this.oDiv.childNodes[i].innerHTML;
//             this.oText.childNodes[0].value=this.oDiv.childNodes[i].innerHTML;
          }
          else
          {
             this.oDiv.childNodes[i].className="";
          }
       }
    }
 };
 
 autoComplete.prototype.keyUp=function(oEvent)
 {
    oEvent=oEvent || window.event;
    var iKeyCode=oEvent.keyCode;
    if(iKeyCode==8 || iKeyCode==46)
    {
       this.autoComplete.onTextChange(false); /* without autocomplete */
    }
 else if (iKeyCode < 32 || (iKeyCode >= 33 && iKeyCode <= 46) || (iKeyCode >= 112 && iKeyCode <= 123))
    {
       //ignore
    }
    else
    {
       this.autoComplete.onTextChange(true); /* with autocomplete */
    }
 };
 
 autoComplete.prototype.positionSuggest=function() /* to calculate the appropriate poistion of the dropdown */
 {
    var oNode=this.oText;
    var x=0,y=oNode.offsetHeight;
 
    while(oNode.offsetParent && oNode.offsetParent.tagName.toUpperCase() != 'BODY')
    {
       x+=oNode.offsetLeft;
       y+=oNode.offsetTop;
       oNode=oNode.offsetParent;
    }
 
    x+=oNode.offsetLeft;
    y+=oNode.offsetTop;
 
    this.oDiv.style.top=y+"px";
    this.oDiv.style.left=x+"px";
 }
 
 autoComplete.prototype.onTextChange=function(bTextComplete)
 {
    var txt=this.oText.value;
//    var txt=this.oText.childNodes[0].value;
    var oThis=this;
    this.cur=-1;
    
    if(txt.length>0)
    {
       while(this.oDiv.hasChildNodes())
          this.oDiv.removeChild(this.oDiv.firstChild);
       
       var aStr=new Array();
       this.db.getMatches(txt,aStr,this.maxSize);
       if(!aStr.length) {this.hideSuggest ;return}
       if(bTextComplete) this.textComplete(aStr[0]);
       this.positionSuggest();
       
//       for(i in aStr)
		for(var i=0;i<aStr.length;i++)
       {
       	  if(i=="jsonClass")  //mu241009
    		  break;
          var oNew=document.createElement('div');
          this.oDiv.appendChild(oNew);
          oNew.onmouseover=
          oNew.onmouseout=
          oNew.onmousedown=function(oEvent)
          {
             oEvent=window.event || oEvent;
             oSrcDiv=oEvent.target || oEvent.srcElement;
 
             //debug :window.status=oEvent.type;
             if(oEvent.type=="mousedown")
             {
                oThis.oText.value=this.innerHTML;
             }
             else if(oEvent.type=="mouseover")
             {
                this.className="over";
             }
             else if(oEvent.type=="mouseout")
             {
                this.className="";
             }
             else
             {
                this.oText.focus();
             }
          };
          oNew.innerHTML=aStr[i];
       }
       
       this.oDiv.style.visibility="visible";
    }
    else
    {
       this.oDiv.innerHTML="";
       this.oDiv.style.visibility="hidden";
    }
 };
 
 function createAutoComplete(val)
 {
 var bNames = val.split(",");	
 var stval = "";
    bNames.size();
    for(m=0 ;m<bNames.size();m++)
    {
    	bNames[m] = modifying(bNames[m]);
    	bNames[m] = modifying(bNames[m]);
    	if(stval=="")
    	{
    		stval=bNames[m];
    	}
    	else
    	{
    		stval=stval+','+bNames[m];
    	}
    }
 	
 var aNames = stval.split(",");
/*    ["Murali",
    "Aaron", "Abbott", "Abdallah", "Abdul", "Abdullah", "Abe", "Abel", "Abiba", "Abie", "Abner", "Abraham", "Abram", "Absalom", "Abu", "Ace", "Ackeem", "Adair", "Adalberto", "Adam", "Adan", "Addison", "Ade", "Adem", "Aderes", "Adie", "Adiel", "Adita", "Adlai", "Adolf", "Adolfo", "Adolph", "Adonia", "Adonis", "Adrian", "Adrien", "Agustin", "Ahmad", "Ahmed", "Aidan", "Aiden", "Airen", "Aislinn", "Aj", "Ajani", "Ajay", "Akeem", "Akil", "Akuji", "Al", "Alain", "Alake", "Alan", "Alaric", "Alastair", "Alban", "Albany", "Albert", "Alberto", "Albeto", "Albin", "Albrecht", "Aldan", "Alden", "Aldo", "Aldon", "Aldora", "Aldous", "Alec", "Alejandro", "Alek", "Aleksander", "Alem", "Alen", "Alev", "Alex", "Alexander", "Alexei", "Alf", "Alfonso", "Alfonzo", "Alfred", "Alfredo", "Alijah", "Alisdair", "Allan", "Allen", "Alonso", "Alonzo", "Aloysius", "Alphonse", "Alphonso", "Alton", "Alva", "Alvaro", "Alvin", "Amadeo", "Amadeus", "Amado", "Amador", "Amalia", "Amalie", "Aman", "Amana", "Amandla", "Amari", "Ambrose", "America", "Americo", "Amerigo", "Amir", "Amiri", "Ammon", "Amon", "Amos", "Anana", "Ananda", "Anando", "Anaru", "Anastasios", "Anatole", "Anatoliy", "Ande", "Anderson", "Andre", "Andreas", "Andrej", "Andres", "Andrew", "Andy", "Anemone", "Anfernee", "Angelo", "Angus", "Anil", "Anin", "Anlon", "Anselm", "Anselmo", "Anson", "Antal", "Anthony", "Anton", "Antonio", "Anwar", "Aoko", "Apollo", "Aquil", "Aquila", "Aquilla", "Ara", "Aram", "Aramis", "Archer", "Archibald", "Archie", "Archy", "Arden", "Aric", "Aries", "Aristotelis", "Aristotle", "Ariza", "Arlan", "Arlen", "Arlo", "Arman", "Armand", "Armande", "Armando", "Armen", "Armin", "Armon", "Armondo", "Arnaud", "Arne", "Arnie", "Arnold", "Aron", "Arran", "Arron", "Art", "Artemis", "Arthur", "Artie", "Arty", "Arva", "Arvid", "Asa", "Asabi", "Asalie", "Asher", "Ashton", "Asis", "Asli", "Athalia", "Athanasius", "Athelstan", "Athelston", "Athol", "Atwell", "August", "Augustin", "Augustine", "Augustus", "Austin", "Avary", "Averil", "Averill", "Avery", "Avi", "Avongara", "Avram", "Ayame", "Ayoka", "Azelin", "Azize", "Azuka", "Azuriah",
     "Bahari", "Baird", "Bairn", "Baldwin", "Ballard", "Balthazar", "Banji", "Baptist", "Barak", "Barke", "Barnabas", "Barnabus", "Barnaby", "Barnard", "Barnett", "Barney", "Barny", "Baron", "Barrett", "Barry", "Bart", "Barth", "Bartholomew", "Barton", "Baruch", "Bary", "Bash", "Basil", "Bast", "Bastian", "Baxter", "Bayard", "Beat", "Beaty", "Beau", "Beauregard", "Beck", "Belay", "Belio", "Bell", "Bellamy", "Ben", "Benedict", "Benen", "Benito", "Benjamin", "Benjy", "Bennet", "Bennett", "Bennie", "Benny", "Benson", "Bentley", "Benton", "Berger", "Berke", "Berman", "Bern", "Bernard", "Berne", "Bernie", "Berny", "Bert", "Bertram", "Bertrand", "Bevan", "Beven", "Bevin", "Beyla", "Bidelia", "Bijean", "Bikita", "Bilen", "Bill", "Billy", "Bin", "Bina", "Bing", "Birch", "Bishop", "Biton", "Bjorn", "Blaine", "Blair", "Blaise", "Blake", "Blane", "Bliss", "Blythe", "Bo", "Bob", "Bobby", "Boden", "Bonaventure", "Bond", "Boniface", "Bonifacio", "Bono", "Boone", "Boris", "Bowen", "Bowie", "Brad", "Braden", "Bradford", "Bradley", "Bradshaw", "Brady", "Braeden", "Braedon", "Braima", "Braithe", "Bran", "Brand", "Branden", "Brandon", "Brant", "Braxton", "Brayden", "Brazil", "Brend", "Brendan", "Brendon", "Brendyn", "Brennan", "Brennon", "Brent", "Brenton", "Bret", "Brett", "Brewster", "Brian", "Briar", "Brice", "Brick", "Brighton", "Brilane", "Britt", "Britton", "Brock", "Broderick", "Brodie", "Brody", "Brogan", "Brone", "Bronson", "Brook", "Brooks", "Bruce", "Bruno", "Bryan", "Bryant", "Bryce", "Bryceton", "Bryn", "Brynn", "Bryon", "Bryson", "Bubba", "Buck", "Bud", "Buddie", "Buddy", "Buford", "Burgess", "Burke", "Burt", "Burton", "Buster", "Butch", "Butcher", "Butchie", "Byrne", "Byron",
    "Caddall", "Cade", "Cadell", "Caden", "Cael", "Caelan", "Caesar", "Cahal", "Cain", "Caine", "Cal", "Caleb", "Callum", "Calum", "Calvin", "Cam", "Camden", "Cameron", "Camlin", "Campbell", "Camron", "Carl", "Carleton", "Carlisle", "Carlo", "Carlos", "Carlton", "Carlyle", "Carmac", "Carmelo", "Carmine", "Carr", "Carrick", "Carson", "Carsten", "Carsyn", "Carter", "Carver", "Cary", "Cash", "Cashley", "Casimir", "Caspar", "Casper", "Caspian", "Cassius", "Cathal", "Cavan", "Cecil", "Cedric", "Cesar", "Chad", "Chance", "Chancellor", "Chandler", "Channing", "Chante", "Chantry", "Charl", "Charles", "Charli", "Charlie", "Charls", "Charlton", "Chars", "Chas", "Chase", "Chauncey", "Chaz", "Cheche", "Chen", "Chesley", "Chester", "Chet", "Cheyne", "Chick", "Chico", "Chill", "Chilton", "Chimelu", "Chip", "Chipo", "Chris", "Chrissy", "Christel", "Christof", "Christoph", "Christopher", "Chuck", "Cian", "Cicero", "Clancey", "Clancy", "Clarence", "Clark", "Clarke", "Claude", "Claudio", "Claus", "Clay", "Clayland", "Clayton", "Cleavant", "Cleave", "Cleavon", "Clem", "Clemens", "Clement", "Clemente", "Cliff", "Clifford", "Clifton", "Clint", "Clinton", "Clive", "Clove", "Clover", "Clovis", "Clyde", "Cobi", "Cocheta", "Cody", "Colbert", "Cole", "Coleman", "Coley", "Colin", "Collin", "Colm", "Colman", "Colt", "Colte", "Coltin", "Colton", "Columbia", "Columbine", "Columbus", "Comfort", "Conal", "Conall", "Conan", "Conell", "Conlan", "Conner", "Connor", "Conor", "Conrad", "Constantine", "Content", "Conway", "Cooper", "Corbin", "Cord", "Cordeiro", "Cordel", "Cordell", "Cordero", "Corey", "Corliss", "Cornelia", "Cornelis", "Cornelius", "Cornell", "Cort", "Corwin", "Cory", "Cosima", "Cosmo", "Coty", "Coy", "Coye", "Coyle", "Craig", "Creighton", "Crevan", "Criostoir", "Cristian", "Cristophe", "Crockett", "Cullen", "Curry", "Curt", "Curtis", "Cy", "Cyd", "Cyril", "Cyrus",
       "Dafydd", "Dagan", "Dahlia", "Dain", "Dakarai", "Dakoda", "Dakota", "Dallin", "Dalton", "Dalziel", "Damario", "Damarius", "Damian", "Damien", "Damion", "Damon", "Dan", "Dane", "Daniel", "Danil", "Danilo", "Danny", "Dante", "Danton", "Daray", "Darby", "Darcey", "Darcie", "Darcy", "Dard", "Daren", "Dareo", "Darian", "Darien", "Darin", "Dario", "Darious", "Darius", "Darnell", "Darrell", "Darren", "Darrin", "Darrius", "Darron", "Darryl", "Darshan", "Daryl", "Daryn", "Dasan", "Dashiell", "Dathan", "Davaid", "Davan", "Dave", "David", "Davin", "Davis", "Davu", "Dawson", "Dax", "Dayton", "Deacon", "Dean", "Dearl", "Declan", "Dedric", "Dedrick", "Del", "Delaney", "Delano", "Delbert", "Delvan", "Delvin", "Dembe", "Demetri", "Demetrius", "Demian", "Demitrius", "Dempsey", "Denis", "Dennis", "Denny", "Denver", "Denzel", "Deo", "Derek", "Derex", "Dermot", "Derora", "Derreck", "Derrell", "Derrick", "Des", "Desdemona", "Desmond", "Devaki", "Devan", "Deven", "Devin", "Devlan", "Devlin", "Devon", "Dewey", "Dewitt", "Dexter", "Diallo", "Diarmuid", "Diata", "Dick", "Dickson", "Diederick", "Diego", "Dieter", "Dillan", "Dillian", "Dillon", "Dimitri", "Dino", "Dion", "Dionysius", "Dionysus", "Dirc", "Dirk", "Dixon", "Dmitri", "Dmyphnah", "Doane", "Doctor", "Dolan", "Dolin", "Dolph", "Dom", "Domenic", "Domenica", "Dominic", "Dominick", "Dominy", "Don", "Donal", "Donald", "Donard", "Donato", "Donnell", "Donny", "Donovan", "Dontae", "Dorcey", "Dorset", "Dorsey", "Doug", "Dougal", "Douglas", "Douglass", "Doyle", "Doyt", "Drake", "Drew", "Dru", "Duane", "Dudley", "Duena", "Duff", "Duffie", "Dugan", "Duka", "Duke", "Dumi", "Duncan", "Dunixi", "Dunn", "Dunne", "Dustan", "Dustin", "Duston", "Dusty", "Dwayne", "Dwight", "Dylan", "Dylon", "Dyre",
       "Eadoin", "Eamon", "Ean", "Earl", "Earle", "Earnest", "Eastin", "Easton", "Eavan", "Eban", "Eben", "Ebenezer", "Eberhard", "Ed", "Eddie", "Eddy", "Edel", "Edgar", "Edison", "Edmond", "Edmund", "Edric", "Eduardo", "Edward", "Edwardo", "Edwin", "Efraim", "Efrat", "Efrem", "Efren", "Egan", "Egbert", "Egon", "Egor", "Eitan", "Elbert", "Elden", "Eldon", "Eldred", "Eleazar", "Elecio", "Elgin", "Eli", "Elia", "Eliab", "Elias", "Elijah", "Eliot", "Elisha", "Eljah", "Elke", "Ellas", "Elliot", "Elliott", "Ellis", "Ellsworth", "Elmer", "Elmo", "Elton", "Elu", "Elva", "Elvan", "Elvin", "Elvis", "Elwin", "Elwood", "Ely", "Emanuel", "Emanuele", "Emeline", "Emene", "Emerson", "Emilio", "Emmanuel", "Emmet", "Emmett", "Emry", "Enid", "Enos", "Enrico", "Enrique", "Enzo", "Eoin", "Eolande", "Ephraim", "Er", "Erasmus", "Eri", "Eric", "Erick", "Erik", "Erland", "Erme", "Ermin", "Ernest", "Ernie", "Erno", "Eros", "Errol", "Erv", "Ervin", "Ervine", "Erving", "Erwin", "Eryk", "Esben", "Eshe", "Esmond", "Espiridion", "Etan", "Ethan", "Ethelwulf", "Etienne", "Eugen", "Eugene", "Eulalie", "Evan", "Evander", "Everett", "Evert", "Ewan", "Ezekiel", "Ezra",
    "Fabian", "Fabio", "Fabiola", "Fabunni", "Fairfax", "Fala", "Farica", "Faris", "Farrell", "Faustine", "Fedor", "Felipe", "Felix", "Fell", "Ferdinand", "Fergal", "Fergie", "Fergus", "Ferguson", "Fernando", "Ferris", "Ferrol", "Fico", "Fidel", "Filippo", "Fineen", "Finley", "Finn", "Finna", "Fionan", "Fisk", "Fisseha", "Flan", "Flannery", "Flavian", "Fletcher", "Floyd", "Flynn", "Folkert", "Foluke", "Forbes", "Ford", "Fordon", "Forest", "Forrest", "Forrester", "Forster", "Foster", "Fox", "Foy", "Fraley", "Francisco", "Franck", "Franco", "Frank", "Franklin", "Franz", "Frasier", "Fred", "Freddie", "Freddy", "Frederica", "Frederick", "Frederik", "Fredrick", "Freed", "Freeman", "Fremont", "Fritz", "Fronde", "Fruma", "Frye", "Fulbright", "Fuller", "Fynn",
       "Gabriel", "Gad", "Gaddy", "Gadi", "Gael", "Gafna", "Gage", "Gainell", "Gaius", "Galbraith", "Gale", "Galen", "Galin", "Gallagher", "Galvin", "Gamada", "Gamal", "Gamaliel", "Ganit", "Garcia", "Gardner", "Gareth", "Garett", "Garfield", "Garland", "Garn", "Garrin", "Garrison", "Garron", "Garry", "Garson", "Garth", "Gary", "Gates", "Gautier", "Gavin", "Gavivi", "Gaylan", "Gaylord", "Gaynell", "Gazali", "Gazit", "Gearoid", "Geary", "Gelsey", "Gene", "Genet", "Gent", "Gentry", "Geoff", "Geoffrey", "George", "Gerald", "Geraldo", "Gerard", "Germaine", "Gerry", "Gian", "Gibson", "Gideon", "Gifford", "Gil", "Gilbe", "Gilbert", "Giles", "Gilles", "Gillespie", "Gino", "Giolla", "Giovanni", "Giuseppe", "Glen", "Glenn", "Glennon", "Godana", "Godfrey", "Gomer", "Gordon", "Gordy", "Grady", "Graeme", "Graham", "Gram", "Grant", "Granville", "Grayson", "Greer", "Greg", "Gregg", "Gregory", "Greyson", "Grif", "Griffin", "Grig", "Grover", "Gualtier", "Guban", "Guillermo", "Gunnar", "Gunther", "Gure", "Gustav", "Gustave", "Gustavo", "Gustov", "Guy", "Guyon",
       "Haben", "Habib", "Hada", "Hadar", "Hagan", "Haggan", "Haile", "Haines", "Hajari", "Hakan", "Hakeem", "Hale", "Hali", "Halil", "Halona", "Ham", "Hamal", "Hamilton", "Hamish", "Hamlet", "Hank", "Hans", "Hansen", "Hanson", "Hanzila", "Haracha", "Hardy", "Harlan", "Harlen", "Harmon", "Harold", "Harper", "Harris", "Harrison", "Harry", "Hart", "Haruni", "Harvey", "Hassan", "Hastin", "Haven", "Hawa", "Hayden", "Hayes", "Hazen", "Hazinac", "Heath", "Hector", "Hedwig", "Heiko", "Heinz", "Helge", "Heller", "Hendrick", "Hendrik", "Henri", "Henrik", "Henry", "Herb", "Herbert", "Heremon", "Hermann", "Herschel", "Hezekiah", "Hiba", "Hibah", "Hidalgo", "Hidi", "Hiero", "Hilton", "Hiram", "Holden", "Hollace", "Hollis", "Holt", "Homer", "Horace", "Horatio", "Horus", "Hosea", "Houston", "Howard", "Howe", "Howell", "Howie", "Hoyt", "Hubert", "Huey", "Hugh", "Hugo", "Humphrey", "Hunter", "Huso", "Hussein", "Huston", "Hy", "Hyacinth", "Hyman",
    "Iain", "Ian", "Ife", "Ige", "Iggi", "Iggy", "Ignatius", "Igor", "Ihab", "Ike", "Ilit", "Ilori", "Iman", "Imogene", "Imran", "Inari", "Inek", "Ineke", "Ingram", "Ion", "Ira", "Irma", "Irvin", "Irving", "Isaac", "Isaiah", "Isak", "Israel", "Issak", "Issay", "Ivan", "Ivo", "Ivrit", "Izzy",
    "Jabari", "Jabilo", "Jack", "Jackson", "Jaco", "Jacob", "Jacques", "Jadon", "Jadyn", "Jaegar", "Jaeger", "Jael", "Jaelin", "Jafaru", "Jagger", "Jahve", "Jair", "Jairo", "Jake", "Jakson", "Jalen", "Jamal", "James", "Jamese", "Jameson", "Jamie", "Jamil", "Jamison", "Janin", "Jansen", "Janson", "Janus", "Jarah", "Jared", "Jariath", "Jarko", "Jaron", "Jarred", "Jarret", "Jarrett", "Jarrod", "Jarvis", "Jasen", "Jason", "Jasper", "Javier", "Jay", "Jaydon", "Jayson", "Jazz", "Jeb", "Jeff", "Jefferson", "Jeffery", "Jeffrey", "Jengo", "Jensen", "Jerah", "Jered", "Jeremiah", "Jeremie", "Jeremy", "Jericho", "Jerico", "Jerimiah", "Jeris", "Jermaine", "Jerod", "Jerold", "Jerome", "Jerrell", "Jerrick", "Jerris", "Jerry", "Jeshua", "Jesiah", "Jesse", "Jesus", "Jethro", "Jim", "Jimbo", "Jimmie", "Jimmy", "Jira", "Jiri", "Jirka", "Joachim", "Joachin", "Joaquim", "Job", "Jobe", "Jobey", "Joby", "Jock", "Joe", "Joel", "Joey", "Johahn", "Johan", "Johanne", "Johannes", "Johaunn", "John", "Johnathan", "Johnny", "Jon", "Jonah", "Jonathan", "Jonny", "Joost", "Jordan", "Jordyn", "Jorge", "Jorie", "Jose", "Josef", "Joseph", "Josh", "Joshua", "Josiah", "Joss", "Jovan", "Juan", "Jud", "Judah", "Judas", "Judd", "Jude", "Judson", "Jule", "Jules", "Julian", "Julio", "Julius", "Jumoke", "Junior", "Jur", "Jure", "Juri", "Jurian", "Jurrian", "Justin", "Justina", "Justise", "Justus", "Jörg",
    "Kabibe", "Kabili", "Kacela", "Kachina", "Kaden", "Kadin", "Kaellen", "Kahdijah", "Kaikura", "Kaiser", "Kale", "Kaleb", "Kamal", "Kamali", "Kambill", "Kame", "Kande", "Kareem", "Karel", "Karik", "Karim", "Karimah", "Karl", "Karna", "Karson", "Kaseko", "Kasi", "Kasim", "Kaspar", "Kassidi", "Kato", "Kaula", "Kayson", "Kaz", "Kazi", "Keagan", "Keaghan", "Keaira", "Keanu", "Keary", "Keaton", "Keb", "Kedem", "Kedrick", "Keefe", "Keegan", "Keeghan", "Keenan", "Keene", "Kees", "Keir", "Keith", "Kelby", "Kelda", "Keleigh", "Kelila", "Kellan", "Kellea", "Kellee", "Kellen", "Kellsie", "Kelton", "Keltyn", "Kelvin", "Ken", "Kendal", "Kendall", "Kendi", "Kendyl", "Kendyll", "Kennan", "Kenneth", "Kenny", "Kent", "Kenton", "Kenyi", "Kenyon", "Kenzie", "Kerel", "Kermit", "Kerr", "Kerry", "Kester", "Ketara", "Keven", "Kevin", "Kevis", "Khadija", "Khadijah", "Khaled", "Khalil", "Khalíl", "Kibbe", "Kibbey", "Kiel", "Kieran", "Kiernan", "Kiki", "Kiley", "Killian", "Kimball", "Kimo", "Kin", "Kincaid", "Kinfe", "King", "Kingsley", "Kinsey", "Kione", "Kip", "Kipling", "Kipp", "Kirabo", "Kirby", "Kiril", "Kirk", "Kiros", "Kitoko", "Kitra", "Kiyoshi", "Klaus", "Kobe", "Kobi", "Kobie", "Koby", "Koda", "Kody", "Koen", "Kolby", "Kolin", "Kolton", "Konrad", "Korbin", "Korey", "Kota", "Krishna", "Kristofer", "Kristoffer", "Kristopher", "Kuron", "Kurt", "Kwanita", "Kylan", "Kyle", "Kyler", "Kyna", "Kyrene",
    "Lachlan", "Lael", "Laird", "Lajuan", "Lale", "Lamar", "Lamont", "Lance", "Lancelot", "Landers", "Landis", "Landry", "Lane", "Lang", "Langdon", "Langer", "Langston", "Lankston", "Laron", "Larry", "Lars", "Larvall", "Lasca", "Laszlo", "Latham", "Latika", "Latimer", "Laurence", "Laurens", "Laval", "Lavan", "Lave", "Lavey", "Lavi", "Lavon", "Lavonn", "Lawrence", "Lazar", "Lazarus", "Leander", "Leavitt", "Lech", "Leda", "Ledell", "Leeto", "Lehana", "Leif", "Leimomi", "Leith", "Leland", "Leo", "Leon", "Leonard", "Leonzal", "Leopold", "Lerato", "Leroy", "Les", "Lester", "Levant", "Leverett", "Levi", "Levia", "Levon", "Lewis", "Lewon", "Lex", "Liam", "Liliha", "Lilo", "Linc", "Lincoln", "Lindon", "Lindy", "Link", "Linton", "Linus", "Lionel", "Lirit", "Lisimba", "Lisle", "Llewellyn", "Lloyd", "Locke", "Logan", "Lohn", "Lolonyo", "Lolovivi", "Lon", "Lona", "Lonato", "London", "Lonnie", "Lorcan", "Loren", "Lorenzo", "Lorimer", "Loring", "Lorne", "Lou", "Loughlin", "Louie", "Louis", "Lowell", "Luc", "Lucas", "Luce", "Lucian", "Lucius", "Lucus", "Ludlow", "Ludwig", "Luigi", "Luis", "Lukas", "Luke", "Lundy", "Luong", "Luther", "Lyde", "Lyle", "Lync", "Lynch", "Lynde", "Lyndon", "Lynne", "Lynton", "Lyre", "Lyris", "Lysander",
     "Maarten", "Maat", "Mac", "Macha", "Mack", "Mackenzie", "Macklin", "Macon", "Maddox", "Magee", "Magnus", "Maha", "Mahari", "Mahdi", "Mahyar", "Maitland", "Major", "Makalo", "Makenna", "Malachi", "Malachy", "Malaika", "Malcolm", "Malik", "Malomo", "Malone", "Mandel", "Manica", "Manning", "Manny", "Manolatos", "Mansa", "Manuel", "Marc", "Marcel", "Marcello", "Marcellus", "Marco", "Marcos", "Marcus", "Mariatu", "Marin", "Marino", "Mario", "Mark", "Marka", "Marko", "Markus", "Marley", "Marlow", "Maro", "Marques", "Marquis", "Marshall", "Martel", "Martell", "Martin", "Marty", "Marv", "Marvene", "Marvin", "Masada", "Maselyn", "Maslin", "Mason", "Mateo", "Mathieu", "Matt", "Matteo", "Matthew", "Matthias", "Mattox", "Mauli", "Maulo", "Maurice", "Maurilio", "Maverick", "Max", "Maxim", "Maxime", "Maximilian", "Maximillian", "Maximillion", "Maxwell", "Mayes", "Maynard", "Mckale", "Mckenzie", "Mea", "Medard", "Meelao", "Meged", "Meier", "Meir", "Melchior", "Melora", "Melva", "Melvin", "Melvyn", "Mendel", "Menora", "Mercer", "Mercury", "Meria", "Merle", "Merlin", "Merrill", "Merv", "Mervin", "Mervyn", "Meryl", "Meryle", "Messina", "Meyer", "Micah", "Michael", "Micheal", "Michel", "Michiel", "Mick", "Mickey", "Miguel", "Mika", "Mikaili", "Mike", "Mikel", "Mikhail", "Milandu", "Miles", "Miller", "Mills", "Milo", "Milson", "Milt", "Milton", "Mircea", "Miroslav", "Mirza", "Misae", "Misha", "Mitch", "Mitchel", "Mitchell", "Miyanda", "Mizell", "Mohamad", "Mohammed", "Moke", "Monahan", "Monroe", "Montague", "Montana", "Monte", "Montego", "Montgomery", "Monty", "Morathi", "Mordecai", "More", "Morey", "Morgen", "Morley", "Morrie", "Morris", "Morrison", "Morse", "Mort", "Mortimer", "Morton", "Morty", "Moses", "Moshe", "Moss", "Moya", "Muhammad", "Muhammed", "Muna", "Murphy", "Murray", "Musoke", "Mutia", "Mycroft", "Mykal", "Myles", "Myron",
       "Naal", "Nabil", "Nadav", "Nadiv", "Nahme", "Naiser", "Nakima", "Nalo", "Namir", "Napoleon", "Narcissus", "Nardo", "Nash", "Nasha", "Nasser", "Nat", "Nate", "Nathan", "Nathaniel", "Natine", "Natividad", "Natori", "Navarro", "Naveen", "Nayer", "Neal", "Ned", "Nedim", "Nedra", "Neetee", "Nehemiah", "Neil", "Nelson", "Nen", "Neriah", "Nerita", "Neriya", "Nero", "Nesbit", "Netanya", "Nevan", "Neville", "Nevin", "Newman", "Niall", "Niambi", "Nic", "Nicandro", "Niccolo", "Nicholai", "Nicholas", "Nick", "Nickel", "Nicklas", "Nickolas", "Nico", "Nicola", "Nicolas", "Niel", "Niels", "Nigel", "Nikkolas", "Nino", "Nira", "Nitara", "Noah", "Nodin", "Noelani", "Nolan", "Noland", "Noma", "Norbert", "Noriel", "Norm", "Norman", "Norris", "Norton", "Nowles", "Noya", "Nuri", "Nyako", "Nyeki", "Nyle", "Nyx",
    "Oakes", "Oakley", "Obadiah", "Obbie", "Obed", "Obediah", "Obedience", "Oberon", "Obert", "Octavio", "Odell", "Odin", "Odysseus", "Ofer", "Ogden", "Ohad", "Ohio", "Okal", "Okapi", "Oke", "Olaf", "Oleg", "Oleh", "Olen", "Olive", "Oliver", "Olivier", "Ollie", "Omar", "Onan", "Oneal", "Oneil", "Oral", "Oran", "Orane", "Orde", "Oren", "Oria", "Orien", "Oringo", "Orion", "Orlando", "Orma", "Ormand", "Orrick", "Orrin", "Orris", "Orsen", "Orsin", "Orson", "Orval", "Orville", "Osaze", "Osborn", "Osborne", "Oscar", "Osgood", "Osias", "Oskar", "Osma", "Osmaan", "Osman", "Osmond", "Osvaldo", "Oswald", "Othello", "Othneil", "Otis", "Otomo", "Otoneil", "Otto", "Ouray", "Overton", "Ovid", "Owen", "Oz", "Ozzie",
    "Packard", "Paco", "Padraic", "Paley", "Palti", "Pancho", "Panfila", "Paolo", "Paris", "Parker", "Parkin", "Parlan", "Parley", "Parrish", "Parry", "Parson", "Pascal", "Pascale", "Pascha", "Pasi", "Patrick", "Patton", "Paul", "Pauline", "Paulo", "Paulos", "Pax", "Paxton", "Payton", "Peale", "Pedro", "Pelham", "Pembroke", "Penn", "Pepe", "Percival", "Percy", "Peregrine", "Perrin", "Perry", "Peta", "Pete", "Peter", "Petrus", "Peyton", "Phelan", "Phemia", "Phiala", "Phil", "Phila", "Philip", "Phillip", "Phoenix", "Pierce", "Pierre", "Pieter", "Pirro", "Placido", "Platt", "Ponce", "Porter", "Potter", "Prakash", "Prentice", "Prescott", "Preston", "Price", "Primo", "Primoz", "Prince", "Princeton",
    "Quentin", "Quenton", "Quillan", "Quimby", "Quincey", "Quincy", "Quinlan", "Quinn", "Quinta", "Quintin",
    "Rach", "Rafe", "Raffaello", "Rafi", "Raimi", "Raleigh", "Ralph", "Ramesh", "Ramiro", "Ramon", "Ramsay", "Ramses", "Ramsey", "Ramzi", "Randal", "Randall", "Randin", "Randle", "Randolph", "Randy", "Ranit", "Ransford", "Ransom", "Raphael", "Rashad", "Rasheed", "Rashid", "Rashida", "Raul", "Ravi", "Rawlin", "Rawlins", "Ray", "Rayce", "Raymond", "Raymonde", "Raynon", "Read", "Reagan", "Red", "Redford", "Reece", "Reed", "Reese", "Reeves", "Reginald", "Reid", "Reilly", "Reily", "Reinhard", "Reinhart", "Remedy", "Remington", "Remond", "Remy", "Renato", "Rennie", "Renny", "Reno", "Reth", "Reuben", "Revelin", "Rex", "Rey", "Reynard", "Reynold", "Reynoldo", "Rhett", "Rhodes", "Rhys", "Ric", "Ricardo", "Rice", "Rich", "Richard", "Ricjunette", "Rick", "Rickey", "Ricky", "Rico", "Rider", "Riely", "Rigoberto", "Riko", "Rileigh", "Ringo", "Riordan", "Rob", "Robert", "Rocco", "Rock", "Rockford", "Rockne", "Rocky", "Rod", "Rodd", "Roddy", "Roderick", "Rodger", "Rodney", "Rodrigo", "Rodrigue", "Rodrigues", "Rodriguez", "Rogan", "Roger", "Rohan", "Roland", "Rolando", "Rolf", "Rolin", "Rollin", "Rollins", "Rollo", "Roma", "Roman", "Romeo", "Romulo", "Romulus", "Ron", "Ronald", "Ronan", "Ronat", "Rondel", "Rondell", "Roni", "Ronli", "Ronnie", "Ronny", "Roosevelt", "Rorey", "Rori", "Rory", "Ross", "Rowan", "Rowdy", "Roy", "Royce", "Ruairidh", "Ruarai", "Ruben", "Rudolf", "Rudolph", "Rudra", "Rudy", "Rueben", "Rupert", "Russ", "Russom", "Rusti", "Rusty", "Ryan", "Ryker", "Rylan", "Ryley", "Rylie", "Ryne",
     "Sabino", "Sacha", "Saddam", "Salal", "Salome", "Salvador", "Salvator", "Sam", "Sameer", "Samir", "Sampson", "Samson", "Samuel", "Sandro", "Sanford", "Santana", "Santiago", "Saul", "Sawyer", "Schafer", "Schuylar", "Schuyler", "Scott", "Seamus", "Sean", "Sebastian", "Selwyn", "Sepp", "Serge", "Sergei", "Sergio", "Seth", "Sethe", "Severa", "Severas", "Shadi", "Shadoe", "Shadow", "Shady", "Shaeffer", "Shakil", "Shaman", "Shane", "Shaquille", "Shaw", "Shawn", "Shelby", "Sheldon", "Shelton", "Sheridan", "Sherill", "Sherman", "Sherril", "Sherwin", "Shilo", "Shiloh", "Siddharta", "Sidney", "Siegfried", "Sigfred", "Sigmund", "Silvano", "Silvester", "Silvio", "Simeon", "Simon", "Skeet", "Skeeter", "Skipper", "Skylar", "Skyler", "Slade", "Sloan", "Sloane", "Sly", "Socrates", "Sol", "Solomon", "Solon", "Sonny", "Speedy", "Spencer", "Spiridion", "Stan", "Stanford", "Stanislaw", "Stanley", "Stanton", "Stavros", "Steel", "Steele", "Stefan", "Stefano", "Stephen", "Sterling", "Sterlington", "Steve", "Steven", "Stewart", "Stiles", "Stone", "Stonewall", "Storm", "Stuart", "Styles", "Sullivan", "Sumner", "Suraj", "Sutton", "Sven", "Syrus",
    "Tad", "Tai", "Takeya", "Talbot", "Tallulah", "Talon", "Tamid", "Tamzen", "Tanner", "Tarance", "Tarek", "Tarrance", "Tavis", "Tavish", "Taylor", "Taz", "Ted", "Teman", "Temani", "Tempest", "Temple", "Terence", "Terrell", "Terrence", "Tevye", "Thaddeus", "Than", "Thaniel", "Thayne", "Theo", "Theobald", "Theodore", "Theodoric", "Theophilus", "Theron", "Thom", "Thomas", "Thomson", "Thor", "Thorburn", "Thorin", "Thorstan", "Thorsten", "Thorston", "Thurston", "Tiago", "Tibor", "Tierry", "Tiger", "Tim", "Timeus", "Timon", "Timothy", "Tito", "Titus", "Tivoli", "Toal", "Tobias", "Toby", "Todd", "Tom", "Tommy", "Tony", "Tor", "Torin", "Torleif", "Torsten", "Trace", "Tranter", "Travis", "Trayc", "Tre", "Trefor", "Tremaine", "Tremayne", "Trent", "Trenton", "Trever", "Trevis", "Trevor", "Trey", "Trinidad", "Tristan", "Tristen", "Tristram", "Troy", "Truman", "Tuan", "Tucker", "Tulio", "Tully", "Turner", "Twain", "Ty", "Tye", "Tyler", "Tylor", "Tym", "Tyree", "Tyrel", "Tyrell", "Tyrese", "Tyrone", "Tysen", "Tyson",
    "Ugo", "Uilliam", "Uland", "Ulandus", "Ulf", "Ulises", "Ulliem", "Ulric", "Ulrich", "Ultan", "Ulysses", "Umberto", "Uri", "Uriah", "Uriel", "Urien", "Ushma", "Uthman",
    "Valdemar", "Valente", "Valentine", "Vallis", "Van", "Vance", "Vander", "Vandyke", "Vani", "Vasilios", "Vasilis", "Vaughan", "Vaughn", "Vern", "Vernon", "Victor", "Victori", "Vilmar", "Vinal", "Vincent", "Vinson", "Virgil", "Virgilio", "Vivek", "Vladilen", "Vladimir", "Vladislav", "Volker", "Volodymyr", "Vulcan",
    "Wade", "Waldo", "Walker", "Wallace", "Wally", "Walter", "Walton", "Waltraud", "Wang", "Warren", "Washington", "Wayman", "Waymon", "Waymond", "Wayne", "Wendell", "Werner", "Wes", "Wesley", "Westin", "Westney", "Weston", "Whitfield", "Wil", "Wilbur", "Wiley", "Wilfred", "Wilfrid", "Wilfried", "Wilhelm", "Wilhelmien", "Will", "Willard", "Willem", "William", "Willie", "Willis", "Wilmer", "Wilmot", "Wilson", "Winifred", "Winston", "Winthrop", "Wolf", "Wolfe", "Wolff", "Wolffe", "Wolfgang", "Wolfram", "Woodrow", "Woody", "Wright", "Wyatt", "Wyeth",
       "Xander", "Xavier", "Xylon",
    "Yakov", "Yan", "Yann", "Yannic", "Yannis", "Yari", "Yasir", "Yasser", "Yevgeniy", "Yevgenyi", "Yitzhak", "Yong", "York", "Yoshi", "Yuri", "Yuriy", "Yves",
    "Zach", "Zachariah", "Zachary", "Zachery", "Zack", "Zackary", "Zaid", "Zandy", "Zane", "Zavier", "Zayd", "Zeb", "Zebadiah", "Zebulon", "Zedekiah", "Zeke", "Zen", "Zeno", "Zenon", "Zephyr", "Ziggy", "Zimraan", "Zuriel"
    ];*/
 
 new autoComplete(aNames,document.getElementById('txt'),document.getElementById('suggest'),10);
 }

function modifying(str)
{
	str=str.replace("&amp;","&");
	str=str.replace("&lt;","<");
	str=str.replace("&gt;",">");
	str=str.replace("&quot;","\"");
	str=str.replace("&apos;","'");
	str=str.replace("&#163;","£");
	str=str.replace("&#39;","'");
	
 	return str;
 	
 	
} 
//mu241009 autosuggest code end  

function displayValue(value)
{
document.forms["LoginInfoForm"].load.value=value;
new Ajax.Updater("locationsDivID", "home.do?param=Cms", {onComplete:function(){},parameters:Form.serialize(document.forms[1]),asynchronous:false, evalScripts:true});
 }
function getconnect()
{
	var domain="";
	if(document.getElementById("countryrestaurants")!=null && document.getElementById("countryrestaurants").value!="Select")
    domain=document.getElementById("countryrestaurants").value;
 	 document.location.href=domain;
}
