//includo il file js utilizzato per l'implementazione dei Flash e degli oggetti OpenLaszlo
document.write("<script language=\"JavaScript\" type=\"text/javascript\" src=\"include/worinclude/library.js\"></script>");

function voidFunction(){
	//ie bug
}

function MM_preloadImages() {
	var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
		if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function OpenPopupImage(v_strIdImage,v_strTitle,v_strCharatteristics)
{
	var l_strZoomPageUrl = "";
	l_strZoomPageUrl = "/tools/utils/ZoomWindow.aspx?img=" + v_strIdImage + "&title=" + v_strTitle + "&chrt=" + v_strCharatteristics;
	window.open(l_strZoomPageUrl,"zoomImage","dependent=yes,Height=0,Width=0,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,titlebar=yes,toolbar=no");
}

function OpenPopupVideo(v_strVideoUrl,v_intWidth,v_intHeight)
{
  var v_intHeightWindow = v_intHeight + 50;
  var objWO = window.open('/tools/utils/videoplayer.lzx.swf?video=' + v_strVideoUrl + '&width=' + v_intWidth + '&height=' + v_intHeight,null,"dependent=no,Height=" + v_intHeightWindow + ",Width=" + v_intWidth + ",location=no,menubar=no,resizable=no,scrollbars=no,status=no,titlebar=no,toolbar=no");
}
function video(v_strVideoUrl)
{
  var objWO = window.open('/tools/utils/videoplayer.lzx.swf?video=' + v_strVideoUrl + '&width=600&height=400',null,"dependent=no,Height=450,Width=600,location=no,menubar=no,resizable=no,scrollbars=no,status=no,titlebar=no,toolbar=no");
}

function changeImage(v_strImageBoxName,v_strImage){
    var objImageBox = document.getElementById(v_strImageBoxName);
    objImageBox.src = v_strImage;
}

function ChangeRiv(strIW)
{
   if (strIW == 'Italy')
   {
        $('divItaly').setStyle({display: 'block'});
        $('divWorld').setStyle({display: 'none'});
        $('divMap').removeClassName('rivMapWorld');
        $('divMap').addClassName('rivMapItaly');
        
   } else 
   {
        $('divItaly').setStyle({display: 'none'});
        $('divWorld').setStyle({display: 'block'});
        $('divMap').removeClassName('rivMapItaly');
        $('divMap').addClassName('rivMapWorld');
   }

}

function ChangeFlvVideo(strVideoUrl, strVideoImg, strContainer, strDivItem){

    var strRandString = String.fromCharCode(97 + Math.round(Math.random() * 25)) +String.fromCharCode(97 + Math.round(Math.random() * 25)) +String.fromCharCode(97 + Math.round(Math.random() * 25)) +String.fromCharCode(97 + Math.round(Math.random() * 25)) +String.fromCharCode(97 + Math.round(Math.random() * 25)) +String.fromCharCode(97 + Math.round(Math.random() * 25)) + String.fromCharCode(97 + Math.round(Math.random() * 25)) + String.fromCharCode(97 + Math.round(Math.random() * 25)) + String.fromCharCode(97 + Math.round(Math.random() * 25));
    
    var s1 = new SWFObject('flvplayer.swf?rnd='+strRandString,'ply'+strRandString,'416','236','10','#');
    s1.useExpressInstall('/include/expressinstall.swf');
    s1.addParam('allowfullscreen','true');
    s1.addParam('allowscriptaccess','always');
    s1.addParam('wmode','opaque');
    s1.addParam('flashvars','image='+ strVideoImg +'&file='+ strVideoUrl +'&skin=bekle.swf&frontcolor=ffffff&lightcolor=ffffff&controlbar=over&stretching=uniform&autostart=true');
    
    s1.write(strContainer);

  	
  	
  	$$('.videoHomeElenco .interno').each(function(e){
  	    if (e.readAttribute("id") == strDivItem)
  	    {
  	        e.setStyle({display: 'none'})
  	        
  	        $$('#' + strDivItem +' .titolo a').each(function(ae){
  	            $('videoTitle').innerHTML = ae.innerHTML;
  	        });
  	    }
  	    else
  	    {
  	        e.setStyle({display: 'block'});
  	        e.setStyle({opacity: '0'});
  	        new Effect.Opacity(e.readAttribute("id"), { from: 0.0, to: 1.0, duration: 0.4 });
  	    }
  	    new Effect.Opacity(strContainer, { from: 0.0, to: 1.0, duration: 0.4 }); 
  
  	});
	
}

function handleSelectStart(evnt) {return false;}

function CustomInitPage(){
    // init della shadowbox
    Shadowbox.init();
    
    if (document.all)
        document.onselectstart=handleSelectStart;
        
}

document.observe("dom:loaded", CustomInitPage);

