//Ajax check url
var url = "ajax_callback.php?d=";

function chk_me() {
	//Create Temporary message
	var notationS = document.getElementById("results")
	notationS.innerHTML = '<img src="images/please_wait.gif">Please Wait While We Check The Domain Name.....';
	
	//Check domain here	
	var word_value = document.getElementById("domain").value;
	http.open("GET", url + escape(word_value), true);
	http.onreadystatechange = handleHttpResponse;
	http.send(null);
}

 function doClear(theText) 
{
     if (theText.value == theText.defaultValue)
 {
         theText.value = ""
     }
 }

function handleHttpResponse() {
	if (http.readyState == 4) {
    	// Split the comma delimited response into an array
		var domain = document.getElementById("domain").value;
	    var results = http.responseText;
	
		//If domain is valid
		if(results == '0'){
			var is_show = '<font color="#0000FF">Invalid Domain '+domain+' Name.</font>';
		} else {
			if(results == '1'){
				var is_show = '<font color="#00CC00">Domain Name '+domain+' is available.</font>';
			} else {
				var is_show = '<font color="#FF0000">Domain Name '+domain+' is taken.</font>';
			}
		}
		var notationS = document.getElementById("results")
		notationS.innerHTML = is_show;
	}
}

function getHTTPObject() { 
	var xmlhttp;
	/*@cc_on
	@if (@_jscript_version >= 5)
		try {
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
					xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
				} catch (E) {
					xmlhttp = false;
				}
		}
	@else xmlhttp = false;
	@end @*/
	if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
		try {
			xmlhttp = new XMLHttpRequest();
		} catch (e) {
			xmlhttp = false;
		}
	}
	return xmlhttp;
}
var http = getHTTPObject(); // We create the HTTP Object 


// sha2fet ajaxeye
var hand = function(str){
	window.document.getElementById('response_span').innerHTML=str;
}
function validateUsername(user){
	var strDomain='';
	window.document.getElementById('response_span').innerHTML="Validating email address...";
	var ajax = new Ajax();
	ajax.doGet(strDomain+'ajax-check.php?action=validateUsername&email_address='+user,hand,'text');
}


// Flash 
var objects = document.getElementsByTagName("object");

for (var i=0; i<objects.length; i++)

    objects[i].outerHTML = objects[i].outerHTML;
	
//Clear text box
 function doClear(theText) 
{
     if (theText.value == theText.defaultValue)
 {
         theText.value = ""
     }
 }


function change(which) {
   document.getElementById('div1').style.display = 'block';
   document.getElementById('div2').style.display = 'none';
   }
   
 function change2(which2) {
   document.getElementById('div1').style.display = 'none';
   document.getElementById('div2').style.display = 'block';
   }


function confirmDelete(delUrl) {
  if (confirm("Are you sure you want to delete")) {
    document.location = delUrl;
  }
}
