﻿(function($){
		  $.fn.uniworld_alpha=function(alpha_trasparent_param)
		  {
			  	var firefox_alpha_trasparent_param=alpha_trasparent_param/100;
				$(this).css("filter","alpha(opacity="+alpha_trasparent_param+")");
				$(this).css("-moz-opacity",firefox_alpha_trasparent_param);
				$(this).css("opacity",firefox_alpha_trasparent_param);
		  }
		  
		   $.fn.uniworld_alpha=function(alpha_trasparent_param)
		  {
			  	var firefox_alpha_trasparent_param=alpha_trasparent_param/100;
				$(this).css("filter","alpha(opacity="+alpha_trasparent_param+")");
				$(this).css("-moz-opacity",firefox_alpha_trasparent_param);
				$(this).css("opacity",firefox_alpha_trasparent_param);
		  }
})(jQuery)

$(function(){
$("body").append('<div id="uniworld-tools-bg-wrap" style="display:none;"></div><div id="uniworld-tools-bg" style="display:none;"></div>');
});


function uniworld_tools_show_background(html)
{
	var Height_e=$(document).height();
	var width=$(document).width();
	
	$("#uniworld-tools-bg-wrap").css("position","absolute");
	$("#uniworld-tools-bg-wrap").css("left","0px");
	$("#uniworld-tools-bg-wrap").css("width",width+"px");
	$("#uniworld-tools-bg-wrap").css("height",Height_e+"px");
	$("#uniworld-tools-bg-wrap").css("top","0px");
	$("#uniworld-tools-bg-wrap").css("background-color","#000");
	

	$("#uniworld-tools-bg-wrap").uniworld_alpha(50);
	
	$("#uniworld-tools-bg").css("z-index","100");
	$("#uniworld-tools-bg").css("position","absolute");
	$("#uniworld-tools-bg").css("top",($(document).scrollTop()+20)+"px");
	$("#uniworld-tools-bg").css("left","0px");
	$("#uniworld-tools-bg").css("width",width+"px");

//	$("#uniworld-tools-bg").css("display","");
//	$("#uniworld-tools-bg-wrap").css("display","");
	$("#uniworld-tools-bg").fadeIn();
	$("#uniworld-tools-bg-wrap").fadeIn();	
	
	$("#uniworld-tools-bg").html('<div style="width:960px; margin:0 auto; "><div style="margin:0 auto; width:900px; text-align:center;">'+html+'</div></div>');
	
	$("a.close").click(uniworld_tools_hide_background);
}


function uniworld_tools_hide_background()
{
	$("#uniworld-tools-bg").fadeOut();
	$("#uniworld-tools-bg-wrap").fadeOut();
	return false;
}

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;
    }
};
