function validation()
	{
		var err=0;
		theModule=document.forms['reg_form']['SelectModule[]'];
		chkCounter=0;
		for(z=0; z<theModule.length;z++) 
		{
			if(theModule[z].type == 'checkbox' ) 
			{
				if(theModule[z].checked)
				{
					chkCounter++;	
				}
			}
		}
		theRdModule=document.forms['reg_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(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 edit_validation(ram,plan)
	{
		var err=0;
		theModule=document.forms['edit_form']['SelectModule[]'];
		chkCounter=0;
		for(z=0; z<theModule.length;z++) 
		{
			if(theModule[z].type == 'checkbox' ) 
			{
				if(theModule[z].checked)
				{
					chkCounter++;	
				}
			}
		}
		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;
		}
	}

