/*POP UP FLASH TEST*/
/*VISIBLE INTO A HTML <div id='flashcontent'>*/


function showPopup(w,h){
   
   popUp = document.createElement('div');
   popUp.style.position = "absolute";
   popUp.style.top = '250px';
   popUp.style.marginLeft = '40%';
   popUp.style.maxWidth = "200px";
   popUp.style.width = "200px";
   popUp.style.height = "160px";
   popUp.style.maxHeight = "160px";
   popUp.style.background = "#FFFFFF";
   popUp.style.border = "5px solid #97111C";   
   popUp.style.textAlign = "center";
   popUp.style.fontFamily = "Arial";
   popUp.style.fontSize = "10px";
   popUp.innerHTML = "<br/><a href='http://get.adobe.com/it/flashplayer/' target='_blank'><img src='http://www.milanomarittima.it/style/flashplayer.jpg' alt='' style='border: none;' /></a><br/><br/>Download per visualizzare il sito!<br/><br/><a href='' onclick=\"hidePopup();\">CHIUDI FINESTRA</a>";
   document.getElementById("flashcontent").appendChild(popUp);
}


function hidePopup(){
   document.getElementById("flashcontent").removeChild(popUp); 
}


function dothis(){
showPopup(200,100);
}


var expDays = 1; // number of days the cookie should last


function GetCookie (name) { 
var arg = name + "="; 
var alen = arg.length; 
var clen = document.cookie.length; 
var i = 0; 
while (i < clen) { 
var j = i + alen; 
if (document.cookie.substring(i, j) == arg) 
return getCookieVal (j); 
i = document.cookie.indexOf(" ", i) + 1; 
if (i == 0) break; 
} 
return null;
}


function SetCookie (name, value,expires) {
var argv = SetCookie.arguments; 
var argc = SetCookie.arguments.length; 
var expires = (argc > 2) ? argv[2] : null; 
var path = (argc > 3) ? argv[3] : null; 
var domain = (argc > 4) ? argv[4] : null; 
var secure = (argc > 5) ? argv[5] : false; 
document.cookie = name + "=" + escape (value) + 
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 
((path == null) ? "" : ("; path=" + path)) + 
((domain == null) ? "" : ("; domain=" + domain)) + 
((secure == true) ? "; secure" : "");
}


function DeleteCookie (name) { 
var exp = new Date(); 
exp.setTime (exp.getTime() - 1); 
var cval = GetCookie (name); 
document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}
var exp = new Date(); 
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));

function getCookieVal(offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}


/*THE FUNCTION TO CALL IN THE BODY ONLOAD*/
function checkFlashPopUp() {
var count = GetCookie('poponce');
if (count == null) {
	count++;
	SetCookie('poponce', count, exp);
	dothis();
	}
}


