function checkId(id) {
	test = false;
	if (document.getElementById) test=document.getElementById(id); 
	else if (document.all) test=eval('document.all.'+id); 
	return test;
}

function getHeight(id) {
	var rt = 0;
	if (checkId(id)){
		if (document.getElementById) rt=document.getElementById(id).offsetHeight; 
		else if (document.all) rt=eval('document.all.'+id+'.clientHeight'); 
	}
	return Math.floor(rt); 
}

function getWidth(id) {
	var rt = 0;
	if (checkId(id)) {
		if (document.getElementById) rt=document.getElementById(id).offsetWidth; 
		else if (document.all) rt=eval('document.all.'+id+'.clientWidth'); 
	}
	return Math.floor(rt); 
}

function getTop(id) {
	var rt = 0;
	if (checkId(id)) {
		if (document.all) rt=eval('document.all.'+id+'.offsetParent.offsetTop'); 
		else if (document.getElementById) rt=document.getElementById(id).offsetTop; 
	}
	return rt; 
}

function getLeft(id) {
	var rt = 0;
	if (checkId(id)) {
		if (document.all) rt=eval('document.all.'+id+'.offsetParent.offsetLeft'); 
		else if (document.getElementById) rt=document.getElementById(id).offsetLeft; 
	}
	return rt; 
}

function setHeight(id,pxs) {
	if (checkId(id)) {
		if (document.getElementById) eval('document.getElementById(\''+id+'\').style.height=\''+pxs+'px\''); 
		else if (document.all) eval('document.all.'+id+'.style.height=\''+pxs+'px\''); 
	}
}

function setTop(id,pxs) {
	if (checkId(id)) {
		if (document.getElementById) eval('document.getElementById(\''+id+'\').style.top=\''+pxs+'px\''); 
		else if (document.all) eval('document.all.'+id+'.style.top=\''+pxs+'px\''); 
	}
}

function trimLayout() {
	alte = 0;
	// if (alte < document.body.clientHeight) alte = document.body.clientHeight - getHeight ('footerMenu') - getHeight ('intestazione');
	if (alte < getHeight ('contenuto-sezione-centrale')) alte = getHeight ('contenuto-sezione-centrale');
	if (alte < getHeight ('contenuto-spalla-sinistra')) alte = getHeight ('contenuto-spalla-sinistra');
	if (alte < getHeight ('contenuto-spalla-destra')) alte = getHeight ('contenuto-spalla-destra');

	alte = alte;
	setHeight ('spalla-sinistra', alte);
	setHeight ('spalla-destra', alte);
	setHeight ('corpo', alte);
	setHeight ('gancio', getHeight ('testa') + getHeight ('testa-senza-riga') + getHeight ('corpo') + getHeight ('piede') + 35);
	return;
}

function aprichiudi(item) {
	elem=document.getElementById(item);
	visibile=(elem.style.display!='none');
	prefisso=document.getElementById('menu' + item);
	if (visibile) {
		elem.style.display='none';
		trimLayout();
	} else {
		elem.style.display='block';
		trimLayout();
	}
}

function espanditutto() {
	divs=document.getElementsByTagName('div');
	for (i=0;i<divs.length;i++) {
		divs[i].style.display='block';
		prefisso=document.getElementById('menu' + divs[i].id);
	}
}

function chiuditutto() {
	divs=document.getElementsByTagName('div');
	for (i=0;i<divs.length;i++) {
		divs[i].style.display='none';
		prefisso=document.getElementById('menu' + divs[i].id);
	}
}

function link_ext(url_ext) {
	var disclaimer='State abbandonando il sito frontlinecombo.it.\nLe informazioni contenute nel nuovo sito prescelto possono non essere conformi con quanto previsto dalla legislazione italiana e le opinioni espresse non riflettono necessariamente le posizioni di Merial Italia, né sono da essa avallate.';
	alert(disclaimer);
	open(url_ext,'');
	return;
}

function WriteDate() {
 	var mydate=new Date();
    var myday = mydate.getDay();
    var dayword = new Array('domenica', 'lunedì', 'martedì', 'mercoledì', 'giovedì', 'venerdì', 'sabato');
    document.write(dayword[myday]+', ');
	var year=mydate.getYear();
	if (year < 1000) year+=1900;
	var month=mydate.getMonth();
	var daym=mydate.getDate();
	var montharray=new Array('gennaio','febbraio','marzo','aprile','maggio','giugno','luglio','agosto','settembre','ottobre','novembre','dicembre');
	document.write(daym+' '+montharray[month]+' '+year);
}

function openWin(fileName,windowName,lar,alt) {
window.open(fileName,windowName,"width="+lar+",height="+alt+",directories=no,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no,resizable=no");
}

function openWin_nobars(fileName,windowName,lar,alt) {
window.open(fileName,windowName,'width='+lar+',height='+alt+',directories=no,title='+windowName+',location=no,menubar=no,scrollbars=no,status=no,toolbar=no,resizable=no');
}

function conferma_eliminazione_record(elimina, non_elimina) {
	var answer = confirm('Vuoi eliminare questo record?');
	if (answer){
		window.location = elimina;
	} else {
		return false;
	}
}