var DHTML = (document.getElementById || document.all || document.layers);
var base = ""
var imgsupported = (document.images);


if (imgsupported)
{
	nrm = new Image();
	nrm.src = base + "nGif/pijl_leeg.gif";

	omo = new Image();
	omo.src = base + "nGif/pijl_3.gif";

	clic = new Image();
	clic.src = base + "nGif/mSel.gif";

	//clicLnk = new Image();
	//clicLnk.src = base + "nGif/pijl_1.gif";
	
}

function overLink(no)
{
	if (document.images)
	{
		document.images["SM"+ no].src = clic.src
  	if (!DHTML) return;
  	var x = new getObj("Tbl" + no);
  		 	x.style.background = "#FFFFFF";
		
	}
}

function outLink(no)
{
	if (document.images)
	{
		document.images["SM"+ no].src = omo.src
  	if (!DHTML) return;
  	var x = new getObj("Tbl" + no);
  		 	x.style.background = "#FFFFFF";
		
	}
}


function over(no)
{
	if (document.images)
	{
		document.images["C"+ no].src = clic.src
		MenuHide();
  	if (!DHTML) return;
  	var x = new getObj("tbl_M" + no);
  		 	x.style.background = "#ffffcc";
		
	}
}

function MenuHide()
{
		// invi('hidden','SUBMENU1');
		// invi('hidden','SUBMENU2');
		// invi('hidden','SUBMENU2D');		
		// invi('hidden','SUBMENU4');
		// invi('hidden','SUBMENU5');		
					
}

function ViewMenu(flag,nameObj){
		invi('hidden','MSUBMENU1');
		invi('hidden','MSUBMENU2');
		invi('hidden','MSUBMENU2D');		
		invi('hidden','MSUBMENU4');
		invi('hidden','MSUBMENU5');		

				
		invi(flag,nameObj)
}
function out(no)
{
	if (document.images)
	{
		document.images["C"+ no].src = omo.src
  	if (!DHTML) return;
  	var x = new getObj("tbl_M" + no);
  		 	x.style.background = "#FFFFFF";
		
	}
}

function getObj(name)
{
  if (document.getElementById)
  {
	  if(document.getElementById(name) != null){ 
  		this.obj = document.getElementById(name);
  	  this.style = this.obj.style;
		}
  }
  else if (document.all)
  {
	  if(document.all[name] != null){
    	this.obj = document.all[name];
    	this.style = this.obj.style;
		}	
  }
  else if (document.layers)
  {
	  if(document.all[name] != null){
     	this.obj = document.layers[name];
   		this.style = document.layers[name];
		}			
  }
	
	return this.style;
	
}

function invi(flag,nameObj)
{
	if (!DHTML) return;
	var x = new getObj(nameObj);
	if (x != undefined){
		 	x.visibility = flag;
			}
	if (nameObj == 'MSUBMENU2')
		 {
    	var x = new getObj('MSUBMENU2D');
    		 	x.visibility = flag;
		 }			
}

function findPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}

function findPosY(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}


var totalLayersInLoop=4;
var layerNumShowing=1;

function viewDesc(obj)
{
	if (!DHTML) return;
	var DivHide = "CAPITOLO" + layerNumShowing; 
	var TopPosizione = 0; 
	var xClass = "Capitello"
			
	var x = new getObj(xClass);
		 	x.visibility = "hidden";

			
	var x = new getObj(DivHide);
		 	x.visibility = "hidden";
			layerNumShowing = obj.substr(8, 1);
	var x = new getObj(obj);
		 	x.visibility = "visible";

}


 function PopWindowContact()
{
	MyCont = window.open("Contatti.asp", null, "height=327,width=503,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,scrollbars=no,left=263,top=150")
}

 function PopWindowEsempio(Documento)
{
		NewWindow("Esempio.asp?xsl=" + Documento,"Esempio",657,600,"yes")			 
}

 function PopWindowLegal()
{
	MyCont = window.open("AvvLegali.asp", null, "height=327,width=518,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,scrollbars=yes,left=263,top=150")
}

var win = null;
function NewWindow(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
win = window.open(mypage,myname,settings)
}



function PopWindowSendToFriend(vRif,vTipo) {
	try
	{
	var loc = window.location.href;
	MyWin = window.open("news.asp?XFile="+vRif+"&xT="+vTipo, null, "height=327,width=503,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,scrollbars=no,left=263,top=150")
	}
  catch(e)
	{
	var loc = window.location.href;
	MyWin = window.open("news.asp?XFile="+vRif+"&xT="+vTipo, null, "height=327,width=503,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,scrollbars=no,left=263,top=150")
	}
}

function BColor(ButtonName,obj)
{
    for (i = 1; i <= 8; i++) {
      	var x = new getObj(ButtonName + i);
       	x.color = "#ccffff";
    }

	  var x = new getObj(obj.id);
       	x.color = "#103c84";

	  var x = new getObj("Descrizione");
		 	  x.visibility = "visible";
				
}

