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 toggleBox(someID)
{
	if (document.getElementById(someID).style.display == "block") {
		document.getElementById(someID).style.display = "none";
	}
	else {
		document.getElementById(someID).style.display = "block";
	}
		
}

function expandItem(dbID)
{
    var tr = document.getElementById(dbID); 
    if (tr==null) { return; } 
    var bExpand = tr.style.display == ''; 
    tr.style.display = (bExpand ? 'none' : ''); 
	
	var header = document.getElementById('header'+dbID); 
	if (header==null) { return; } 
	var bBGcolor = header.style.backgroundColor == '#EAF1F8';
	header.style.backgroundColor=(bBGcolor ? '' : '#EAF1F8'); 
	
	var thislink = document.getElementById('link'+dbID); 
	if (thislink==null) { return; } 
	var bColor = thislink.style.color == '#FF9933';
	thislink.style.color=(bColor ? '' : '#FF9933');
} 

function initDisplay() {
	var x = document.getElementsByTagName('div');
	for (var i=0;i<x.length;i++)
	{
		if (x[i].className == 'label')
			x[i].onclick = clickNav;
	}
	closeNav();
	document.getElementById('start').style.display="block";
}

function closeNav()
{
	var x = document.getElementsByTagName('div');
	for (var i=0;i<x.length;i++)
	{
		if (x[i].className == 'content')
			x[i].style.display = 'none';
		if (x[i].className == 'label')
			x[i].style.fontWeight = 'normal';
	}
}

function clickNav(e)
{
    alert(" clickNav");
	if (!e) var e = window.event;
	if (e.target) var tg = e.target;
	else if (e.srcElement) var tg = e.srcElement;
	while (tg.nodeName != 'DIV')  // Safari GRRRRRRRRRR
		tg = tg.parentNode;
	var nextSib = tg.nextSibling;
	while (nextSib.nodeType != 1)
		nextSib = nextSib.nextSibling;
	var nextSibStatus = (nextSib.style.display == 'none') ? 'block' : 'none';
	var nextChild = tg.firstChild;
	var nextChildClass = (nextChild.className == 'active') ? 'inactive' : 'active';
	var weightStatus = (tg.style.fontWeight == 'normal') ? 'bold' : 'normal';
	closeNav();
	nextSib.style.display = nextSibStatus;
	tg.style.fontWeight = weightStatus;
	if(nextChild.className == 'active'){
	  sitestat('http://be.sitestat.com/cme/promo/s?chi_siamo.'+nextSib.id);
	}
}


function clickNav2(e)
{
    
    
	if (!e) var e = window.event;
	if (e.target) var tg = e.target;
	else if (e.srcElement) var tg = e.srcElement;
	while (tg.nodeName != 'DIV')  // Safari GRRRRRRRRRR
		tg = tg.parentNode;
	var nextSib = tg.nextSibling;
	while (nextSib.nodeType != 1)
		nextSib = nextSib.nextSibling;
	var nextSibStatus = (nextSib.style.display == 'none') ? 'block' : 'none';
	var nextChild = tg.firstChild.firstChild.firstChild.firstChild.firstChild;
	var nextChildClass = (nextChild.className == 'inactive') ? 'active' : 'inactive';
	closeNav();
	nextSib.style.display = nextSibStatus;
	nextChild.className = nextChildClass;
	if(nextChild.className == 'active'){
	  sitestat('http://be.sitestat.com/cme/promo/s?chi_siamo.'+nextSib.id);
	}
}
function initDisplay4() {
    
	var x = document.getElementsByTagName('div');
	for (var i=0;i<x.length;i++)
	{
		if (x[i].className == 'header'){
			x[i].firstChild.firstChild.firstChild.firstChild.firstChild.className = 'active';
			x[i].onclick = clickNav2;
		}
	}	
}

function initDisplay2() {
    
	var x = document.getElementsByTagName('div');
	for (var i=0;i<x.length;i++)
	{
		if (x[i].className == 'header'){
			x[i].firstChild.firstChild.firstChild.firstChild.firstChild.className = 'active';
			x[i].onclick = clickNav2;
		}
	}	
}

function initDisplay3() {
	var x = document.getElementsByTagName('div');
	for (var i=0;i<x.length;i++)
	{
		if (x[i].className == 'header2'){
			x[i].firstChild.firstChild.firstChild.firstChild.firstChild.className = 'inactive';
			x[i].onclick = clickNav2;
		}
	}
	closeNav3();
}
function initDisplay4() {
    
	var x = document.getElementsByTagName('div');
	for (var i=0;i<x.length;i++)
	{
		if (x[i].className == 'header2'){
			x[i].firstChild.firstChild.firstChild.firstChild.firstChild.className = 'inactive';
			x[i].onclick = clickNav3;
		}
	}
	closeNav3();
}

function clickNav3(e)
{
  	if (!e) var e = window.event;
	if (e.target) var tg = e.target;
	else if (e.srcElement) var tg = e.srcElement;
	while (tg.nodeName != 'DIV')  // Safari GRRRRRRRRRR
		tg = tg.parentNode;
	var nextSib = tg.nextSibling;
	while (nextSib.nodeType != 1)
		nextSib = nextSib.nextSibling;
	var nextSibStatus = (nextSib.style.display == 'none') ? 'block' : 'none';
	var nextChild = tg.firstChild.firstChild.firstChild.firstChild.firstChild;
	var nextChildClass = (nextChild.className == 'inactive') ? 'active' : 'inactive';
	closeNav();
	nextSib.style.display = nextSibStatus;
	nextChild.className = nextChildClass;
	if(nextChild.className == 'active'){
	  sitestat('http://be.sitestat.com/cme/promo/s?chi_siamo.'+nextSib.id);
	}
}

function closeNav3()
{
	var x = document.getElementsByTagName('div');
	for (var i=0;i<x.length;i++)
	{
		if (x[i].className == 'footer2')
			x[i].style.display = 'none';
	}

}

function confirmDistance() {
	return alert('Stai per abbandonare le pagine del sito Internet di Clerical Medical Italia.\nClerical Medical Italia non è responsabile del contenuto di siti Internet esterni al proprio.');
}

window.status = "Clerical Medical Italia";
window.name = "it";
var isIE = (window.navigator.userAgent.indexOf("MSIE") > 0);
function change(color){ 
	if (isIE) {
		var el=event.srcElement;
		if (el.tagName=="TD" && el.name=="menu") 
			event.srcElement.style.backgroundColor=color;
	}
} 

function spawnWin(options) {
 var url = options[options.selectedIndex].value;
 var winArgs = "toolbar=no,location=no,directories=no, status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no," ;
  winArgs+= "width=650,height=700";
  var howdy = open(url,"newsletter",winArgs);
 }
 
function spawnWin2(options) {
    if (options[options.selectedIndex].value.length !=0)
        {         
         sitestat('https://be.sitestat.com/cme/it/s?homepage.news.link.mese');
         var url = options[options.selectedIndex].value;
         var winArgs = "toolbar=yes,location=yes,directories=no, status=yes,menubar=yes,scrollbars=yes,resizable=yes,copyhistory=no," ;
          winArgs+= "width=800,height=600";
          var howdy = open(url,"pdf",winArgs);
         } 
}

function TriggerWaitCursor(milliSeconds)
{
 document.getElementById('ImageWaitCursor').style.display = 'block';
 setTimeout(function(){document.getElementById('ImageWaitCursor').style.display='none'},milliSeconds)
}

function setHeight(h) {
    h = parseInt(h);
	var iframe = document.getElementById('LipperModulesCenterIFrame');
	iframe.style.height = h + "px";
}

function resizeCenterIFrame(iframe) {

  var url;
  if (iframe.contentDocument)
    url = iframe.contentDocument.URL;  // standard
  else
    url = iframe.contentWindow.document.URL;  // Internet Explorer
  alert(url); 
  var pos = url.lastIndexOf('?height=');
  if (pos<0) return;
  pos += '?height='.length;
  var newheight = url.substring(pos);
  
  var targetname = 'LipperModulesCenterIFrame';
var targetiframe = document.getElementById(targetname);
                                              // the IFrame to be resized
  targetiframe.height = newheight;
  
}

function changeThis(classArg){ 
	if (isIE) {
		var el=event.srcElement;
		if (el.tagName=="INPUT"&&el.type=="submit") 
			event.srcElement.className=classArg;
	}
} 

function changeThat(classArg,font){ 
	if (isIE) {
		var el=event.srcElement;
		if (el.tagName=="INPUT"&&el.type=="submit") 
			event.srcElement.className=classArg;
			event.srcElement.style.color=font;
	}
} 
