	// JavaScript Document

function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    {
    c_start=c_start + c_name.length+1;
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    }
  }
return "";
}

function setCookie(c_name,value,expiredays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+ ((expiredays==null) ? "" : ";expires="+exdate.toUTCString());
}

function checkCookie()
{

quizcookie=getCookie('quizcookie');

if (quizcookie!="return_user")
	{
	//alert(quizcookie);
    setCookie('quizcookie','return_user',1);
    toggle('quiz');    
    }
/*
else{
	alert(quizcookie);
}
*/
}





	function toggle(fieldId) {
		var showDiv = document.getElementById(fieldId);
		var cur_location = window.location.pathname;
		var flashDiv1 = document.getElementById("flash");
		//var titlebar = document.getElementById("ui-dialog-titlebar");
//		titlebar.style.display = "none";
		$.ui.dialog.defaults.stackfix = true;
	        // increase the default animation speed to exaggerate the effect
        $.fx.speeds._default = 1000;
		$(showDiv).dialog({
			bgiframe: true,
			resizable: false,			
			draggable: false,
			width:640,
			modal: true,
//			overlay: {
//				backgroundColor: '#FF0000',
//				opacity: 0.9
//			},
			buttons: {
				"Non merci": function(){
					$(this).dialog('close');
					if(cur_location == "/poster.htm")
					{
						flashDiv1.style.display = "block";
					}
				}
			}/*,
			height: 400,
			show: "blind",
			hide: "blind"*/
		});
		$(showDiv).dialog('open');
		
		//alert(cur_location);
		if(cur_location == "/poster.htm")
		{
			flashDiv1.style.display = "none";
		}
		/*$(showDiv).dialog('option', 'show', 'blind');
		$(showDiv).dialog('option', 'hide', 'blind');*/
	}
	

