var pt_popups;
pt_popups = new Array();
pt_popups[0] = 'registrati';
pt_popups[1] = 'webmaster';
pt_popups[2] = 'partner';
pt_popups[3] = 'software';
pt_popups[4] = 'loginPopup';
pt_popups[5] = 'prodotti';
pt_popups[6] = 'about';
pt_popups[7] = 'news';
pt_popups[8] = 'welcomePopup';

if (window != top) top.location.href = location.href;

NS4 = (document.layers) ? 1 : 0;
IE4 = (document.all) ? 1 : 0;
DOM = (document.getElementById) ? 1 : 0;
ver4 = (NS4 || IE4) ? 1 : 0;
var agt=navigator.userAgent.toLowerCase();
NS6 = (agt.indexOf('gecko') != -1);

/*
Debugging:
	$IE4 = 1	$IE3 =  	$NS4 =  	$NS3 =  	$X11 =  	$HAVE_STYLE = 1*/

var loaded = 0;
var gotlayers = 0;
var lastbutton='top';

function PT_popupSH(w,h) {
  var i, obj, v;
  for( i = 0; i < pt_popups.length; i ++ ) {
    if( (obj = MM_findObj(pt_popups[i])) != null ) {
      if( w == pt_popups[i] ) {
		v = h;
		moveLayers();
	  } else v = 'hide';
      if( obj.style ) {
		if( v == 'show' ) {
		  moveLayers();
		  v = 'visible';
		} else if( v == 'hide' ) v = 'hidden';
        obj = obj.style;
      }
	  obj.visibility = v;
    }
  }
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_swapImgRestoreCerca() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;
  if(!d)
    d=document;
  if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document;
    n=n.substring(0,p);
  }
  if(!(x=d[n])&&d.all)
    x=d.all[n];
  for (i=0;!x&&i<d.forms.length;i++)
    x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++)
    x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById)
    x=document.getElementById(n);
  return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_swapImageCerca() { //v3.0
var mostra;
mostra = 0;
if (NS4) {
	if( document.layers["loginPopup"].visibility == "show" )
		mostra = 1;
} else if (DOM) {
	if( document.getElementById("loginPopup").style.visibility == "visible" )
		mostra = 1;
} else {
	if( document.all["loginPopup"].style.visibility == "visible" )
		mostra = 1;
}
if( mostra == 0 ) {
	var i,j=0,x,a=MM_swapImageCerca.arguments;
	document.MM_sr=new Array;
	for(i=0;i<(a.length-2);i+=3)
		if ((x=MM_findObj(a[i]))!=null) {
			document.MM_sr[j++]=x;
			if(!x.oSrc)
				x.oSrc=x.src;
			x.src=a[i+2];
		}
}
}
function MM_clicImageCerca() { //v3.0
var mostra;
mostra = 0;
if (NS4) {
	if( document.layers["loginPopup"].visibility == "show" )
		mostra = 1;
} else if (DOM) {
	if( document.getElementById("loginPopup").style.visibility == "visible" )
		mostra = 1;
} else {
	if( document.all["loginPopup"].style.visibility == "visible" )
		mostra = 1;
}
if( mostra == 0 ) {
	window.location = "http://www.presstoday.com/";
}
}

function moveLayers() {
	if (gotlayers) {
		if (NS4) {
			screenWidth = window.innerWidth;
			document.layers['loginPopup'].left = 10;
			document.layers['loginPopup'].top = 151;
		} else if (NS6) {
			screenWidth = (document.body.clientWidth ? document.body.clientWidth : window.innerWidth) + 18;
			document.getElementById('loginPopup').style.left = 10; //400;
			document.getElementById('loginPopup').style.top = 145; //60;
		} else if (DOM) {
			screenWidth = (document.body.clientWidth ? document.body.clientWidth : window.innerWidth) + 18;
			document.getElementById('loginPopup').style.left = 10; //400;
			document.getElementById('loginPopup').style.top = 149; //60;
        } else {
			screenWidth = document.body.clientWidth + 18;
			document.all['loginPopup'].style.pixelLeft = 20; //435;
			document.all['loginPopup'].style.pixelTop = 130; //60;
		}
	}
}

function popUpMenu(menuName,on) {
	if (gotlayers) {
		if (on) {
			moveLayers();
			if (NS4) {
				document.layers[menuName].visibility = "show";
			} else if (DOM) {
				document.getElementById(menuName).style.visibility = "visible";
                        } else {
				document.all[menuName].style.visibility = "visible";
			}
		} else {
			if (NS4) {
				document.layers[menuName].visibility = "hide";
			} else if (DOM) {
				document.getElementById(menuName).style.visibility = "hidden";
			} else {
				document.all[menuName].style.visibility = "hidden";
			}
		}
	}
}

function LoadImgs () {
	if (document.images) {


		loaded = 1;
	}
}

function change(Name,No) {
	if (document.images && (loaded == 1) && (document[Name])) {
		document[Name].src = eval("b_" + Name + No + ".src");
	}
	if (No == 1) {
		if (gotlayers) {
			popUpMenu('loginPopup',false);
		}
		if (Name != 'sear') {
			change('sear',0);
		}
		lastbutton = Name;
	}
}

function hide() {
	if (document.images && (loaded == 1)) {
		change(lastbutton,0);
	}
}
LoadImgs();
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);

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
