/***************************************************************\
|             Copyright © 2007-2009 By VitaGay.Net               |
|         vitagay_media.js č di proprietą di VitaGay.Net         |
\***************************************************************/
isFx=(navigator.userAgent.toLowerCase().indexOf("firefox") != -1)?true:false; isSa=(navigator.userAgent.toLowerCase().indexOf("safari") != -1)?true:false; isIe=(navigator.userAgent.toLowerCase().indexOf("msie") != -1)?true:false; isOp=(navigator.userAgent.toLowerCase().indexOf("opera") != -1)?true:false; isNs=(document.getElementById&&!document.all)?true:false; function $(n) {return document.getElementById(n);}var StatoStep = 0; var SrcPoint = null; var TYPE_MAP = ''; var SrcZoom = null; var Gmap = null; var vgImg = new Array(); var IndexImgView = 0; var TotaleImgView = 0;
var PrevImg=''; var PrevW=0; var PrevH=0; var NextImg=''; var NextW=0; var NextH=0; var FlPlayerImg = false; var PlayerImgStep = 1; var TimerPreload = null;var VGImgPrev=null; var VGImgNext=null;
function StartStopPlayerImg(){ if(FlPlayerImg) { FlPlayerImg = false; SetButtonPlayerStop(); } else { PlayerImgStep = 6; FlPlayerImg = true; PlayNextImg(); } }
function SetButtonPlayerStop() { var ObjPlay = $("VgPlayerImg"); if(ObjPlay != null) { ObjPlay.src = '/images/icons/ico_film.gif'; } }
function PlayNextImg() { if($("VgPlayerImg") != null) { if(FlPlayerImg) { PlayerImgStep--; if(PlayerImgStep == 0) { PlayerImgStep = 5; SlideImgGallery(IndexImgView,'Next'); } $("VgPlayerImg").src='/images/icons/pl_num_'+PlayerImgStep+'.gif'; setTimeout(PlayNextImg,1000); } else SetButtonPlayerStop(); } }
function SlideImgGallery(Idx,Where) { try { if(vgImg != null) { if(Where == 'Next') Idx++; else Idx--; if(Idx >= TotaleImgView) Idx=0; if(Idx >= 0 && Idx < TotaleImgView) { IndexImgView=Idx; ShowObj(false,true,false,vgImg[Idx][1],vgImg[Idx][2],vgImg[Idx][3],vgImg[Idx][0]); } } } catch(e) {} }
function PreloadPrevNextImg(){ TimerPreload=null; if(PrevImg!=''){try {VGImgPrev = new Image(PrevW,PrevH); VGImgPrev = PrevImg;} catch(e) {}}if(NextImg!=''){try {VGImgNext = new Image(NextW,NextH);VGImgNext.src = NextImg;} catch(e) {}}}
function ShowMeteo(IdCapDiProv) { try { ChiudiTutteSchede(); var Width1 = 540; var Height1 = 340; var Url1 = 'http://www.ilmeteo.it/script/meteo2.php?id=free&citta=' + IdCapDiProv; var Width2 = 700; var Height2 = 420; var Url2 = 'http://www.ilmeteo.it/script/meteo3h.php?id=free&citta=' + IdCapDiProv; var Width = 710; var Height = 430; var Top = GetTopPage(); var Left = parseInt((VgBodyWidth - Width) / 2)-50; var Esiste = true; var oDv = $("divMeteo"); if(oDv == null) { Esiste=false; oDv = document.createElement("div"); } oDv.id='divMeteo'; oDv.className = 'divMeteo'; oDv.style.left = Left+"px"; oDv.style.top = Top+"px"; oDv.style.display = 'block'; var VgHTML = '<table style="width:'+Width+'px; height:'+Height+'px; background-color:#b9b9b9;" bordercolor="#FFFFFF" cellpadding="0" cellspacing="0" border="0"><tr><td valign="middle" nowrap="nowrap" style="height:25px; padding:2px; background-image: url(/images/BarraShowObjDown.gif);" align="left">&nbsp;&nbsp;'+GetTermine(JS_METEO)+'&nbsp;<span class="OpzioniBottone Puntatore" onclick=\'SetTipoMeteo("' + Url1 + '",' + Width1 + ','+ Height1 +')\';>'+GetTermine(JS_METEO_PREV_5_DAY)+'</span><span class="OpzioniBottone Puntatore" onclick=\'SetTipoMeteo("' + Url2 + '",' + Width2 + ','+ Height2 +')\';>'+GetTermine(JS_METEO_PREV_ORA)+'</span></td><td valign="middle" style="background-image: url(/images/BarraShowObjDown.gif);" align="right" class="Puntatore" onmousedown="HideObject(\'divMeteo\');"><b>'+GetTermine(JS_CHIUDI)+'</b><img align="middle" src="/images/icons/ico_close.gif" class="IcoClose" alt="'+GetTermine(JS_CHIUDI_FINESTRA)+'" /></span></td></tr><tr><td id="tdBackMeteo" valign="100%" colspan="2" align="center" style="padding:4px; background-image:url(/images/LoadingScheda.gif); background-repeat:no-repeat; background-color:#FFFFFF; background-position: '+(Width/2-16)+'px 60px;" width="100%;" height="'+Height+'"><iframe style="display:none;" id="ifmMeteo" width="'+Width+'" height="'+Height+'" scrolling="no" frameborder="no" noresize="noresize" src="'+Url1+'"></iframe></td></tr><tr><td class="ToolTips" valign="100%" colspan="2" align="center">'+GetTermine(JS_METEO_INFO)+'</td></tr></table>'; oDv.innerHTML = VgHTML; if(Esiste == false) AddMainDiv(oDv); SetTipoMeteo(Url1,Width1,Height1); } catch(e) {} }
function SetTipoMeteo(Url, Width, Height) { try { var ifmMeteo = $("ifmMeteo"); if(ifmMeteo!=null) { var tdBackMeteo = $("tdBackMeteo"); if(tdBackMeteo!=null) tdBackMeteo.style.backgroundColor="#FFFFFF"; ifmMeteo.style.display='none'; ifmMeteo.width = Width; ifmMeteo.height = Height; ifmMeteo.src = Url; ifmMeteo.style.display='inline'; if(tdBackMeteo!=null) tdBackMeteo.style.backgroundColor="#b9b9b9"; } } catch(e) {} }
function ShowPanorama360xPagina(aryPan) { try { ChiudiTutteSchede(); var Width = 900; var Top = GetTopPage(); var Left = parseInt((VgBodyWidth - Width) / 2); var Esiste = true; var oDv = null; oDv = $("Panorama360"); if(oDv == null) { Esiste=false; oDv = document.createElement("div"); } oDv.id='Panorama360'; oDv.className = 'Panorama360'; oDv.style.left = Left+"px"; oDv.style.top = Top+"px"; oDv.style.display = 'block'; var VgHTML = '<table bordercolor="#FFFFFF" cellpadding="0" cellspacing="0" border="0" width="'+(Width+6)+'" bgcolor="#b9b9b9"><tr><td valign="middle" nowrap="nowrap" style="background-image: url(/images/BarraShowObjDown.gif);" align="left">&nbsp;'+GetTermine(JS_PANORAMICHE_360)+'&nbsp;'; if(aryPan.length>1) { for(VgId = 0; VgId < aryPan.length; VgId++) VgHTML += '<img id="ImgSetPan'+VgId+'" align="middle" style="margin:4px;" alt="'+GetTermine(JS_VISUALIZZA_PAN_NUM)+' '+(VgId+1)+'" src="/images/icons/num_'+(VgId+1)+'.gif2" class="Puntatore icon16x16" onclick="SetPanorama('+VgId+',\''+aryPan[VgId][0]+'\',\''+aryPan[VgId][1]+'\','+aryPan.length+');" />'; } VgHTML += '&nbsp;&nbsp;<span id="TitoloPanorama"></span></td><td valign="middle" style="background-image: url(/images/BarraShowObjDown.gif);" align="right" class="Puntatore" onmousedown="HideObject(\'Panorama360\');"><b>'+GetTermine(JS_CHIUDI)+'</b><img align="middle" src="/images/icons/ico_close.gif" class="IcoClose" alt="'+GetTermine(JS_CHIUDI_FINESTRA)+'" /></span></td></tr><tr><td colspan="2" style="padding:4px;">\n<div id="ContenitorePanorama" style="background-color:#FFFFFF; border: solid 1px #CCCCCC;"></div></td></tr><tr><td colspan="2" class="ToolTips"><table cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td style="padding:2px;" align="right" valign="middle" >'+GetTermine(JS_PER_VEDERE_SCARICA_JAVA)+'</td><td style="padding:2px;" valign="middle" ><a target="_blank" href="http://java.com/it/download/index.jsp?cid=jdp82245"><img hspace="4" alt="'+GetTermine(JS_INSTALLAZIONE_JAVA)+'" src="/images/getjava_sm.gif" style="border:0px; width:88px; height:31px;" /></a></td><td style="padding:2px; " valign="middle" >'+GetTermine(JS_PANORAMICHE_CONSIGLI)+'<img align="middle" style="margin:4px;" src="/images/icons/num_1.gif" class="icon16x16" alt="" /><img align="middle" style="margin:4px;" src="/images/icons/num_2.gif" class="icon16x16" alt="" /><img align="middle" style="margin:4px;" src="/images/icons/num_3.gif" class="icon16x16" alt="" />...'+ GetTermine(JS_ALTRI_PANORAMI)+ '</td></tr></table></td></tr></table>'; oDv.innerHTML = VgHTML; if(Esiste == false) AddMainDiv(oDv); SetPanorama(0,aryPan[0][0],aryPan[0][1],aryPan.length); fadeInObj('Panorama360',0,100); } catch(e) {} }
function SetPanorama(VgId,Titolo,FileName,Panlen) { try { var Width = 900; var Height = 420; var TitoloPanorama = $("TitoloPanorama"); if(TitoloPanorama!=null) TitoloPanorama.innerHTML = (VgId+1)+'&deg;)&nbsp;<b>'+Titolo+'<b>'; for(Idx = 0; Idx < Panlen; Idx++) { SetImg = $("ImgSetPan"+Idx); if(SetImg!=null) { if(VgId==Idx) SetImg.src="/images/icons/num_sel.gif"; else SetImg.src="/images/icons/num_"+(Idx+1)+".gif"; } } var ContenitorePanorama = $("ContenitorePanorama"); if(ContenitorePanorama!=null) { FileName = VgDecrypt(FileName); ContenitorePanorama.innerHTML = '<applet style="" code="ptviewer.class" width="'+Width+'" height="'+Height+'" archive="/inclusioni/ptviewer.jar">\n<param name="file" 		  value="'+FileName+'">\n<param name="cursor"         value="MOVE">\n<param name="quality" 		  value="9">\n<param name="auto"			  value="0.1">\n<param name="tilt" 		  value="0">\n<param name="pan" 			  value="0">\n<param name="fov"			  value="0">\n<param name="bgcolor"        value="FFFFFF">\n<param name="shotspot0"      value="x82 y399 a119 b418 q i\'/images/ptviewer/play3.gif\'">\n<param name="shotspot1"      value="x82 y399 a119 b418 p i\'/images/ptviewer/play4.gif\' u\'ptviewer:startAutoPan(-0.1,0,1)\'">\n<param name="shotspot2"      value="x109 y399 a136 b418 q i\'/images/ptviewer/play1.gif\'">\n<param name="shotspot3"      value="x109 y399 a136 b418 p i\'/images/ptviewer/play2.gif\' u\'ptviewer:startAutoPan(0.1,0,1)\'">\n<param name="shotspot4"      value="x136 y399 a163 b418 q i\'/images/ptviewer/stop1.gif\'">\n<param name="shotspot5"      value="x136 y399 a163 b418 p i\'/images/ptviewer/stop2.gif\' u\'ptviewer:stopAutoPan()\'">\n<param name="toolbarImage"   value="/images/ptviewer/toolbar.gif">\n<param name="showtoolbar"    value="true">\n<param name="toolbarDescr_x" value="170">\n</applet>\n'; SetLogFile(FileName); } } catch(e) {} }
function HeightSize() { var myHeight = 0; try { if( typeof( window.innerWidth ) == 'number' ) myHeight = window.innerHeight; else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) myHeight = document.documentElement.clientHeight; else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) myHeight = document.body.clientHeight; } catch(e) {} return myHeight; } 
function WidthSize() { var myWidth = 0; try { if( typeof( window.innerWidth ) == 'number' ) myWidth = window.innerWidth; else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) myWidth = document.documentElement.clientWidth; else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) myWidth = document.body.clientWidth; } catch(e) {} return myWidth; }
function ShowMaps(TITOLO_MENU, LATITUDINE, LONGITUDINE, ZOOM ,GET_TYPE_MAP) { try { TYPE_MAP = GET_TYPE_MAP; ChiudiTutteSchede(); destroyObj('MapBox'); var mapBox = document.createElement("div"); mapBox.id = 'MapBox'; mapBox.name = 'MapBox'; AddBody(mapBox); if(mapBox != null) { mapBox.innerHTML += '<table cellpadding="2" cellspacing="0" border="0" width="100%"><tr><td align="left" valign="middle" class="MapTitolo" nowrap="nowrap"><span style="width:100px; background-position: 3px 4px; background-image:url(/images/icons/ico_google.gif);" class="OpzioniBottone Puntatore" onclick="ShowMaps(\''+TITOLO_MENU+'\', \''+LATITUDINE+'\', \''+LONGITUDINE+'\', '+ZOOM+',\'GoogleMaps\');">'+GetTermine(JS_GOOGLE_MAPS)+'</span>&nbsp;<span style="width:130px; background-position: 3px 4px; background-image:url(/images/icons/ico_microsoft.gif);" class="OpzioniBottone Puntatore" onclick="ShowMaps(\''+TITOLO_MENU+'\', \''+LATITUDINE+'\', \''+LONGITUDINE+'\', '+ZOOM+',\'MsVirtualEarth\');">'+GetTermine(JS_MS_VIRTUAL_EARTH)+'</span>&nbsp;<span id="MapTitolo"></span></td><td valign="middle" align="right" class="MapChiudi Puntatore" onclick="HideObject(\'MapBox\');"><b>'+GetTermine(JS_CHIUDI)+'</b><img align="middle" src="/images/icons/ico_close.gif" class="IcoClose" alt="'+GetTermine(JS_CHIUDI_FINESTRA)+'" /></td></tr><tr><td colspan="4"><div id="MapPage" class="MapPage"></div></td></tr></table>'; mapBox.style.display=''; ResizeMap(); var maptitolo = $('MapTitolo'); if(maptitolo!=null) maptitolo.innerHTML = '<span style="font-size:12px;">Maps:</span>&nbsp;<span style="font-size:10px; font-weight:bold;">'+TITOLO_MENU+'</span>&nbsp;<span style="font-size:10px;" id="MapsCoordinate"></span>'; TITOLO_MENU = '<span style="font-size: 14px">' + TITOLO_MENU + '</span>'; if(TYPE_MAP == 'GoogleMaps') loadGoogleMaps('MapPage',LATITUDINE,LONGITUDINE,ZOOM,TITOLO_MENU); else if(TYPE_MAP == 'MsVirtualEarth') loadVirtualEarthMaps('MapPage',LATITUDINE,LONGITUDINE,ZOOM,TITOLO_MENU); else alert('Tipo di mappa non supportata ('+TYPE_MAP+').'); } } catch(e) {} }
function ResizeMap() { try { var mapBox = $('MapBox'); if(mapBox != null && mapBox.style != null) { var Top = GetTopPage(); if(Top < 70) Top = 70; var GMw = WidthSize() - 10; var GMh = HeightSize() - Top - 40 + ScroolPageTop(); mapBox.style.top = Top+'px'; mapBox.style.left = '0'; mapBox.style.width = (GMw+8)+'px'; mapBox.style.height = (GMh+30)+'px'; var mapBoxP = $('MapPage'); if(mapBoxP != null && mapBoxP.style != null) { mapBoxP.style.width = GMw+'px'; mapBoxP.style.height = GMh+'px'; } } } catch(e) {} }
function loadVirtualEarthMaps(DivName,Lat,Lng,Zoom,DescrHtml) { try { Gmap = null; if($(DivName) != null) $(DivName).innerHTML=''; var pinID = 1; SrcZoom = Zoom; SrcPoint = new VELatLong(Lat, Lng); Gmap = new VEMap(DivName); Gmap.LoadMap(SrcPoint, Zoom ,'h' ,false); GMapResetPoint(); Gmap.AttachEvent('onendpan', ShowLatLongZoom ); Gmap.AttachEvent('onendzoom', ShowLatLongZoom ); /*Gmap.ShowMiniMap();*/ Gmap.SetMapStyle(VEMapStyle.Hybrid); var rnd = Math.floor(Math.random()*3); var VEIcon = ''; rnd = Math.floor(Math.random()*3); if(rnd == 0) VEIcon = '/images/bird_map.gif'; else if(rnd == 1) VEIcon = '/images/map_falco.gif'; else VEIcon = '/images/map_colomba_pace.gif'; var pin = new VEPushpin(pinID,Gmap.GetCenter(),VEIcon,'Luogo:',DescrHtml,'VEiconStyle'); Gmap.AddPushpin(pin); } catch(e) {} }
function loadGoogleMaps(DivName,Lat,Lng,Zoom,DescrHtml) { try { if($(DivName) != null) $(DivName).innerHTML=''; if (GBrowserIsCompatible()) { Gmap = new GMap2($(DivName)); if(Gmap!=null) { var point = new GLatLng(Lat, Lng); SrcPoint = point; SrcZoom = Zoom; GMapResetPoint(); Gmap.addControl(new GLargeMapControl()); Gmap.addControl(new GOverviewMapControl()); Gmap.addControl(new GScaleControl()); Gmap.addControl(new GMapTypeControl()); Gmap.setMapType(G_HYBRID_MAP); var icon = new GIcon(); var rnd = Math.floor(Math.random()*3); if(rnd == 0) { icon.image = "http://www.vitagay.net/images/bird_map.gif"; icon.iconSize = new GSize(100, 74); } else if(rnd == 1) { icon.image = "http://www.vitagay.net/images/map_falco.gif"; icon.iconSize = new GSize(125, 111); } else { icon.image = "http://www.vitagay.net/images/map_colomba_pace.gif"; icon.iconSize = new GSize(100, 117); } icon.iconAnchor = new GPoint(120, 50); icon.infoWindowAnchor = new GPoint(120, 50); var marker = new GMarker(point, icon); Gmap.addOverlay(marker); GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(DescrHtml); }); GEvent.addListener(Gmap, "moveend", function() {  ShowLatLongZoom(); }); } } else alert(GetTermine(JS_NON_COMPATIBILE)); } catch(e) {} }
function ShowLatLongZoom(e) { try { var TxtCoord = $("MapsCoordinate"); if(TxtCoord != null) { var Txt = ''; var CurrLat = 0.0; var CurrLng = 0.0; var OrigLat = 0.0; var OrigLng = 0.0; var Zoom = 0; if(TYPE_MAP == 'GoogleMaps') { var center = Gmap.getCenter(); CurrLat = parseInt(center.y*1000000)/1000000; CurrLng = parseInt(center.x*1000000)/1000000; OrigLat = parseInt(SrcPoint.y*1000000)/1000000; OrigLng = parseInt(SrcPoint.x*1000000)/1000000; Zoom = Gmap.getZoom(); } else if(TYPE_MAP == 'MsVirtualEarth') { center = Gmap.GetCenter(); CurrLat = parseInt(center.Latitude*1000000)/1000000; CurrLng = parseInt(center.Longitude*1000000)/1000000; OrigLat = parseInt(SrcPoint.Latitude*1000000)/1000000; OrigLng = parseInt(SrcPoint.Longitude*1000000)/1000000; Zoom = Gmap.GetZoomLevel(); } Txt = "( Lat:<b>" + CurrLat.toString() + "</b>  Lng:<b>" + CurrLng.toString() + "</b>  Zoom:<b>" + Zoom + "</b> "; if( Zoom != SrcZoom || parseInt(CurrLat*1000)/1000 != parseInt(OrigLat*1000)/1000 || parseInt(CurrLng*1000)/1000 != parseInt(OrigLng*1000)/1000 ) { Txt += "<img align='bottom' class='Puntatore icon16x16' alt='"+GetTermine(JS_RESET_CCORDINATE)+"' src='/images/icons/arrow_in.gif' onclick='GMapResetPoint();' />"; classNameCoordinate = 'GMapMoved'; } else { Txt += "<img align='bottom' alt='"+GetTermine(JS_RESET_CCORDINATE)+"' src='/images/icons/ball_green.gif' class='icon16x16' />"; classNameCoordinate = 'GMapStart'; } TxtCoord.className = classNameCoordinate; Txt += ")"; TxtCoord.innerHTML = Txt; } } catch(e) {} }
function GMapResetPoint() { try { if(TYPE_MAP == 'GoogleMaps') Gmap.setCenter(SrcPoint, SrcZoom); else if(TYPE_MAP == 'MsVirtualEarth') Gmap.SetCenterAndZoom(SrcPoint, SrcZoom); ShowLatLongZoom(); } catch(e) {} }
function HidePopup(e) { try { if(StatoStep==0) { el = $("MenuPopUp"); if(el != null) { var Ok = true; if(!isIe && e != null) { var MouseX = e.pageX; var MouseY = e.pageY; var elX = parseInt(el.style.left); var elY = parseInt(el.style.top); var elW = parseInt(el.offsetWidth); var elH = parseInt(el.offsetHeight); if(MouseX >= elX && MouseX <= elX+elW && MouseY >= elY && MouseY <= elY+elH) Ok = false; } if(Ok) { StatoStep = -1; fadeOutObj('MenuPopUp',90,0); } } } } catch(e) {} }
function createFlashPlayer (src, width, height, params, flashvars, parentId) { try { var str = ""; var fv=""; if(flashvars != null) { for(var i in flashvars) fv+=i+"="+flashvars[i]+"&"; } str += "<embed menu=\"false\" bgcolor=\"#FFFFFF\" AllowScriptAccess=\"always\" src=\"" + src + "\" flashVars=\"" + fv + "\" width=\"" + width + "\" height=\"" + height + "\""; for(var ii in params) { str += " " + ii + "=\"" + params[ii] + "\""; } str += "></embed>"; document.write(str); } catch(e) {} }
function showMenu(event) { try { if(StatoStep==0) { var el = null; var elBack = null; var Esiste=true; el = $("MenuPopUp"); if(isIe) elBack = $("MenuPopUpBack"); if(el == null) Esiste=false; if ((isIe&&event.type=="contextmenu")||(!isIe && event.which>1)) { if(!Esiste) { el = document.createElement("div"); if(isIe) elBack = document.createElement("IFRAME"); } if(isIe) { elBack.id='MenuPopUpBack'; elBack.src = "javascript:false;"; elBack.style.zIndex="60000"; elBack.style.display = 'none'; elBack.style.position = 'absolute'; elBack.style.border = '0'; elBack.className = 'Opacity0'; elBack.src=''; } el.id='MenuPopUp'; el.className = "VGm Opacity10"; el.style.zIndex="60001"; el.style.display = 'block'; el.style.border = 'outset 2px #FFDDDD'; el.style.visibility = 'visible'; el.style.padding = '4px 4px 4px 4px'; el.style.backgroundColor = '#FFFFAA'; el.style.backgroundImage = 'url(/images/vetro_giallo.jpg)'; if(isIe) el.onmouseleave = HidePopup; else el.onmouseout = HidePopup; if(isIe) el.style.filter = ' alpha(opacity=0)'; else el.style.opacity = 0; var Subject = 'Vi invio le mie foto, da inserire nella pagina: '+self.location.href; var CurPage = self.location.href; var InviaAmico = 'InviaPaginaAmico(\''+CurPage+'\')'; 
var VgHTML = '<span class="VGmit"><a href="javascript:void(0);" onclick="HidePopup();" class="VGmi" '+
'style="color:#FFFF00; font-weight:bold; border:inset 1px; background-color:#BB9900; padding:2px;">'+
'VitaGay.Net <img align="middle" src="/images/linea_3_in.gif" style="border:0px; height:10px; width:200px;" alt="" /> <img src="/images/icons/ico_close.gif" style=" border:0px;" align="middle" alt="'+GetTermine(JS_CHIUDI_QUESTO_MENU)+'" /></a></span>'+
'<a style="background-image: url(/images/icons/house.gif);" onclick="self.location.href=\'/\'" class="VGmi VGPopupItem" href="javascript:void(0);">'+GetTermine(JS_HOMEPAGE)+'</a>'+
'<a style="background-image: url(/images/icons/action_back.gif);" onclick="history.back();" class="VGmi VGPopupItem" href="javascript:void(0);">'+GetTermine(JS_TORNA_IN_DIETRO)+'</a>'+
'<a style="background-image: url(/images/icons/action_forward.gif);" onclick="history.go(1);" class="VGmi VGPopupItem" href="javascript:void(0);">'+GetTermine(JS_VAI_AVANTI)+'</a>'+
'<a style="background-image: url(/images/icons/ico_cerca.gif);" onclick="self.location.href=\'/web/cerca.aspx\'" class="VGmi VGPopupItem" href="javascript:void(0);">'+GetTermine(CERCA_TESTO)+'</a>'+
'<div class="VGmis"></div>'+
'<a style="background-image: url(/images/icons/ico_preferiti.gif);" onclick="HidePopup(); AddFavorite(location.href, document.title);" class="VGmi VGPopupItem" href="javascript:void(0);">'+GetTermine(JS_INSERISCI_PREFERITI)+'</a>'+
'<a style="background-image: url(/images/icons/ico_smile.gif);" HidePopup(); onclick="'+InviaAmico+'" class="VGmi VGPopupItem" href="javascript:void(0);">'+GetTermine(JS_INVIA_AMICO)+'</a>'+
'<a style="background-image: url(/images/icons/printer.gif);" onclick="if(StampaQuestaPagina) StampaQuestaPagina()" class="VGmi VGPopupItem" href="javascript:void(0);">'+GetTermine(JS_STAMPA)+'</a>'+
'<div class="VGmis"></div>'+
'<a style="background-image: url(/images/icons/ico_contribuisci2.gif);" onclick="self.location.href=\'/web/contribuisci.aspx?rif='+CurPage+'\'" class="VGmi VGPopupItem" href="javascript:void(0);">'+GetTermine(JS_CONTRIBUISCI)+'</a>'+
'<a style="background-image: url(/images/icons/email_go.gif);" onclick="self.location.href=\'mailto:pagine@vitagay.net/?subject='+Subject+'\'" class="VGmi VGPopupItem" href="javascript:void(0);">'+GetTermine(JS_INVIA_FOTO)+'</a>';
el.innerHTML = VgHTML; if(Esiste == false) { if(isIe) AddBody(elBack); AddBody(el); } var pageW = document.body.offsetWidth; var pageH = document.body.offsetHeight; var x = event.clientX - ScroolPageLeft() - 10 - (el.offsetWidth/5); var y = event.clientY + ScroolPageTop() - 20; if ((x+parseInt(el.offsetWidth))>=pageW) x = pageW - parseInt(el.offsetWidth) - 5; if(x<3) x=3; if(y<3) y=3; el.style.top = y + "px"; el.style.left = x + "px"; if(isIe) { elBack.style.top = el.style.top; elBack.style.left = el.style.left; elBack.style.width = el.offsetWidth; elBack.style.height = el.offsetHeight; elBack.style.display = 'block'; } StatoStep = 1; fadeInObj('MenuPopUp',0,90); } else if(Esiste && isIe) HidePopup(event); } } catch(e) {} }
function ShowPdig(IsVideo,IsImage,IsAudio,FileName,Width,Height,Titolo) { ShowObj(IsVideo,IsImage,IsAudio,FileName,Width,Height,Titolo); }
function AddSlideButton(ImmagineCorrente) { try {if(TotaleImgView > 1){if(IndexImgView > 0){PrevImg=VgDecrypt(vgImg[IndexImgView-1][1]);PrevW=vgImg[IndexImgView-1][2];PrevH=vgImg[IndexImgView-1][3];}else{PrevImg=VgDecrypt(vgImg[TotaleImgView-1][1]);PrevW=vgImg[TotaleImgView-1][2];PrevH=vgImg[TotaleImgView-1][3];}if(IndexImgView < TotaleImgView-1){NextImg=VgDecrypt(vgImg[IndexImgView+1][1]);NextW=vgImg[IndexImgView+1][2];NextH=vgImg[IndexImgView+1][3];}else{NextImg=VgDecrypt(vgImg[0][1]);NextW=vgImg[0][2];NextH=vgImg[0][3];} clearTimeout(TimerPreload); TimerPreload=setTimeout(PreloadPrevNextImg,2000);}} catch(e) {} if( ImmagineCorrente != null && TotaleImgView > 1) { try { var ButtonPlayImage='ico_film.gif'; var TipsAlt = ''; if(FlPlayerImg) { ButtonPlayImage='pl_num_5.gif'; TipsAlt = GetTermine(JS_IMG_PLAYER_STOP); } else TipsAlt = GetTermine(JS_IMG_PLAYER); var Ht = "<img id=\"VgPlayerImg\" class=\"IcoPlayerImg Puntatore icon16x16\" title=\""+TipsAlt+"\" alt=\""+TipsAlt+"\" src=\"/images/icons/"+ButtonPlayImage+"\" onclick=\"StartStopPlayerImg()\" />"; if(IndexImgView > 0) Ht += "<img class=\"IcoPlayerImg Puntatore icon16x16\" title=\""+GetTermine(JS_IMG_PREC)+ "\" alt=\""+GetTermine(JS_IMG_PREC)+"\" src=\"/images/icons/ico_sx_16x16.gif\" onclick=\"FlPlayerImg=false; SlideImgGallery(IndexImgView,'Prev');\" />"; else Ht += "<img class=\"IcoPlayerImg icon16x16\" alt=\"\" src=\"/images/vg.gif\" />"; Ht += '<span style="padding-top:3px; color:#FFFFFF;"><b>'+(IndexImgView+1)+'</b>/'+TotaleImgView+"</span>"; if(IndexImgView < TotaleImgView-1) Ht += "<img class=\"IcoPlayerImg Puntatore icon16x16\" title=\""+GetTermine(JS_IMG_SUCC)+ "\" alt=\""+GetTermine(JS_IMG_SUCC)+"\" src=\"/images/icons/ico_dx_16x16.gif\" onclick=\"FlPlayerImg=false; SlideImgGallery(IndexImgView,'Next');\">"; else Ht += "<img class=\"IcoPlayerImg icon16x16\" alt=\"\" src=\"/images/vg.gif\" />"; ImmagineCorrente.innerHTML = Ht+"&nbsp;&nbsp;"; } catch(e) {} } }
function HideDivShow() { try { $('PreviewImg').style.display='none'; } catch(e) {} try { $('PreviewImg').innerHTML=null; } catch(e) {} try { $('ShowObj').innerHTML=null; $('ShowObj').style.width='0'; $('ShowObj').style.height='0';} catch(e) {} try { $('DivShow').style.display='none'; } catch(e) {} try { $('divLente').style.display='none'; $('divLente').innerHTML = ''; } catch(e) {} }

var DebugZoom = false;
var ImgOpened = null;
var ImgOpenedWidth = 0;
var ImgOpenedHeight = 0;
var ImgOpenedZoom = 2;
var PosMouseImgX = 0;
var PosMouseImgY = 0;
var LenteWidth = 250;
var LenteHeight = 200;
var txtImgZoom = '';
var Debug = '';

function ShowObj(IsVideo,IsImage,IsAudio,FileName,Width,Height,Titolo)
{
    try {
        ImgOpened = null;
        ChiudiTutteSchede();
        HideShowVideo(false);
        FileName = VgDecrypt(FileName);
        var ImmagineCorrente = $('ImmagineCorrente');
        if( ImmagineCorrente!=null )
            ImmagineCorrente.innerHTML = '';
        if(vgImg != null)
        {
            for(Inc=0; Inc<TotaleImgView; Inc++)
            {
                if(VgDecrypt(vgImg[Inc][1]) == FileName)
                {
                    IndexImgView = Inc;
                    break;
                }
            }
        }
        var DivS = $('DivShow');
        var PreviewImg = $("PreviewImg");
        var Esiste = true;
        if(PreviewImg == null)
        {
            Esiste=false;
            PreviewImg = document.createElement("div");
            PreviewImg.id='PreviewImg';
            if(DivS == null)
                AddBody(PreviewImg);
            else
                DivS.appendChild(PreviewImg);
        }
        if(DivS == null)
        {
            PreviewImg.style.position="absolute";
            PreviewImg.style.zIndex="1000";
        }
        PreviewImg.style.display = '';
        PreviewImg.style.color='#000000';

        if(Width>820 || Height>520)
        {
            var maxW = 820.0;
            var maxH = 520.0;
            var Scale = ((maxW / Width) <= (maxH / Height)) ? (maxW / Width) : (maxH / Height);
            Width = parseInt(Width * Scale);
            Height = parseInt(Height * Scale);
        }
        ImgOpenedWidth = Width;
        ImgOpenedHeight = Height;
        var ImgL = '0';

        if(!IsAudio)
        {
            if(Width < 820)//350)
            {
                Width = 820; //350;
                ImgL = (parseInt((Width-ImgOpenedWidth)/2)).toString()+'px';
            }
            Height = 521;
        }
        var BaW = Width+11;
        var BaWt = Width-120;
        var Html = 
            '<table border=0 cellpadding=0 cellspacing=0 style="width:'+BaW.toString()+'px"><tr>'+
            '<td valign="middle" align="left" style="width:5px;" class="TdShowTitoloLeft"><img src="/images/vg.gif" style="width:5px; height:20px;" alt="" /></td>'+
            '<td valign="middle" align="left" style="width:'+BaWt.toString()+'px"  class="TdShowTitoloCenter" id="TitoloImgCur" ><b>'+Titolo+'</b></td>'+
            '<td valign="middle" align="center" style="width:153px; white-space:nowrap;" class="TdShowTitoloCenter"><span id="ImmagineCorrente"></span></td>'+
            '<td valign="middle" align="right" style="width:16px; white-space:nowrap; padding: 2px 4px 0 0; " class="TdShowTitoloRight"><img onclick="FlPlayerImg=false; HideDivShow();" src="/images/icons/ico_close.gif" class="IcoClose Puntatore" alt="'+GetTermine(JS_CHIUDI_FINESTRA)+'" /></td>'+
            '</tr><tr><td colspan="4">'+
            '<table border="0" cellpadding="3" cellspacing="0"><tr>'+
            '<td id="tdImgGallery" class="TdShowObjBody" style="background-color:#4b82b4;">';
        if(IsImage)
        { 
            //if(TotaleImgView > 1) VgScr = 'SlideImgGallery(IndexImgView,\'Next\');';
            Html += 
                '<div id="ShowObj" class="ShowObj" style="width:'+(Width-2).toString()+'px; height:'+Height.toString()+'px;" >'+
                '<img src="'+FileName+'" style="border:0px; position:absolute; z-index:1; top:0; left:'+ImgL.toString()+
                ';" alt="" width="'+ImgOpenedWidth.toString()+'" height="'+ImgOpenedHeight.toString()+'" >';
            var VgScr = 'HideDivShow();';
            Html += '<img style="position:absolute; z-index:2; top:0; left:0;" class="Puntatore" onmousedown="FlPlayerImg=false; '+VgScr+
                '" src="/images/vg.gif" alt="" width="'+(Width-2).toString()+'" height="'+Height.toString()+'" /></div>';

            PreviewImg.innerHTML = Html + AddGalleryFooter(Width);
            AddSlideButton($('ImmagineCorrente'));

            var tdImgGallery = $('tdImgGallery');
            if(tdImgGallery != null && !isFx)
            {
                ImgOpened = FileName;
                document.onkeyup = SetZoom;
                tdImgGallery.onmousemove = ZoomImgOver;
                if(isIe)
                    tdImgGallery.onmouseleave = ZoomImgOut;
                else
                    tdImgGallery.onmouseout = ZoomImgOut;
            }
        }
        else if(IsVideo)
        {
            if(FileName.indexOf(".flv") > 0)
            {
                Html = Html + 
                    '<div align="center" class="ShowObj" style="width:'+Width.toString()+'px; height:'+Height.toString()+'px;">'+
                    '<embed style="margin:0;" src="/inclusioni/flvplayer.swf" ' +
                    'flashvars="file='+FileName+'&autostart=true&allowfullscreen=true' +
                    '&backcolor=0x000099&frontcolor=0xAABBFF&lightcolor=0x0000FF" '+
                    'type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" ' +
                    'height="'+ImgOpenedHeight+'" width="'+ImgOpenedWidth+'" repeat="true"></embed>'+
                    '</div>';
            }
            else if(FileName.indexOf(".avi") > 0 || FileName.indexOf(".wmv") > 0 || FileName.indexOf(".mpg") > 0 || FileName.indexOf(".mov") > 0)
            {
                Html += 
                    '<div align="center" class="ShowObj" style="width:'+Width.toString()+'px; height:'+Height.toString()+'px;">'+
                    '<embed style="margin-left:0;" align="middle" autostart="true"' +
                    ' src="'+ FileName + '" width="' + ImgOpenedWidth + '" height="' + ImgOpenedHeight + '"></embed>'+
                    '</div>';
            }
            else
                Html += '<div align="center" class="ShowObj" style="width:'+Width.toString()+'px; height:'+Height.toString()+'px;">'+
                    ShowYouTubeVideo(FileName,ImgOpenedWidth,ImgOpenedHeight)+'</div>';
                
            PreviewImg.innerHTML = Html + AddGalleryFooter();
            StopSound();
        }
        else
        {
            Html += 
                '<embed style="margin-left:4px;" src="/inclusioni/mediaplayer.swf" '+
                'flashvars="file='+FileName+'&autostart=true" '+
                'type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" '+
                'height="'+Height+'" width="'+Width+' repeat="true" />';
           PreviewImg.innerHTML = Html + AddGalleryFooter();
           StopSound();
        }
        if(DivS == null)
        {
            SetLeft(PreviewImg);
            StartScrool();
        }
        else DivS.style.display='block';
        PreviewImg.style.display='block';
        SetLogFile(FileName);
    } catch(e) {}
}

function AddGalleryFooter(Width)
{
    return  '</td></tr><tr><td align="center" class="CopyrightGallery">'+ 
            '<iframe id="IfrmAdSense" style="background-color:#222222;" src="/inclusioni/adsense_gallery.htm" width="'+Width+'" height="85" scrolling="no" frameborder="no" noresize="noresize"></iframe>'+
            '</td></tr></table>'+
            '</td></tr></table>';
}


function ZoomImgOver(e)
{
    try {
        Debug = '';
        var divLente = $('divLente');
        if(ImgOpenedZoom <= 1)
        {
            if(divLente != null && divLente.style.display!='none')
                divLente.style.display='none';
        }
        else
        {
            if (!e) e = window.event;
            var Mx = GetMouseX(e);
            var My = GetMouseY(e);
            var ImgLeft = 0;
            var ImgTop = 0;
            var tdImgGallery = $('tdImgGallery');
            var PreviewImg = $("PreviewImg");
            var DivShow = $("DivShow");
            txtImgZoom = 'Zoom: x'+ImgOpenedZoom;
            if(PreviewImg != null && tdImgGallery != null)
            {
                var TitoloH = 50;
                var TitoloImgCur = $('TitoloImgCur');
                if(TitoloImgCur != null)
                    TitoloH = TitoloImgCur.clientHeight;

                if(e.offsetX)
                {
                    PosMouseImgX = e.offsetX;
                    PosMouseImgY = e.offsetY;
                    if(DebugZoom) Debug = '<br>PosMouseImgX='+PosMouseImgX+'<br>PosMouseImgY='+PosMouseImgY+'<br>';

                }
                else
                {
                    PosMouseImgX = e.clientX;
                    PosMouseImgY = e.clientY;
                    if(DivShow != null && DivShow.style.display != 'none')
                    {
                        if(isFx)
                        {
                            if(parseInt($('GalleriaPagina').style.top)==0)
                                PosMouseImgY -= 80;
                        }
                        var tbMasterW = parseInt($('tbMaster').clientWidth);
                        PosMouseImgX -= parseInt(((parseInt(pageWidth()) - tbMasterW) / 2) - 23 + tbMasterW - parseInt(tdImgGallery.clientWidth) - parseInt($('GalleriaPagina').clientWidth));
                        PosMouseImgY -= TitoloH;
                        if(DebugZoom) 
                            Debug = 
                                '<br>PosMouseImgX= '+PosMouseImgX+
                                '<br>PosMouseImgY= '+PosMouseImgY+
                                '<br>GalleriaPagina.style.top= '+parseInt($('GalleriaPagina').style.top);
                                
                    }
                }
                
                PosMouseImgX -= ((parseInt(tdImgGallery.clientWidth)-8)-parseInt(ImgOpenedWidth))/2;
                
                if(DebugZoom) Debug += 
                    '<br>ImgOpenedWidth='+parseInt(ImgOpenedWidth)+
                    '<br>PreviewImg.clientWidth='+(parseInt(tdImgGallery.clientWidth)-8)+
                    '<br>PosMouseImgX New= '+PosMouseImgX;
                
                
                if(divLente == null)
                {
                    divLente = document.createElement("div");
                    divLente.id = 'divLente';
                    divLente.style.position="absolute";
                    divLente.style.zIndex="20010";
                    divLente.style.display = 'none';
                    divLente.style.overflow = 'hidden';
                    divLente.className = 'divLente Puntatore';
                    divLente.style.width = LenteWidth+'px';
                    divLente.style.height = LenteHeight+'px';
                    AddBody(divLente);
                }
                if(divLente != null && ImgOpened != null)
                {
                    var ImgZoomed = $('ImgZoomed');
                    if(ImgZoomed == null)
                    {
                        divLente.innerHTML = 
                            '<img id="ImgZoomed" src="'+ImgOpened+'" alt="" style="border:o; position:absolute; '+
                            'left: '+(-(PosMouseImgX*ImgOpenedZoom)+(LenteWidth/2))+'px; top: '+(-(PosMouseImgY*ImgOpenedZoom)+(LenteHeight/2))+'px; width: '+(ImgOpenedWidth*ImgOpenedZoom)+'px; height: '+(ImgOpenedHeight*ImgOpenedZoom)+'px;" />' +
                            '<div id="txtImgZoom" style="position:absolute; left:0; top:0; z-index:100; font-weight:bold; color:#FFFFFF"></div>';
                    }
                    else
                    {
                        if(ImgZoomed.src != ImgOpened)
                            ImgZoomed.src = ImgOpened;
                        UpdateZoomSize(ImgZoomed);
                    }
                    if($('txtImgZoom') != null)
                        $('txtImgZoom').innerHTML = txtImgZoom + Debug;
                    
                    Mx -= LenteWidth/2;
                    My += 20;
                    if(Mx<0) Mx=0;
                    divLente.style.left=Mx+'px';
                    divLente.style.top=My+'px';
                    if(divLente.style.display=='none')
                        divLente.style.display='inline';
                }
            }
        }
    } catch(e) {}
}

function UpdateZoomSize(ImgZoomed)
{
    try {
        if(ImgZoomed != null)
        {
            ImgZoomed.style.left = ((LenteWidth/2)-(PosMouseImgX*ImgOpenedZoom))+'px';
            ImgZoomed.style.top = ((LenteHeight/2)-(PosMouseImgY*ImgOpenedZoom))+'px';
            ImgZoomed.style.width = (ImgOpenedWidth*ImgOpenedZoom)+'px';
            ImgZoomed.style.height = (ImgOpenedHeight*ImgOpenedZoom)+'px';
        }
    } catch(e) {}
}

function SetZoom(e)
{
    try {
        var divLente = $('divLente');
        if(divLente != null && divLente.style.display!='none')
        {
            if (!e) e = window.event;
            var KeyID = ''; 
            if(window.event)
                KeyID = e.keyCode;
            else if(e.which)
                KeyID = e.which;
                
            if (KeyID == 107 && ImgOpenedZoom < 10)
                ImgOpenedZoom++;
            else if (KeyID == 109 && ImgOpenedZoom > 1)
                ImgOpenedZoom--;
            txtImgZoom = 'Zoom: x'+ImgOpenedZoom;
            if(ImgOpenedZoom <= 1)
            {
                if(divLente.style.display!='none')
                    divLente.style.display='none';
            }
            else
            {
                if(divLente.style.display!='inline')
                    divLente.style.display = 'inline';
                if($('txtImgZoom') != null)
                    $('txtImgZoom').innerHTML = txtImgZoom + Debug;
                UpdateZoomSize($('ImgZoomed'));
            }
        }
    } catch(e) {}
}


function ZoomImgOut(e)
{
    try {
        var divLente = $('divLente');
        if(divLente != null)
            divLente.style.display='none';
    } catch(e) {}
}





