// JavaScript Document
function changevideo (val,b){
	if (b) yt_save(val)
	
}
function yt_check(){
	var image = new Image();
	image.src = "http://youtube.com/favicon.ico";
	image.onload = function(){	yt_save('yes');	};
	image.onerror = function(){ yt_save('no');	};
}
function yt_save(val){	
	var xmlhttp;
	if (window.XMLHttpRequest){ xmlhttp=new XMLHttpRequest();} // code for IE7+, Firefox, Chrome, Opera, Safari	
	else {  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); }// code for IE6, IE5	
	
	xmlhttp.onreadystatechange=function(){
	  if (xmlhttp.readyState==4 && xmlhttp.status==200){
		window.location.reload();
	   }
	}	
	xmlhttp.open("POST","/_includes/aj_routines/main.php",true);
	xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
	xmlhttp.send("Function=set_youtube&val="+escape(val));
}


function lt(id){
	if (id.href){		
		if (id.href.search(/ventrac.com/i)>-1){			
		}else{
			var xmlhttp;
			if (window.XMLHttpRequest){ xmlhttp=new XMLHttpRequest();} // code for IE7+, Firefox, Chrome, Opera, Safari	
			else {  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); }// code for IE6, IE5	
			xmlhttp.open("POST","/_includes/aj_routines/main.php",true);
			xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
			xmlhttp.send("Function=log_external_link&link="+escape(id.href));
		}
	}
}

function lt_debug(id){	
	if (id.href){		
		if (id.href.search(/ventrac.com/i)>-1){
			alert(id.href.search(/ventrac.com/i));	
		}else{
			alert ("sending requestc: "+escape(id.href));
			var xmlhttp;
			if (window.XMLHttpRequest){ xmlhttp=new XMLHttpRequest();} // code for IE7+, Firefox, Chrome, Opera, Safari	
			else {  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); }// code for IE6, IE5	
			xmlhttp.onreadystatechange=function(){
			  if (xmlhttp.readyState==4 && xmlhttp.status==200){
				alert(xmlhttp.responseText);
			   }
			}			
			xmlhttp.open("POST","/_includes/aj_routines/main.php",true);
			xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
			xmlhttp.send("Function=log_external_link&link="+escape(id.href));
		}
	}
}


function trigger_ip_lookup(){
	var xmlhttp;
	if (window.XMLHttpRequest){ xmlhttp=new XMLHttpRequest();} // code for IE7+, Firefox, Chrome, Opera, Safari	
	else {  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); }// code for IE6, IE5	
	xmlhttp.onreadystatechange=function(){
	  if (xmlhttp.readyState==4 && xmlhttp.status==200){
		document.getElementById("head_locator").innerHTML=xmlhttp.responseText;
	   }
	}
	xmlhttp.open("POST","/_includes/aj_routines/main.php",true);
	xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
	xmlhttp.send("Function=LocationFromIP");
}

function refresh_locator_bar(){
	var xmlhttp;
	if (window.XMLHttpRequest){ xmlhttp=new XMLHttpRequest();} // code for IE7+, Firefox, Chrome, Opera, Safari	
	else {  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); }// code for IE6, IE5	
	xmlhttp.onreadystatechange=function(){
	  if (xmlhttp.readyState==4 && xmlhttp.status==200){
		document.getElementById("head_locator").innerHTML=xmlhttp.responseText;
	   }
	}
	xmlhttp.open("POST","/_includes/aj_routines/main.php",true);
	xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
	xmlhttp.send("Function=refresh_locator_bar");
}
