// JavaScript Document
//Author: Aamir Yousuf
//Dated:31-10-2009
var sn;
function chk()
{
	var fl=true;
	for(i=0;i<document.feed.elements.length;i++)
	{
		if(document.feed.elements[i].value=="")
		{
			if(document.feed.elements[i].name=="selectName")
			{
			alert("    Please Specify the Place   ");
			document.feed.elements[i].focus();
			}
			else if(document.feed.elements[i].name=="branch")
			{
				alert("    Please Specify the Branch    ");
				document.feed.elements[i].focus();
			}
			else
			{

			alert("Please Specify the given fields");
			document.feed.elements[i].focus();
			}
			fl=false;
			break;
		}
	}
	if(fl==true)
	{
		//if(document.feed.elements[i].name=="email")
		//{
		if((document.feed.email.value.indexOf("@")==-1) ||(document.feed.email.value.indexOf(".")==-1))
		{
			alert("Please Specify a Valid Email ID");
			fl=false;
		}
	}
	if(fl==true)
	{
		
	feed.action="thnkuapply.php";
	feed.submit();
	}


}
function addItem(selname)
{


	feed.action="apply.php";
	feed.submit();

}
function chktxt(seltxt)
{
	if(seltxt=="other")
	{

		document.getElementById('other').innerHTML="<input type='text' name='otherproduct' size='25' >";
	}
	else
	{
		document.getElementById('other').innerHTML="<input type='text' name='otherproduct' size='25' disabled='true'  value='specify other products here' >";

	}
}

function ajaxFunction(selname)
{

var xmlHttp;
sn=selname;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    try
      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    catch (e)
      {
      alert("Undefined Error");
      return false;
      }
    }
  }
  xmlHttp.onreadystatechange=function()
    {
    if(xmlHttp.readyState==4)
      {

	  //document.feed.branch.disabled=false;
      var res=xmlHttp.responseText;
	
			document.getElementById("brid").innerHTML=res;

		//}

      }
    }
	if(sn!="")
	{
		var url="apply_now.php?branch="+sn;
		xmlHttp.open("POST",url,true);
		xmlHttp.send(null);
  }
  else
  {
  document.getElementById("brid").innerHTML="<select name='branch' class='finder' disabled='true'><option value='' selected>Select Branch</option></select>";
  }
  }
