var xmlDoc;
function getXMLHTTP() { //fuction to return the xml http object
		
		var xmlhttp=false;	
		try{
			xmlhttp=new XMLHttpRequest();
		}
		catch(e)	{		
			try{			
				xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e){
				try{
				xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
				}
				catch(e1){
					xmlhttp=false;
				}
			}
		}
		 	
		return xmlhttp;		
    }
function change_text(str,jobname)
{
	document.getElementById("findjob").value = jobname ;
	document.getElementById("livesearch").style.visibility = "hidden";
	xmlHttp=GetXmlHttpObject()

	if (xmlHttp==null)
 	{
	 alert ("Browser does not support HTTP Request");
	 return;
	 } 

	var url="search_jobguest.php";
	url=url+"?q="+str;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=stateChanged_jobsearch1 ;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
	
}
	
function stateChanged_jobsearch1() 
{ 
	

	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	 { 
		
	 document.getElementById("guest").innerHTML=xmlHttp.responseText;
	 
	 } 
}

function showResult(str,user_language)
{
	document.getElementById("livesearch").style.visibility = "visible";	
	//document.getElementById("livesearch").style.visibility = visible;
if (str.length==0)
 { 
 document.getElementById("livesearch").
 innerHTML="";
 document.getElementById("livesearch").
 style.border="0px";
 return;
 }

xmlHttp=GetXmlHttpObject()

if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request");
 return;
 } 

var url="livesearch.php";
url=url+"?q="+str + "&language=" + user_language;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChanged_jobsearch ;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
} 

function stateChanged_jobsearch() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("livesearch").
 innerHTML=xmlHttp.responseText;
 } 
}

function fun_banner(pubid,fid,guestid)
	{
		
		document.getElementById('disfull').innerHTML = "";
		document.getElementById('disfull').style.height = "0px";
		var strURL="full_rightbanner.php?pid="+ pubid + "&fid=" + fid + "&gid=" + guestid;	
		//alert(strURL);
		
		var req = getXMLHTTP();		
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {	
					//alert (req.responseText);
										
						document.getElementById('fullpage').innerHTML=req.responseText;					
						
						
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}				
			}			
			req.open("GET", strURL, true);			
			req.send(null);
		}
	}
function search_guest(strcid, strname) //Search country
{
	
	//alert(strsid);
	//alert(strccid);
	//alert(str1);
//	alert(str2);
//	alert(str3);
var url="guest_search.php";

xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 

url =url+"?cid="+strcid+ "&name=" + strname;
//alert(url);
//url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
function stateChanged() 
{ 
if (xmlHttp.readyState==4)
{ 
document.getElementById("guest").innerHTML=xmlHttp.responseText;

}
}

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;
}

function guest_ad(guestid,adtype) {	
		//alert(adtype);
		var strURL;
	
					if(adtype == 1 )
					{
						document.getElementById("logo_ad").style.visibility = "visible";
						strURL = "right_banner.php?gid="+guestid ;
					}
					else if(adtype == 2 )
					{
						document.getElementById("minipage_ad").style.visibility = "visible";
						strURL = "mini_page.php?gid="+guestid ;
					}
					else if(adtype == 3 )
					{
						document.getElementById("fullpage_ad").style.visibility = "visible";
						strURL = "full_page.php?gid="+guestid ;
					}
					else if(adtype == 4 )
					{
						document.getElementById("logo_ad").style.visibility = "visible";
						var strURL="right_info.php?gid="+guestid ;		
					}
				//alert(strURL)	;
		var req = getXMLHTTP();
		
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {	
						if(adtype == 1 )		
						{
							document.getElementById('logo_ad').innerHTML=req.responseText;
						}
						else if (adtype == 2)
						{ document.getElementById('minipage_ad').innerHTML=req.responseText; 
						
						}
						else if (adtype == 3)
						{ document.getElementById('fullpage_ad').innerHTML=req.responseText; 
						
						}
						else if (adtype == 4)
						{ document.getElementById('logo_ad').innerHTML=req.responseText; 
						
						}
						//document.getElementById('statediv_update').innerHTML=req.responseText;
					} 
					else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}				
			}			
			req.open("GET", strURL, true);			
			req.send(null);
		}		
		
	}
	function fun_exit()
{
	document.getElementById("minipage_ad").style.visibility = "hidden";	
	document.getElementById("fullpage_ad").style.visibility = "hidden";
	}
	function rightlinks()
{
	
	document.getElementById("logo_ad").style.visibility = "hidden";
	
	}
	function fun(guestid,nextbu)
	{
		//salert("A");
		document.getElementById('disimg').innerHTML = "";
		document.getElementById('disimg').style.height = "0px";
		var strURL="mini_banner.php?gid="+guestid + "&img=" + nextbu ;	
		
		var req = getXMLHTTP();		
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {	
					//alert (req.responseText);
										
						document.getElementById('divImage').innerHTML=req.responseText;					
						
						
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}				
			}			
			req.open("GET", strURL, true);			
			req.send(null);
		}
	}
