function positionairplane(){
		if(!document.getElementById) return false;
		if(!document.getElementById("airplane")) return false;
		var elem = document.getElementById("airplane");
		var docWidth = window.screen.width + "px";
		elem.style.position = "fixed";
		elem.style.left = docWidth;
		elem.style.bottom = "400px";
		elem.style.display = "block";
	}
	
	function moveElement(elementID, final_x, final_y, interval, speed){
		if(!document.getElementById) return false;
		if(!document.getElementById(elementID)) return false;
		var elem = document.getElementById(elementID);
		var xpos = parseInt(elem.style.left);
		var ypos = parseInt(elem.style.bottom);
		if(xpos == final_x && ypos ==final_y){
			return true;
		}
		if(xpos<final_x){
			xpos+=speed;
		}
		if(xpos>final_x){
			xpos-=speed;
		}
		if(ypos<final_y){
			ypos+=speed;
		}
		if(ypos>final_y){
			ypos-=speed;
		}
		elem.style.left = xpos + "px";
		elem.style.bottom = ypos + "px";
		var repeat = "moveElement('"+elementID+"',"+final_x+","+final_y+","+interval+","+speed+")";
		movement = setTimeout(repeat,interval);
	}
	
	function valComment(){
		var userEmail = document.frm.email.value;
		var atLoc = userEmail.indexOf("@",1);
		var dotLoc = userEmail.indexOf(".",atLoc+2);
		var len = userEmail.length;
		if(!document.frm.name.value){
			alert("Please enter your name.");
			document.frm.name.focus();
			return false;
		}else if((atLoc<=0)||(dotLoc<=0)||(len<dotLoc+2)){
			alert("Please enter a valid email address.");
			document.frm.email.focus();
			return false;
		}else if(!document.frm.comment.value){
			alert("Please enter your comment.");
			document.frm.comment.focus();
			return false;
		}else{
			return true;
		}
	}
	
	//ajax instance
	function getHTTPObject(){
		var xhr=false;
		if(window.XMLHttpRequest){
			xhr = new XMLHttpRequest();
		}else if(window.ActiveXObject){
			try{
				xhr = new ActiveXObject("Msxml2.XMLHTTP");
			}catch(e){
				try{
					xhr = new ActiveXObject("Microsoft.XMLHttp");
				}catch(e){
					xhr = false;
				}
			}
		}
		return xhr;
	}
	
	//sends data from form
	function sendData(data){
		var request = getHTTPObject();
		if(request){
			displayLoading(document.getElementById("contactform"));
			request.onreadystatechange = function(){
				parseResponse(request);
			};
			request.open("POST","contactlogic.asp",true);
			request.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
			request.send(data);
			return true;
		}else{
			return false;
		}
	}
	
	//prepares to form to send data
	function prepareForm(){
		if(!document.getElementById){
			return;
		}
		if(!document.getElementById("frm")){
			return;
		}
		document.getElementById("frm").onsubmit = function(){
			var data = "";
			for(var i = 0;i<this.elements.length;i++){
				data+= this.elements[i].name;
				data+= "=";
				data+= escape(this.elements[i].value);
				data+= "&";
			}
			return !sendData(data);
		};
	}
	
	function addLoadEvent(func){
		var oldonload = window.onload;
		if(typeof window.onload != 'function'){
			window.onload = func;
		}else{
			window.onload = function(){
				if(oldonload){
					oldonload();
				}
				func();
			}
		}
	}
	
	addLoadEvent(positionairplane);
