// JavaScript Document





	
	function LaunchAdv() {
    var file = "http://www.sportyland.it/immagini/banner/ban_trofeoautunno_ott_2011.jpg";
	var ext = "jpg";
	var width = 700;
	var height = 560;
	var bgcolor = "#000000";
	var version = "8,0,0,0";
	
	// Minor version of Flash required
	var requiredMinorVersion = 0;
	// Minor version of Flash required
	var requiredRevision = 0;
	// Major version of Flash required
	var requiredMajorVersion = 8;
	
	//// se mi interessa e voglio andare alla pagina specifica
	
	var address = "http://www.sportyland.it/pdf/programma-gara-trofeoautunno-2011.pdf";

	var noflashcontent = '';
	var noflashpage = "";
	var popup = "no";
	var position = "";
	var title = "30 ottobre 2011: Trofeo d'Autunno a Sportyland";
	var second = 60000;
	

	var html;
	var NNONE;
	NNONE= noflashcontent;	

	
	// Controllo per settare cookie alla spotcover
	if(file!=""){
	
	var nomefile = file + '?session=false'; 
	
	var view = (CookieLeggi("view")!=null) ? CookieLeggi("view") : '';
	
	if((popup && popup=="yes") || (view=="YES")){
		nomefile = nomefile + '&popup=yes';
	}else{
		nomefile = nomefile + '&popup=no';
	}


    html = "";
	html += '<h1 style="padding:0px; padding-bottom:10px; margin:0px; margin-bottom:10px;">'+title+'</h1>';

    // se il banner è in formato flash allora
	if(address==""){
		address = "javascript:HideAdv()";
	} else{
	    address = "javascript:GoToLinkAdv('"+address+"')";	
	}
	
	var hasReqestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
	
    if(ext=="swf"){

		if (hasReqestedVersion) {
		
		html +=('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=' + version + '" WIDTH="' + width + '" HEIGHT="' + height + '"> \n');
		html += ('<PARAM NAME=movie VALUE="' + nomefile + '"> \n');
		html += ('<PARAM NAME=quality VALUE=high>');
		html += ('<PARAM NAME=bgcolor VALUE=#' + bgcolor + '> \n');
		html += ('<PARAM NAME=menu VALUE=False> \n');
		html += ('<PARAM NAME=borders VALUE=noborder> \n');
		html += ('<PARAM NAME=loop VALUE=true>');
		html += ('<embed src="' + nomefile + '" quality=high loop=true menu=false bgcolor=#' + bgcolor + '');
		html += ('swLiveConnect="FALSE" WIDTH="' + width + '" HEIGHT="' + height + '" border="0" TYPE="application/x-shockwave-flash"');
		html += ('PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></embed></OBJECT>');
		}else{
		html = "";
		html += ('<a href="'+address+'" target="_self" title="'+title+'">');
		html += ('<img src="'+noflashcontent+'" border="0" alt="'+title+'" ></a>');
		}
	
	} else if(ext=="jpg"){
	

		html += ('<a href="'+address+'" target="_self" title="'+title+'">');
		html += ('<img src="'+file+'" border="0" alt="'+title+'" ></a>');
	
	}
	
	html +='<div>';
	




	
	
	// html +='<a href="javascript:GoToLinkAdv(\''+address+'\');" target="_self" title="Maggiori informazioni" id="link1">&raquo; Maggiori informazioni</a>';
	// html +='<a href="javascript:HideAdv();" target="_self" title="Non visualizzare pi&ugrave; questo avviso" id="link2">&raquo; Non visualizzare pi&ugrave; questo avviso</a>';







	html +='<a href="javascript:CloseAdv();" target="_self" title="Non visualizzare pi&ugrave; questo avviso" id="link2">&raquo; Non visualizzare pi&ugrave; questo avviso&nbsp;<img src="http://www.sportyland.it/immagini/ico_divieto.gif" alt="Chiudi pagina" border="0"/></a>';
	html +='</div>';
	

	
	if((!view ) || (view=="") || (view=="NO")){  //// SE ANCORA NON HA VISTO LO SPOT OPPURE IL COOKIES NON E' SCRITTO...
	
	   PrintAdvertising(html, width, height, ext, address, second);
	
	
   } else {   ///// ha già visto lo spot allora lo mandiamo alla pagina e apriamo in popup
	   
	   
	   

	   
   }
	

	
	
	//document.write(NNONE); setTimeout("document.location.replace('"+noflashpage+"')",5000); 
	}
	
	
	
}


///////////////////////// APRI IN POP UP

var newwindow;


function PrintAdvertising(html, w, h, ext, address, s){
	
	
	     var browser = null;
		 var browser_name = BrowserDetect.browser;
		 var browser_version = BrowserDetect.version;
		 
		 	  winH = document.getElementById("contenitore").offsetHeight;
			  winW = document.getElementById("contenitore").offsetWidth;

         if(browser_name=="Explorer"){
			  browser = "IE";
		
		 }else if(browser_name=="Firefox"){
			  browser = "NN";
		 }
		 
			
	     
		 if((html!="") && document.createTextNode && document.getElementsByTagName){
			 
			overlay = document.createElement("DIV");
	

			var height = winH;
			overlay.id = "OverlayLayer";
			overlay.style.height = height+"px";
			
			centered = document.createElement("DIV");
			centered.id = "advBanner";
			centered.style.width=w+"px";
			//centered.style.backgroundColor="#000000";
			centered.style.marginLeft="-"+(w/2)+"px";
			centered.innerHTML=html;
			

			
			if(browser=="NN"){
			document.getElementsByTagName("body").item(0).appendChild(overlay);
			document.getElementsByTagName("body").item(0).appendChild(centered);
			}else{
			document.getElementsByTagName("body").item(0).insertBefore(overlay);
			document.getElementsByTagName("body").item(0).insertBefore(centered);
			}
			
			if(s>0){ setTimeout('HideAdv()',s); }
			
		} 
		 

			
	

}



function GoToLinkAdv(address){
	     CloseAdv();
         window.location.href=address;
}



function HideAdv(){
	       
		   var overlay = document.getElementById("OverlayLayer");
		   document.getElementsByTagName("body").item(0).removeChild(overlay);
		   document.getElementsByTagName("body").item(0).removeChild(centered);
		   
}



function CloseAdv(){
	       
		   var overlay = document.getElementById("OverlayLayer");
		   document.getElementsByTagName("body").item(0).removeChild(overlay);
		   document.getElementsByTagName("body").item(0).removeChild(centered);
		   
		   
		   var CookiePath="/";
	       var CookieDomain="";
	       CookieScrivi('view','YES',2,CookiePath,CookieDomain);
		   
}
