function feed_back()
{ 
	Window=open("","","width=400,height=400,top=100,left=200");
	Window.document.open();
	Window.document.write("<html><head><title>Feedback</title><link href='sikkiminfo.css' rel=StyleSheet type='text/css'></head>")
	Window.document.write("<body background='images/bg.jpg'><p><b><center><font color='#800800' face='Arial' size='4'> FEEDBACK  </center></b></p></b>");
	Window.document.write("<form name='myform' method='POST' action='feedback.php'>")
	Window.document.write("<div align='center'><center><table border='0' cellpadding='0' cellspacing='0' width='80%' ><tr><td colspan=2></td></tr>");
	Window.document.write("<tr><td><b>Name :</b></td><td><input type=text name='name'> </td></tr>")
	Window.document.write("<tr><td><b>Email :</b></td><td><input type=text name='email'> </td></tr>")
	Window.document.write("<tr><td><b>Comments :</b></td><td><textarea name='comment' cols='25' rows='10'></textarea> </td></tr>")
	Window.document.write("<tr><td colspan=2 align=center><image src='images/send.gif' name='send'></td></tr>")
	Window.document.write("</table>")
	Window.document.send.onclick=check;

	Window.document.write("</form></body></html>")
	Window.focus();
}

function check()
{		
	var formcheck2=Window.document.myform.name.value;
	var formcheck1=Window.document.myform.email.value;
	var formcheck3=Window.document.myform.comment.value;

	var message = "";
	var flag =0;
	
	if(formcheck1=="" || formcheck2==""  || formcheck3=="" )
	{
			flag=1;
					
			 if(formcheck3=="")
			 {
			 	if(message!="")message="," +message;
				message=" Feedback"+ message;
				Window.document.myform.comment.focus();
			 }	
			
				
			if(formcheck1=="")
			 {
			 	if(message!="")message="," +message;message=" Email"+ message;
			Window.document.myform.email.focus();
			}
			
		
			
			if(formcheck2=="")
			 {
			 	if(message!="")message="," +message;message=" Name"+ message;
				Window.document.myform.name.focus();
			 }
			
	
			
			
		alert('Please fill up your ' +message + ".");
		return (false);
	}
	
if(flag==0)
{
	if(formcheck1.indexOf(" ") >= 0 )
		{
			alert("Please enter the E-Mail address without any white space character.");
			Window.document.myform.email.focus();
			return (false);
		}

		
		AtRateCheckfrom = formcheck1.indexOf("@");
		AtDotCheckfrom  = formcheck1.indexOf(".");

		
		AtRateCheckLastfrom = formcheck1.lastIndexOf("@");
		AtDotCheckLastfrom = formcheck1.lastIndexOf(".");
 

		
		if ( (AtRateCheckfrom == -1) || (AtDotCheckfrom == -1) && flag==0)
		{
			alert("Please enter your valid email-id"); 
			Window.document.myform.email.focus();
			
			
			return (false);
		}
		
			
		if( (AtRateCheckLastfrom != AtRateCheckfrom)  && flag==0)
		{
			alert("Please enter your valid email-id"); 
			Window.document.myform.email.focus();
			return (false);
		}

		BeforeAtRatefrom = formcheck1.substring(0,formcheck1.indexOf("@"));
		AfterAtRatefrom = formcheck1.substring(formcheck1.indexOf("@")+1,formcheck1.length);

				
		if (AfterAtRatefrom.indexOf(".") == -1 && flag==0)
		{
			alert("Please enter your valid email-id"); 
			Window.document.myform.email.focus();
			return (false);
		}

		
		middlefrom = AfterAtRatefrom.substring(0, AfterAtRatefrom.indexOf("."))
		lastfrom = AfterAtRatefrom.substring(AfterAtRatefrom.indexOf(".") + 1,AfterAtRatefrom.length)

		
		if (BeforeAtRatefrom.length == 0 || middlefrom.length == 0 || lastfrom.length == 0 && flag==0)
		{
			alert("Please enter your valid E-Mail"); 
			Window.document.myform.email.focus();
			return (false);
		}
		else
		{
		Window.document.myform.submit();
			return (true);
		}
	
		
	}

}
