if(!ajax)	var ajax = new sack();

function closeAlert(){
	if(document.getElementById('ajaxCover'))document.getElementById('ajaxCover').style.display = 'none';
	if(document.getElementById('alertBox'))document.getElementById('alertBox').style.display = 'none';
	if(document.getElementById('default'))document.getElementById('default').style.display = 'block';
}

function callLoadAnim(){
	loadingAnim('','loadballs','&bull;');
}
var intrvl;
function findKey(target,e){
	//var unicode=e.charCode? e.charCode : e.keyCode;
	var keycode;
	if (window.event) keycode = window.event.keyCode;
	else if (e) keycode = e.which;
	else return true;

	if (keycode == 13){
		// action
		initPublic(document.getElementById('pp').value,document.getElementById('sq').value,document.getElementById('t').value,0,document.getElementById('d').value,document.getElementById('myid').value);
		return false;
   }else{
	   return true;
	}
}
function initPublic(pp,sq,t,s,d,myid){
	var cont;
	if(document.getElementById('pubContentSmall'))	cont = document.getElementById('pubContentSmall');
	else if(document.getElementById('pubContent'))	cont = document.getElementById('pubContent');
	else											cont = document.getElementById('default');
	cont.innerHTML = '<br /><h1 id="sTitle" align="center">Loading</h1><p align="center" id="loadballs">&nbsp;</p>';
	loadingAnim('','loadballs','&bull;');
	intrvl = setInterval(callLoadAnim,300);
	ajax.requestFile = 'scripts/ajax_search.php?action=1&pp='+pp+'&sq='+sq+'&t='+t+'&s='+s+'&d='+d+'&myid='+myid;
	ajax.onCompletion = evalResponse;
	ajax.onError = function(){alert('error: data page not found');}
	ajax.runAJAX();
}
function evalResponse(){
	eval(ajax.response);
}