var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
 try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
  try {
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (E) {
   xmlhttp = false;
  }
 }
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	try {
		xmlhttp = new XMLHttpRequest();
	} catch (e) {
		xmlhttp=false;
	}
}
if (!xmlhttp && window.createRequest) {
	try {
		xmlhttp = window.createRequest();
	} catch (e) {
		xmlhttp=false;
	}
}

function FetchPage2(domain,ref)
 {
	document.getElementById('domain'+ref).innerHTML='Checking' 
	document.getElementById('domain'+ref).style.display='block'
    document.getElementById('whois'+ref).style.display='block'
    document.getElementById('hide'+ref).style.display='block'
    document.getElementById('expand'+ref).style.display='none'
 }

/*	window.setTimeout('FetchPage2()',1) */


function FetchPage(domain,ref) {
/* alert('tag = ' + domain + ' - ' + ref); */
xmlhttp.open("GET", "http://www.dailydomain.co.uk/whois.php?domain="+domain,true);
 xmlhttp.onreadystatechange=function() {
  if (xmlhttp.readyState==4) {
   if (xmlhttp.responseText.indexOf('This domain name has not been registered') !=-1)
   {
      var wdate = xmlhttp.responseText.substr(xmlhttp.responseText.indexOf('lookup made at ')+13);
      var wdate = wdate.substr(2,wdate.indexOf('--')-8);
      document.getElementById('hide'+ref).style.display='block'
      document.getElementById('domain'+ref).innerHTML='<b>Available </b>'+wdate
      document.getElementById('domain'+ref).style.display='block'
      document.getElementById('expand'+ref).style.display='none'
      document.getElementById('whois'+ref).innerHTML=xmlhttp.responseText
      document.getElementById('whois'+ref).style.display='block'
   }
   else
   {
      var wdate = xmlhttp.responseText.substr(xmlhttp.responseText.indexOf('lookup made at ')+13);
      var wdate = wdate.substr(2,wdate.indexOf('--')-8);
      document.getElementById('hide'+ref).style.display='block'
      document.getElementById('domain'+ref).innerHTML='<b>Not available </b>'+wdate
      document.getElementById('domain'+ref).style.display='block'
      document.getElementById('expand'+ref).style.display='none'
      document.getElementById('whois'+ref).innerHTML=xmlhttp.responseText
      document.getElementById('whois'+ref).style.display='block'
   }
  } else {
	document.getElementById('domain'+ref).innerHTML=
			'<table>' +
				'<tr>' +
					'<td valign=middle style="color:#006699;">' +
						'PLEASE WAIT' +
					'</td>' +
					'<td valign=middle>' +
						'<object type="application/x-shockwave-flash" data="http://www.dailydomain.co.uk/img/throbber-bars1.swf" width="40" height="40">' +
							'<param name="movie" value="http://www.dailydomain.co.uk/img/throbber-bars1.swf" />' +
							'<param name="BGCOLOR" value="#ffffff" />' +
							'<param name="wmode" value="transparent" />' +
						'</object>' +
					'</td>' +
				'</tr>' +
			'</table>';
	document.getElementById('domain'+ref).style.display='block'
    document.getElementById('whois'+ref).style.display='block'
    document.getElementById('hide'+ref).style.display='block'
    document.getElementById('expand'+ref).style.display='none'  
  }
 }
 xmlhttp.send(null)
}

function rez(ref) {
   document.getElementById('domain'+ref).style.display='none'
   document.getElementById('expand'+ref).style.display='block'
   document.getElementById('hide'+ref).style.display='none'
   document.getElementById('whois'+ref).style.display='none'
}

// ****************************************************************************************
// ***
// *** 
// ****************************************************************************************

function ajaxload(passdata) {
xmlhttp.onreadystatechange=alertContents;
xmlhttp.open("GET", "http://www.dailydomain.co.uk/sql.php?"+passdata, true);
xmlhttp.send(null)
}


function ajaxload2(passdata) {
xmlhttp.onreadystatechange=alertContents;
xmlhttp.open("GET", "http://www.dailydomain.co.uk/sql_search.php?"+passdata, true);
xmlhttp.send(null)
}



function alertContents() {
	if (xmlhttp.readyState==4) {
		document.getElementById('ajaxspan').innerHTML=xmlhttp.responseText;
	} else {
	document.getElementById('ajaxspan').innerHTML=
		'<table>' +
			'<tr>' +
				'<td valign=middle style="color:#006699;">' +
					'Searching domains<br /><br />PLEASE WAIT' +
				'</td>' +
				'<td valign=middle>' +
					'<object type="application/x-shockwave-flash" data="http://www.dailydomain.co.uk/img/throbber-bars1.swf" width="40" height="40">' +
						'<param name="movie" value="http://www.dailydomain.co.uk/img/throbber-bars1.swf" />' +
						'<param name="BGCOLOR" value="#ffffff" />' +
						'<param name="wmode" value="transparent" />' +
					'</object>' +
				'</td>' +
			'</tr>' +
		'</table>';
	}
}


