function GetXmlHttpObject()
{
  var xmlHttp=null;
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    }
  return xmlHttp;
} // end of function GetXmlHttpObject

function getCountryList()
{
		myStateDiv		= document.getElementById("statelist");
		myloadDiv		= document.getElementById("loadingContent");
    	if(xmlHttp.readyState==1 || xmlHttp.readyState==2 || xmlHttp.readyState==3)
		{
			 	myStateDiv.style.display		 	= "none";
				myloadDiv.style.display				= "";	
		}
		if(xmlHttp.readyState==4)
		{
			
			var responseVal = xmlHttp.responseText;
			//alert(responseVal);	
			if(responseVal==0)
			{
			var responseVal	= "FAIL";
			}
			if(responseVal==3)
			{
			var responseVal	= "NA";
			}
			if(responseVal=="FAIL")
			{
				myStateDiv.style.display	= "none";
				myloadDiv.style.display		= "";
				myloadDiv.innerHTML			= "Select Country has no value,Please select other Country.";
			
			}else if(responseVal=="NA")
			{
				myStateDiv.style.display	= "none";
				myloadDiv.style.display		= "";
				myloadDiv.innerHTML			= "States not availabel,Please select another Country.";
			}else{
				var abc	= responseVal.split("|||");
				myHid	= document.getElementById("hid_state_id");
				myHid.value	 = abc[0];
				
				myStateDiv.style.display	= "";
				myStateDiv.innerHTML		= abc[1];	
				myloadDiv.style.display		= "none";
			   
			}
		}
} // end of fucntion requestChanged


function getArticlePreview()
{
		var pDiv	= document.getElementById("prevDiv");
		pDiv.style.top	= (tempY-25)+"px";
		pDiv.style.left	= (tempX-370)+"px";
		
		if(xmlHttp.readyState==1 || xmlHttp.readyState==2 || xmlHttp.readyState==3)
		{
			pDiv.style.display	= "";
			pDiv.innerHTML	= "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr><td><img style=\"margin:0px;\" src=\"./html/images/loading1.gif\"></td>&nbsp;<span class=\"boldgrey\">Loading Preview... Please wait.</span></td></tr></table>";
				
		}
		if(xmlHttp.readyState==4)
		{ 
			var responseVal = xmlHttp.responseText;
			pDiv.style.display	= "";
			pDiv.innerHTML	= responseVal;
		}

} // end of function getArticlePreview


function registerArticleVote()
{
		var ratDiv		= document.getElementById("ratingBarId");
		if(xmlHttp.readyState==1 || xmlHttp.readyState==2 || xmlHttp.readyState==3)
		{
			
			ratDiv.innerHTML	= "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr><td><img style=\"margin:0px;\" src=\"html/images/ajax-loader_process.gif\"></td>&nbsp;<span class=\"error\">Registering your vote...</span></td></tr></table>";
				
		}
		if(xmlHttp.readyState==4)
		{ 
			
			var responseVal = xmlHttp.responseText;
			ratDiv.innerHTML	= responseVal;
		}
} // end of function registerArticleVote

function getSCList()
{
		
		mySCDiv			= document.getElementById("sclist");
		mySCloadDiv		= document.getElementById("loadingContent_sc");

		if(xmlHttp.readyState==1 || xmlHttp.readyState==2 || xmlHttp.readyState==3)
		{
			 	mySCDiv.style.display		 	= "none";
				mySCloadDiv.style.display				= "";	
		}
		if(xmlHttp.readyState==4)
		{ 
			var responseVal = xmlHttp.responseText;
						
			if(responseVal==0)
			var responseVal	= "FAIL";
			if(responseVal==3)
			var responseVal	= "NA";
						
			if(responseVal=="FAIL")
			{
				mySCDiv.style.display	= "none";
				mySCloadDiv.style.display		= "";
				mySCDiv.innerHTML			= "Select user type has no value,Please select othery user type.";
			
			}
			else if (responseVal=="NA")
			{
				mySCDiv.style.display	= "none";
				mySCloadDiv.style.display		= "";
				mySCDiv.innerHTML			= "Schools/ Colleges not availabel,Please select another user type.";
			}else
			{
				var abc	= responseVal.split("|||");
				mySCHid	= document.getElementById("hid_sc_id");
				mySCHid.value	 = abc[0];
				
				mySCrowCaption	= document.getElementById("schoolCaption");
				mySCrowCaption.innerHTML = abc[2];

				mySCDiv.style.display	= "";
				mySCDiv.innerHTML		= abc[1];	
				mySCloadDiv.style.display		= "none";
			}
		}

} // end of function getSCList


/*-----------------------Xml object in ajax---------------------------*/
function createXMLHttp()
{
if(typeof XMLHttpRequest != "undefined" )
  {
return new XMLHttpRequest();

  } else if(window.ActiveXObject)
         {
         var aVersions=["MSXML2.XMLHttp.5.0","MSXML2.XMLHttp.4.0","MSXML2.XMLHttp.3.0","MSXML2.XMLHttp","Microsoft.XMLHttp"];
		    for(var i=0;i<aVersions.length;i++)
		        {
		        try{
		           var oXmlHttp=new ActiveXObject(aVersions[i]);
				   return oXmlHttp;
				   }catch(oError){}
		 
		        }
		 }
throw new Error("www.misternetworker.com unable to create Xml object.");
}
/*----------------------end of xml object in ajax---------------------*/
//function for get user agent

function getBrowser()
{
var userAgent=navigator.userAgent

var index = userAgent.indexOf("Opera");
if(index==-1){
var index = userAgent.indexOf("Firefox");
}
if(index==-1){
var index = userAgent.indexOf("Safari");
}


if(index==-1){
agent="IE";
}else{
agent="NETSCAPE";
}

return agent;
}

//-------------end of getBrowser()-------

//finction for create state select box 

function getState(countryId,stateboxName,stateboxId,stateDiv)
{

var oXmlHttp=createXMLHttp();

var objcountry  = document.getElementById(countryId);

var objstatediv = document.getElementById(stateDiv);

var act="ajax_middle_action.php?clickfor=state&subject="+objcountry.value+"&boxName="+stateboxName+"&boxId="+stateboxId;

oXmlHttp.open("get",act,true);

oXmlHttp.onreadystatechange=function()
{
	
if(oXmlHttp.readyState==4)
 {
	 
    if(oXmlHttp.status==200)
	  { 
			if(oXmlHttp.responseText!=0)
			{
              
			  result=oXmlHttp.responseText;
			 
			  if(result!="")
			  {
				 objstatediv.innerHTML=result;
				 
			  }
			}
   	  }
 }
};
oXmlHttp.send(null);

}
//-------------------------------------
