$(document).ready(function() {

	/* BODY FONT */
	$(function(element){
	var fontDetector = new Detector();
	
		if(fontDetector.test('Calibri')){
		$('body, #footerright').css('font-family', 'Calibri').css('font-size', '14px');
		$('h3').css('font-family', 'Calibri').css('font-size', '16px');
		$('.navlegend, .navbuttons, .navbuttons a, .navbuttons span, .caption').css('font-family', 'Calibri').css('font-size', '12px');
		$('#footerleft').css('font-family', 'Calibri').css('font-size', '10px');
		}
	
	});
	
	
	/*PRELOAD IMAGES*/
	function preload(arrayOfImages) {
    $(arrayOfImages).each(function(){
        $('<img/>')[0].src = this;
    });
	}
	
	preload([
		'images/button1_on.png',
		'images/button2_on.png',
		'images/button3_on.png',
		'images/button4_on.png',
		'images/button5_on.png',
		'images/button6_on.png',
		'images/button7_on.png',
		'images/button8_on.png',
		'images/home_business_hvac_on.png',
		'images/hvac_installations_repairs_on.png',
		'images/hvac_satisfied_customers_on.png',
		'images/hvac_eco-friendly_green_on.png',
		'images/tab_contact_on.png',
		'images/tab_billpay_on.png',
		'images/take_our_survey_on.png'
	]);

	
	/*MENU GUI*/
	$(".button").hover(function() {
		if ($(this).attr("src").indexOf("_on") == -1) {
		var newSrc = $(this).attr("src").replace(".png","_on.png");
		$(this).attr("src",newSrc);
		}
	},
	function() {
		if($(this).attr("src").indexOf("_on.png") != -1) {
		var oldSrc = $(this).attr("src").replace("_on.png",".png");
		$(this).attr("src",oldSrc);
		}
	});
	
	
	/*SWITCH GUI*/
	$(".switch").hover(function() {
	$(this).addClass("switchon");					
	},
	function() {
	$(this).removeClass("switchon");
	});
	
	$(".button, .switch").click(function() {
	$(this).blur();	
	});
        
});
