/*
Creator : Casale Francesco
Copyright (c) 2009 Nuguerrilla
www.nuguerrilla.com
Not for redistribution.
*/

function modalView()
{

var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  	
  	var myelemW = document.getElementById('nonopache').offsetWidth;
  	var myelemH = document.getElementById('nonopache').offsetHeight;
  	
  	var element_marginTop = (myHeight-myelemH)/2;
  	var element_marginLeft = (myWidth-myelemW)/2;
  	
  	document.getElementById('myStyle').style.display = 'block';
  	//document.getElementById('myStyle').style.height = myHeight;
	document.getElementById('nonopache').style.visibility = 'visible';
	document.getElementById('nonopache').style.marginTop = element_marginTop+"px";	
  	document.getElementById('nonopache').style.marginLeft = element_marginLeft+"px";
  	
  	
}

function close_modalView()
{
document.getElementById('myStyle').style.display = 'none';
document.getElementById('nonopache').style.display = 'none';
}

function menulato(elem, param)
{
	if(param=="0"){
		document.getElementById(elem+"_voce").style.background = "url(utility/images/menuLato_hover.jpg) no-repeat right";
	}else{
		document.getElementById(elem+"_voce").style.background = "none";
	}
}

function correctPNG() // correctly handle PNG transparency in Win IE 5.5 & 6.
{
   var arVersion = navigator.appVersion.split("MSIE")
   var version = parseFloat(arVersion[1])
   if ((version >= 5.5) && (document.body.filters)) 
   {
      for(var i=0; i<document.images.length; i++)
      {
         var img = document.images[i]
         var imgName = img.src.toUpperCase()
         if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
         {
            var imgID = (img.id) ? "id='" + img.id + "' " : ""
            var imgClass = (img.className) ? "class='" + img.className + "' " : ""
            var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
            var imgStyle = "display:inline-block;" + img.style.cssText 
            if (img.align == "left") imgStyle = "float:left;" + imgStyle
            if (img.align == "right") imgStyle = "float:right;" + imgStyle
            if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
            var strNewHTML = "<span " + imgID + imgClass + imgTitle
            + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
            + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
            + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
            img.outerHTML = strNewHTML
            i = i-1
         }
      }
   }    
}


function resizeModal(){
var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  
  	var myelemW = document.getElementById('nonopache').offsetWidth;
  	var myelemH = document.getElementById('nonopache').offsetHeight;
  
  	var element_marginTop = (myHeight-myelemH)/2;
  	var element_marginLeft = (myWidth-myelemW)/2;
  	
  	//alert(element_marginLeft);
  	
	document.getElementById('nonopache').style.marginTop = element_marginTop+"px";	
  	document.getElementById('nonopache').style.marginLeft = element_marginLeft+"px";
  	
  		
}


function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
