function validation()
	{
		var err=0;
		theModule=document.forms['reg_form']['restaurantList[]'];
		chkCounter=0;
		
		chkCounter=theModule.length;

		theRdModule=document.forms['reg_form']['rdPlanModule[]'];
		rdValue = 0;
		for(z=0; z<theRdModule.length;z++) 
		{
			if(theRdModule[z].type == 'radio' ) 
			{
				if(theRdModule[z].checked)
				{
					rdValue=theRdModule[z].value
				}
			}
		}
		
		if(rdValue==0)
		{
			alert("Please select a membership of your choice");
			err++
		}
		
		if(rdValue==1)
		{
			if(chkCounter>4)
			{
				alert("You can choose only 4 restaurants");
				err++;	
			}
			else if(chkCounter<4)
			{
				alert("Please select 4 restaurants");
				err++;	
			}	
		}
		else if(rdValue==2)
		{
			if(chkCounter>12)
			{
				alert("You can choose only 12 restaurants");	
				err++;
			}
			else if(chkCounter<12)
			{
				alert("Please select 12 restaurants");	
				err++;
			}	
		}
		else if(rdValue==3)
		{
			if(chkCounter>15)
			{
				alert("You can choose only 15 restaurants");	
				err++;	
			}
			else if(chkCounter<15)
			{
				alert("Please select 15 restaurants");	
				err++;	
			}	
		}
		else if(rdValue==4)
		{
			if(chkCounter>24)
			{
				alert("You can choose only 24 restaurants");	
				err++;
			}	
			else if(chkCounter<24)
			{
				alert("Please select 24 restaurants");	
				err++;
			}	
		}
		else if(rdValue==5)
		{
			if(chkCounter>35)
			{
				alert("You can choose only 35 restaurants");	
				err++;
			}	
			else if(chkCounter<35)
			{
				alert("Please select 35 restaurants");	
				err++;
			}	
		}
		else if(rdValue==6)
		{
			if(chkCounter>50)
			{
				alert("You can choose only 50 restaurants");	
				err++;
			}	
			else if(chkCounter<50)
			{
				alert("Please select 50 restaurants");	
				err++;
			}	
		}
		
					
		tc=0;
		if(!document.getElementById('chk1').checked)
		{
			tc++;
		}
		if(!document.getElementById('chk2').checked)
		{
			tc++;
		}
		if(!document.getElementById('chk3').checked)
		{
			tc++;
		}
		if(!document.getElementById('chk4').checked)
		{
			tc++;
		}
		if(!document.getElementById('chk5').checked)
		{
			tc++;
		}
		if(!document.getElementById('chk6').checked)
		{
			tc++;
		}
		if(err==0 && tc >0)
		{
			alert("please checked terms and conditions.");	
		}
		if(err==0 && tc==0)
		{
			return true;
		}
		else
		{
			return false;
		}
	}
function faq_validation()
{
	
	faq_question = $("#faq_question").val();
	faq_ans = $("#faq_ans").val();
	if(faq_question == ""){
		alert("Please Enter Question");
		return false;
	}
	
			
	
}

function contact_validation()
{
	
	ourhours = $("#ourhours").val();
	maddress = $("#maddress").val();
	cservice = $("#cservice").val();
	if(ourhours == ""){
		alert("Please Enter Our hours and days of operation");
		return false;
	}
	if(maddress == ""){
		alert("Please Enter Mailing Address");
		return false;
	}
	if(cservice == ""){
		alert("Please Enter Customer Service");
		return false;
	}
			
	
}

	
function admin_validation()
{
	var err=0;
	theModule=document.forms['edit_form']['restaurantList[]'];
	chkCounter=0;
	
	chkCounter=theModule.length;

	theRdModule=document.forms['edit_form']['rdPlanModule[]'];
	rdValue = 0;
	for(z=0; z<theRdModule.length;z++) 
	{
		if(theRdModule[z].type == 'radio' ) 
		{
			if(theRdModule[z].checked)
			{
				rdValue=theRdModule[z].value
			}
		}
	}
	
	if(rdValue==0)
	{
		alert("Please select a membership of your choice");
		err++
	}
	
	if(rdValue==1)
	{
		if(chkCounter>4)
		{
			alert("You can choose only 4 restaurants");
			err++;	
		}
		else if(chkCounter<4)
		{
			alert("Please select 4 restaurants");
			err++;	
		}	
	}
	else if(rdValue==2)
	{
		if(chkCounter>12)
		{
			alert("You can choose only 12 restaurants");	
			err++;
		}
		else if(chkCounter<12)
		{
			alert("Please select 12 restaurants");	
			err++;
		}	
	}
	else if(rdValue==3)
	{
		if(chkCounter>15)
		{
			alert("You can choose only 15 restaurants");	
			err++;	
		}
		else if(chkCounter<15)
		{
			alert("Please select 15 restaurants");	
			err++;	
		}	
	}
	else if(rdValue==4)
	{
		if(chkCounter>24)
		{
			alert("You can choose only 24 restaurants");	
			err++;
		}	
		else if(chkCounter<24)
		{
			alert("Please select 24 restaurants");	
			err++;
		}	
	}
	else if(rdValue==5)
	{
		if(chkCounter>35)
		{
			alert("You can choose only 35 restaurants");	
			err++;
		}	
		else if(chkCounter<35)
		{
			alert("Please select 35 restaurants");	
			err++;
		}	
	}
	else if(rdValue==6)
	{
		if(chkCounter>50)
		{
			alert("You can choose only 50 restaurants");	
			err++;
		}	
		else if(chkCounter<50)
		{
			alert("Please select 50 restaurants");	
			err++;
		}	
	}
	
				
	if(err==0)
	{
		return true;
	}
	else
	{
		return false;
	}
}


function edit_validation(ram,plan)
	{
		var err=0;
		theModule=document.forms['edit_form']['restaurantList[]'];
		chkCounter=0;
		
		chkCounter=theModule.length;

		theRdModule=document.forms['edit_form']['rdPlanModule[]'];
		for(z=0; z<theRdModule.length;z++) 
		{
			if(theRdModule[z].type == 'radio' ) 
			{
				if(theRdModule[z].checked)
				{
					rdValue=theRdModule[z].value
				}
			}
		}
		if(rdValue==1)
		{
			
					if(ram >4 && plan==1)
					{	
						if(chkCounter>ram)
						{
								alert("You can't select more then "+ ram +" restaurants");
								err++;
						}
						else if(chkCounter<ram)
						{
								alert("You can't select less then "+ ram +" restaurants");
								err++;
						}
					}
					else if(chkCounter>4)
					{
						alert("You can choose only 4 restaurants");
						err++;	
					}
					else if(chkCounter<4)
					{
						alert("Please select 4 restaurants");
						err++;	
					}
			  
		}
		
		if(rdValue==2)
		
		{		
					if(ram >12 && plan==2)
					{
						if(chkCounter>ram)
						{
								alert("You can't select more then"+ ram +" restaurants");
								err++;
						}
						else if(chkCounter<ram)
						{
								alert("You can't select less then "+ ram +" restaurants");
								err++;
						}
					}
					else if(chkCounter>12)
					{
						alert("You can choose only 12 restaurants");	
						err++;
					}
					else if(chkCounter<12)
					{
						alert("Please select 12 restaurants");	
						err++;
					}
			  
		}
		if(rdValue==3)
		
		{		
					if(ram >15 && plan==3)
					{
						if(chkCounter>ram)
						{
								alert("You can't select more then"+ ram +" restaurants");
								err++;
						}
						else if(chkCounter<ram)
						{
								alert("You can't select less then "+ ram +" restaurants");
								err++;
						}
					}
					else if(chkCounter>15)
					{
						alert("You can choose only 15 restaurants");	
						err++;
					}
					else if(chkCounter<15)
					{
						alert("Please select 15 restaurants");	
						err++;
					}
			  
		}
		if(rdValue==4)
		{
			if(ram >24 && plan==4)
			{
				if(chkCounter>ram)
					{
						alert("You can't select more then "+ ram +" restaurants");
						err++;
					}
				else if(chkCounter<ram)
					{
						alert("You can't select less then "+ ram +" restaurants");
						err++;
					}
			}
			else if(chkCounter>24)
			{
				alert("You can choose only 24 restaurants");	
				err++;	
			}
			else if(chkCounter<24)
			{
				alert("Please select 24 restaurants");	
				err++;	
			}	
		}
		if(rdValue==5)
		{
			if(ram >35 && plan==5)
			{
				if(chkCounter>ram)
					{
						alert("You can't select more then "+ ram +" restaurants");
						err++;
					}
				else if(chkCounter<ram)
					{
						alert("You can't select less then "+ ram +" restaurants");
						err++;
					}
			}
			else if(chkCounter>35)
			{
				alert("You can choose only 35 restaurants");	
				err++;	
			}
			else if(chkCounter<35)
			{
				alert("Please select 35 restaurants");	
				err++;	
			}	
		}
		if(rdValue==6)
		{
			if(ram >50 && plan==6)
			{
				if(chkCounter>ram)
					{
						alert("You can't select more then "+ ram +" restaurants");
						err++;
					}
				else if(chkCounter<ram)
					{
						alert("You can't select less then "+ ram +" restaurants");
						err++;
					}
			}
			else if(chkCounter>50)
			{
				alert("You can choose only 50 restaurants");	
				err++;
			}	
			else if(chkCounter<50)
			{
				alert("Please select 50 restaurants");	
				err++;
			}	
		}
		if(err==0)
		{
			return true;
		}
		else
		{
			return false;
		}
	}
	
function validateSelection(rdValue, chkCounter)
{
	var err = 0;
	if(rdValue==0 || rdValue==undefined)
	{
		alert("Please select a membership of your choice");
		err++
	}
	
	if(rdValue==1)
	{
		if(chkCounter>3)
		{
			alert("You can choose only 4 restaurants");
			err++;	
		}
	}
	else if(rdValue==2)
	{
		if(chkCounter>11)
		{
			alert("You can choose only 12 restaurants");	
			err++;
		}
	}
	else if(rdValue==3)
	{
		if(chkCounter>14)
		{
			alert("You can choose only 15 restaurants");	
			err++;	
		}
	}
	else if(rdValue==4)
	{
		if(chkCounter>23)
		{
			alert("You can choose only 24 restaurants");	
			err++;
		}	
	}
	else if(rdValue==5)
	{
		if(chkCounter>34)
		{
			alert("You can choose only 35 restaurants");	
			err++;
		}	
	}
	else if(rdValue==6)
	{
		if(chkCounter>49)
		{
			alert("You can choose only 50 restaurants");	
			err++;
		}	
	}
	
	if(err==0)
		return true;
	else
		return false;
}

function newWindow(mypage,myname,w,h)
{
	var scrol="yes";
	var win = null;
	mypage += "/"+$("#states").val()+"/"+$("#cities").val()+"/";
	
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	
	settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scrol+',resizable';
	
	win = window.open(mypage,myname,settings);
}

