 var site_url;
 var val;
     
 var req = createXMLHttpRequest();  
   function createXMLHttpRequest() {  
   var ua;  
   if(window.XMLHttpRequest) {  
   try {  
   ua = new XMLHttpRequest();  
   } catch(e) {  
     ua = false;  
    }  
    } else if(window.ActiveXObject) {  
     try {  
       ua = new ActiveXObject(
       "Microsoft.XMLHTTP");  
     } catch(e) {  
       ua = false;  
     }  
    }  
   return ua;  
   } 
		function div_show()
		{
		document.getElementById('div_info').innerHTML='<DIV id="container2"><table width="350" border="0" cellpadding="0" cellspacing="1" bgcolor="#004971"><tr><td bgcolor="#FFFFFF"><TABLE width="100%" border="0" cellpadding="5" cellspacing="1" bgcolor="#E0DFE3"><TR><TD valign="bottom" bgcolor="#FFFFFF" style="font-family:arial;font-size:13px;color:#004971;line-height:25px;">Site Url<font color="#FF0000">*</font>:</TD><TD bgcolor="#FFFFFF" ><INPUT TYPE="TEXT" NAME="site_url" id="site_url" SIZE="30" value="http://"class="txt-box"></TD></TR><TR><TD bgcolor="#FFFFFF"  style="font-family:arial;font-size:13px;color:#004971;line-height:25px;">Your Email<font color="#FF0000">*</font>:</TD><TD bgcolor="#FFFFFF" ><INPUT TYPE="TEXT" NAME="site_email" id="site_email" SIZE="30" class="txt-box"></TD></TR><TR><TD bgcolor="#FFFFFF"  style="font-family:arial;font-size:13px;color:#004971;line-height:25px;">Site Title<font color="#FF0000">*</font>:</TD><TD bgcolor="#FFFFFF" ><INPUT TYPE="TEXT" NAME="site_title" id="site_title" SIZE="30" class="txt-box" maxlength="100"></TD></TR><TR><TD bgcolor="#FFFFFF"  style="font-family:arial;font-size:13px;color:#004971;line-height:25px;">Site Description.<font color="#FF0000">*</font>:</TD><TD bgcolor="#FFFFFF" ><INPUT TYPE="TEXT" NAME="site_desc" id="site_desc" SIZE="30" class="txt-box" maxlength="100"></TD></TR><TR><TD colspan="2" bgcolor="#FFFFFF" ><TABLE width="100%" align="center" border="0" cellpadding="0" cellspacing="0"><TR><TD width="50%" align="right"><INPUT TYPE="Submit" NAME="Submit" id="Submit" VALUE="Submit My Site" onclick="submitsite();"></TD><TD width="50" align="left"><DIV ONCLICK="div_hide()" STYLE="cursor:pointer"><IMG SRC="/gifs/close.gif" BORDER="0" ALT="Close" align="right"></DIV></TD><TD align="left">&nbsp;</TD></TR></TABLE></TD></TR></TABLE></td></tr></table></div>';		
	document.getElementById('div_info').className = "div_on";
	document.getElementById('div_info2').className = "div_off";
		}		
		function div_hide()
		{
		document.getElementById('div_info').className = "div_off";
		}		
		
		   
function submitsite() { 
	if((document.getElementById("site_url").value=='')|| (document.getElementById("site_url").value=='http://'))
	{
	alert('Please enter the website URL');
	return false;
	}
	/*var v = new RegExp();
    	v.compile("^[A-Za-z0-9-_]+\\.[A-Za-z0-9-_%&\?\/.=]+$");
	if (!v.test(document.getElementById("site_url").value)) 
	{
        alert("You must supply a valid URL.");
		document.getElementById("site_url").focus();
        return false;
    	} */
	else if(!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(document.getElementById("site_email").value))) 
		{
		alert("Invalid Email ID. Kindly enter the correct ID.");
		document.getElementById("site_email").focus();
		return (false);
		} 
		else if(document.getElementById("site_desc").value=="")
		{
		alert("Please put your site description here.");
		document.getElementById("site_desc").focus();
		return (false);
		}else if(document.getElementById("site_title").value=="")
		{
		alert("Please put your site title here.");
		document.getElementById("site_title").focus();
		return (false);
		}
		
		else if(document.getElementById("site_desc").value.length>100)
		{
		alert("Sorry! You can give only 100 characters.");
		document.getElementById("site_desc").focus();
		return (false);
		}
		else {
			document.getElementById("Submit").disabled = true;
            document.getElementById("Submit").value = "Please wait...";
		}
	url=document.getElementById("site_url").value;
	email=document.getElementById("site_email").value;
	title=document.getElementById("site_title").value;
	description=document.getElementById("site_desc").value;

	var strcat=category+'|'+subcategory1+'|'+subcategory2+'|'+subcategory3+'|'+subcategory4
	site_url=url;
	req.open('GET','/validate.php?url='+escape(url)+'&email='+escape(email)+'&title='+escape(title)+'&desc='+escape(description)+'&strcat='+escape(strcat)); 
	req.onreadystatechange = handleResponse; 
	req.send(null); 	   
} 
    
   function handleResponse() { 
   if(req.readyState == 4){ 
       var response = req.responseText; 
	if(response==1)
	{
	 thanks_data='<div id="container2"><table width="350" border="0" cellpadding="0" cellspacing="1" bgcolor="#004971"><tr><td height="24" align="center" bgcolor="#FFFFFF" class="hd2" style="font-family:arial;font-size:15px;color:#004971;line-height:25px;color:red;"><strong>Thank You</strong></td></tr><tr><td><table width="100%" align="center" border="0" cellpadding="0" cellspacing="0" ><tr><td bgcolor="#FFFFFF"><div style="font-family:arial;font-size:13px;text-align:left;color:#004971;line-height:25px;padding:5px;">Thank you for your interest! This site has already has been submitted,<br>Please wait for approval as we are still working on it.<br><div align="center"><strong><a style="cursor: pointer;" onclick="div_show();"><u>Add More Website</u></a></strong></div></div></td></tr><tr><td bgcolor="#FFFFFF"><div onclick="div_hide()" style="cursor:pointer"><img src="/gifs/close.gif" border="0" alt="close" align="right"></div></td></tr></table></td></tr></table></div>';
	}
	else if(response==0)
	{
	 thanks_data='<div id="container2"><table width="350" border="0" cellpadding="0" cellspacing="1" bgcolor="#004971"><tr bgcolor="#004971"><td height="24" align="center" bgcolor="#FFFFFF" class="hd2" style="font-family:arial;font-size:15px;color:#004971;line-height:25px;color:red;"><strong>Thank You</strong></td></tr><tr><td><table width="100%" align="center" border="0" cellpadding="0" cellspacing="0"><tr><td bgcolor="#FFFFFF" style="padding-top:5px;"><div style="font-family:arial;font-size:13px;color:#004971;line-height:25px;text-align:left;padding:5px;">Thank you for your interest! This site has already has been approved,<br>You can access it on indiaseek.com.<br> <div align="center"><strong><a style="cursor: pointer;" onclick="div_show();"><u>Add More Website</u></a></strong></div></div></td></tr><tr> <td bgcolor="#FFFFFF"><div onclick="div_hide()" style="cursor:pointer"><img src="/gifs/close.gif" border="0" alt="close" align="right"></div></td></tr></table></td></tr></table></div>';
	
	}
	else if(response==2)
	{
	 thanks_data='<div id="container2"><table width="350" border="0" cellpadding="0" cellspacing="1" bgcolor="#004971"><tr bgcolor="#004971"><td height="10" align="center" bgcolor="#FFFFFF" class="hd2" style="font-family:arial;font-size:15px;color:#004971;line-height:25px;color:red;"><strong>Thank You</strong></td></tr><tr><td><table width="100%" align="center" border="0" cellpadding="0" cellspacing="0"> <tr> <td bgcolor="#FFFFFF" class="txt" style="padding-top:5px;"><div style="font-family:arial;font-size:13px;color:#004971;line-height:25px;text-align:left;padding:5px;">Thanks for submit your website.<br>Your listing would appear with 48 hours in your submitted categories<br>Please feel free to contact us & continue submitting! more sites of your choice.<br><br><div align="center"><strong><a style="cursor: pointer;" onclick="div_show();"><u>Add More Website</u></a></strong></div></div></td></tr><tr><td bgcolor="#FFFFFF"><div onclick="div_hide()" style="cursor:pointer"><img src="/gifs/close.gif" border="0" alt="close" align="right"></div></td></tr></table></td></tr></table></div>';
	
	}
	document.getElementById("div_info").innerHTML=thanks_data;
    } 
  } 