
/****************** LOGIN SCREEN ************************/

	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
		{
			//clearOrder();
		/**sai*/
		    
			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,"/");
			}
			
		/**sai*/
			document.forms[1].ordertype.value=a;
			document.forms[1].timezone.value=tz;
		//	document.forms[0].action='Order.do?ordertype='+a+'&timezone='+tz;
			document.forms[1].action='Order.do';
		//	 var strURL='Order.do';
			//new Ajax.Updater('msg',strURL,{asynchronous:false, evalScripts:true});
		//	new Ajax.Updater("msg", strURL, {parameters:Form.serialize("LoginInfoForm"),onComplete:function(){},asynchronous:false, evalScripts:true});
			document.forms[1].submit();
		}
	}

	/*if(a=='sct')
	{
		 if(document.forms[0].countryId[document.forms[0].countryId.selectedIndex].text=='Select')
		{
			alert("please select the country");
		   status='false'
		}	
	}*/

   
     if(a=="allSearch")
	{
	  // clearOrder();

	   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)//eatin
			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';
			
		}
		//alert(searchWith);
		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)//eatin
			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';
			
			}
	  

		//alert(status);

		//if(status=='false')
		//	return;

		if(status=='true' && searchWith!="")
		{
			//alert(value);
			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();
		}
	}

/*	if(a=="dish")
	{
		var status=true;

		if(document.forms[0].dish.value == "")
		{
			clearOrder();
			alert("Please enter dish.");
			document.forms[0].dish.focus();
			status=false;
			
		}
		else
		{
			clearOrder();
			document.forms[0].action="Order.do?ordertype="+a+'&searchValue='+a+'&timezone='+tz+'&shippingLoc='+sloc;
			document.forms[0].submit();
		}
	}*/

}

function getCuisines2(cuisine)
{
	var b='cuisine';
	var visitortime = new Date();
	var tz=(visitortime.getTimezoneOffset()/60)*(-1);
	document.forms[0].action='Order.do?ordertype='+b+'&searchValue='+cuisine+'&timezone='+tz;
	document.forms[0].submit();
}


function funRegister(type)
{

	document.forms[0].action="register.do?newUser=new&registertype="+type;
	document.forms[0].submit();
		
}



function funEnter(a,e)

{
	var key;
 //   e.eventStop();
	if(window.event)
          key = window.event.keyCode;     //IE
     else
          key = e.which;     //firefox

    
	if(key== 13)
	{
		e.Handled=true;
	  loginClicked(a);
	 return false;
	}
}
function funEnternew(a,e)

{
	var key;
   e.eventStop();
	if(window.event)
          key = window.event.keyCode;     //IE
     else
          key = e.which;     //firefox

    
	if(key== 13)
	{
		e.handled=true;
	  loginClicked2(a)
	}
}

	function funViewCart(param)
	{
			 var sloc="";
	  if(document.forms[0].blocationName!=null)
	  {
		 sloc=document.forms[0].blocationName[document.forms[0].blocationName.selectedIndex].text;
	
	  }		

			document.forms[0].action="Customer.do?newOrder="+param+"&shippingLoc="+sloc;
			document.forms[0].submit()
	}

	function funNewOrderDetails(param)
	{
		
		 var sloc="";
	  if(document.forms[0].blocationName!=null)
	  {
		 sloc=document.forms[0].blocationName[document.forms[0].blocationName.selectedIndex].text;
	
	  }
			clearOrder()
//			document.forms[0].action="Customer.do?newOrder="+param+"&shippingLoc="+sloc;

			if(document.forms[0].formType!=null)
			{
			
              document.forms[0].formType.value="restaurantForm";//srikar 12-04-08 After the invoice clicking the home button and clicking the new order  search criteria is not coming 
			}
		
			if(document.forms[0].cuisineType!=null)
			{
					
			document.forms[0].cuisineType.value="All";
			}
			document.forms[0].action="RestaurantSelection.do?order=newOrder";
			document.forms[0].submit()
	}

	
	function funLoad()
	{
		
			if(document.forms[0].userName!=null)
				document.forms[0].userName.focus()

			else
				document.forms[0].postcode.focus()
	}
	

	 function getDetails()
		  {
		  	
			  var sloc="";
			  if(document.forms["RestaurantSelectionForm"].sLocName!=null)
			  {
				 sloc=document.forms["RestaurantSelectionForm"].sLocName.value;
			  }
			//document.forms[0].action='mainPage.do?shippingLoc='+sloc;
			// document.forms[0].submit();
			 var strURL='SearchCriteria.do?shippingLoc='+sloc+'&param=shippingLocation';
			new Ajax.Updater("searchCriteria",strURL,{asynchronous:false, evalScripts:true});
		  } 
	var str=false;
	function change()
	  {
		if(str)
		  {
		 document["H1"].src="images/Header.gif";
		 str=false;
		 changeImage();
		  }
		else
		  {

		 document["H1"].src="images/Header1.gif";
		 str=true;
		 changeImage();
		  }

	  } 
function encrypt(str, pwd) 
	{
	  if(pwd == null || pwd.length <= 0) {
		return null;
	  }
	  var prand = "";
	  for(var i=0; i<pwd.length; i++) {
		prand += pwd.charCodeAt(i).toString();
	  }
	  var sPos = Math.floor(prand.length / 5);
	  var mult = parseInt(prand.charAt(sPos) + prand.charAt(sPos*2) + prand.charAt(sPos*3) + prand.charAt(sPos*4) + prand.charAt(sPos*5));
	  var incr = Math.ceil(pwd.length / 2);
	  var modu = Math.pow(2, 31) - 1;
	  if(mult < 2) {
		return null;
	  }
	  var salt = Math.round(Math.random() * 1000000000) % 100000000;
	  prand += salt;
	  while(prand.length > 10) {
		prand = (parseInt(prand.substring(0, 10)) + parseInt(prand.substring(10, prand.length))).toString();
	  }
	  prand = (mult * prand + incr) % modu;
	  var enc_chr = "";
	  var enc_str = "";
	  for(var i=0; i<str.length; i++) {
		enc_chr = parseInt(str.charCodeAt(i) ^ Math.floor((prand / modu) * 255));
		if(enc_chr < 16) {
		  enc_str += "0" + enc_chr.toString(16);
		} else enc_str += enc_chr.toString(16);
		prand = (mult * prand + incr) % modu;
	  }
	  salt = salt.toString(16);
	  while(salt.length < 8)salt = "0" + salt;
	  enc_str += salt;
	  return enc_str;
	}


function decrypt(str, pwd) 
	{
	  if(str == null || str.length < 8) {
		return;
	  }
	  if(pwd == null || pwd.length <= 0) {
		return;
	  }
	  var prand = "";
	  for(var i=0; i<pwd.length; i++) {
		prand += pwd.charCodeAt(i).toString();
	  }
	  var sPos = Math.floor(prand.length / 5);
	  var mult = parseInt(prand.charAt(sPos) + prand.charAt(sPos*2) + prand.charAt(sPos*3) + prand.charAt(sPos*4) + prand.charAt(sPos*5));
	  var incr = Math.round(pwd.length / 2);
	  var modu = Math.pow(2, 31) - 1;
	  var salt = parseInt(str.substring(str.length - 8, str.length), 16);
	  str = str.substring(0, str.length - 8);
	  prand += salt;
	  while(prand.length > 10) {
		prand = (parseInt(prand.substring(0, 10)) + parseInt(prand.substring(10, prand.length))).toString();
	  }
	  prand = (mult * prand + incr) % modu;
	  var enc_chr = "";
	  var enc_str = "";
	  for(var i=0; i<str.length; i+=2) {
		enc_chr = parseInt(parseInt(str.substring(i, i+2), 16) ^ Math.floor((prand / modu) * 255));
		enc_str += String.fromCharCode(enc_chr);
		prand = (mult * prand + incr) % modu;
	  }
	  return enc_str;
}

//anvesh 5/july/2008
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[1].userName.value == "")	
			{
				alert("Please enter UserName.");
				document.forms[1].userName.focus();
			}
		else 
		if(document.forms[1].password.value == "")
		{
			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 == ""))
		{
			alert("User Id   -- First letter should be character")
			document.forms[1].userName.focus();
		}
		else
		{
			//clearOrder();
		/**sai*/
		    
			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,"/");
			}
			
		/**sai*/
			document.forms[1].ordertype.value=a;
			document.forms[1].timezone.value=tz;
			document.forms[0].action='Order.do?ordertype='+a+'&timezone='+tz;
		//	document.forms[1].action='Order.do?parameter=logout';
		//	 var strURL='Order.do';
			//new Ajax.Updater('msg',strURL,{asynchronous:false, evalScripts:true});
		//	new Ajax.Updater("msg", strURL, {parameters:Form.serialize("LoginInfoForm"),onComplete:function(){},asynchronous:false, evalScripts:true});
			document.forms[1].submit();
		}
	}

	/*if(a=='sct')
	{
		 if(document.forms[0].countryId[document.forms[0].countryId.selectedIndex].text=='Select')
		{
			alert("please select the country");
		   status='false'
		}	
	}*/

   
     if(a=="allSearch")
	{
	  // clearOrder();

	   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)//eatin
			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';
			
		}
		//alert(searchWith);
		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)//eatin
			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';
			
			}
	  

		//alert(status);

		//if(status=='false')
		//	return;

		if(status=='true' && searchWith!="")
		{
			//alert(value);
			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 newloginClicked(a)
	{
	
	 var visitortime = new Date();
	  tz=(visitortime.getTimezoneOffset()/60)*(-1);
	
	if(a=="login")
	{
		var mikExp = /[$\\@\\\#%\^\&\*\(\)\[\]\+\_\{\}\`\~\=\.\,\;\'\"\:\[0-9]|]/;
		if(document.getElementById("loginName").value == "" || document.getElementById("loginName").value==null)	
			{
				alert("Please enter UserName.");
				document.getElementById("loginName").focus();
			}
		else 
		if(document.getElementById("password").value == "" || document.getElementById("password").value==null)
		{
			alert("Please enter Password.");
			document.getElementById("password").focus();
			
		}
		else
		if(mikExp.test(document.getElementById("loginName").value.substring(0,1))&& !(document.getElementById("loginName").value == "")&&!(document.getElementById("loginName").value == null))
		{
			alert("User Id   -- First letter should be character")
			document.getElementById("loginName").focus();
		}
		else
		{
			 var userName=document.getElementById("loginName").value;
			 var password=document.getElementById("password").value;
			 var ordertype=a;
			 var timezone=tz;
			 var userobj=new UserInfoObj(userName,password,ordertype,timezone);	  
			 var userlogjson=Object.toJSON(userobj); 
			 document.forms["LoginInfoForm"].userDetails.value=userlogjson;

			// document.forms["LoginInfoForm"].action='Order.do?ordertype='+a+'&timezone='+tz+'&UserInfo'+userJSON;
            if(document.forms["PartyForm"]!=null)
            {
            document.forms["LoginInfoForm"].action='home.do?param=fromParty';
            document.forms["LoginInfoForm"].submit();
            }
            else
            {
            document.forms["LoginInfoForm"].action='home.do';
            document.forms["LoginInfoForm"].submit();
            }
            
		}
	}

}

function loginClicked2(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.getElementById("loginName").value == "")	
			{
				alert("Please enter UserName.");
				document.getElementById("loginName").focus();
			}
		else 
		if(document.getElementById("password").value == "")
		{
			alert("Please enter Password.");
			document.getElementById("password").focus();
			
		}
		else
		if(mikExp.test(document.getElementById("loginName").value.substring(0,1))&& !(document.getElementById("loginName").value == ""))
		{
			alert("User Id   -- First letter should be character")
			document.getElementById("loginName").focus();
		}
		else
		{
			document.forms["LoginInfoForm"].ordertype.value=a;
			document.forms["LoginInfoForm"].timezone.value=tz;
		//	document.forms[0].action='Order.do?ordertype='+a+'&timezone='+tz;
			document.forms["LoginInfoForm"].action='Order.do?parameter=logout';
			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)//eatin
			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)//eatin
			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();
		}
	}
}


























