// JavaScript Document
function show_form(){
	document.getElementById("tip_form_holder").style.display='block';
	document.getElementById("free").style.display='none';
	return;
}
function hold(){
	return;
}
function pull(){
	var name;
	var email;
	email = document.getElementById("tip_email").value;
	name = document.getElementById("tip_name").value;			
	validate__(name,email);
	return;
}
function kill(){
	document.getElementById("tip_form_holder").style.display='none';
	document.getElementById("free").style.display='block';
}
function validate__(this_,that){
	if ((this_=="")){
		alert("Please type in your name!");
	}
	else{
		if ((that=="")){
			alert("Please type in your email address!");
		}
		else if (that.indexOf("@",1)==-1){
			alert("Please enter a valid email address.");
		}
		else if (that.indexOf(".",3)==-1){
			alert("Please enter a valid email address.");
		}
		else{
			if(rocket(this_,that)!=false){
				document.getElementById("tip_form").submit();
			}
			else{
				alert("something's wrong");
			}
		}
	}
	return;
}
function rocket(id,idd){
	xmlHttp00=GetXmlHttpObject();
	if (xmlHttp00==null){
		alert ("Your browser does not support AJAX!");
		return;
	}
	url = "scripts/placement.php";
	url = url + "?id=" + id;
	url = url + "&idd=" + idd;
	url= url + "&sid=" + Math.random();
	xmlHttp00.open("Get",url,false);
	xmlHttp00.send(null);
	var style_ = xmlHttp00.responseText;
	if (style_=="no"){
		return false;
	}else{
		document.getElementById("tip_form").action=style_;
		return true;	
	}
}
function GetXmlHttpObject(){
	var xmlHttp=null;
	try{
		xmlHttp=new XMLHttpRequest();
	}
	catch (e){
  		try{
    		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    	}
  		catch (e){
    		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    	}
	}
	return xmlHttp;
}
