function do_search()
{
 document.myform.action="domain.php?action=check_availability";
 document.myform.submit();
}
function do_register()
{
 document.myform.action="domain.php?action=buy";
 document.myform.submit();
}
function log_out(item_count)
{
 ht = document.getElementsByTagName("html");
 ht[0].style.filter = "progid:DXImageTransform.Microsoft.BasicImage(grayscale=1)";
 if(item_count!=0)
 {
  var mess = document.getElementById('signout2').value;
//  var mess = 'You have '+item_count+' item(s) in your shopping cart. All these items will be emptied and you will have to start all over again. Are you sure?';
 }
 else
 {
//  var mess = 'Are you sure you want to signout?';
  var mess = document.getElementById('signout1').value;
 }
 if (confirm(mess))
 {
  return true;
 }
 else
 {
  ht[0].style.filter = "";
  return false;
 }
}
//Function to toggle Div, with Plus/Minus image
function togPlus(objDiv,objImg)
{
	if(document.getElementById(objDiv))
	{
		var myElement = document.getElementById(objDiv);    
		if (myElement.style.display == "none")
		{
      myElement.style.display = "block";
      objImg.src = "images/collapse.gif";
		}
		else
		{
      myElement.style.display = "none";
      objImg.src = "images/expand.gif";
		}
	}
}

function tog(objDiv)
{
	if(document.getElementById(objDiv))    
	{
		var myElement = document.getElementById(objDiv);
		if(myElement.style.display == "none")
		{
			myElement.style.display = "block";
		}
		else
		{
			myElement.style.display = "none";
		}
	}
}


///////////////////////////////////
var tempbutton=null;
function chk_selected(check_selected_err,butt)
{
	var domlength,i,temp,flag;
	domlength=document.myform.domval.length;
	flag=false;
	if(document.myform.domval.checked)
	{
			flag=true;
	}
	for(i=0 ; i<domlength ; i++)
	{
		if(document.myform.domval[i].checked)
		{
			flag=true;
			break;
		}
	}
	if(flag==false)
	{
		/*var check_selected_err = document.getElementById('chk_selected_error');*/
		check_selected_err.style.display = 'block';
		/*window.scrollTo(-100,-1000);*/
		return false;
	}
	if(butt.className=="frmButton-disable")
	{
		return false;
	}
	else
	{
		tempbutton=butt;
	//butt.value="   Processing...  ";
	butt.className="frmButton-disable";
	animLoading();
	document.myform.action="domain.php?action=buy";
	document.myform.submit();	
	}
	/*document.myform.action="domain.php?action=buy";
	checkandsubmit(butt,document.myform);
	/*butt.value='Processing..';
	butt.disabled=true;
	do_register();*/
}
var step=1;
function animLoading()
{
	butt=tempbutton;
	step++;
    if (step == 9) step = 1;

    if (step == 1)
    {
       window.status = 'Processing.   ';
	   butt.value = 'Processing.   ';
    }
    if (step == 2)
    {
          window.status = 'Processing.   ';
		butt.value = 'Processing.   ';
    }
    if (step == 3)
    {
          window.status = 'Processing..  ';
		butt.value= 'Processing..  ';
    }
    if (step == 4)
    {
         window.status = 'Processing..  ';
	   butt.value = 'Processing..  ';
    }
    if (step == 5)
    {
         window.status = 'Processing... ';
	   butt.value = 'Processing... ';
    }
    if (step == 6)
    {
         window.status = 'Processing... ';
	   butt.value = 'Processing... ';
    }
    if (step == 7)
    {
        window.status = 'Processing....';
	  butt.value = 'Processing....';
    }
    if (step == 8)
    {  window.status = 'Processing....';
        butt.value = 'Processing....';
    }
    setTimeout("animLoading()", 200);
}

function round_decimals(original_number, decimals)
	{
		var result1 = original_number * Math.pow(10, decimals)
		var result2 = Math.round(result1)
		var result3 = result2 / Math.pow(10, decimals)
		return pad_with_zeros(result3, decimals)
	}

	function pad_with_zeros(rounded_value, decimal_places)
	{

		// Convert the number to a string
		var value_string = rounded_value.toString()
		
		// Locate the decimal point
		var decimal_location = value_string.indexOf(".")
		
		// Is there a decimal point?
		if (decimal_location == -1) 
	{
		// If no, then all decimal places will be padded with 0s
		decimal_part_length = 0

		// If decimal_places is greater than zero, tack on a decimal point
		value_string += decimal_places > 0 ? "." : ""
	}
	else 
	{
		// If yes, then only the extra decimal places will be padded with 0s
		decimal_part_length = value_string.length - decimal_location - 1
	}
		// Calculate the number of decimal places that need to be padded with 0s
		var pad_total = decimal_places - decimal_part_length
	
	if (pad_total > 0) 
	{
		// Pad the string with 0s
		for (var counter = 1; counter <= pad_total; counter++) 
		value_string += "0"
	}
		return value_string
	}
	
	function chk_button(formname)
	{
		var sub = document.getElementById('sub_button');
		if(formname.agree.checked)
		{
			sub.className='frmButton';
		}
		else
		{
			sub.className='frmButton-disable';
		}
	}

function checkandsubmit(butt,formname)
{
	if(butt.className=="frmButton-disable")
	{
		return false;
	}
	else
	{
		//butt.value="   Processing...  ";
		butt.className="frmButton-disable";
		tempbutton=butt;
		animLoading();
		formname.submit();	
	}
}

function on_mouse_over(butt)
{
	if(butt.className!="frmButton-disable")
		butt.className='frmButton-over';
}
function on_mouse_out(butt)
{
	if(butt.className!="frmButton-disable")
		butt.className='frmButton';
}
//dggdg
function on_mouse_over_secondary(butt)
{
	if(butt.className!="frmButton-disable")
		butt.className='frmButton-secondary-over';
}
function on_mouse_out_secondary(butt)
{
	if(butt.className!="frmButton-disable")
		butt.className='frmButton-secondary';
}

function href_checkandsubmit(butt,form_action)
{
	if(butt.className=="frmButton-disable")
	{
		return false;
	}
	else
	{
	//butt.value="   Processing...  ";
	butt.className="frmButton-disable";
	tempbutton=butt;
	animLoading();
	self.location.href=form_action;
	formname.submit();	
	}
}

function disableselect(e){
if (omitformtags.indexOf(e.target.tagName.toLowerCase())==-1)
return false
}

function reEnable(){
return true
}

if (typeof document.onselectstart!="undefined")
document.onselectstart=new Function ("return false")
else{
document.onmousedown=disableselect
document.onmouseup=reEnable
}
var message="Function Disabled!"; 
  function clickIE() 
    {
    if (document.all) 
      {
      alert(message);
      return false;
      }
    } 
//  function clickNS(e) {
//    if (document.layers||(document.getElementById&&!document.all))  { 
//      if (e.which==2||e.which==3) {
//        alert(message);
//        return false;
//      }
//    }
//  } 
//  if (document.layers) {
//    document.captureEvents(Event.MOUSEDOWN);
//    document.onmousedown=clickNS;
//    } 
//  else  {
//    document.onmouseup=clickNS;
//    document.oncontextmenu=clickIE;
//    } 
//  document.oncontextmenu=new 
//  Function("return false");
