//"height=259,width=259,scrollbars=no,resizable=0,toolbar=0"
function Finestra(htm,parametri){
	//alert(parametri);
	fine = window.open(htm,"",parametri)
}

// Funzione per il pop up!
function PopIt(){
	popup = window.open("pop.htm","","height=259,width=259,scrollbars=no,resizable=0,toolbar=0")
	popup.document.close()
}

function chiudi()
{
	fine.close();
}
// funzione scritta che viene visualizzata sulla barra di status
function scritta() {
//msg="Solidarietà a vantaggio dei soci";
self.status = 'Medecine And High Technology';
}

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_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];}
}


// ---- Sezione personalizzabile (v. scheda nel sito: http://www.jsdir.com/staffscripts/script062.asp)

// Pixel di spostamento per ogni ciclo

var Step = 5;
var StepPage = 50;

// Velocita' di scorrimento: millisecond per il setInterval() - piu' piccolo il numero --> piu' veloce lo scorrimento
var Tempo = 200;

// ---- Fine sezione personalizzabile

var nn = document.layers?true:false;
var N6 = navigator.userAgent.toLowerCase().indexOf("gecko")!=-1?true:false;
var LayText=null;
var AltezzaLivello=0;
var LarghezzaLivello=0;
var Limite =0;
var texTop=0;
var DeltaTop = 0;
var timsc=null;
var cinzia=9;

function Start()
	{
	//alert (document.getElementById("textLayer"));
	//alert (N6);
	LayText=nn?document.layers.textLayer:N6?document.getElementById("textLayer").style:document.all.textLayer.style;
        DeltaTop=nn?LayText.top:N6?document.getElementById("textLayer").offsetTop:document.all.textLayer.offsetTop;
        AltezzaLivello=parseInt(nn?LayText.clip.height:N6?LayText.height:LayText.height);
        LarghezzaLivello=parseInt(nn?LayText.clip.width:N6?LayText.width:LayText.width);

        if (N6) {
        	//alert("netscape");
        	//alert(AltezzaLivello);
        	alfa=document.getElementById("divN6").offsetHeight;
        	Limite=AltezzaLivello-alfa
        	}
        else {
        Limite=-AltezzaLivello+(nn?LayText.document.height:document.all.textLayer.clientHeight);
        }
        //alert(Limite);
	}


function Move(where)
	{
	//alert(texTop);
	//alert(Limite);
        where?texTop>=Limite?null:texTop+=Step:texTop==0?null:texTop-=Step;
	LayText.top=-texTop+DeltaTop;
	//alert (LayText.top);
	//alert (nn);
	if (nn)
		{
		LayText.clip.top=texTop;
		LayText.clip.bottom=eval(texTop+AltezzaLivello);
		}
		else
		LayText.clip = "rect(" + texTop + ", " + LarghezzaLivello + ", " +eval(texTop+AltezzaLivello) + ", 0)";
	}


function StartScroll(updown){
//alert(updown);
timsc=setInterval(updown?"Move(true)":"Move(false)",Tempo);
}


function StartScrollPage(updown){
//alert(updown);
timsc=setInterval(updown?"MovePage(true)":"MovePage(false)",Tempo);
}


function StopScroll(){clearInterval(timsc);}


function Carica(newurl){
 var tmp = new String(window.location);
 var car = tmp.indexOf('?');
 if (car==-1)
 {
  dim(newurl);
 }
}

function CaricaAsp(newurl){

 var tmp = new String(window.location.search.substr(1));
 var dati = new Array();
 //alert(tmp);
 dati=tmp.split("&");
 //alert("carica   .... ASP");

 var dato1 = dati[0].substr(dati[0].indexOf("=")+1);
 num=dati.length;
 //alert(num);
 if (num==1)
 {
 newurl=newurl+"?"+dati[0];
 //alert(newurl);
 dimAsp(newurl);
 }

}

function dim(newurl){

  var bb,aa;
  var nn = document.layers?true:false;
  var N6 = navigator.userAgent.toLowerCase().indexOf("gecko")!=-1?true:false;

  if (document.getElementById)
  {
   //alert("netscape 6");
   bb=self.innerWidth;
   aa=self.innerHeight;

  }
  if(document.layers) {
  //alert("qui.. .");
  bb=self.innerWidth;
  aa=self.innerHeight;
  }
  else
  if(document.all) {
  bb=document.body.offsetWidth;
  aa=document.body.offsetHeight;
  }

  document.ResizeDef.h.value=aa;
  document.ResizeDef.w.value=bb;

  page=newurl+"?h="+aa+"&w="+bb
  //alert(page);
  document.location.href=page

  //b=  window.open('mia.htm','Mia','toolbar=yes,directories=yes,Width='+(bb)+',Height='+(aa)+',scrollbars=yes,resizable=yes');
}



function dimAsp(newurl){
  var bb,aa;
  var nn = document.layers?true:false;
  var N6 = navigator.userAgent.toLowerCase().indexOf("gecko")!=-1?true:false;

  //alert("redimensionamento ASP");
  var tmp = new String(window.location.search.substr(1));
  if (document.getElementById)
  {
   //alert("netscape 6");
   bb=self.innerWidth;
   aa=self.innerHeight;

  }
  if(document.layers) {
  //alert("qui.. .");
  bb=self.innerWidth;
  aa=self.innerHeight;
  }
  else
  if(document.all) {
  bb=document.body.offsetWidth;
  aa=document.body.offsetHeight;
  }

  document.ResizeDef.h.value=aa;
  document.ResizeDef.w.value=bb;


  var tmp = new String(window.location.search.substr(1));
  var dati = new Array();
  //alert(tmp);
  dati=tmp.split("&");


   page=newurl+"&h="+aa+"&w="+bb
  //alert(page);
  document.location.href=page

  //b=  window.open('mia.htm','Mia','toolbar=yes,directories=yes,Width='+(bb)+',Height='+(aa)+',scrollbars=yes,resizable=yes');
}


//------------

// overly simplistic test for IE
isIE = (document.all ? true : false);
// both IE5 and NS6 are DOM-compliant
isDOM = (document.getElementById ? true : false);

lefter=0;
topper=0;
layerVisible=0;

// get the true offset of anything on NS4, IE4/5 & NS6, even if it's in a table!
function getAbsX(elt) { return (elt.x) ? elt.x : getAbsPos(elt,"Left"); }
function getAbsY(elt) { return (elt.y) ? elt.y : getAbsPos(elt,"Top"); }
function getAbsPos(elt,which) {
 iPos = 0;
 while (elt != null) {
  iPos += elt["offset" + which];
  elt = elt.offsetParent;
 }
 return iPos;
}

function getDivStyle(divname) {
 var style;
 if (isDOM) { style = document.getElementById(divname).style; }
 else { style = isIE ? document.all[divname].style
                     : document.layers[divname]; } // NS4
 return style;
}

function hideElement(divname) {
 getDivStyle(divname).visibility = 'hidden';
}

function showElement(divname) {
 getDivStyle(divname).visibility = 'visible';
}

// annoying detail: IE and NS6 store elt.top and elt.left as strings.
function moveBy(elt,deltaX,deltaY) {
 elt.left = parseInt(elt.left) + deltaX;
 elt.top = parseInt(elt.top) + deltaY;
}

function toggleVisible(divname) {
 //alert("dentro toggleVisible");
 divstyle = getDivStyle(divname);
 fixPosition(divname);
 divstyle.visibility = 'visible';
}

function setPosition(elt,positionername,isPlacedUnder) {
 var positioner;
 if (isIE) {
  positioner = document.all[positionername];
 } else {
  if (isDOM) {
    positioner = document.getElementById(positionername);
  } else {
    // not IE, not DOM (probably NS4)
    // if the positioner is inside a netscape4 layer this will *not* find it.
    // I should write a finder function which will recurse through all layers
    // until it finds the named image...
    positioner = document.images[positionername];
  }
 }
 elt.left = getAbsX(positioner);
 elt.top = getAbsY(positioner) + (isPlacedUnder ? positioner.height : 0);
}

function setPosition(elt,positionername,isPlacedUnder) {
 var positioner;
 if (isIE) {
  positioner = document.all[positionername];
 } else {
  if (isDOM) {
    positioner = document.getElementById(positionername);
  } else {
    // not IE, not DOM (probably NS4)
    // if the positioner is inside a netscape4 layer this will *not* find it.
    // I should write a finder function which will recurse through all layers
    // until it finds the named image...
    positioner = document.images[positionername];
  }
 }
 elt.left = getAbsX(positioner);
 elt.top = getAbsY(positioner) + (isPlacedUnder ? positioner.height : 0);

 //alert(elt.left);
 //alert(elt.top);
}

function setPositionNew(elt,positionername,isPlacedUnder) {
 var positioner;
 if (isIE) {
  positioner = document.all[positionername];
 } else {
  if (isDOM) {
    positioner = document.getElementById(positionername);
  } else {
    // not IE, not DOM (probably NS4)
    // if the positioner is inside a netscape4 layer this will *not* find it.
    // I should write a finder function which will recurse through all layers
    // until it finds the named image...
    positioner = document.images[positionername];
  }
 }
 elt.left = getAbsX(positioner);
 elt.top = getAbsY(positioner) + (isPlacedUnder ? positioner.height : 0);
 lefter=elt.left;
 topper=elt.top;
}


function setta(divname) {
//alert("setta");
//alert(divname);
 divstyle = getDivStyle(divname);
 divstyle.left = lefter;
 divstyle.top = topper;
 //divstyle.visibility = 'visible'
 //lefter=elt.left;
 //topper=elt.top;
}

function VisibleNumber(numero) {

 nome2="";
 if (layerVisible!=0)
  {
    var oldLay=layerVisible;
    nome2=oldLay.toString();

  }
 nome2="textLayer"+nome2;
 divstyle = getDivStyle(nome2);
 divstyle.visibility = 'hidden';
 var A = numero;
 nome = A.toString();
 nome="textLayer"+nome;

 //alert(nome);

 //alert("dentro toggleVisible");
 divstyle = getDivStyle(nome);
 //fixPosition(divname);
 divstyle.visibility = 'visible';

 layerVisible=numero;
}
