function setStyle(myStyle) {
	if (myStyle == "loft"){ // loft
		$("#header").css("background-image" , "url(/wp-content/themes/oakhall-child/css/i/bg-header-loft.png)");
		$("#acorn").css("background-image" , "url(/wp-content/themes/oakhall-child/css/i/acorn-loft.png)");			
		$("#footer").css("background" , "url(/wp-content/themes/oakhall-child/css/i/bg-footer-loft.jpg) center -7px");
		$("body").addClass('loft');
		$("body").removeClass('leather');
		$("body").removeClass('suit');
		$("body").removeClass('wool');
		$("body").removeClass('wood');
		$("#styles a").removeClass('on');
		$("#loft").addClass('on');
	} 	
	if (myStyle == "leather"){ // leather
		$("#header").css("background-image" , "url(/wp-content/themes/oakhall-child/css/i/bg-header-leather.png)");
		$("#acorn").css("background-image" , "url(/wp-content/themes/oakhall-child/css/i/acorn-leather.png)");			
		$("#footer").css("background" , "url(/wp-content/themes/oakhall-child/css/i/bg-footer-leather.jpg) repeat center -8px");
		$("body").removeClass('loft');
		$("body").addClass('leather');
		$("body").removeClass('suit');
		$("body").removeClass('wool');
		$("body").removeClass('wood');
		$("#styles a").removeClass('on');
		$("#leather").addClass('on');
	}
	if (myStyle == "suit"){ // suit
		$("#header").css("background-image" , "url(/wp-content/themes/oakhall-child/css/i/bg-header-suit.png)");
		$("#acorn").css("background-image" , "url(/wp-content/themes/oakhall-child/css/i/acorn-suit.png)");			
		$("#footer").css("background" , "url(/wp-content/themes/oakhall-child/css/i/bg-footer-suit.jpg) repeat center -12px");
		$("body").removeClass('loft');
		$("body").removeClass('leather');
		$("body").addClass('suit');
		$("body").removeClass('wool');
		$("body").removeClass('wood');
		$("#styles a").removeClass('on');
		$("#suit").addClass('on');
	}
	if (myStyle == "wool"){ // wool
		$("#header").css("background-image" , "url(/wp-content/themes/oakhall-child/css/i/bg-header-wool.png)");
		$("#acorn").css("background-image" , "url(/wp-content/themes/oakhall-child/css/i/acorn-loft.png)");			
		$("#footer").css("background" , "url(/wp-content/themes/oakhall-child/css/i/bg-footer-wool.jpg) repeat center 0px");
		$("body").removeClass('loft');
		$("body").removeClass('leather');
		$("body").removeClass('suit');
		$("body").addClass('wool');
		$("body").removeClass('wood');
		$("#styles a").removeClass('on');
		$("#wool").addClass('on');
	}
	if (myStyle == "wood"){ // wood
		$("#header").css("background-image" , "url(/wp-content/themes/oakhall-child/css/i/bg-header-wood.png)");
		$("#acorn").css("background-image" , "url(/wp-content/themes/oakhall-child/css/i/acorn-wood.png)");			
		$("#footer").css('background' , 'url(/wp-content/themes/oakhall-child/css/i/bg-footer-wood.jpg) repeat center 0px');
		$("body").removeClass('loft');
		$("body").removeClass('leather');
		$("body").removeClass('suit');
		$("body").removeClass('wool');
		$("body").addClass('wood');
		$("#styles a").removeClass('on');
		$("#wood").addClass('on');
	}
	else{  // loft
		 
	}
}

    function setCookie(choosenStyle) {  
    	// javascript set
    	$.cookie('style', null); 			// clear cookie
    	$.cookie('style', choosenStyle, { expires: 365 }); 	// set cookie		
    }		


$(document).ready(function() {
		// stylesheet setup
		var headID = document.getElementsByTagName("head")[0];		   
		var cssNode = document.createElement('link');
		cssNode.type = 'text/css';
		cssNode.rel = 'stylesheet';
	  	
	    var style_color = $.cookie('style');
	    if (style_color != undefined) {
	    	cssNode.href = '/wp-content/themes/oakhall-child/css/' + style_color + '.css';		
	    } else {
	    	cssNode.href = '/wp-content/themes/oakhall-child/css/loft.css';
	    	style_color = "loft";
	    }			
	    cssNode.media = 'screen';
	    headID.appendChild(cssNode);
	// set style for the image src.  Not required unless you are setting an image dynamically, like we do here.
	    setStyle(style_color);
	
	// click actions
	
	$("#loft").click(function()
	{
    	setStyle("loft");
		setCookie("loft");
		$('#styles a').removeClass('on');
		$(this).addClass('on');
	});

	$("#leather").click(function()
	{
    	setStyle("leather");
		setCookie("leather");
		$('#styles a').removeClass('on');
		$(this).addClass('on');
	});

	$("#suit").click(function()
	{
    	setStyle("suit");
		setCookie("suit");
		$('#styles a').removeClass('on');
		$(this).addClass('on');
	});

	$("#wool").click(function()
	{
    	setStyle("wool");
		setCookie("wool");
		$('#styles a').removeClass('on');
		$(this).addClass('on');
	});
	
	$("#wood").click(function()
	{
    	setStyle("wood");
		setCookie("wood");
		$('#styles a').removeClass('on');
		$(this).addClass('on');
	});

});
