function externalLinks() {
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") &&
       anchor.getAttribute("rel") == "external")
     anchor.target = "_blank";
 }
}
/*window.onbeforeunload = leavePage; */
var click=0;
window.onload = externalLinks;
function clickto(){
	click=1;
	return false;
}

function leavePage(){
	if(click==0){
		click=1;
/*		location.href = "http://jbeta.treasuretrooper.com/signup-redirect"; */
alert("Don't go yet! We're so sure you'll enjoy TreasureTrooper, that we'll start you off with a $3 BONUS in your account! Hit CANCEL to take advantage of this offer!"); location.href = "http://www.treasuretrooper.com/signup-redirect"; return "Don't go yet! We're so sure you'll enjoy TreasureTrooper, that we'll start you off with a $3 BONUS in your account! Hit CANCEL to take advantage of this offer!"; 
		return("Don't go yet! We're so sure you'll enjoy TreasureTrooper, that we'll start you off with a $3 BONUS in your account! Hit CANCEL to take advantage of this offer!");
	}
}
function makerequestshoutbox(object) {
	
	if ( window.ActiveXObject ) {
		eval(object = new ActiveXObject("Msxml2.XMLHTTP"));
	}
	else {
		eval(object = new XMLHttpRequest());
	}
	eval(object).open("GET", 'http://www.treasuretrooper.com/ajax/shoutbox?key=' + window.shoutkey + '&amount=' + window.amount, true);
	eval(object).setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
	eval(object).onreadystatechange = function() {
		if ( eval(object).readyState == 4 && eval(object).status == 200 ) {
			if ( eval(object).responseText != 'NO' ) {
				stringtot = eval(object).responseText;
				//var newDiv = document.createElement("p");
				try { 
				document.getElementById('rightshout').innerHTML = stringtot;
				}
				catch(e) {
				document.getElementById('rightshouthome').innerHTML = stringtot;
				}
				//newDiv.innerHTML = stringtot[1];
				//document.getElementById('rightshout').appendChild(newDiv,document.getElementById('rightshout').firstChild);
				setTimeout("makerequestshoutbox('shoutme')",30000);
				externalLinks();
			}
			else { 
				setTimeout("makerequestshoutbox('shoutme')",5000);
			}
		}
		else if ( eval(object).readyState == 4 ) { }
	}
	eval(object).send();
}
function makerequestearns(object) {
	
	if ( window.ActiveXObject ) {
		eval(object = new ActiveXObject("Msxml2.XMLHTTP"));
	}
	else {
		eval(object = new XMLHttpRequest());
	}
	eval(object).open("GET", 'http://www.treasuretrooper.com/ajax/total_earnings', true);
	eval(object).setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
	eval(object).onreadystatechange = function() {
		if ( eval(object).readyState == 4 && eval(object).status == 200 ) {
			if ( eval(object).responseText != 'NO' ) {
				stringtot = eval(object).responseText;
				//var newDiv = document.createElement("p");
				try { 
				move_earned(stringtot);
				}
				catch(e) {
				move_earned(stringtot);
				}
				//newDiv.innerHTML = stringtot[1];
				//document.getElementById('rightshout').appendChild(newDiv,document.getElementById('rightshout').firstChild);
				setTimeout("makerequestearns('shoutme')",10000);
			}
			else { 
				setTimeout("makerequestearns('shoutme')",10000);
			}
		}
		else if ( eval(object).readyState == 4 ) { }
	}
	eval(object).send();
}
function clearpass() {
	if ( document.getElementById('passwordpl').value == 'Password' ) { 
		document.getElementById('passwordpl').style.display = 'none';
		document.getElementById('password').style.display = 'inline';
		document.getElementById('password').focus();
		document.getElementById('password').style.color = '#000000';
	}
}
function clearemail() {
	if ( document.getElementById('email').value == 'E-Mail' ) { 
		document.getElementById('email').value = '';
		document.getElementById('email').style.color = '#000000';
	}
}
function unclearpass() {
	if ( document.getElementById('password').value == '' ) { 
		document.getElementById('passwordpl').value = 'Password';
		document.getElementById('passwordpl').style.color = '#999999';
		document.getElementById('passwordpl').style.display = 'inline';
		document.getElementById('password').style.display = 'none';

	}
}
function unclearemail() {
	if ( document.getElementById('email').value == '' ) { 
		document.getElementById('email').value = 'E-Mail';
		document.getElementById('email').style.color = '#999999';
	}
}
setTimeout("makerequestshoutbox('shoutme')",5000);


