function setColorSwiter(){
	var localhost = 'http://www2.mediosaustrales.cl/wp-content/themes/maus2010_1/wp-creator/view/css/';

	switch(jQuery.cookie("mausColorSwiterCookie")){
		case 'color_grey':
			jQuery('#switchColorGrey').parent().parent().children('.selected').removeClass('selected');
			jQuery('#switchColorGrey').parent().addClass('selected');
			jQuery('#cssColors').attr('href', localhost+"colors/color_grey.css");
			break;
		case 'color_lightblue':
			jQuery('#switchColorBlue').parent().parent().children('.selected').removeClass('selected');
			jQuery('#switchColorBlue').parent().addClass('selected');
			jQuery('#cssColors').attr('href', localhost+"colors/color_lightblue.css");
			break;
			
		case 'color_turquoise':
	    	jQuery('#switchColorTurquoise').parent().parent().children('.selected').removeClass('selected');
	    	jQuery('#switchColorTurquoise').parent().addClass('selected');
	    	jQuery('#cssColors').attr('href', localhost+"colors/color_turquoise.css");
	    	break;
	    
		case 'color_green':
	    	jQuery('#switchColorGreen').parent().parent().children('.selected').removeClass('selected');
	    	jQuery('#switchColorGreen').parent().addClass('selected');
	    	jQuery('#cssColors').attr('href', localhost+"colors/color_green.css");
	    	break;
	    
	    case 'color_orange':
	    	jQuery('#switchColorOrange').parent().parent().children('.selected').removeClass('selected');
	    	jQuery('#switchColorOrange').parent().addClass('selected');
	    	jQuery('#cssColors').attr('href', localhost+"colors/color_orange.css");
	    	break;
	    
	    case 'color_pink':
	    	jQuery('#switchColorPink').parent().parent().children('.selected').removeClass('selected');
	    	jQuery('#switchColorPink').parent().addClass('selected');
	    	jQuery('#cssColors').attr('href', localhost+"colors/color_pink.css");
	    	break;
	    
	    case 'color_violet':
	    	jQuery('#switchColorViolet').parent().parent().children('.selected').removeClass('selected');
	    	jQuery('#switchColorViolet').parent().addClass('selected');
	    	jQuery('#cssColors').attr('href', localhost+"colors/color_violet.css");
	    	break;
	    default:
	    	jQuery('#switchColorGrey').parent().parent().children('.selected').removeClass('selected');
			jQuery('#switchColorGrey').parent().addClass('selected');
			jQuery('#cssColors').attr('href', localhost+"colors/color_grey.css");
			setColorSwiterCookie('color_grey');
	    	break;
	}

    jQuery('#switchColorGrey').click(function(){
    	jQuery(this).parent().parent().children('.selected').removeClass('selected');
    	jQuery(this).parent().addClass('selected');
    	jQuery('#cssColors').attr('href', localhost+"colors/color_grey.css");
    	setColorSwiterCookie('color_grey');    	
		return false;
    });
    
    jQuery('#switchColorBlue').click(function(){
    	jQuery(this).parent().parent().children('.selected').removeClass('selected');
    	jQuery(this).parent().addClass('selected');
    	jQuery('#cssColors').attr('href', localhost+"colors/color_lightblue.css");
    	setColorSwiterCookie('color_lightblue');
		return false;
    });
    
    jQuery('#switchColorTurquoise').click(function(){
    	jQuery(this).parent().parent().children('.selected').removeClass('selected');
    	jQuery(this).parent().addClass('selected');
    	jQuery('#cssColors').attr('href', localhost+"colors/color_turquoise.css");
    	setColorSwiterCookie('color_turquoise');
		return false;
    });
    
    jQuery('#switchColorGreen').click(function(){
    	jQuery(this).parent().parent().children('.selected').removeClass('selected');
    	jQuery(this).parent().addClass('selected');
    	jQuery('#cssColors').attr('href', localhost+"colors/color_green.css");
    	setColorSwiterCookie('color_green');
		return false;
    });
    
    jQuery('#switchColorOrange').click(function(){
    	jQuery(this).parent().parent().children('.selected').removeClass('selected');
    	jQuery(this).parent().addClass('selected');
    	jQuery('#cssColors').attr('href', localhost+"colors/color_orange.css");
    	setColorSwiterCookie('color_orange');
		return false;
    });
    
    jQuery('#switchColorPink').click(function(){
    	jQuery(this).parent().parent().children('.selected').removeClass('selected');
    	jQuery(this).parent().addClass('selected');
    	jQuery('#cssColors').attr('href', localhost+"colors/color_pink.css");
    	setColorSwiterCookie('color_pink');
		return false;
    });
    
    jQuery('#switchColorViolet').click(function(){
    	jQuery(this).parent().parent().children('.selected').removeClass('selected');
    	jQuery(this).parent().addClass('selected');
    	jQuery('#cssColors').attr('href', localhost+"colors/color_violet.css");
    	setColorSwiterCookie('color_violet');
		return false;
    });
    
}

function setColorSwiterCookie(color){
	
	 var COOKIE_NAME = 'mausColorSwiterCookie';
     var options = { path: '/', expires: 365 };
     
     jQuery.cookie(COOKIE_NAME, null, options);
     jQuery.cookie(COOKIE_NAME, color, options);	
}

jQuery(document).ready(function(){
	setColorSwiter();
});
