 $(document).ready(function(){
 
 // rounded corners
 
 $(".left_nav ul li:first-child").corner("8px cc:#fff top");
 $(".left_nav ul li:last-child").corner("8px cc:#fff bottom");
 //$(".desc_wrapper").corner("8px cc:#fff top");
 $(".image").corner("8px keep");
 $(".order_form_btm").corner("8px keep cc:#fff bl");
 $(".contact_ad_wrapper").corner("8px cc:#fff bottom");
 
 // sub nav animation
 /*
    $("#main_nav li").hover(function () {

		$("#sub_nav ul").css("display","none");
	
		var main_nav_el = this.id;
		var idArr = main_nav_el.split("_");
		var dropdown_id = "dropdown_" + idArr[3];

		if(document.getElementById(dropdown_id)){
		dropdown_id = document.getElementById(dropdown_id);
		$(dropdown_id).css("display","block");
		}
    });
*/

// faq animation


if(document.getElementById("faq_content")){

	$("#faq_content .faq").css("display","none");
	$("#faq_content h3").css("cursor","pointer");
	
	$("#faq_content h3").click(function(){
	
	var h3_id = $(this).attr("id");
	var id = h3_id.split("_");
	var faq_div = "#a_" + id[1];
	$(faq_div).slideToggle("slow");
	
	});
	
}
 
 });
 
 function changeFluidsOption(option_to_product_id, option_value_id, option_name_id, product_id){

var el_id = 'option_' + option_name_id + '_' + product_id;
var oil_only_el = 'oil_only_' + product_id;
var all_fluids_el = 'all_fluids_' + product_id;
document.getElementById(el_id).value = option_to_product_id;

if(option_value_id == '1'){
document.getElementById(oil_only_el).src = document.getElementById(oil_only_el).src.replace(/_off.png/,"_on.png");
document.getElementById(all_fluids_el).src = document.getElementById(all_fluids_el).src.replace(/_on.png/,"_off.png");
}

if(option_value_id == '2'){
document.getElementById(oil_only_el).src = document.getElementById(oil_only_el).src.replace(/_on.png/,"_off.png");
document.getElementById(all_fluids_el).src = document.getElementById(all_fluids_el).src.replace(/_off.png/,"_on.png");
}

}

function disable_billing_address(){

if(document.getElementById('billing_address').checked == true){

document.getElementById('billing_title').disabled = true;
document.getElementById('billing_name').disabled = true;
document.getElementById('billing_address_l1').disabled = true;
document.getElementById('billing_address_l2').disabled = true;
document.getElementById('billing_address_l3').disabled = true;
document.getElementById('billing_post_code').disabled = true;
document.getElementById('billing_country').disabled = true;
document.getElementById('billing_telephone').disabled = true;

document.getElementById('billing_title').value = document.getElementById('delivery_title').value;
document.getElementById('billing_name').value = document.getElementById('delivery_name').value;
document.getElementById('billing_address_l1').value = document.getElementById('delivery_address_l1').value;
document.getElementById('billing_address_l2').value = document.getElementById('delivery_address_l2').value;
document.getElementById('billing_address_l3').value = document.getElementById('delivery_address_l3').value;
document.getElementById('billing_post_code').value = document.getElementById('delivery_post_code').value;
document.getElementById('billing_country').value = document.getElementById('delivery_country').value;
document.getElementById('billing_telephone').value = document.getElementById('delivery_telephone').value;

}

else{

document.getElementById('billing_title').disabled = false;
document.getElementById('billing_name').disabled = false;
document.getElementById('billing_address_l1').disabled = false;
document.getElementById('billing_address_l2').disabled = false;
document.getElementById('billing_address_l3').disabled = false;
document.getElementById('billing_post_code').disabled = false;
document.getElementById('billing_country').disabled = false;
document.getElementById('billing_telephone').disabled = false;

}

}

sfHover = function() {
	var sfEls = document.getElementById("sub_nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

