All pastes #563353 Raw Edit

Unnamed

public javascript v1 · immutable
·published 2007-06-13 03:04 UTC
rendered paste body
var query_string, account_num, account_number,disable,disable2;var ajax_timer = null, ajax_timeout = 3000;function initEventHandlers(){	account_num = document.getElementById("account_number");	hitcon = document.getElementById("hits");	disable = document.getElementById("overlay");	disable2 = document.getElementById("overlay2");}function send_data(sessid,add_hits){	disable.style.display = "block";		account_number = account_num.value;	hits = hitcon.innerHTML;	query_string = "account=" + escape(account_number) + "&hits=" + escape(hits) + "&sid=" + sessid;		if (add_hits)	{		disable2.style.display = "block";		query_string += "&add_hits=1"	;	}	if (account_number == "")	{		alert("Please enter your account number");	}	else	{		objAjax = initAjaxObj();		objAjax.open("POST","pointgame.php",true);		objAjax.onreadystatechange = getAjaxData;		objAjax.setRequestHeader('Content-Type','application/x-www-form-urlencoded');		objAjax.send(query_string);			//	ajax_timer = setTimeout(ajax_timed_out, ajax_timeout);				return false;	}}function getAjaxData(){	if (objAjax.readyState == 4 && objAjax.status == 200)	{		var response;		 response = eval(objAjax.responseText);				if(response[0].email)		{			document.getElementById("account_num_container").style.display = 'none';			document.getElementById("email_container").style.display = 'block';			document.getElementById("email").innerHTML = "";			document.getElementById("email").appendChild( document.createTextNode(response[0].email) )			disable.style.display = "none";		}		if (response[0].error)		{			disable.style.display = "none";			alert(response[0].error)		}		if (response[0].redirect)		{			disable.style.display = "none";			window.location = response[0].redirect		}				if (response[0].show_notice)		{			disable.style.display = "none";			alert(response[0].show_notice);			revert();		}	}}function initAjaxObj(){	if (window.XMLHttpRequest)	{		return new XMLHttpRequest();	} else if (window.ActiveXObject) {		return new ActiveXObject("Microsoft.XMLHTTP");	}}function ajax_timed_out(){	return;}function revert(){	document.getElementById('account_num_container').style.display = 'block';	document.getElementById('email_container').style.display = 'none';}window.onload = initEventHandlers;