function changecolor4(table1,table2,name)
{
if(document.form1.category.value !="-Select one-")
{
 document.getElementById('table41').style.backgroundColor="#E5E5E5";
 document.getElementById('table42').style.backgroundColor="#FBFDFF"; 
}
else
{
document.getElementById('table41').style.backgroundColor="#FFB591";
document.getElementById('table42').style.backgroundColor="#FFDECE"; 
}

}
function changecolor(table1,table2,name)
{
if(document.form1.name.value !="")
{
 document.getElementById('table11').style.backgroundColor="#E5E5E5";
 document.getElementById('table12').style.backgroundColor="#FBFDFF"; 
}
else
{
document.getElementById('table11').style.backgroundColor="#FFB591";
document.getElementById('table12').style.backgroundColor="#FFDECE"; 
}

}
function changecolor2(table1,table2,name)
{
if(document.form1.email.value !="")
{
 document.getElementById('table21').style.backgroundColor="#E5E5E5";
 document.getElementById('table22').style.backgroundColor="#FBFDFF"; 
}
else
{
document.getElementById('table21').style.backgroundColor="#FFB591";
document.getElementById('table22').style.backgroundColor="#FFDECE"; 
}

}
function changecolor3(table1,table2,name)
{
if(document.form1.content.value !="")
{
 document.getElementById('table31').style.backgroundColor="#E5E5E5";
 document.getElementById('table32').style.backgroundColor="#FBFDFF"; 
}
else
{
document.getElementById('table31').style.backgroundColor="#FFB591";
document.getElementById('table32').style.backgroundColor="#FFDECE"; 
}

}
function changecolors()
{

document.getElementById('table31').style.backgroundColor="#FFB591";
document.getElementById('table32').style.backgroundColor="#FFDECE"; 
document.getElementById('table21').style.backgroundColor="#FFB591";
document.getElementById('table22').style.backgroundColor="#FFDECE"; 
document.getElementById('table11').style.backgroundColor="#FFB591";
document.getElementById('table12').style.backgroundColor="#FFDECE"; 
document.getElementById('table41').style.backgroundColor="#FFB591";
document.getElementById('table42').style.backgroundColor="#FFDECE"; 


}
function validation(f)
{
if(document.form1.category.value =="-Select one-")
{
 alert("Please choose feedback category");
 f.focus();
 return false;
}
else if(document.form1.name.value =="")
{
alert("Please type your name");
 f.focus();
 return false;
}
else if(document.form1.email.value =="")
{
alert("Please type your email");
 f.focus();
 return false;
}
else if(document.form1.content.value =="")
{
alert("Please write the feedback content");
 f.focus();
 return false;
}
else
{
 var emailID=document.form1.email
	
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please Enter your Email ID")
		 f.focus();
 return false;
	}
	if (echeck(emailID.value)==false){
		emailID.value=""
		 f.focus();
 return false;
	}
	return true
}
}
function checking()
{
if(document.form1.category.value !="-Select one-")
{
 document.getElementById('table41').style.backgroundColor="#E5E5E5";
 document.getElementById('table42').style.backgroundColor="#FBFDFF"; 
}
else
{
document.getElementById('table41').style.backgroundColor="#FFB591";
document.getElementById('table42').style.backgroundColor="#FFDECE"; 
}

if(document.form1.name.value !="")
{
 document.getElementById('table11').style.backgroundColor="#E5E5E5";
 document.getElementById('table12').style.backgroundColor="#FBFDFF"; 
}
else
{
document.getElementById('table11').style.backgroundColor="#FFB591";
document.getElementById('table12').style.backgroundColor="#FFDECE"; 
}

if(document.form1.email.value !="")
{
 document.getElementById('table21').style.backgroundColor="#E5E5E5";
 document.getElementById('table22').style.backgroundColor="#FBFDFF"; 
}
else
{
document.getElementById('table21').style.backgroundColor="#FFB591";
document.getElementById('table22').style.backgroundColor="#FFDECE"; 
}
if(document.form1.content.value !="")
{
 document.getElementById('table31').style.backgroundColor="#E5E5E5";
 document.getElementById('table32').style.backgroundColor="#FBFDFF"; 
}
else
{
document.getElementById('table31').style.backgroundColor="#FFB591";
document.getElementById('table32').style.backgroundColor="#FFDECE"; 
}
}
function echeck(str) {

		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					
	}

