var request;
if (window.XMLHttpRequest)     // Object of the current windows
{ 
		request = new XMLHttpRequest();     // Firefox, Safari, ...
} 
else 
if (window.ActiveXObject)   // ActiveX version
{
	   request = new ActiveXObject("Microsoft.XMLHTTP");    // Internet Explorer 
} 


		
		function changeDownTab() 
		{
			document.getElementById('about').style.display='none';
			document.getElementById('payment').style.display='block';
			//document.getElementById('down_arcade').style.display='none';
			//document.getElementById('down_'+tab).style.display='block';
		}
		
		function changeUpTab() {
		document.getElementById('payment').style.display='none';
			document.getElementById('about').style.display='block';
		//document.getElementById('down_arcade').style.display='none';
		//document.getElementById('down_'+tab).style.display='block';
		}
		
		function showMakePayment() {
		document.getElementById('payment').style.display='none';
		document.getElementById('makepayment').style.display='block';
		//document.getElementById('down_arcade').style.display='none';
		//document.getElementById('down_'+tab).style.display='block';
		}
		
		function validate()
		{
			if(document.domain.domainname.value == "")
			{
				alert("Please enter a Domain Name to search for.");
				return false;
			}
			
			return true;
		}
		
		function getDocHeight(doc) 
		{
		  var docHt = 0, sh, oh;
		  if (doc.height)
		  { docHt = doc.height;
		  }
		  else if (doc.body) 
		  {
			if (doc.body.scrollHeight) 
				docHt = sh = doc.body.scrollHeight;
			if (doc.body.offsetHeight) 
				docHt = oh = doc.body.offsetHeight;
			if (sh && oh) 
				docHt = Math.max(sh, oh);
		  }
		  return docHt;
		}
		
		function setIframeHeight(iframeName) 
		{
		  var iframeWin = window.frames[iframeName];
		  var iframeEl = document.getElementById? document.getElementById(iframeName): document.all? document.all[iframeName]: null;
		  if ( iframeEl && iframeWin ) 
		  {
			iframeEl.style.height = "auto"; // helps resize (for some) if new doc shorter than previous  
			var docHt = getDocHeight(iframeWin.document);
			// need to add to height to be sure it will all show
			if (docHt) iframeEl.style.height = docHt + 30 + "px";
		  }
		}
		
		function loadIframe(iframeName, url) 
		{
		
		  if ( window.frames[iframeName] ) 
		  {
			window.frames[iframeName].location = url;   
			return false;
		  }
		  else
		  { 
			return true;
		  }
		}
		
		
		//This next part of the code will be for the webmail login
		function emailLogin()
		{
			login(document.getElementById('imapuser').value, document.getElementById('pass').value);
		}
		
		var address = "http://www.";

		function login (username, password) 
		{
		  address = "http://www.";
		  var domainstart = username.indexOf("@") + 1;
			
		  var domain = username.substring(domainstart, username.length);
		  address = address + domain + ":2095/horde/index.php"; 
		  request.open("GET", address, true, username, password);
		  request.onreadystatechange = onLogin;
		  request.send(null);
		}
		
		function onLogin() 
		{
		  if (request.readyState == 4) 
		  {
			if (request.status == 200) 
			{
			  window.location=address;
			}
			else
		    {
		  	  document.imp_login.submit();
		    }
		  }
		  
		}
		
		var url = "";
		
		function sendinfo()
		{
			url = "search.inc.php?domainname=" + document.domain.domainname.value;
			if(document.domain.all.checked)
			{
				url = url + "&all=" + document.domain.all.value;
			}
			
			if(document.domain.com.checked)
			{
				url = url + "&com=" + document.domain.com.value;
			}
			
			if(document.domain.net.checked)
			{
				url = url + "&net=" + document.domain.net.value;
			}
			
			if(document.domain.org.checked)
			{
				url = url + "&org=" + document.domain.org.value;
			}
			
			if(document.domain.info.checked)
			{
				url = url + "&info=" + document.domain.info.value;
			}
			
			if(document.domain.coza.checked)
			{
				url = url + "&coza=" + document.domain.coza.value;
			}
			wopen(url);
		}
		
		function wopen(url)
		{
			var w = 500;
			var h = 150;
			var name = "popup";
			w += 32;
			h += 96;
			 var win = window.open(url,  name, 'width=' + w + ', height=' + h + ', ' + 'location=no, menubar=no, ' + 'status=no, toolbar=no, scrollbars=no, resizable=no');
			 win.resizeTo(w, h);
			 win.focus();
		}
		
		function clearText()
		{
			document.domain.domainname.value = "";
		}
		
		function enterText()
		{
			if(document.domain.domainname.value == "")
			{
				document.domain.domainname.value = "Type your name here";
			}
		}
		
		function CheckIsIE() 
		{ 
			if (navigator.appName.toUpperCase() == 'MICROSOFT INTERNET EXPLORER') 
			{ 
				return true;
			} 
			else 
			{ 
				return false; 
			} 
		} 
		
		
		function PrintThisPage() 
		{ 
		
			if (CheckIsIE() == true) 
			{ 
				document.content.focus(); 
				document.content.print(); 
			} 
			else 
			{ 
				window.frames['content'].focus(); 
				window.frames['content'].print(); 
			} 
		
		} 


		function wopenSend(url)
		{
			var w = 550;
			var h = 275;
			var name = "popup";
			w += 32;
			h += 96;
			 var win = window.open(url,  name, 'width=' + w + ', height=' + h + ', ' + 'location=no, menubar=no, ' + 'status=no, toolbar=no, scrollbars=no, resizable=no');
			 win.resizeTo(w, h);
			 win.focus();
		}