jQuery.cookie = function (key, value, options) {

    // key and value given, set cookie...
    if (arguments.length > 1 && (value === null || typeof value !== "object")) {
        options = jQuery.extend({}, options);

        if (value === null) {
            options.expires = -1;
        }

        if (typeof options.expires === 'number') {
            var days = options.expires, t = options.expires = new Date();
            t.setDate(t.getDate() + days);
        }

        return (document.cookie = [
            encodeURIComponent(key), '=',
            options.raw ? String(value) : encodeURIComponent(String(value)),
            options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
            options.path ? '; path=' + options.path : '',
            options.domain ? '; domain=' + options.domain : '',
            options.secure ? '; secure' : ''
        ].join(''));
    }

    // key and possibly options given, get cookie...
    options = value || {};
    var result, decode = options.raw ? function (s) { return s; } : decodeURIComponent;
    return (result = new RegExp('(?:^|; )' + encodeURIComponent(key) + '=([^;]*)').exec(document.cookie)) ? decode(result[1]) : null;
};

	function lucid_change_skin(name){
		$.cookie('lucid_skin',name,{ expires: 90,path:'/', domain: 'kudika.ro' });
		switch (name){
			case '':
				key_c = 'VeNortjK2UjIytlCyBlwwDXkCNw--';
			break;
			case 'dark':
				key_c = 'VeNortjK2UjIytlSyBlwwDXwCOA--';
			break;
			case 'mauve':
				key_c = 'VeNortjK2UjIyMVCyBlwwDWUCMA--';
			break;
			case 'white':
				key_c = 'VeNortjK2UjIyMVSyBlwwDWgCMQ--';
			break;
			
			
		}
		
		
		_track_lucid = new Image(1,1);
		_track_lucid.src= 'http://ads.icorp.ro/others/STS/?t='+key_c ;
		location.reload();
		return false;
	}

	$(document).ready(
		function(){
			if ($.cookie('lucid_skin')){
				old_skin ='';
				if ($.cookie('_trak_lucid_skin')){
					old_skin = $.cookie('_trak_lucid_skin');
				}
				if ($.cookie('_trak_lucid_skin_nr')){
					nr_lucid= $.cookie('_trak_lucid_skin_nr');
				}else{
					nr_lucid= 0;
				}
				$.cookie('_trak_lucid_skin_nr',(nr_lucid+1),{ expires: 90,path:'/', domain: 'kudika.ro' });
				$.cookie('_trak_lucid_skin',$.cookie('lucid_skin'),{ expires: 90,path:'/', domain: 'kudika.ro' });
				if ($.cookie('lucid_skin')==old_skin && nr_lucid==2){
					switch ($.cookie('lucid_skin')){
						case '':
							key_c = 'CeNortjK2UjIytlCyBlwwDXkCNw--';
						break;
						case 'dark':
							key_c = 'CeNortjK2UjIytlSyBlwwDXwCOA--';
						break;
						case 'mauve':
							key_c = 'CeNortjK2UjIyMVCyBlwwDWUCMA--';
						break;
						case 'white':
							key_c = 'CeNortjK2UjIyMVSyBlwwDWgCMQ--';
						break;
					}
					_track_lucid_a = new Image(1,1);
					_track_lucid_a.src= 'http://ads.icorp.ro/others/STS/?t='+key_c ;
				}	
			}	
		}		
	);

	$(function () {
	
		$('.ptm_item').hover(
			function () {
				var ptm_id = $(this).attr('id');
				var psm_id = ptm_id.replace(/ptm_/i, 'psm_');
				$('#'+ptm_id).addClass('ptm_hover');
				$('#'+psm_id).slideDown(125);
				$('#page_menu_indexer').css({ zIndex: 200, position: 'relative' });
			},
			function () {
				var ptm_id = $(this).attr('id');
				var psm_id = ptm_id.replace(/ptm_/i, 'psm_');
				$('#'+ptm_id).removeClass('ptm_hover');
				$('#'+psm_id).fadeOut(67);
				$('#page_menu_indexer').css({ zIndex: 1, position: 'relative' });
			}
		);
		
		$('.psm_item').hover(
			function () {
				var psm_id = $(this).attr('id');
				var pem_id = psm_id.replace(/psm_/i, 'pem_');
				$('#'+psm_id).addClass('psm_hover');
				$('#'+pem_id).css('margin-left', $('#'+psm_id).width()).fadeIn(67);
			},
			function () {
				var psm_id = $(this).attr('id');
				var pem_id = psm_id.replace(/psm_/i, 'pem_');
				$('#'+psm_id).removeClass('psm_hover');
				$('#'+pem_id).fadeOut(33);
			}
		);
		
	});
	
