// JavaScript Document
function apriWin(theURL,winName,features) { //v2.2
  
  win = window.open(theURL,winName,features);
  win.focus();
	   
}


function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

// Example: obj = findObj("image1");
function findObj(theObj, theDoc)
{
  var p, i, foundObj;
  
  if(!theDoc) theDoc = document;
  if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)
  {
    theDoc = parent.frames[theObj.substring(p+1)].document;
    theObj = theObj.substring(0,p);
  }
  if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
  for (i=0; !foundObj && i < theDoc.forms.length; i++) 
    foundObj = theDoc.forms[i][theObj];
  for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
    foundObj = findObj(theObj,theDoc.layers[i].document);
  if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
  
  return foundObj;
}

// * Dependencies * 
// this function requires the following snippets:
// JavaScript/readable_MM_functions/findObj
//
// Accepts a variable number of arguments, in triplets as follows:
// arg 1: simple name of a layer object, such as "Layer1"
// arg 2: ignored (for backward compatibility)
// arg 3: 'hide' or 'show'
// repeat...
//
// Example: showHideLayers(Layer1,'','show',Layer2,'','hide');
function showHideLayers()
{ 
  var i, visStr, obj, args = showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3)
  {	if ((obj = findObj(args[i])) != null)
    {
      visStr = args[i+2];
      if (obj.style)
      {
        obj = obj.style;
        if(visStr == 'show') visStr = 'visible';
        else if(visStr == 'hide') visStr = 'hidden';
      }
      obj.visibility = visStr;
    }
  }
}

function BW_centerLayers() { //v2.3 for DW 2.0
  var i, horz, vert, width, height, x, y, args;
  args = BW_centerLayers.arguments;
  for (i=0; i<(args.length-5); i+=6) {
    horz   = args[i+2];
    vert   = args[i+3];
    width   = args[i+4];
    height   = args[i+5];
	//alert(navigator.appName);
    if (navigator.appName == 'Netscape') {
	   //alert(document.layer[Layer1].left);
	   //alert(height);
    	if ((obj = findObj(args[i])) != null)
	    {
			//alert(obj.visibility);
       //(horz) ? x = (window.innerWidth - width)/2 : x = eval(args[i]+'.left');
        if(horz) {
			x = (window.innerWidth - width)/2;
			}
		else { 
			if(obj.style.left) {
				x = eval(obj.style.left)
				}
			else {
				x=0;
				}
		}
        if(vert) {
			y = (window.innerHeight - height)/2;
			}
		else { 
			if(obj.style.left) {
				y = eval(obj.style.top)
				}
			else {
				//x=0;
				y=0;
				}
		}
	   //(vert) ? y = (window.innerHeight - height)/2 : y = eval(args[i]+'.top');
	   //alert('x='+x);
	   //alert('y='+y);
		}
      //if (document.layers != null) eval(args[i]+'.moveTo ('+x+','+y+')');
      if (obj.style) {
	  		if (x>0){
				obj.style.left=x;
			}
	  		if (y>0){
	  			obj.style.top=y;
			}
	  }
    } else { //IE
      	if (document.all != null){
			if ((horz)&&(((document.body.clientWidth - width)/2)>0)){
				eval(args[i+1]+'.style.left ='+((document.body.clientWidth - width)/2));
			}
			if ((vert)&&(((document.body.clientHeight - height)/2)>0)){
				//se si usa il link al dtd:
				//HVal=(document.compatMode=="CSS1Compat")?document.documentElement.clientHeight:document.body.clientHeight;
      			//eval(args[i+1]+'.style.top ='+ ((HVal - height)/2));
				eval(args[i+1]+'.style.top ='+ ((document.body.clientHeight - height)/2));
			}
       }   
	 }
  }
}
function SwapImg (filename, altname, width, height) {

imgSwap.src = filename;
imgSwap.alt = altname;
imgSwap.width = width;
imgSwap.height = height;

}

