// ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## 
// utility.js

function cleanup() {
	//document.getElementById('prExpressReferral').style.display = 'none';
	var prContents = document.getElementById('prContents')

	if (prContents) {
		var children = document.getElementById('prContents').getElementsByTagName('div');
		for (i = children.length - 1; i > 0 ; i--){
			if (children[i].className == 'prExpressReferral'){
				children[i].style.display = 'none';
				i = 1
			}
		}
	}
}

function hide(layer_ref) {
        if (document.getElementById &&!document.all) {
                hza = document.getElementById(layer_ref);
                hza.style.display = 'none';
        }
}


function returnObjById( id )
{
    if (document.getElementById)
        var returnVar = document.getElementById(id);
    else if (document.all)
        var returnVar = document.all[id];
    else if (document.layers)
        var returnVar = document.layers[id];
    return returnVar;
}

function copyCheckoutAddress(checkbox) {
if (checkbox.checked == true){
checkoutForm = document.getElementById('checkout-form');

checkoutForm.billing_name_first.value = checkoutForm.shipping_name_first.value;
checkoutForm.billing_name_last.value = checkoutForm.shipping_name_last.value;
checkoutForm.billing_company.value = checkoutForm.shipping_company.value;
checkoutForm.billing_address_line_1.value = checkoutForm.shipping_address_line_1.value;
checkoutForm.billing_address_line_2.value = checkoutForm.shipping_address_line_2.value;
checkoutForm.billing_city.value = checkoutForm.shipping_city.value;
checkoutForm.billing_state.value = checkoutForm.shipping_state.value;
checkoutForm.billing_zipcode.value = checkoutForm.shipping_zipcode.value;
checkoutForm.billing_countries_id.value = checkoutForm.shipping_countries_id.value;
checkoutForm.billing_phone.value = checkoutForm.shipping_phone.value;
checkoutForm.billing_fax.value = checkoutForm.shipping_fax.value;
//alert('hello');	
}

} 


function set_password_focus (){
	yes_button = document.getElementById('yesButton');
	yes_button.checked = true;

}

counter = 0;
function clicktrap() {
	counter++;
	if(counter > 1) { return false; }
	return true;
}



/*getRequestTransport
AJAX browser-independent glue routine */
function getRequestTransport(){
        var transport=false;
        try{transport=new ActiveXObject('Msxml2.XMLHTTP');}
        catch(er){transport=false;}

        if(!transport){
        try{transport=new ActiveXObject('Microsoft.XMLHTTP');}
        catch(er){transport=false;}
        }
        if(!transport){
        try{transport=new XMLHttpRequest();}
        catch(er){transport=false;}
        }
        return transport;
};


