﻿// JScript File
function checkBrowser(){
	this.ver=navigator.appVersion
	this.dom=document.getElementById?1:0
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom)?1:0;
	this.ie5=(this.ver.indexOf("MSIE")>-1 && this.dom)?1:0;	
	this.ie4=(document.all && !this.dom)?1:0;
	this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;
	this.ns4=(document.layers && !this.dom)?1:0;
	if (navigator.appName == "Opera"){ this.dom = 1;this.ie5=1};
	this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5 )
	return this
}
bw=new checkBrowser();                      
function MostraBK(sValore){
    var divmove = document.getElementById('ModalBKGServer');    
    divmove.style.display = sValore;    
    divmove.style.zIndex = '2';
    var width=0;
    var height=0;    
    if (sValore!='none'){
	    if(document.documentElement&&document.documentElement.scrollHeight)
	    { if(document.documentElement.scrollHeight > document.documentElement.offsetHeight) {
		        width=document.documentElement.scrollWidth;
		        height= document.documentElement.scrollHeight;
		  } else {
		    width=document.documentElement.offsetWidth;
		    height= document.documentElement.offsetHeight;
		  }
	    }
	    else if(document.body.scrollHeight)
	    {
	        if(document.body.scrollHeight > document.body.offsetHeight){
		        width=document.body.scrollWidth;
		        height=document.body.scrollHeight;
		    } else {
		        width=document.body.offsetWidth;
		        height=document.body.offsetHeight;
		    }		    
	    }
    }       
    divmove.style.height = String(height) + 'px';    
    divmove.style.width = String(width) + 'px';           
}
function CentramyPopUpMsg(id){
    pos = 0;
    centra=0;
    offset = 60;
    if (window.innerHeight)	{pos = window.pageYOffset}
	else if (document.documentElement && document.documentElement.scrollTop)
	{pos = document.documentElement.scrollTop}
	else if (document.body)	{pos = document.body.scrollTop};
	
	if (window.innerHeight) {centra=window.innerHeight}
	else {centra = document.documentElement.clientHeight}
	
	//MostraBK('block');
    mytop= pos +( centra / 2) - offset + 'px';
    mydiv = document.getElementById(id);
    mydiv.style.top = mytop;
    mydiv.style.visibility = 'visible'    
    mydiv.style.display = 'block'
    // per Internet explore 6.0 nascondo i select    
     if (bw.ie6){hideElmsIE6('select');}
    
}
function ImpostaDiv() {
    pos = 0;
    centra=0;
    offset = 60;
    if (window.innerHeight)	{pos = window.pageYOffset}
	else if (document.documentElement && document.documentElement.scrollTop)
	{pos = document.documentElement.scrollTop}
	else if (document.body)	{pos = document.body.scrollTop};
	
	if (window.innerHeight) {centra=window.innerHeight}
	else {centra = document.documentElement.clientHeight};	
	/*alert(centra);   */
	if(centra<580) centra=580; 
	mydiv = document.getElementById('footer');
	mydiv.style.top = centra - 90 + 'px';
	mydivC = document.getElementById('content');
	mydivC.style.height = centra - 190 + 'px';
	myId=document.getElementById('mydivScorrimento');	
	if(myId != null){myId.style.height = centra - 200 + 'px';}; 
	myId=document.getElementById('mydivScorrimento2');	
	if(myId != null){myId.style.height = centra - 290 + 'px';};   
}

function ChiudiPopUpMsg(id) {
    mydiv = document.getElementById(id);
    mydiv.style.top = mytop;
    mydiv.style.visibility = 'hidden'
    mydiv.style.display = 'none'    
    MostraBK('none');
    // per internet explorer mostro i select
    if (bw.ie6){ShowElmsIE6('select');}
}
function clickButton(e, buttonid){ 
      var bt = document.getElementById(buttonid); 
      if (typeof bt == 'object'){ 
           if(bw.ns4 || bw.ns5){ 
                  if (e.keyCode == 13){ 
                        bt.click(); 
                        return false; 
                  } 
            } 
            if (bw.ie5){ 
                  if (event.keyCode == 13){ 
                        bt.click(); 
                        return false; 
                  } 
            } 
      } 
} 
function hideElms(elmTag) {
	for (i=0; i<document.all.tags(elmTag).length; i++){
		obj = document.all.tags(elmTag)[i];
		if (!obj || !obj.offsetParent) continue;
		obj.style.visibility = "hidden";
	}
    }
var divCatVisibile='';
function ScambiaCategoria(idDiv)
{
    //Nascondo tutte quelle visibile
    if (mydiv = document.getElementById(divCatVisibile)){
        mydiv.style.display = 'none';    
    }
    if( divCatVisibile != idDiv){    
    divCatVisibile=idDiv;
    if (mydiv = document.getElementById(idDiv)){
     mydiv.style.display = 'block';    
     mydiv.focus();}
    } else {divCatVisibile='';};
    return false;
}
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function refGoogle(myID,sLink)  { 
    var myIFrame = document.getElementById(myID); 
    if (myIFrame != null) {
    myIFrame.src = sLink;}
    }
    
function NoBanner(id){
        identity=document.getElementById(id);         
        identity.style.display = "none";}  
          
function MostraDiv(id,sStato) 
        { 
        identity=document.getElementById(id);         
        identity.style.display = sStato ;
        if (sStato!='none') {
        refGoogle('ifG1',"http://maps.google.it/maps?f=q&hl=it&geocode=&q=show+biz+milano&ie=UTF8&cid=45475836,9167154,8887173431899772777&s=AARTsJqzl43rPbo1j_w_5BLpvXcyKH0D0Q&ll=45.480686,9.167962&spn=0.011284,0.019827&z=15&iwloc=A&output=embed");
        refGoogle('ifG2',"http://maps.google.it/maps?f=q&hl=it&geocode=&q=Via+Procaccini,+4+-+20154+Milano&sll=45.483758,9.172914&sspn=0.008304,0.018303&g=Via+Procaccini,+4+-+20154+Milano&ie=UTF8&s=AARTsJoSVmnE7m_8Y1s7ydTo2Qq-K18k2w&ll=45.491427,9.178219&spn=0.021059,0.036478&z=14&iwloc=addr&output=embed");}
        //return '#';
        } 
        
function SwapDiv(id){
    identity=document.getElementById(id);   
    if(identity.style.display=='none'){
        identity.style.display = 'block' }
        else
        {
        identity.style.display = 'none' };
    return true;
}
        
function hideElmsIE6(elmTag) {
    for (i=0; i<document.all.tags(elmTag).length; i++){
	    obj = document.all.tags(elmTag)[i];
	    if (!obj || !obj.offsetParent) continue;
	    obj.style.visibility = "hidden";
    }
}
function ShowElmsIE6(elmTag) {
// Risolve il problema della sovrapposizione dei select bug ie 6.0
    for (i=0; i<document.all.tags(elmTag).length; i++){
	    obj = document.all.tags(elmTag)[i];
	    if (!obj || !obj.offsetParent) continue;
	    obj.style.visibility = "visible";
    }
}
/*javascript per menu espandibile
window.onload=function(){
if(document.getElementsByTagName && document.getElementById){
    document.getElementById("nav").className="jsenable";
    BuildList();
    
    }
}*/

function BuildList(){
var hs=document.getElementById("nav").getElementsByTagName("h3");
for(var i=0;i<hs.length;i++){
    hs[i].onclick=function(){
        this.parentNode.className=(this.parentNode.className=="show") ? "hide" : "show";
        }
    }
}
function ForzaApertura(){
var hs=document.getElementById("nav").getElementsByTagName("h3");
for(var i=0;i<hs.length;i++){    
         hs[i].parentNode.className="show";        
    }
}
function barraeffetto(myId,sP){
    myImg = document.getElementById('ctl00_ShowBizMenuIta1_' + myId);
    myC = document.getElementById('ctl00_ShowBizMenuIta1_' + 'imgCur');
    if(sP=='on'){
     myImg.src='images/barracursore2on.gif';      
     myC.style.left = myImg.style.left;
     myC.style.display="block";
    }
    else { myImg.src='images/barracursore2.gif';    
    myC.style.display="none";}
 }
function barraeffettoE(myId,sP){
    myImg = document.getElementById('ctl00_ShowBizMenuEng1_' + myId);
    myC = document.getElementById('ctl00_ShowBizMenuEng1_' + 'imgCur');
    if(sP=='on'){
     myImg.src='images/barracursore2on.gif';      
     myC.style.left = myImg.style.left;
     myC.style.display="block";
    }
    else { myImg.src='images/barracursore2.gif';    
    myC.style.display="none";}
 }