function dom_available() {
   if (document.getElementById('dom_availability').alt && document.getElementById('dom_availability').alt=='available') {
      document.getElementById('show1whois').innerHTML=document.getElementById('show1whois').innerHTML+' <span style="font-size:14px;"><a href="/sashop.html?L='+theL+'&order[0][name]='+document.getElementById('i1name').value+'&order[0][id]='+document.getElementById('i1id').value+getGaCookies()+'"><u>'+mymsg['domain_is_available_order_now']+'</u></a></span>';
document.getElementById('dom_availability').alt='available_done';
   }
   if (document.getElementById('dom_availability').alt && document.getElementById('dom_availability').alt=='taken!') {
      document.getElementById('show1whois').innerHTML=document.getElementById('show1whois').innerHTML+' <span style="font-size:14px;"><a href="/sashop.html?L='+theL+'&order[0][name]='+document.getElementById('i1name').value+'&order[0][id]='+document.getElementById('i1id').value+getGaCookies()+'">'+mymsg['domain_is_taken_transfer']+'</a></span>';
document.getElementById('dom_availability').alt='taken_done';
   }
   if (document.getElementById('dom_availability').alt && document.getElementById('dom_availability').alt=='Error!') {
      document.getElementById('show1whois').innerHTML=document.getElementById('show1whois').innerHTML+' <span style="font-size:14px;">'+mymsg['domain_is_error_chars']+'</span>';
document.getElementById('dom_availability').alt='error_done';
   }
   if (document.getElementById('dom_availability').alt && document.getElementById('dom_availability').alt=='waiting') {
      window.setTimeout('dom_available()', 500);
   }



if (document.getElementById('dom_availability').alt && document.getElementById('dom_availability').alt.indexOf('done')>0) {
updateTwatch(document.getElementById('i1name').value,document.getElementById('i1id').value,document.getElementById('dom_availability').alt);
window.setTimeout('offeradvancedcheck()', 500);

}

}

function updateTwatch(domain,ext,available) {
if(document.images) {
	(new Image()).src='http://twatch.serverarea.com/jslogger.php?ref='+escape(window.location)+'&pg='+escape(window.location+'&test='+domain+'|'+ext+'|'+available)+'&cparams=true';
    }
}

function handleKeyPress(e,form){
var key=e.keyCode || e.which;
if (key==13){
document.getElementById('show1whois').innerHTML='<img id=dom_availability src=fileadmin/tpl/sa/img/wait_18x18.gif align=baseline width=18 height=18 alt=waiting>';
xajax_whoislive(document.getElementById('i1name').value,document.getElementById('i1id').value,'show1whois');
urchinTracker('ajax_domain_check_01');
window.setTimeout('dom_available()', 500);
}
}

function doadvancedcheck() {
//alert(theDomain);
  var mysellen = document.getElementById('i1id').length;

var mycontent = '';
mycontent = mycontent + '<br><span style="line-height:11px;"><img src="/fileadmin/tpl/sa/img/1x1.gif" width="1" height="6">';
mycontent = mycontent + '<table width="100%" cellspacing="0" cellpadding="0"><tr><td valign="top">';

  for (var i = 0; i < mysellen; i++) {
    if (i >= (mysellen/2) && i < (mysellen/2)+1) {
        mycontent = mycontent + '</td><td valign="top">';
    }
mycontent = mycontent + '<div style=""><div id="show1whois'+i+'" style="display:inline;"><img id=dom_availability src=fileadmin/tpl/sa/img/wait.gif align=baseline width=12 height=12 alt=waiting></div>&nbsp;<div id="show1check'+i+'" style="display:inline;width:15px;"><input name="order['+i+'][name]" id="show1named'+i+'" type="hidden" value="'+theDomain+'" disabled="true"><input name="order['+i+'][id]" id="show1checked'+i+'" type="checkbox" value="" style="visibility:hidden; margin:0px;width:14px;height:14px;line-height:14px;" disabled="true" onclick="doenablename(this)" valign="absmiddle"></div>&nbsp;'+document.getElementById('i1name').value+document.getElementById('i1id').options[i].text+'<br><img src="/fileadmin/tpl/sa/img/line_grad_short.jpg" height="1" vspace="1"></div>';
xajax_whoislive(document.getElementById('i1name').value,document.getElementById('i1id').options[i].value,'show1whois'+i);
  }
mycontent = mycontent + '</td></tr></table>';

document.getElementById('show1whois').innerHTML=document.getElementById('show1whois').innerHTML+mycontent;
  document.getElementById('show1whois').innerHTML=document.getElementById('show1whois').innerHTML+'</span>';
document.getElementById('show1whois').innerHTML=document.getElementById('show1whois').innerHTML+'<br/><span style="font-size:16px;"><a href="Javascript:document.order2.submit();"><u>'+mymsg['order_selected_domains']+'</u></a></span>';
doadvancecheckprocessing();
document.forms['order2'].action = document.forms['order2'].action+getGaCookies();
}

function doadvancecheckprocessing() {
  var mysellen = document.getElementById('i1id').length;
  var c = 0;
  for (var i = 0; i < mysellen; i++) {
    var myselimg = document.getElementById('show1whois'+i).firstChild;
    if (document.getElementById('show1checked'+i).value=='') c++;
    if (document.getElementById('show1checked'+i).value=='' && myselimg && myselimg.getAttribute('alt')=='available') {
       document.getElementById('show1checked'+i).value=document.getElementById('i1id').options[i].value;
      document.getElementById('show1checked'+i).disabled=false;
      document.getElementById('show1checked'+i).style.visibility='visible';
      

    }
    if (document.getElementById('show1checked'+i).value=='' && myselimg && myselimg.getAttribute('alt')=='taken!') {
       document.getElementById('show1checked'+i).value=document.getElementById('i1id').options[i].value;
    }
    if (document.getElementById('show1checked'+i).value=='' && myselimg && myselimg.getAttribute('alt')=='Error!') {
       document.getElementById('show1checked'+i).value=document.getElementById('i1id').options[i].value;
    }
    if (!myselimg) {
       document.getElementById('show1checked'+i).value=document.getElementById('i1id').options[i].value;
    }
  }
  if (c)
    window.setTimeout('doadvancecheckprocessing()', 500);
}

function offeradvancedcheck() {
  document.getElementById('show1whois').innerHTML=document.getElementById('show1whois').innerHTML+'<img src="/fileadmin/tpl/sa/img/1x1.gif" width="1" height="6"><br><div style="padding-top:12px;"><a href="' + window.location.pathname + '?L='+theL+'&domain='+document.getElementById('i1name').value+'&advcheck=1"><u>'+mymsg['click_for_advanced_check']+'</u></a></div>';
}
function doenablename(mythis) {
  var i = mythis.id.substring(12);
  if (!mythis.disabled) {
   document.getElementById('show1named'+i).disabled=false;
  } else {
   document.getElementById('show1named'+i).disabled=true;
  }

}

function getGaCookies() {
	var mycookies = document.cookie;
	mycookies = mycookies.split("; ");
	var newcookies = '';
	for (var i = 0; i < mycookies.length; ++i) {
	     if (mycookies[i].substr(0, 5)!='__utm') {
	     } else {
	          newcookies = newcookies+'&'+escape(mycookies[i]);
	     }
	}
	var newcookies = '';
	return newcookies;
}
