/***************************************************************\
|             Copyright © 2007-2009 By VitaGay.Net               |
|         vitagay.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);}
window.onerror = VG_ShowErr; var VgBodyWidth = 970; var n4=(document.layers)?true:false; var wndPrint = null; var VgTitolo = null; var VgBody = null;var tempX = 0;var tempY = 0;var wndZoom = null; var VgOlFunc = new Array();var OldinnerHTMLFlash = '';var PrevRegSel = null; var StartY = 0; var BarraAltaHeight = 74; var StepScroll = isIe?8:4; var StepTime = isIe?10:5; var Scivola = true; var GalleriaPagina = null; var ScrollAvviato = false;
function VgGoTo() { ChiudiTutteSchede(); ShowHideAttendere(''); ShowHideImgFix('none',true); }
function OIP(Img, Stato) { try { if(Img != null) { if(Stato) Img.className='VgGpHover Puntatore'; else  Img.className='VgGp'; } } catch(e) {} }
function ShowHideAttendere(Disp){ try { if($('divJsAttendere') != null) $('divJsAttendere').style.display=Disp; } catch(e) {} }
function ShowHideLingue(){var objLang = $('BarraAltaLingue');if(objLang != null){var show = (objLang.style.display == 'none')?true:false;if(show){fadeInObj('divInnerBarraAltaLingue',0,95);objLang.style.display = '';}else{objLang.style.display = 'none';}}}
function AddBody(elemento) {return document.body.appendChild(elemento);}
function AddMainDiv(elemento) {return $('VgMainDiv').appendChild(elemento);}
function AddVgEvent() { document.body.onscroll = PosizionaSchede; window.onresize = PosizionaSchede; window.onscroll = PosizionaSchede; }
function addListener(element, event, listener, bubble) {try { if(element.addEventListener) { if(typeof(bubble) == "undefined") bubble = false; element.addEventListener(event, listener, bubble); } else if(this.attachEvent) element.attachEvent("on" + event, listener); } catch(e) {} }
function addEvent(oTarget, sType, fpDest) { var oOldEvent = oTarget[sType]; if (typeof oOldEvent != "function") { oTarget[sType] = fpDest; } else { oTarget[sType] = function(e) { oOldEvent(e); fpDest(e); } } }
function addWindowOnLoadEvent(func) {var oldonload = window.onload; if (typeof window.onload != 'function') { window.onload = func; } else { window.onload = function() { if (oldonload) { oldonload(); } func(); } } }
function addWindowOnUnloadEvent(func) { var oldonunload = window.onunload; if (typeof window.onunload != 'function') { window.onunload = func; } else { window.onunload = function() { if (oldonunload) { oldonunload(); } func(); } } }
function VgOlRun() { for(var i = 0;i < VgOlFunc.length;i++) { try { eval(VgOlFunc[i]); } catch(e) {} } }
function onLoadAdd(func) { try { VgOlFunc[VgOlFunc.length] = func; } catch(e) {} } 
function Del(elemento) {return $('VgMainDiv').removeChild(elemento);}
function GetTopPage() {return document.documentElement&&document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop;}
function EndVitaGayNet() { try { HtmlIsLoad=false;PageIsLoad=false; if($('MapPage')!=null) GUnload(); } catch(e) {} }
function CopyToClipboard(ObjTxt) { ObjTxt.focus(); ObjTxt.select(); TheRange=ObjTxt.createTextRange(); TheRange.execCommand("Copy"); }
function ScroolPageTop() { return typeof window.pageYOffset != 'undefined' ? window.pageYOffset: document.documentElement.scrollTop? document.documentElement.scrollTop: document.body.scrollTop? document.body.scrollTop:0; } 
function ScroolPageLeft() { return typeof window.pageXOffset != 'undefined' ? window.pageXOffset: document.documentElement.scrollLeft? document.documentElement.scrollLeft: document.body.scrollLeft? document.body.scrollLeft:0; }
function isDefined(variable) { return (typeof(window[variable]) == "undefined")?  false: true; }
function isDefinedFunc(Function) { return (typeof(Function) == "undefined")?  false: true; }
function AddFavorite(Href, Title) { try { if (isIe) window.external.AddFavorite(Href , Title); else if (window.sidebar) window.sidebar.addPanel(Title, Href,""); } catch(e) { alert(GetTermine(JS_NO_IN_QUESTO_BROWSER)); } }
function TipsTextBoxOnMouseDownUp(Obj, isUp, Tips) { try { if(isUp && Obj.value == '') { Obj.value = Tips; } if(!isUp && Obj.value == Tips) { Obj.value = ''; } } catch(e) {} }
function FindCtrl(NomeId,ShowAlert) { var Ret=null; try { if (isIe) Ret = eval('document.all.'+NomeId); else Ret = $(NomeId); if(Ret==null && ShowAlert) alert('Attenzione! Il controllo \''+NomeId+'\' non č stato trovato con document.'+isIe?'all...':'getElementById(...'); } catch(e) {} return Ret; }
function VG_preloadImages() {try { var d=document; if(d.images) { if(!d.VG_p) d.VG_p=new Array(); var i, j=d.VG_p.length, a=VG_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0) { d.VG_p[j]=new Image; d.VG_p[j++].src='/images/'+a[i]; } } } catch(e) {} return d.VG_p; }
function ShowPreview(NomeTxt,NomeDiv) { try { var Txt; var Div; Txt = FindCtrl(NomeTxt,false); Div = FindCtrl(NomeDiv,false); if(Txt != null && Div != null) Div.innerHTML = replaceAll(Txt.value, '\r', '<br>') ; } catch(e) {} }
function OpenUrl(Dest, Trg) { var win = window.open (Dest, Trg, ''); win.focus(); }
function OpenUrlCenter(Dest, Trg, wi, hi) { var win = window.open (Dest, Trg, 'toolbar=no,status=no,menubar=no,scrollbars=no,resizable=no,top=' + ((screen.height-hi)/2) + ',left=' + ((screen.width/2)- wi/2) + ',width=' + wi + ',height=' + hi); win.focus(); }
function VG_ShowErr(err,sURL,sLine) { try { var strErr = err+'\nLinea:'+sLine+'\nin:'+sURL; if(sURL.indexOf('http://www.vitagay.net')<0) alert(strErr); else { var HiddenPost = $('HiddenPost'); if(HiddenPost != null) HiddenPost.src = '/inclusioni/form/vg_form.aspx?Type=InviaErrore&Err='+escape(strErr); } } catch(e) {} return true; }
function OpenUrlTop(Dest, Trg, wi, hi) { var win = window.open (Dest, Trg, "toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=yes,top=0,left=" + ((screen.width/2)- wi/2) + ",width=" + wi + ",height=" + hi); win.focus(); }
function OpenUrlInPage(NomeID,strUrl,intW,intH,Titolo,UseOpacity) { var intT = GetTopPage(); var intL = parseInt((VgBodyWidth - intW) / 2); var oDiv = $(NomeID); if(oDiv == null) { oDiv = document.createElement("div");oDiv.id = NomeID; oDiv.name = NomeID; if(UseOpacity) oDiv.className = "DivUrlInPage Opacity90"; else oDiv.className = "DivUrlInPage"; AddMainDiv(oDiv); } oDiv.style.left = intL+'px'; oDiv.style.top = intT+'px'; oDiv.style.display='block'; oDiv.innerHTML = '<div class="DivUrlInPageBarraAlta" style="width:'+intW+'px;"><table cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td align="left" width="10%"><div class="OpzioniBottone Puntatore" style="background-image:url(/images/icons/printer.gif);" onclick="StampaIframe(\'iFrame'+NomeID+'\');">'+GetTermine(JS_STAMPA)+'</div></td><td  align="center" width="80%"><div class="DivUrlInPageBarraAltaLeft">'+Titolo+'</div></td><td align="right" width="10%"><div class="DivUrlInPageBarraAltaRight" onclick="CloseUrlInPage(\''+NomeID+'\')"><img align="middle" src="/images/icons/ico_close.gif" class="IcoClose" alt="'+GetTermine(JS_CHIUDI_FINESTRA)+'" /></div></td></tr></table></div><iframe id="iFrame'+NomeID+'" src="/inclusioni/form/blank.htm" name="iFrame'+NomeID+'" width="'+intW+'" height="'+intH+'" frameborder="0"></iframe>'; var Doc = getIFrameDocument("iFrame"+NomeID); Doc.open(); Doc.write('<html xmlns="http://www.w3.org/1999/xhtml"><head><title></title></head><body style="background-color:#EEEEEE;"><br /><br /><center><b>'+GetTermine(JS_ATTENDERE)+'</b><br /><br /><br /><img src="/images/loading_scheda.gif" align="middle" alt="" /></center></body></html>');Doc.close();if(strUrl != ''){var iFrm = $("iFrame"+NomeID);iFrm.src = strUrl;}return Doc;}
function CloseUrlInPage(NomeID){var oDiv = $(NomeID);if(oDiv != null){oDiv.innerHTML = '';oDiv.style.display='none';Del(oDiv);if($(NomeID+'Iframe')!=null)Del($(NomeID+'Iframe'));}}
function setOpacity(Obj,value) { try { if(Obj != null && Obj.style != null) { Obj.style.opacity = value/100; Obj.style.filter = 'alpha(opacity=' + value + ')'; } } catch(e) {} }
function replaceAll(sString, sReplaceThis, sWithThis) { try { if (sReplaceThis != "" && sReplaceThis != sWithThis) { var counter = 0; var start = 0; var before = ""; var after = ""; while (counter<sString.length) { start = sString.indexOf(sReplaceThis, counter); if (start == -1) { break; } else { before = sString.substr(0, start); after = sString.substr(start + sReplaceThis.length, sString.length); sString = before + sWithThis + after; counter = before.length + sWithThis.length; } } } } catch(e) {} return sString; } 
function VgDecrypt(theText) { try { output = new String; if(theText.charAt(0)=='V' && theText.charAt(1)=='G' && theText.charAt(2)=='F') { theText=theText.replace('047105109109097103105110105047','047122111111109047'); TextSize = theText.length; for (i = 3; i < TextSize; i+=3) { output += String.fromCharCode(theText.charAt(i)+theText.charAt(i+1)+theText.charAt(i+2)); } } else output = theText; } catch(e) { output = theText; } return output; }
function changeOpacByIdName(opacity, ObjIdName) { changeOpac(opacity, $(ObjIdName)); } 
function changeOpac(opacity, ObjId) { try { if(ObjId && ObjId.style) { var object = ObjId.style; opac = (opacity / 100); object.opacity = opac; object.MozOpacity = opac; object.KhtmlOpacity = opac; object.filter = "alpha(opacity=" + opacity + ")"; } } catch(e) {} } function ObjMouseOverOut(ObjId,IsOver) { try { if(IsOver) changeOpac(40, ObjId); else changeOpac(100, ObjId); } catch(e) {} }
function PannelloMouseOverOut(ObjId,Opacity,Zindex) { try {ObjId.style.zIndex = Zindex; changeOpac(Opacity, ObjId); } catch(e) {} }
function HideShowVideo(ShowHide) { try { var ObjVid = $('divVideo'); if(ObjVid != null) { if(ShowHide) ObjVid.style.display = ''; else ObjVid.style.display = 'none'; } } catch(e) {}  } 
function HideObject(NomeObj) { try { var divObj = $(NomeObj); if(divObj != null) { divObj.style.display = 'none'; divObj.innerHTML = ''; } HideShowVideo(true); } catch(e) {} }
function ChiudiTutteSchede() { HideObject('divMeteo'); HideObject('Panorama360'); HideObject('MapBox'); HideDivShow(); }
function PosizionaSchede() { SetLeft($("PreviewImg")); OnScroolBrowserPerGalleria(); ResizeMap();}
function SetLeft(Obj) { if(Obj != null) Obj.style.left = parseInt((document.body.offsetWidth - Obj.offsetWidth) / 2)+"px"; }
function SfogliaIcone() { OpenUrlCenter('/inclusioni/form/SfogliaIcone.aspx?','SfogliaIcone',800,660); }
function StartStopScrool(Obj) { try { if(Obj!=null) { if(Obj.alt=='Stop') { Obj.stop(); Obj.alt='Play'; } else { Obj.start(); Obj.alt='Stop'; } } } catch(e) {} }
function StartStopScroolByName(ObjName,IsOver) { try { var Obj = $(ObjName); if(Obj!=null) { if(!IsOver) { Obj.stop(); } else { Obj.start(); } } } catch(e) {} }
function GalleryOverOut(ObjTable,ClassOpacity,NamePanel,Height) { try { ObjTable.className = ClassOpacity; $(NamePanel).style.height = Height; } catch(e) {} } 
function get_cookie(Name) { var search = Name + "="; var returnvalue = ""; if (document.cookie.length > 0) { offset = document.cookie.indexOf(search); if (offset != -1) { offset += search.length; end = document.cookie.indexOf(";", offset); if (end == -1) end = document.cookie.length; returnvalue=unescape(document.cookie.substring(offset, end)); } } return returnvalue; }
function set_cookie(Nome, Valore) { document.cookie = Name + '=' + Valore; }
function WriteInnerHtmlInDiv(DivName,InnerHtml) { try { var Div = $(DivName); if(Div != null) { Div.innerHTML = InnerHtml; Div.style.display='block'; } } catch(e) {} }
function ShowBarraAlta(DivName,FileSwf,wid,hei) { WriteInnerHtmlInDiv(DivName,'<embed src=\''+FileSwf+'\' width=\''+wid+'\' height=\''+hei+'\' />'); }
function SetAudio(FileName) { var Div = $('BarraAltaFlashAudio'); if(Div != null) { var str = '<embed src="/inclusioni/play_intro.swf" flashvars="mp3='+VgDecrypt(FileName)+'&autoplay=1" type="application/x-shockwave-flash" height=0 width=0 repeat="false" />'; Div.innerHTML = str; }}
function SetPlayIntro(FileName) { var divPlayIntro = $('divPlayIntro'); if(divPlayIntro != null) { divPlayIntro.innerHTML = "<img class='Puntatore icon16x16' src='/images/icons/sound.gif' alt='"+GetTermine(JS_ASCOLTA_INTRO)+"' title='"+GetTermine(JS_ASCOLTA_INTRO)+"' onclick='SetAudio(\""+FileName+"\");' align='middle' /><img align='middle' class='Puntatore Icon16x16' src='/images/icons/sound_none.gif' title='"+GetTermine(JS_FERMA_INTRO)+"' alt='"+GetTermine(JS_FERMA_INTRO)+"' onclick='StopSound();' />"; divPlayIntro.style.display = ''; } }
function getMouseXY(e) { try { if (isIe) { tempX = event.x + document.body.scrollLeft - 13; tempY = event.y + document.body.scrollTop; } else { tempX = e.pageX; tempY = e.pageY; } if (tempX < 0){tempX = 0;} if (tempY < 0){tempY = 0;} var Txt = $('MouseXY'); if(Txt!=null) Txt.value = 'X:'+tempX+'  Y:'+ tempY; } catch(e) {} return true; }
function GetMouseX(e) { var posx = 0; if (!e) e = window.event; if (e.pageX) posx = e.pageX; else if (e.clientX) posx = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft; return posx; }
function GetMouseY(e) { var posy = 0; if (!e) e = window.event; if (e.pageY) posy = e.pageY; else if (e.clientY) posy = e.clientY + document.body.scrollTop + document.documentElement.scrollTop; return posy; }
function HideObj(NomeObj) { try { var obj = document.getElementById(NomeObj); if(obj == null) obj = document.getElementsByName(NomeObj); if(obj != null) { obj.style.display='none'; obj.innerHTML=''; destroyObj(obj); } } catch (e) {} }
function SetPrintValue() { try { if(isDefinedFunc(wndPrint.window.PreparaStampa)) wndPrint.window.PreparaStampa(VgTitolo.innerHTML,VgBody.innerHTML); else setTimeout('SetPrintValue()',100); } catch(e) {  } }
function VgToggle(img, nomeNodo) { try { Div = $(nomeNodo); if(Div.style.display == 'none') { img.src = "/images/treeimg/minus.gif"; Div.style.display='block'; } else { img.src = "/images/treeimg/plus.gif"; Div.style.display='none'; } } catch(e) {} }
function ShowYouTubeVideo(CodSrc,wid,hei) { if(CodSrc.indexOf('')>=0) CodSrc = CodSrc.replace("/public/video/",""); var Html =  '<embed style="margin:0;" src="http://www.youtube.com/v/'+CodSrc+'&amp;autoplay=1&amp;loop=1&amp;color1=0x000133&amp;color2=0x4b82b4" type="application/x-shockwave-flash" wmode="transparent" width="'+wid+'" height="'+hei+'"></embed>'; return Html; }
function FadeInOut(ObjName, opacStart, opacEnd, millisec) { var id = $(ObjName); if(id != null) { var speed = Math.round(millisec / 100); var timer = 0; if(opacStart > opacEnd) { for(i = opacStart; i >= opacEnd; i--) { setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); timer++; } } else if(opacStart < opacEnd) { for(i = opacStart; i <= opacEnd; i++) { setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); timer++; } } } } 
function fadeInObj(NomeObj,fade_index,EndOpac) { try { var el = $(NomeObj); if(el != null) { fade_index += 25; if(fade_index > EndOpac || !UseaEffettiSpeciali) fade_index = EndOpac; if(fade_index>=100) { if(isIe) el.style.filter = ''; else el.style.opacity = ''; } else { if(isIe) el.style.filter = ' alpha(opacity='+ (fade_index) +')'; else el.style.opacity = fade_index/100; } if(fade_index < EndOpac) { goIn = setTimeout("fadeInObj('" + NomeObj + "',"+fade_index+","+EndOpac+")", 1); if(fade_index >= EndOpac) clearTimeout(goIn); } else StatoStep = 0; } } catch(e) {} } 
function fadeOutObj(NomeObj,fade_index,EndOpac) { try { var el = $(NomeObj); if(el != null) { if(isIe) fade_index -= 30; else fade_index -= 10; if(fade_index < EndOpac) fade_index = EndOpac; if(isIe) el.style.filter = ' alpha(opacity='+ (fade_index) +')'; else el.style.opacity = fade_index/100; if(fade_index > EndOpac) { goIn = setTimeout("fadeOutObj('"+NomeObj+"',"+fade_index+","+EndOpac+")", 10); if(fade_index <= EndOpac) clearTimeout(goIn); } else { StatoStep = 0; fade_index = 0; el.style.display = 'none'; el.innerHTML  = ''; if(isIe) { var elBack = $('MenuPopUpBack'); if(elBack != null) elBack.style.display = 'none'; } } } } catch(e) {} } 
function ShowZoom(FILE,WID,HEI,TITLE) { try { var LEFT = ((screen.width-WID)/2); var TOP = ((screen.height-HEI)/2); var wndParams = "scrollbars=no,resizable=no,location=no,menubar=no,status=no,width=" + WID + ",height=" + HEI; wndParams += ",left="+LEFT+",top="+TOP; FILE = VgDecrypt(FILE); var html = "<html><head><title>VitaGay.Net - "+TITLE+"<\/title><\/head><body onload='self.focus();' style=\"overflow:hidden; margin:0; \"><table cellpadding=\"0\" cellspacing=\"0\" style=\"width: 100%; height:100%;\"><tr style=\"cursor:pointer;cursor:hand;\"><td style=\"background-repeat:no-repeat;background-image: url(" + FILE + ");\" onclick=\"self.close();\"><img onmousedown=\"self.close();\" alt=\""+TITLE+"\" src=\"/images/vg.gif\" style=\"border:0px; width:" + WID + "px; height:"+HEI+"px;\"><\/td><\/tr><\/table><\/body><\/html>"; if(wndZoom) { if(!wndZoom.closed) { wndZoom.close(); }} wndZoom = open('', 'Zoom', wndParams); wndZoom.document.write(html); wndZoom.document.close(); } catch(e) {} }
function SetLogFile(FileName) { var Hp = $('HiddenPost'); if(Hp!=null) Hp.src='/web/inc_log_accessi.aspx?File='+FileName; }
function DownloadAllegato(FileName,SaveAs) { self.location.href = '/inclusioni/download.aspx?fn=' + FileName + '&Sa=' + SaveAs; SetLogFile(FileName); }
function CleanTextbox(Txt) { try { var t = $(Txt); if(t != null) { t.value = t.value.replace(/<|>|;|=/g,""); t.value = replaceAll(replaceAll(t.value,"'",""),'"',""); } } catch(e) {} }
function StampaIframe(NomeIfrm) { if (isIe) { eval('document.'+NomeIfrm).focus(); eval('document.'+NomeIfrm).print(); } else { window.frames[NomeIfrm].focus(); window.frames[NomeIfrm].print(); } }
function getIFrameDocument(aID) { var rv = null; if ($(aID).contentDocument) rv = $(aID).contentDocument; else rv = document.frames[aID].document; return rv; }
function destroyObj(NomeObj) { var Obj = $(NomeObj); if(Obj != null) document.body.removeChild(Obj); }
function StampaBodyPagina(Intestazione,NomeTitolo,NomeBody) { try { VgTitolo = $(NomeTitolo); VgBody = $(NomeBody); if(VgBody != null && VgTitolo != null) { var WID = 950; var HEI = 500; if(isIe) { var Html = '<html><head><title>VitaGay.Net '+GetTermine(JS_STAMPA)+' '+VgTitolo.innerHTML+'</title><link rel="stylesheet" type="text/css" href="/inclusioni/vitagay.css" /><link rel="stylesheet" type="text/css" href="/inclusioni/vitagay_print.css" /><script language="javascript" type="text/javascript" src="/inclusioni/vitagay.js"></script><script language="javascript" type="text/javascript" src="/inclusioni/vitagay_media.js"></script><script language="javascript" type="text/javascript" src="/inclusioni/boxover.js"></script></head><body class="MarginPadding0" onload="HideXprint()">' + VgBody.innerHTML + '</body></html>'; wndPrint = OpenUrlInPage('FormStampa','',WID,HEI,GetTermine(JS_STAMPA),true); wndPrint.open(); wndPrint.write(Html); wndPrint.close(); } else { var LEFT = ((screen.width-WID)/2); var TOP = ((screen.height-HEI)/2); var wndParams = 'scrollbars=yes,resizable=yes,location=no,menubar=no,status=no,width=' + WID + ",height=" + HEI +',left='+LEFT+',top='+TOP; if(wndPrint) { if(!wndPrint.closed) { wndPrint.close(); }} wndPrint = open('/inclusioni/form/vgn_stampa.aspx', 'Print', wndParams); SetPrintValue(); } } else self.print(); } catch(e) { alert(GetTermine(JS_STAMPA_ERRORE)); } }
function HideXprint() { HideObj('AdSenseInPage'); HideObj('AdSenseInPage1'); HideObj('PaginaAdSenseAlto'); HideObj('PaginaCommenti'); HideObj('google_ads_frame'); ApriChiudiTutteSchedeCatalogo(true); if($('FiltriCatalogoTable') != null) $('FiltriCatalogoTable').style.display = 'none'; }
function OnScroolBrowserPerGalleria() { StartScrool(); }
function StopSound() { try { $('BarraAltaFlashAudio').innerHTML=''; } catch(e) {} }
function StartVitaGayNet() { PageIsLoad=true; try {StartScrool();} catch(e) {} AddVgEvent(); ShowHideAttendere('none'); ShowHideImgFix('',true); }
function SecondsToTime(seconds) { hours = parseInt(seconds/36000); mins = parseInt(seconds/60); secs = seconds - hours*3600 - mins*60; if ( hours < 10 ) hours = '0' + hours; if ( mins < 10 ) mins  = '0' + mins; if ( secs < 10 ) secs  = '0' + secs; return hours + ':' + mins + ':' + secs; }
function SetClip(Id,clipTop,clipLeft,clipWidth,clipRight) { if (document.layers) { Id.style.clip.top = clipTop; Id.style.clip.left = clipLeft; Id.style.clip.right = clipRight; Id.style.clip.bottom = clipBottom; } else if (document.getElementById || document.all) { Id.style.clip = 'rect('+clipTop+'px,'+clipRight+'px,'+clipRight+'px,'+clipLeft+'px)'; } }
function clipTo(obj, t, r, b, l) { if(obj.clip) { obj.clip = "rect("+t+"px "+r+"px "+b+"px "+l+"px)"; } }
function clipValues(obj, which) { if(obj.clip) { var re = /rect\(([0-9]+).*[ |,]([0-9]+).*[ |,]([0-9]+).*[ |,]([0-9]+).*\)/; var clipv = re.exec(obj.clip); if (which=="t") return Number(clipv[1]); if (which=="r") return Number(clipv[2]); if (which=="b") return Number(clipv[3]); if (which=="l") return Number(clipv[4]); } return 0; }
function AnimOpenCloseDiv(Open,NomeDiv,maxWid,maxHei,stepMillisec) { var dvCal = $(NomeDiv); if(dvCal!=null) { dvCal = (dvCal.style) ? dvCal.style : dvCal; if(!dvCal.clip) dvCal.clip = "rect(0 0 0 0)"; var curWid = clipValues(dvCal, 'r'); var curHei = clipValues(dvCal, 'b'); if(Open) { if(dvCal.display == 'none') dvCal.display = ''; if(curWid < maxWid || curHei < maxHei) { if(curWid < maxWid) { curWid += stepMillisec; } if(curHei < maxHei) { curHei += stepMillisec; } clipTo(dvCal, 0, curWid, curHei, 0); setTimeout("AnimOpenCloseDiv(true,'"+NomeDiv+"',"+maxWid+","+maxHei+","+stepMillisec+")",stepMillisec); } } else { if(curWid > 0 || curHei > 0) { if(curWid > 0) { curWid -= stepMillisec; } else { curWid = 0; } if(curHei > 0) { curHei -= stepMillisec; } else { curHei = 0; } clipTo(dvCal, 0, curWid, curHei, 0); setTimeout("AnimOpenCloseDiv(false,'"+NomeDiv+"',"+maxWid+","+maxHei+","+stepMillisec+")",stepMillisec); } else dvCal.display = 'none'; } } }
function FiltraNews(FN,Sel){VgGoTo(); self.location.href='/web/news.aspx?'+Sel+'&FN='+FN;}
function FiltraStati(SC,Sel){VgGoTo(); self.location.href='/web/varie.aspx?'+Sel+'&SC='+SC;}
function InviaPaginaAmico(Url){CloseAllForm(); OpenUrlInPage('FormInviaAdAmico','/inclusioni/form/vg_form.aspx?Type=InviaPaginaAmico&Url='+Url,710,510,GetTermine(INVIA_PAG_AMICO),true);}
function InserisciCommento(IC,IR,OG){CloseAllForm(); OpenUrlInPage('FormInserisciCommento','/inclusioni/form/vg_form.aspx?Type=InserisciCommento&IC='+IC+'&IR='+IR+'&OG='+OG,510,310,GetTermine(INS_COMMENTO_A_PAG),true);}
function CloseAllForm(){var Div = $('FormInserisciCommento');if(Div != null) CloseUrlInPage('FormInserisciCommento');Div = $('FormInviaAdAmico');if(Div != null) CloseUrlInPage('FormInviaAdAmico');}
function AlertInviaCommento(Url) { if(confirm(GetTermine(JS_PER_INVIARE_COMMENTO))) self.location.href='/web/login.aspx?RefUrl='+Url; } 
function ImpostaSondaggio(ifr){if(ifr.height == 0) { $('imgLoadingSondaggio').style.display = 'none'; ifr.height = '100px'; } }
function Attendere(divBox,divAttendere){var oB = $(divBox);var oA = $(divAttendere);if(oB != null) oB.style.display = 'none';if(oA != null) oA.style.display = 'inline';}
function SelReg(NomeMap,Sel){ if(PrevRegSel != null) PrevRegSel.className = 'Regione Puntatore'; var Map = $(NomeMap); if(Map != null) { PrevRegSel = Map; if(Sel) Map.className = 'RegioneEvidenzia  Puntatore'; else Map.className = 'Regione Puntatore'; } }
function CercaConGoogle(Keys,UrlGoogle,LinguaGoogle) { var Url = 'http://'+UrlGoogle+'/custom?domains=www.vitagay.net&q='+Keys+'&sa=Cerca&sitesearch=&client=pub-9904232510168834&forid=1&ie=ISO-8859-1&oe=ISO-8859-1&cof=GALT%3a%23008000%3bGL%3a1%3bDIV%3a%23336699%3bVLC%3a663399%3bAH%3acenter%3bBGC%3aFFFFFF%3bLBGC%3a336699%3bALC%3a0000FF%3bLC%3a0000FF%3bT%3a000000%3bGFNT%3a0000FF%3bGIMP%3a0000FF%3bFORID%3a11&hl='+LinguaGoogle+'&ad=w9&num=10'; OpenUrl(Url, '_blank'); }
function stripHTML(){ for (i=0; i<arguments.length; i++) arguments[i].value=arguments[i].value.replace(/<\S[^><]*>/g,""); }
function StartScrool() { try { if(!ScrollAvviato) { ScrollAvviato = true; var MuoviScrool = false; if($('GalleriaPagina')!=null) { StartY = 0; GalleriaPagina = $('GalleriaPagina'); MuoviScrool = true; Scivola = UseaEffettiSpeciali; } if($('PreviewImg')!=null) { StartY = BarraAltaHeight; GalleriaPagina = $('PreviewImg'); MuoviScrool = true; Scivola = UseaEffettiSpeciali; } if($('GalleriaPaginaEdit')!=null) { StartY=0; GalleriaPagina = $('GalleriaPaginaEdit'); MuoviScrool = true; Scivola = false; } if(MuoviScrool) { ScrollGalleriaPagina(); } else ScrollAvviato = false; } } catch(e) {} }
function ScrollGalleriaPagina() { try { if(GalleriaPagina!=null) { function ml() { if(document.layers) GalleriaPagina.style=GalleriaPagina; GalleriaPagina.sPy=function(y) { GalleriaPagina.style.top=y + "px"; }; GalleriaPagina.y = StartY; GalleriaPagina.sPy(GalleriaPagina.y); return GalleriaPagina; }; window.stayTopLeftScroll=function() { var pY = ScroolPageTop(); if(pY < BarraAltaHeight) pY = 0; else pY -= BarraAltaHeight - 1; gObj.y += (pY + StartY - gObj.y)/StepScroll; gObj.sPy(gObj.y); setTimeout("stayTopLeftScroll()", StepTime); }; window.stayTopLeft=function() { var pY = ScroolPageTop(); if(pY < BarraAltaHeight) pY = 0; else pY -= BarraAltaHeight - 1; gObj.sPy(pY); setTimeout("stayTopLeft()", StepTime); }; var gObj = ml(); if(Scivola) { stayTopLeftScroll(); } else { stayTopLeft(); } } } catch(e) {} }
function FiltraVideo(ObjTxt,UrlCerca) { document.location.href=UrlCerca+escape(ObjTxt.value)+'#CercaVideo'; }
function FiltraElencoPdig(ObjTxt,ObjFiltroTipo,ObjPdigXpag,ObjRegione,UrlCerca) {document.location.href=UrlCerca+escape(ObjTxt.value)+'&Tipo='+getSelected(ObjFiltroTipo)+'&Regione='+getSelected(ObjRegione)+'&PXP='+getSelected(ObjPdigXpag)+'#CercaPdig'; }function getSelected(Sel){var Ret='';if(Sel != null && Sel.selectedIndex>=0)Ret = Sel.options[Sel.selectedIndex].value;return Ret;}
function Show3dGallery(Titolo,RifPag) { var win=window.open('/inclusioni/gallery/?RifPag='+RifPag+'&Titolo='+Titolo, 'VitaGay3dGallery', 'toolbar=no,status=no,menubar=no,scrollbars=no,resizable=yes,top=0,left=0,width=' + screen.width + ',height=' + screen.height );  }
function SetArrayImg(){var strTxt = document.body.innerHTML; var strFind = 'ShowObj(false,true,false,';if(strTxt.indexOf('vgImg[0]=new Array') < 0 && strTxt.indexOf(strFind) >= 0){var strD = ''; var strF = ''; var strW = 0; var strH = 0;var PosStart = -1; var PosEnd = -1; var NewPos = 0; var PosImg = 0;var PosTmp = -1;var NewTmp = -1; while ((PosStart = strTxt.indexOf(strFind, NewPos)) >= 0){PosEnd = strTxt.indexOf("'", PosStart + strFind.length + 10);if (PosEnd >= 0){strF = VgDecrypt(strTxt.substring(PosStart + strFind.length + 1,PosEnd).replace("\'","").replace("\\",""));NewTmp = PosEnd+2;PosTmp = strTxt.indexOf(',',PosEnd+3);strW = parseInt(strTxt.substring(NewTmp,PosTmp));NewTmp = PosTmp+1;PosTmp = strTxt.indexOf(',',NewTmp+1);strH = parseInt(strTxt.substring(NewTmp,PosTmp));NewTmp = PosTmp+2;PosTmp = strTxt.indexOf(')',NewTmp+1);strD = strTxt.substring(NewTmp,PosTmp-1).replace("\'","").replace("\\","");vgImg[PosImg]=new Array(strD,strF,strW,strH);PosImg++;}NewPos = PosEnd + 1;}TotaleImgView = PosImg;}}
function ShowHideSchedaCatalogo(IdScheda,CodLingua, CloseSize) { try { var DivIdScheda = $('tbSchedaCatalogo'+IdScheda.toString()); if(DivIdScheda != null) { var DynaCat = $('DynaCat'+IdScheda); var DynaFondo = $('CatalogoCellaTesto'+IdScheda); if(DivIdScheda.style.height == CloseSize) { DivIdScheda.style.height = ''; if(DynaFondo!=null) DynaFondo.className='CatalogoCellaTesto'; if(DynaCat != null) DynaCat.innerHTML = vgCat[IdScheda]; } else { if(DynaFondo!=null) DynaFondo.className='CatalogoCellaTestoClose'; DivIdScheda.style.height = CloseSize; if(DynaCat != null) DynaCat.innerHTML = ''; } } } catch(e) {} }
function ApriChiudiTutteSchedeCatalogo(Aperte) { try { if($('CatalogoInPagina') != null) { var Div = document.getElementsByTagName('div'); for (var i=0;i<Div.length;i++) { if(isDefinedFunc(Div[i].id) &&  Div[i].id.indexOf('tbSchedaCatalogo') >= 0) {  var IdScheda = parseInt(Div[i].id.replace('tbSchedaCatalogo','')); var DynaCat = $('DynaCat'+IdScheda); var DynaFondo = $('CatalogoCellaTesto'+IdScheda); if(Aperte) { Div[i].style.height = ''; if(DynaCat != null && IdScheda != 'NaN' && IdScheda > 0 && vgCat[IdScheda].length > 0) DynaCat.innerHTML = vgCat[IdScheda]; if(DynaFondo!=null) DynaFondo.className='CatalogoCellaTesto'; } else { Div[i].style.height = '130px'; if(DynaCat != null) DynaCat.innerHTML = ''; if(DynaFondo!=null) DynaFondo.className='CatalogoCellaTestoClose'; } } } } } catch(e) {} }
function SetSizeFont(SizePx, ObjNameId) { if(ObjNameId != '') { var Obj = document.getElementById(ObjNameId); if(Obj != null) Obj.style.fontSize = SizePx + 'px'; } }
function ShowHideImgFix(Display,Force) { try { var pageWidth = isIe ? window.document.body.clientWidth : window.innerWidth; if(pageWidth < 1090 || Force) { if($('ImgFixL')!= null) $('ImgFixL').style.display=Display; if($('ImgFixR')!= null) $('ImgFixR').style.display=Display;  if($('DivMsgAlertInPage')!= null) $('DivMsgAlertInPage').style.display=Display; } } catch(e) {} } 
function WinRes(w,h) { try { window.resizeTo(w,h); } catch(e) {} }
function ShowDialog(Url,Width,Height) { try { return showModalDialog(Url,"","font-family:Verdana,Tahoma; font-size:12; dialogWidth:"+Width+"px; dialogHeight:"+Height+"px" );} catch(e) {} }
function pageWidth() { try { return window.innerWidth? window.innerWidth : window.document.body.clientWidth; } catch(e) {} }
function setClass(Obj,ClassName) { if(Obj!=null) Obj.className=ClassName; }
function scrollBottom(Obj) { try { if(Obj!=null) Obj.scrollTop = Obj.scrollHeight; } catch(e) {} }
function AvviaSlidePanel(NomePanelIn,NomePanelOut,scroolDescMount,scroolDescDelay,ScroolDescDirezione) { var PanelIn = $(NomePanelIn); var PanelOut = $(NomePanelOut); if(PanelIn != null && PanelOut != null) { PanelIn.scroolDescDelay = scroolDescDelay; PanelIn.scroolDescMount = scroolDescMount; PanelIn.ScroolDescDirezione = ScroolDescDirezione; var IdT = window.setInterval("SlidePanel('"+NomePanelIn+"','"+NomePanelOut+"')", scroolDescDelay); PanelIn.InMovimento = true; PanelIn.IdT = IdT; } }
function StartStopPanel(NomePanelIn,NomePanelOut, InMovimento) { var PanelIn = $(NomePanelIn); if(PanelIn != null) { if(InMovimento && !PanelIn.InMovimento) { var IdT = window.setInterval("SlidePanel('"+NomePanelIn+"','"+NomePanelOut+"')", PanelIn.scroolDescDelay); PanelIn.InMovimento = true; PanelIn.IdT = IdT; } if(!InMovimento && PanelIn.InMovimento) { clearInterval(PanelIn.IdT); PanelIn.InMovimento = false; } } }
function SlidePanel(NomePanelIn,NomePanelOut){if(PageIsLoad){var PanelIn = document.getElementById(NomePanelIn);var PanelOut = document.getElementById(NomePanelOut);var PosTop = parseInt(PanelIn.style.top.replace(/px/,""));var PosLeft = parseInt(PanelIn.style.left.replace(/px/,""));if(PanelIn.clientHeight > 0 && PanelOut.clientWidth > 0){switch (PanelIn.ScroolDescDirezione){case 1: if( PosLeft == 10000){PosLeft = - PanelIn.clientWidth - 20;PanelIn.PosLeftStart = PosLeft;PanelIn.PosLeft = PosLeft;PosTop = 0;}PosLeft += PanelIn.scroolDescMount;if(PosLeft > PanelOut.clientWidth+5)PosLeft = PanelIn.PosLeftStart;break;case 2:if( PosLeft == 10000){PosLeft = PanelIn.clientWidth + 20;PanelIn.PosLeftStart = PosLeft;PanelIn.PosLeft = PosLeft;PosTop = 0;}PosLeft -= PanelIn.scroolDescMount; if(Math.abs(PosLeft) > PanelIn.clientWidth+5) PosLeft = PanelIn.PosLeftStart; break; case 3: if( PosTop == 10000) { PosTop = PanelOut.clientHeight+20; PanelIn.PosTopStart = PosTop; PosLeft = 5; PanelIn.PosLeft = PosLeft; } PosTop -= PanelIn.scroolDescMount; if(Math.abs(PosTop) > PanelIn.clientHeight+5) PosTop = PanelIn.PosTopStart; break; case 4: if( PosLeft == 10000){PosTop = - PanelIn.clientHeight - 20;PanelIn.PosTopStart = PosTop;PosLeft = 5;PanelIn.PosLeft = PosLeft;}PosTop += PanelIn.scroolDescMount;if(PosTop > PanelOut.clientHeight+5)PosTop = PanelIn.PosTopStart;break;}PanelIn.style.top = PosTop + 'px';PanelIn.style.left = PosLeft + 'px';}}}
function selectedValue(SelectName) {var Valore = null;var Select = document.getElementById(SelectName);if(Select != null && Select.selectedIndex!=null && Select.selectedIndex>=0)Valore = Select.options[Select.selectedIndex].value;return Valore;}
function selectedValueByObj(Select) {var Valore = null;if(Select != null && Select.selectedIndex!=null && Select.selectedIndex>=0)Valore = Select.options[Select.selectedIndex].value;return Valore;}
function GetSizeWindow(){var agent = navigator.userAgent.toLowerCase();var is_ie = (agent.indexOf('msie') != -1);var is_mac = (agent.indexOf('macintosh') != -1);var pageWidth = is_ie ? window.document.body.clientWidth : window.innerWidth;var pageHeight = is_ie ? window.document.body.clientHeight : window.innerHeight; if (!is_ie){var scrollbarSize = is_mac ? 15 : 19;if (pageWidth < minWidth) pageHeight -= scrollbarSize;if (pageHeight < minHeight) pageWidth -= scrollbarSize;}var Ret = new Object();Ret.Width = pageWidth;Ret.Height = pageHeight;return Ret;}
function EvidenziaMsg(){var Div = $('DivMsgAlertInPage');if(Div != null){Div.style.backgroundColor = 'rgb('+(Math.floor(Math.random()*100)+150).toString()+','+(Math.floor(Math.random()*100)+150).toString()+','+(Math.floor(Math.random()*100)+150).toString()+')'; setTimeout("EvidenziaMsg()", 250);}}
addWindowOnLoadEvent(StartVitaGayNet);addWindowOnUnloadEvent(EndVitaGayNet);


