if (navigator.userAgent.indexOf("Firefox") != -1){
	firefox = true;
}
else{
	firefox = false;
}

function create_ajax(){
	if (window.XMLHttpRequest){
		xmlhttp=new XMLHttpRequest();
	}
	else{
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	return xmlhttp;
}

function run_ajax(obj,type,url,vars){
	if (type == "GET"){
		obj.open(type,url+"?"+vars);
		obj.send();
	}
	else{
		obj.open(type,url,true);
		obj.setRequestHeader("Content-type","application/x-www-form-urlencoded");
		obj.send(vars);
	}
}

function newwindow_links(){
	var e = new Array();
	var i;
	e = document.getElementsByTagName("a");
	for(i=0;i<e.length;i++){
		if(e[i].className.indexOf("newwindow") > -1){
			e[i].target="_blank";
		}
	}
}

function dis_click(ds_id,referrer){
	
	ajax = create_ajax();
	
	ajax.onreadystatechange=function(){
		if (ajax.readyState==4 && ajax.status==200){
			response = ajax.responseText;
		}
	}
		
	run_ajax(ajax,"POST","/_ajax/distributor_click.php","ds_id="+ds_id+"&referrer="+referrer);
	
}

function change_pic(img,title){
	
	var theLink = document.getElementById("aPartPic");
	var theImage = document.getElementById("imgPartPic");
	
	theLink.href = "/_assets/parts/images/"+img;
	theLink.title = title;
	
	theImage.src = "/_assets/parts/images/"+img;
	theImage.alt = title;
	
}

function follow_link(element){
	for(i = 0;element.childNodes[i]; i++ ){
	    if(element.childNodes[i].tagName == 'A'){ 
			window.location = element.childNodes[i].href; 
		}
	}
}
