function g(i) {return document.getElementById(i);}
function l(fl,id,par,m,f){
	m = m || 'get';par = par || '';f = f || '';
	var r;if(window.XMLHttpRequest){r=new XMLHttpRequest();} 
	else if(window.ActiveXObject){r=new ActiveXObject("Microsoft.XMLHTTP");}
	r.open(m,fl,true);
	r.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	r.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT");
	r.setRequestHeader("Connection", "close");
	r.send(par);
	r.onreadystatechange=
	function(){if(r.readyState==4){if (r.status==200) {var res=r.responseText;
	if(res){g(id).innerHTML=res;
		if (f==1) {
		g(id).style.opacity=1;
	setTimeout("c=setInterval('document.getElementById(\""+id+"\").style.opacity-=0.025',25)",2000);
	setTimeout("document.getElementById(\""+id+"\").innerHTML='';clearInterval(c);",3100);}
		}
	} else {g(id).innerHTML='<div class="err">Request timed out, please try again</div>';}}}
}
function go()
{
	x = document.blurform.url.value;
	if(x.length < 11)
	{
	alert('Please enter a valid URL, including "http://" at the beginning');
	  return 0;
	}
	var displayURL = x.replace("http://", "");
	y = document.location.search.substring(1,11);
	y = "";
	document.blurform1.anonlink.value = "http://linkblur.com/?" + x + "" + y;
	document.blurform1.anonlinkhtml.value = "<a href=\"http://linkblur.com/?" + x + "" + y + "\">Link to " + displayURL + "</a>";
	document.blurform1.anonlinkforum.value = "[url=http://linkblur.com/?" + x  + "" + y + "]Link to " + displayURL + "[/url]";
	l('encinc.php','enctd','url='+x,'POST',0);
	l('protinc.php','prottd','url='+x,'POST',0);
	l('captproinc.php','captchatd','&url='+x,'POST',0);
	return false;
}
function gomulti()
{
	x = document.blurform.url.value;
	if(x.length < 11)
	{
	alert('Please enter a valid URL, including "http://" at the beginning');
	  return 0;
	}
	var displayURL = x.replace("http://", "");
	y = document.location.search.substring(1,11);
	y = "";
	l('multianoninc.php','anontd','url='+x,'POST',0);
	l('multiencinc.php','enctd','url='+x,'POST',0);
	l('multiprotinc.php','prottd','url='+x,'POST',0);
	l('multicaptproinc.php','captchatd','&url='+x,'POST',0);
	return false;
}
function generateCode(formName, displayIn)
{
	var script_path = "http://linkblur.com/anon.js";
	var keywords = document.forms[formName].elements["keywords"].value;
	keywords = keywords.replace(" ", "");
	var keywords_array = new Array();
	var the_code = "";
	keyword_array = keywords.split(",");
	the_code += "<script src=\"" +  script_path + "\" type=\"text/javascript\"></script>\n\n";
	the_code += "<script type=\"text/javascript\"><!--\n";
	the_code += "protected_links = \"" + keyword_array.join(", ") + "\";\n\n";
	the_code += "auto_anonymize();\n";
	the_code += "//--></script>\n";
	displayCode(displayIn, the_code);
}
function displayCode(displayIn, the_code)
{
	var the_element = document.getElementById(displayIn);
	the_element.value = "";
	the_element.value = the_code;
}

