//Ajax methodes and calls

var Ajax = new Object();

var http;

var tid,btnid;

var ldrid;

var httpr,drpid,ready;

//Function to check if a number is NUMERIC

function numeric(val)
{

	var ValidChars ="0123456789.";
	var IsNumber=true;
	if(val=="")
	{
			IsNumber = false;
	}

	var Char;
	for (i=0;i<val.length&&IsNumber==true; i++)
		{ 
			Char = val.charAt(i);
			if (ValidChars.indexOf(Char) == -1)
					{
						IsNumber = false;
					}
		}

	return IsNumber;

}

//Function to Check Numeric Ends here
//Handle Request from other page//

function httpobject()
	{

		var obj;
		if(window.XMLHttpRequest) {
			obj = new XMLHttpRequest();
		} else if(window.ActiveXObject) {
			obj = new ActiveXObject("MSXML2.XMLHTTP");
		}
		return obj;
	}
//----------------Load any page--------------------------
function loader_ajax(id,ldid) {

		ldrid=ldid;
		var url=id;
		http = httpobject();
		http.open('get',url);
		http.onreadystatechange = rloader_ajax;		
		http.send(null);
}

function rloader_ajax() {

			if(http.readyState == 4)
			{
				var response = http.responseText;
				document.getElementById(ldrid).innerHTML="";
				document.getElementById(ldrid).innerHTML=response;
			}else {
			//Page is not Ready Yet . Display Loading Image
			document.getElementById(ldrid).innerHTML="";
			document.getElementById(ldrid).innerHTML="<div style=\"width: 360px; margin: 0px auto;\ text-align:center; padding-top: 50px;\"><img src=\"/images/ajax-loader.gif\" width=\"32\" height=\"32\"></div>";

			}	

}

//------------------emd load any page--------------------
//---------------------Report Link-----------------------
function report_link(id,type,ldid,tid) {

		var tids=document.getElementById(tid);
		tids.style.display="none";
		ldrid=ldid;
		var url="/_modules/ajax/report_link_ajax.php?id="+id+"&type="+type;
		http = httpobject();
		http.open('get',url);
		http.onreadystatechange = rloader_ajax;		
		http.send(null);
}

//---------------------End Report Link-------------------
//----------------Load job and announcement onload only--------------------------
function loader_ajax_onload(id,ldid){

		ldrid=ldid;
		var url=id;
		http = httpobject();
		http.open('get',url);
		http.onreadystatechange = rloader_ajax_load;		
		http.send(null);
}

function rloader_ajax_load() {

			if(http.readyState == 4)
			{
				var response = http.responseText;
				document.getElementById(ldrid).innerHTML="";
				document.getElementById(ldrid).innerHTML=response;
				loadAjaxedAnswers('0','1');

			}else {
			//Page is not Ready Yet . Display Loading Image
			document.getElementById(ldrid).innerHTML="";
			document.getElementById(ldrid).innerHTML="<div style=\"width: 360px; margin: 0px auto;\ text-align:center; padding-top: 50px;\"><img src=\"/images/ajax-loader.gif\" width=\"32\" height=\"32\"></div>";
			}	

}

function loader_ajax_onload2(id,ldid){

		ldrid=ldid;
		var url=id;
		http = httpobject();
		http.open('get',url);
		http.onreadystatechange = rloader_ajax_load2;		
		http.send(null);

}

function rloader_ajax_load2() {

			if(http.readyState == 4)
			{
				var response = http.responseText;
				document.getElementById(ldrid).innerHTML="";
				document.getElementById(ldrid).innerHTML=response;
				ldfeaturedemp_subsub('anlist','2');

			}else {

			//Page is not Ready Yet . Display Loading Image
			document.getElementById(ldrid).innerHTML="";
			document.getElementById(ldrid).innerHTML="<div style=\"width: 360px; margin: 0px auto;\ text-align:center; padding-top: 50px;\"><img src=\"/images/ajax-loader.gif\" width=\"32\" height=\"32\"></div>";
			}	
}

//------------------emd load any page--------------------
//----------------Load any page with the fade effect--------------------------

function loader_ajax_fade(id,ldid) {

		//alert("in ajax");
		ldrid=ldid;
		var url=id;
		http = httpobject();
		http.open('get',url);
		http.onreadystatechange = rloader_ajax_fade;		
		http.send(null);
}

function rloader_ajax_fade() {

			if(http.readyState == 4)
			{
				//fadeOutMyPopup();
				var response = http.responseText;
				document.getElementById(ldrid).innerHTML="";
				document.getElementById(ldrid).style.display="none";
				document.getElementById(ldrid).innerHTML=response;
				//alert(ret[1]);
				fireMyPopup();

			}else {

			//Page is not Ready Yet . Display Loading Image
			//document.getElementById(ldrid).innerHTML="";
			//fadeOutMyPopup();
			//document.getElementById(ldrid).innerHTML="<div style=\"width: 360px; margin: 0px auto;\ text-align:center; padding-top: 50px;\"><img src=\"/images/ajax-loader.gif\" width=\"32\" height=\"32\"></div>";

			}	

}

//------------------emd load any page with the fade effect--------------------
//var dvid;
function setOpacity( value) {
//alert(dvid);

 document.getElementById(ldrid).style.opacity = value / 10;
 document.getElementById(ldrid).style.filter = 'alpha(opacity=' + value * 10 + ')';
}

function fadeInMyPopup() {
 for( var i = 0 ; i <= 100 ; i++ )
   setTimeout( 'setOpacity(' + (i / 10) + ')' , 8 * i );
}

function fadeOutMyPopup() {
 for( var i = 0 ; i <= 100 ; i++ ) {
   setTimeout( 'setOpacity(' + (10 - i / 10) + ')' , 8 * i );
 }

 //setTimeout('closeMyPopup()', 800 );
}

function closeMyPopup() {
 document.getElementById(ldrid).style.display = "none"
}

function fireMyPopup() {
 setOpacity( '0');
 document.getElementById(ldrid).style.display = "block";
 fadeInMyPopup();
}
//-------------------------------------------------------------------------------

//-------------------------Load Main Alliance--------------------------------
function loader_ajax_main(id,ldid) {

		ldrid=ldid;
		var url=id;
		http = httpobject();
		http.open('get',url);
		http.onreadystatechange = rloader_ajax_main;		
		http.send(null);

}

function rloader_ajax_main() {

			if(http.readyState == 4)
			{
				//fadeOutMyPopup();
				var response = http.responseText;
				document.getElementById(ldrid).innerHTML="";
				document.getElementById(ldrid).innerHTML=response;
				alliance_beta_job_load();
				//fireMyPopup();

			}else {

			//Page is not Ready Yet . Display Loading Image
			document.getElementById(ldrid).innerHTML="";
			//fadeOutMyPopup();
			document.getElementById(ldrid).innerHTML="<div style=\"width: 360px; margin: 0px auto;\ text-align:center; padding-top: 50px;\"><img src=\"/images/ajax-loader.gif\" width=\"32\" height=\"32\"></div>";

			}	

}
//End Load main ajax---------------------------------------------------------
//////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////AutoLoadFunctions////////////////////////////////////////
function loader_auto_job(id,ldid)
{
	ldrid=ldid;
	var url=id;
	http = httpobject();
	http.open('get',url);
	http.onreadystatechange = rloader_auto_job;		
	http.send(null);

}function rloader_auto_job()
{
	if(http.readyState == 4)
			{
				var response = http.responseText;
				document.getElementById(ldrid).innerHTML="";
				document.getElementById(ldrid).innerHTML=response;
				alliance_beta_job_auto();
				}else
			{
			document.getElementById(ldrid).innerHTML="";
			document.getElementById(ldrid).innerHTML="<div style=\"width: 360px; margin: 0px auto;\ text-align:center; padding-top: 50px;\"><img src=\"/images/ajax-loader.gif\" width=\"32\" height=\"32\"></div>";
			}	
}
function loader_auto_featr(id,ldid)
{
		ldrid=ldid;
	var url=id;
	http = httpobject();
	http.open('get',url);
	http.onreadystatechange = rloader_auto_featr;		
	http.send(null);
}function rloader_auto_featr()
{
	if(http.readyState == 4)
			{
				var response = http.responseText;
				document.getElementById(ldrid).innerHTML="";
				document.getElementById(ldrid).innerHTML=response;
				//alert("loaded job loading feature");
				ldfeaturedemp_subsub_auto('fwlist','1');
				//ldallianceful_sub_auto();
				}else
			{
			document.getElementById(ldrid).innerHTML="";
			document.getElementById(ldrid).innerHTML="<div style=\"width: 360px; margin: 0px auto;\ text-align:center; padding-top: 50px;\"><img src=\"/images/ajax-loader.gif\" width=\"32\" height=\"32\"></div>";
			}	
}
function loader_auto_announce(id,ldid)
{
	ldrid=ldid;
	var url=id;
	http = httpobject();
	http.open('get',url);
	http.onreadystatechange = rloader_auto_announce;		
	http.send(null);

}function rloader_auto_announce()
{
	if(http.readyState == 4)
			{
				var response = http.responseText;
				document.getElementById(ldrid).innerHTML="";
				document.getElementById(ldrid).innerHTML=response;
				//alert("Loaded Feature . Loading annouce");
				loadAjaxedAnswers_auto('0','1');
				}else
			{
			document.getElementById(ldrid).innerHTML="";
			document.getElementById(ldrid).innerHTML="<div style=\"width: 360px; margin: 0px auto;\ text-align:center; padding-top: 50px;\"><img src=\"/images/ajax-loader.gif\" width=\"32\" height=\"32\"></div>";
			}	
}
function loader_ajax_onload2_auto(id,ldid){
		ldrid=ldid;
		var url=id;
		http = httpobject();
		http.open('get',url);
		http.onreadystatechange = rloader_ajax_onload2_auto;		
		http.send(null);
			}
function rloader_ajax_onload2_auto()
		{
			if(http.readyState == 4)
				{
					var response = http.responseText;
					document.getElementById(ldrid).innerHTML="";
					document.getElementById(ldrid).innerHTML=response;
					ldfeaturedemp_subsub_auto('anlist','2');
					}else
					{
					document.getElementById(ldrid).innerHTML="";
					document.getElementById(ldrid).innerHTML="<div style=\"width: 360px; margin: 0px auto;\ text-align:center; padding-top: 50px;\"><img src=\"/images/ajax-loader.gif\" width=\"32\" height=\"32\"></div>";
					}	

				
		}	
function loader_auto_giveback(id,ldid){
		ldrid=ldid;
		var url=id;
		http = httpobject();
		http.open('get',url);
		http.onreadystatechange = rloader_auto_giveback;		
		http.send(null);
			}
function rloader_auto_giveback()
		{
			if(http.readyState == 4)
				{
					var response = http.responseText;
					document.getElementById(ldrid).innerHTML="";
					document.getElementById(ldrid).innerHTML=response;
					//alert("Loading give back");
					ldfeaturedemp_subsub_auto('tag_list','3');
					}else
					{
					document.getElementById(ldrid).innerHTML="";
					document.getElementById(ldrid).innerHTML="<div style=\"width: 360px; margin: 0px auto;\ text-align:center; padding-top: 50px;\"><img src=\"/images/ajax-loader.gif\" width=\"32\" height=\"32\"></div>";
					}	

				
		}		
function loader_auto_networknews(id,ldid){
		ldrid=ldid;
		var url=id;
		http = httpobject();
		http.open('get',url);
		http.onreadystatechange = rloader_auto_networknews;		
		http.send(null);
			}
function rloader_auto_networknews()
		{
			if(http.readyState == 4)
				{
					var response = http.responseText;
					document.getElementById(ldrid).innerHTML="";
					document.getElementById(ldrid).innerHTML=response;
					//alert("Loaded giveback. Now news");
					ldfeaturedemp_subsub_auto('gbaknews','4');
					}else
					{
					document.getElementById(ldrid).innerHTML="";
					document.getElementById(ldrid).innerHTML="<div style=\"width: 360px; margin: 0px auto;\ text-align:center; padding-top: 50px;\"><img src=\"/images/ajax-loader.gif\" width=\"32\" height=\"32\"></div>";
					}	

				
		}
		function loader_auto_pplathof(id,ldid){
		ldrid=ldid;
		var url=id;
		http = httpobject();
		http.open('get',url);
		http.onreadystatechange = rloader_auto_pplathof;		
		http.send(null);
			}
function rloader_auto_pplathof()
		{
			if(http.readyState == 4)
				{
					var response = http.responseText;
					document.getElementById(ldrid).innerHTML="";
					document.getElementById(ldrid).innerHTML=response;
					//alert("Loaded News. Now Peoplehere");
					ldfeaturedemp_subsub_auto('pplhof','5');
					}else
					{
					document.getElementById(ldrid).innerHTML="";
					document.getElementById(ldrid).innerHTML="<div style=\"width: 360px; margin: 0px auto;\ text-align:center; padding-top: 50px;\"><img src=\"/images/ajax-loader.gif\" width=\"32\" height=\"32\"></div>";
					}	

				
		}
		function loader_auto_tagit(id,ldid){
		ldrid=ldid;
		var url=id;
		http = httpobject();
		http.open('get',url);
		http.onreadystatechange = rloader_auto_tagit;		
		http.send(null);
			}
function rloader_auto_tagit()
		{
			if(http.readyState == 4)
				{
					var response = http.responseText;
					document.getElementById(ldrid).innerHTML="";
					document.getElementById(ldrid).innerHTML=response;
					//alert("Loaded People. Now tag");
					ldfeaturedemp_subsub_auto('tagsali','6');
					}else
					{
					document.getElementById(ldrid).innerHTML="";
					document.getElementById(ldrid).innerHTML="<div style=\"width: 360px; margin: 0px auto;\ text-align:center; padding-top: 50px;\"><img src=\"/images/ajax-loader.gif\" width=\"32\" height=\"32\"></div>";
					}	

				
		}
		function loader_auto_netstats(id,ldid){
		ldrid=ldid;
		var url=id;
		http = httpobject();
		http.open('get',url);
		http.onreadystatechange = rloader_auto_netstats;		
		http.send(null);
			}
function rloader_auto_netstats()
		{
			if(http.readyState == 4)
				{
					var response = http.responseText;
					document.getElementById(ldrid).innerHTML="";
					document.getElementById(ldrid).innerHTML=response;
					//alert("Loaded Tagsnow. Now Netstat");
					ldfeaturedemp_subsub_auto('netstats','7');
					}else
					{
					document.getElementById(ldrid).innerHTML="";
					document.getElementById(ldrid).innerHTML="<div style=\"width: 360px; margin: 0px auto;\ text-align:center; padding-top: 50px;\"><img src=\"/images/ajax-loader.gif\" width=\"32\" height=\"32\"></div>";
					}	

				
		}function loader_auto_industry(id,ldid){
		ldrid=ldid;
		var url=id;
		http = httpobject();
		http.open('get',url);
		http.onreadystatechange = rloader_auto_industry;		
		http.send(null);
			}
function rloader_auto_industry()
		{
			if(http.readyState == 4)
				{
					var response = http.responseText;
					document.getElementById(ldrid).innerHTML="";
					document.getElementById(ldrid).innerHTML=response;
					//alert("Loaded netstat ok. Now industry");
					ldfeaturedemp_subsub_auto('industrymem','8');
					}else
					{
					document.getElementById(ldrid).innerHTML="";
					document.getElementById(ldrid).innerHTML="<div style=\"width: 360px; margin: 0px auto;\ text-align:center; padding-top: 50px;\"><img src=\"/images/ajax-loader.gif\" width=\"32\" height=\"32\"></div>";
					}	

				
		}
		function loader_auto_map(id,ldid){
		ldrid=ldid;
		var url=id;
		http = httpobject();
		http.open('get',url);
		http.onreadystatechange = rloader_auto_map;		
		http.send(null);
			}
function rloader_auto_map()
		{
			if(http.readyState == 4)
				{
					var response = http.responseText;
					document.getElementById(ldrid).innerHTML="";
					alert(response);
					document.getElementById(ldrid).innerHTML=response;
					//alert("Loaded netstat ok. Now industry");
					//loadedMap('4');
					loadAjaxedEvents('0','1')
					}else
					{
					document.getElementById(ldrid).innerHTML="";
					document.getElementById(ldrid).innerHTML="<div style=\"width: 360px; margin: 0px auto;\ text-align:center; padding-top: 50px;\"><img src=\"/images/ajax-loader.gif\" width=\"32\" height=\"32\"></div>";
					}	

				
		}
function loader_ajax_maped(id,ldid){
		ldrid=ldid;
		var url=id;
		http = httpobject();
		http.open('get',url);
		http.onreadystatechange = rloader_ajax_maped;		
		http.send(null);
			}
function rloader_ajax_maped()
		{
			if(http.readyState == 4)
				{
					var response = http.responseText;
					document.getElementById(ldrid).innerHTML="";
					document.getElementById(ldrid).innerHTML=response;
					//alert("Loaded netstat ok. Now industry");
					njobsearchtry('2');	
					//dateslide();
}else
					{
					document.getElementById(ldrid).innerHTML="";
					document.getElementById(ldrid).innerHTML="<div style=\"width: 360px; margin: 0px auto;\ text-align:center; padding-top: 50px;\"><img src=\"/images/ajax-loader.gif\" width=\"32\" height=\"32\"></div>";
					}	

				
		}		
		
function loader_ajax_onload_event(id,ldid){
		ldrid=ldid;
		var url=id;
		http = httpobject();
		http.open('get',url);
		http.onreadystatechange = rloader_ajax_onload_event;		
		http.send(null);
			}
function rloader_ajax_onload_event()
		{
			if(http.readyState == 4)
				{
					var response = http.responseText;
					document.getElementById(ldrid).innerHTML="";
					document.getElementById(ldrid).innerHTML=response;
					//alert("Loaded netstat ok. Now industry");
					//loadedMap('4');
					njobsearchtry('2');
					//dateslide();
}else
					{
					document.getElementById(ldrid).innerHTML="";
					document.getElementById(ldrid).innerHTML="<div style=\"width: 360px; margin: 0px auto;\ text-align:center; padding-top: 50px;\"><img src=\"/images/ajax-loader.gif\" width=\"32\" height=\"32\"></div>";
					}	

				
		}		
				
		
/////////////////////////////////////////End AutoLoad////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
function loadalphabets_mcontacts_ajax(id,ldid){
		ldrid=ldid;
		var url=id;
		http = httpobject();
		http.open('get',url);
		http.onreadystatechange = rloadalphabets_mcontacts_ajax;		
		http.send(null);
			}
function rloadalphabets_mcontacts_ajax()
		{
			if(http.readyState == 4)
				{
					var response = http.responseText;
					document.getElementById(ldrid).innerHTML="";
					document.getElementById(ldrid).innerHTML=response;
					//alert("Loaded netstat ok. Now industry");
					//loadedMap('4');
					//dateslide();
					loadcontents_mcontacts_ajax();
}else
					{
					document.getElementById(ldrid).innerHTML="";
					document.getElementById(ldrid).innerHTML="<div style=\"width: 360px; margin: 0px auto;\ text-align:center; padding-top: 50px;\"><img src=\"/images/ajax-loader.gif\" width=\"32\" height=\"32\"></div>";
					}	

				
		}		
function loader_ajax_loadEndless(id,ldid)
{
		ldrid=ldid;
		var url=id;
		http = httpobject();
		http.open('get',url);
		http.onreadystatechange = rloader_ajax_loadEndless;		
		http.send(null);
}
function rloader_ajax_loadEndless()
{
			if(http.readyState == 4)
				{
					var response = http.responseText;
					document.getElementById(ldrid).innerHTML="";
					document.getElementById(ldrid).innerHTML=response;
					AutoLoadEndless();
					
				}else
					{
					document.getElementById(ldrid).innerHTML="";
					document.getElementById(ldrid).innerHTML="<div style=\"width: 360px; margin: 0px auto;\ text-align:center; padding-top: 50px;\"><img src=\"/images/ajax-loader.gif\" width=\"32\" height=\"32\"></div>";
					}	
	
}
function load_deletedJobs(id,ldid)
{
	ldrid=ldid;
		var url=id;
		http = httpobject();
		http.open('get',url);
		http.onreadystatechange = rload_deletedJobs;		
		http.send(null);
}
function rload_deletedJobs()
{
	if(http.readyState == 4)
				{
					var response = http.responseText;
					document.getElementById(ldrid).innerHTML="";
					document.getElementById(ldrid).innerHTML=response;
					var suc="Your job opportunity has been deleted";
					if(response.indexOf(suc)!=-1)
					{
						document.getElementById('addbutton').style.display="";
						document.getElementById('fullmessage').style.display="none";
						if (document.getElementById('jbid').selectedIndex != -1) {
					document.getElementById('jbid').options[document.getElementById('jbid').selectedIndex] = null
						}

						
					}
					
				}else
					{
					document.getElementById(ldrid).innerHTML="";
					document.getElementById(ldrid).innerHTML="<div style=\"width: 360px; margin: 0px auto;\ text-align:center; padding-top: 50px;\"><img src=\"/images/ajax-loader.gif\" width=\"32\" height=\"32\"></div>";
					}	
}
function loader_ajax_ldeMap(id,ldid)
{
		ldrid=ldid;
		var url=id;
		http = httpobject();
		http.open('get',url);
		http.onreadystatechange = rloader_ajax_ldeMap;		
		http.send(null);	
	
}
function rloader_ajax_ldeMap()
{
			if(http.readyState == 4)
				{
					var response = http.responseText;
					document.getElementById(ldrid).innerHTML="";
					document.getElementById(ldrid).innerHTML=response;
					loadedMap('4');
					
				}else
					{
					document.getElementById(ldrid).innerHTML="";
					document.getElementById(ldrid).innerHTML="<div style=\"width: 360px; margin: 0px auto;\ text-align:center; padding-top: 50px;\"><img src=\"/images/ajax-loader.gif\" width=\"32\" height=\"32\"></div>";
					}	
	
}
				
