// JavaScript Document


jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
        // CAUTION: Needed to parenthesize options.path and options.domain
        // in the following expressions, otherwise they evaluate to undefined
        // in the packed version for some reason...
        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};


function colorsCreuBlanca(seccion){
		 switch(seccion){
				case 'home':
					jQuery('#logoCreu').css({ backgroundImage:"url(/_gif/logogris.jpg)"});
					jQuery("#Menu").addClass("blau");
					jQuery('#btnMenu').css({ backgroundImage:"url(/_gif/btnmenublau.jpg)"});
					jQuery(".menuLink").mouseover(function () { 
						jQuery(this).css({ backgroundColor:"#57cee8"});
					});
				break;
				case 'avui-com-et-sents':
					jQuery('#logoCreu').css({ backgroundImage:"url(/_gif/logogris.jpg)"});
					jQuery("#Menu").addClass("blau");
					jQuery('#btnMenu').css({ backgroundImage:"url(/_gif/btnmenublau.jpg)"});
					jQuery('#back').css({ backgroundImage:"url(/_gif/backblau.jpg)"});
					jQuery(".menuLink").mouseover(function () { 
						jQuery(this).css({ backgroundColor:"#57cee8"});
					});
				break;
				case 'lluminos':
					jQuery('#logoCreu').css({ backgroundImage:"url(/_gif/logogroc.jpg)"});
					jQuery("#Menu").addClass("groc");
					jQuery('#btnMenu').css({ backgroundImage:"url(/_gif/btnmenugroc.jpg)"});
					jQuery('#back').css({ backgroundImage:"url(/_gif/backgroc.jpg)"});
					jQuery(".menuLink").mouseover(function () { 
						jQuery(this).css({ backgroundColor:"#f09e00"});
					});
				break;
				case 'enginyos':
					jQuery('#logoCreu').css({ backgroundImage:"url(/_gif/logoblau.jpg)"});
					jQuery("#Menu").addClass("blau");
					jQuery('#btnMenu').css({ backgroundImage:"url(/_gif/btnmenublau.jpg)"});
					jQuery('#back').css({ backgroundImage:"url(/_gif/backblau.jpg)"});
					jQuery(".menuLink").mouseover(function () { 
					jQuery(this).css({ backgroundColor:"#57cee8"});
					});
				break;
				case 'optimista':
					jQuery('#logoCreu').css({ backgroundImage:"url(/_gif/logoverd.jpg)"});
					jQuery("#Menu").addClass("verd");
					jQuery('#btnMenu').css({ backgroundImage:"url(/_gif/btnmenuverd.jpg)"});
					jQuery('#back').css({ backgroundImage:"url(/_gif/backverd.jpg)"});
					jQuery(".menuLink").mouseover(function () { 
					jQuery(this).css({ backgroundColor:"#d8e89d"});
					});
				break;
				case 'trendy':
					jQuery('#logoCreu').css({ backgroundImage:"url(/_gif/logofucsia.jpg)"});
					jQuery("#Menu").addClass("fucsia");
					jQuery('#btnMenu').css({ backgroundImage:"url(/_gif/btnmenufucsia.jpg)"});
					jQuery('#back').css({ backgroundImage:"url(/_gif/backfucsia.jpg)"});
					jQuery(".menuLink").mouseover(function () { 
					jQuery(this).css({ backgroundColor:"#d2659b"});
					});
				break;
				default:
					jQuery('#logoCreu').css({ backgroundImage:"url(/_gif/logogris.jpg)"});
					jQuery("#Menu").addClass("blau");
					jQuery('#btnMenu').css({ backgroundImage:"url(/_gif/btnmenublau.jpg)"});
					jQuery('#back').css({ backgroundImage:"url(/_gif/backblau.jpg)"});
					jQuery(".menuLink").mouseover(function () { 
						jQuery(this).css({ backgroundColor:"#57cee8"});
					});
		}
	jQuery(".menuLink").mouseout(function () { 
						jQuery(this).css({ background:"none"});
	});
	jQuery("#logoCreu:hidden:first").fadeIn(1000);
	
};
jQuery().ready(function(){
	jQuery('#Menu').css({ display:"none"});
	
	jQuery("#btnMenu").click(function () { 
		jQuery("#Menu:hidden:first").fadeIn("slow");
	});
	jQuery("#closeMenu").click(function () { 
		jQuery("#Menu").fadeOut("slow");
	});
});

function divExplicacio (){
		jQuery("#explicacio:hidden:first").fadeIn(1000);
		jQuery('#backexplicacio').animate({ 
	        opacity: 0.92
      }, 500 );
		jQuery("#closeLink").click(function () { 
			jQuery("#explicacio").fadeOut("slow");
		jQuery.cookie('estatPopup', 'tancat', { expires: 4, path: '/' });
		jQuery("#veureExplicacio").css({ display:"block"});
	});

}