// JavaScript Document
function display_popup(nomediv, larghezza, altezza) {
	mywindow=window.open("/popup.htm?nomeDiv="+nomediv,"Immergas","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,width="+larghezza+",height="+altezza);
}
function display_popup_caius(nomediv, larghezza, altezza) {
	mywindow=window.open("/popup_caius.htm?nomeDiv="+nomediv,"Immergas","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,width="+larghezza+",height="+altezza);
}
function display_popup_print_product(indice_menu) {
	mywindow=window.open("/popup_print_product.htm?indice_menu="+indice_menu,"Immergas","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,width=800,height=600");
}
function display_popup_print_static_product(indice_menu) {
	mywindow=window.open("/popup_print_static_product.htm?indice_menu="+indice_menu,"Immergas","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,width=800,height=600");
}
function display_popup_print(nomediv1,nomediv2) {
	mywindow=window.open("/popup_print.htm?nomeDiv1="+nomediv1+"&nomeDiv2="+nomediv2,"Immergas","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,width=800,height=600");
}

function displayFlash(name, path, width, height, param)
{
	path = path.replace(".swf","");
	if (AC_FL_RunContent == 0) {
		alert("This page requires AC_RunActiveContent.js. In Flash, run \"Apply Active Content Update\" in the Commands menu to copy AC_RunActiveContent.js to the HTML output folder.");
	} else {
		AC_FL_RunContent(
			'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0',
			'width', width,
			'height', height,
			'src', path,
			'quality', 'high',
			'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
			'align', 'middle',
			'play', 'true',
			'loop', 'true',
			'scale', 'showall',
			'wmode', 'window',
			'devicefont', 'false',
			'id', name,
			'bgcolor', '#ffffff',
			'name', name,
			'menu', 'true',
			'allowScriptAccess','sameDomain',
			'movie', path,
			'flashVars', param,
			'salign', ''
		); //end AC code
	}	
}

//positioning layer
x0 = 0;
x1 = 0;
x2 = 0;
y0 = 490;
clientWidthAttributes = new Array();
clientWidthAttributes[0] = 'document.body.clientWidth';
clientWidthAttributes[1] = 'window.innerWidth';
leftAttributes = new Array();
leftAttributes[0] = '.style.pixelLeft';
leftAttributes[1] = '.style.left';
topAttributes = new Array();
topAttributes[0] = '.style.pixelTop';
topAttributes[1] = '.style.top';

function gGetObject(id) {
	return document.getElementById(id);
}

function gGetClientWidth() {
	width = 0;
	for(clientWidthIndex=0; clientWidthIndex<clientWidthAttributes.length; clientWidthIndex++) {
		eval('width = '+clientWidthAttributes[clientWidthIndex]);
		if(width != 0) break;
	}
	return width;
}

function gSetPixelLeft(id, x) { 
	for(leftAttributeCtr=0; leftAttributeCtr<leftAttributes.length; leftAttributeCtr++)
		eval('gGetObject("'+id+'")'+leftAttributes[leftAttributeCtr]+' = '+x);
}

function gSetPixelTop(id, y) {
	for(topAttributeCtr=0; topAttributeCtr<leftAttributes.length; topAttributeCtr++)
		eval('gGetObject("'+id+'")'+topAttributes[topAttributeCtr]+' = '+y);
}

function gSetPixelPos(id, x, y) {
	gSetPixelLeft(id, x);
	gSetPixelTop(id, y);
}

function refreshCoordinates() {
  x0 = (gGetClientWidth()-1000)/2;
  if(x0 < 0) x0 = 0;
  x0 = x0 + 226;
  x1 = (gGetClientWidth()-1000)/2;
  if(x1 < 0) x1 = 0;
  x1 = x1 + 471;
  x2 = (gGetClientWidth()-1000)/2;
  if(x2 < 0) x2 = 0;
  x2 = x2 + 722;
}

function refreshPage() {
  refreshCoordinates();
  if(gGetObject('dbox1'))
  	gSetPixelPos('dbox1', x0, y0);
  if(gGetObject('dbox2'))
  	gSetPixelPos('dbox2', x1, y0);  
  if(gGetObject('dbox3'))
  	gSetPixelPos('dbox3', x2, y0);  
}
