///////////////////////////////////////////////////////////////////
///////                  DialogKutesan                      ///////
///////             PrestaShop Tools Module                 ///////
///////                                                     ///////
///////               CREATED BY :  KUTESAN                 ///////
///////                  MADE IN : SPAIN                    ///////
///////  TESTED WITH THE VERSIONS: 1.2                      ///////
///////             CREATED DATE : 02 - JUNE - 2009         ///////
///////                  LICENSE : CopyLeft                 ///////
///////              AUTOR'S WEB :                          ///////
///////                                                     ///////
///////////////////////////////////////////////////////////////////


    $(document).ready(function() { 
 
	//Put in the DIV id you want to display
	launchWindow('#dialog1');
		$('#dialog1').delay(4000).fadeOut('fast').queue(function() {
			$(this).remove();
			$('#mask').animate({height: '0'}, 'slow').queue(function() {
				$(this).remove();
				setCookie(cookie_name,cookie_value);
			});
		});
	});


function launchWindow(id) {
	
		//Get the screen height and width
		var maskHeight = $(document).height();
		var maskWidth = $(window).width();
	
		//Set heigth and width to mask to fill up the whole screen
		$('#mask').css({'width':maskWidth,'height':maskHeight});
		
		//transition effect		
		$('#mask').show();	
	
		//Get the window height and width
		var winH = $(window).height();
		var winW = $(window).width();
              
		//Set the popup window to center
		$(id).css('display','block');
		//$(id).css('top',  winH/2-$(id).height());
		$(id).css('left', winW/2-$(id).width()/2);
	
		//transition effect
	
};

 
    
    function setCookie(cookiename,cookievalue,expires,path,domain,secure) {
      document.cookie=
      escape(cookiename)+'='+escape(cookievalue)
      +(expires?'; EXPIRES='+expires.toGMTString():'')
      +(path?'; PATH='+path:'')
      +(domain?'; DOMAIN='+domain:'')
      +(secure?'; SECURE':'');
    }
    
    function getCookie(cookiename) {
      var posName=document.cookie.indexOf(escape(cookiename)+'=');
      if (posName!=-1) {
        var posValue=posName+(escape(cookiename)+'=').length;
        var endPos=document.cookie.indexOf(';',posValue);
        if (endPos!=-1) cookie_get_value=unescape(document.cookie.substring(posValue,endPos));
        else cookie_get_value=unescape(document.cookie.substring(posValue));
      }
      return cookie_get_value;
    } 
