// -----------------------------------------------
// Impostazioni utili per gestire tutti i browser:
// -----------------------------------------------
var layerRef = String("");
var styleRef = String("");
var parentesiID_1 = String("");
var parentesiID_2 = String("");

if (document.getElementById)
{
	layerRef = ".getElementById";
	styleRef = ".style";
	parentesiID_1 = "(";
	parentesiID_2 = ")";
}
else if (navigator.appName == "Netscape")
{
	layerRef = ".layers";
	styleRef = "";
	parentesiID_1 = "[";
	parentesiID_2 = "]";
}
else
{
	layerRef = ".all";
	styleRef = ".style";
	parentesiID_1 = "[";
	parentesiID_2 = "]";
}

var srcContenuto = new String("");
var voceMenu = new String("");

function PreparaStampa()
{
	switch (voceMenu)
	{
		case "index":
			eval("document" + layerRef + parentesiID_1 + "'welcome'" + parentesiID_2 + ".src = 'welcome_P.htm'");
			htmlLogo = "<img src=images/intestHome.jpg height=145>";
			break;
		case "capabilities":
			htmlLogo = "<img src=images/intestCapab.jpg height=145>";
			break;
		case "technologies":
			htmlLogo = "<img src=images/intestTech.jpg height=145>";
			break;
		case "projects":
			htmlLogo = "<img src=images/intestProj.jpg height=145>";
			break;
		case "careers":
			htmlLogo = "<img src=images/intestJobs.jpg height=145>";
			break;
		case "contacts":
			htmlLogo = "<img src=images/intestCont.jpg height=145>";
			break;
		case "downloads":
			htmlLogo = "<img src=images/intestDown.jpg height=145>";
			break;
		default:
			htmlLogo = "<img src=images/intestNO.jpg height=145>";
	}		

	eval("document" + layerRef + parentesiID_1 + "'logo'" + parentesiID_2 + ".innerHTML = htmlLogo");
	eval("document" + layerRef + parentesiID_1 + "'menu'" + parentesiID_2 + ".innerHTML = ''");
	CambiaCSS("stileStampa");
}

function RipristinaPagina()
{
	switch (voceMenu)
	{
		case "index":
			eval("document" + layerRef + parentesiID_1 + "'welcome'" + parentesiID_2 + ".src = 'welcome.htm'");
			swfMenu = "index";
			break;
		case "capabilities":
			swfMenu = "capabilities";
			break;
		case "technologies":
			swfMenu = "applications";
			break;
		case "projects":
			swfMenu = "projects";
			break;
		case "careers":
			swfMenu = "careers";
			break;
		case "contacts":
			swfMenu = "contacts";
			break;
		case "downloads":
			swfMenu = "download";
			break;
		default:
			swfMenu = "menufinale";
	}		

	htmlLogo = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width=100% height=100%>";
    	htmlLogo = htmlLogo + "<param name=movie value=menu5.swf><param name=quality value=high>";
	htmlLogo = htmlLogo + "<embed src=menu5.swf quality=high pluginspage=http://www.macromedia.com/go/getflashplayer type=application/x-shockwave-flash width=100% height=100%></embed></object>";
	htmlMenu = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width=100% height=100%>";
    	htmlMenu = htmlMenu + "<param name=movie value=" + swfMenu + ".swf><param name=quality value=high>";
	htmlMenu = htmlMenu + "<embed src=" + swfMenu + ".swf quality=high pluginspage=http://www.macromedia.com/go/getflashplayer type=application/x-shockwave-flash width=100% height=100%></embed></object>";

	eval("document" + layerRef + parentesiID_1 + "'logo'" + parentesiID_2 + ".innerHTML = htmlLogo");
	eval("document" + layerRef + parentesiID_1 + "'menu'" + parentesiID_2 + ".innerHTML = htmlMenu");
	CambiaCSS("stileBase");
}

function StampaNW()
{
	finStampa = window.open(voceMenu + ".htm","finStampa","top=10px,left=10px,width=40px,height=40px,scrollbars=no,menubar=no");

	switch (voceMenu)
	{
		case "index":
			eval("finStampa.document" + layerRef + parentesiID_1 + "'welcome'" + parentesiID_2 + ".src = 'welcome_P.htm'");
			htmlLogo = "<img src=images/intestHome.jpg height=145>";
			break;
		case "capabilities":
			htmlLogo = "<img src=images/intestCapab.jpg height=145>";
			break;
		case "technologies":
			htmlLogo = "<img src=images/intestTech.jpg height=145>";
			break;
		case "projects":
			htmlLogo = "<img src=images/intestProj.jpg height=145>";
			break;
		case "careers":
			htmlLogo = "<img src=images/intestJobs.jpg height=145>";
			break;
		case "contacts":
			htmlLogo = "<img src=images/intestCont.jpg height=145>";
			break;
		case "downloads":
			htmlLogo = "<img src=images/intestDown.jpg height=145>";
			break;
		default:
			htmlLogo = "<img src=images/intestNO.jpg height=145>";
	}		

	eval("finStampa.document" + layerRef + parentesiID_1 + "'logo'" + parentesiID_2 + ".innerHTML = htmlLogo");
	eval("finStampa.document" + layerRef + parentesiID_1 + "'menu'" + parentesiID_2 + ".innerHTML = ''");
	finStampa.loadSource(srcContenuto);
	finStampa.CambiaCSS("stileStampa");

	finStampa.print();
	finStampa.close();
}

function CambiaCSS()
{
	var ss = document.styleSheets;
	// disabilita tutti i fogli di stile con un titolo 
	// tranne quello/i passato per argomento alla funzione
	for( var x = 0; x < ss.length; x++ ) 
	{
		if( ss[x].title ) 
		{
			ss[x].disabled=true;
		}
		for( var y = 0; y < arguments.length; y++ ) 
		{
			//controlla ogni titolo passato per argomento...
			if(ss[x].title == arguments[y])
			{
				//e riabilita il foglio di stile se ha il titolo scelto
				ss[x].disabled=false;
			}
		}
	}
	if( !ss.length ) 
	{ 
		alert( 'Browser non abilitato a cambiare i fogli di stile' );
	}
}

function BackLink(projectName)
{
	var finParent = new String(parent.location.href);  
	parent.srcContenuto = projectName + ".htm";

	/*
	if (finParent.indexOf("technologies") >= 0)
	{
		return "";
	}
	else
	{
	*/
		switch(projectName)
		{
		case "tsgt":
		case "antenna":
		case "uie":
		case "mewsg":
		case "isms":
		case "vlf":	
		case "czmcs":
		case "ptc":
			return "<b><a href=government.htm><-- Government and defence</a></b>";
			break;
		default:
			return "<b><a href=oil.htm><-- Oil and gas</a></b>";
			break;
		}
	//}
}

function loadSource(page)
{
	document.getElementById("contenuto").innerHTML="<IFRAME id='frmContenuto' SRC='" + page + "'  width='100%' height='100%' MARGINWIDTH=0 MARGINHEIGHT=0 FRAMEBORDER='No' SCROLLING='Auto'></IFRAME>"
	srcContenuto = page;
}

function Stampa()
{
	eval("document" + layerRef + parentesiID_1 + "'welcome'" + parentesiID_2 + ".src = 'welcome_P.htm'");
	CambiaCSS("stileStampa");
	htmlLogo = "<img src=images/intestHome.jpg height=145>";
	eval("document" + layerRef + parentesiID_1 + "'logo'" + parentesiID_2 + ".innerHTML = htmlLogo");
	eval("document" + layerRef + parentesiID_1 + "'menu'" + parentesiID_2 + ".innerHTML = ''");
	window.print();
	htmlLogo = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width=100% height=100%>";
    	htmlLogo = htmlLogo + "<param name=movie value=menu5.swf><param name=quality value=high>";
	htmlLogo = htmlLogo + "<embed src=menu5.swf quality=high pluginspage=http://www.macromedia.com/go/getflashplayer type=application/x-shockwave-flash width=100% height=100%></embed></object>";
	htmlMenu = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width=100% height=100%>";
    	htmlMenu = htmlMenu + "<param name=movie value=index.swf><param name=quality value=high>";
	htmlMenu = htmlMenu + "<embed src=index.swf quality=high pluginspage=http://www.macromedia.com/go/getflashplayer type=application/x-shockwave-flash width=100% height=100%></embed></object>";
	CambiaCSS("stileBase");
	eval("document" + layerRef + parentesiID_1 + "'logo'" + parentesiID_2 + ".innerHTML = htmlLogo");
	eval("document" + layerRef + parentesiID_1 + "'menu'" + parentesiID_2 + ".innerHTML = htmlMenu");
	eval("document" + layerRef + parentesiID_1 + "'welcome'" + parentesiID_2 + ".src = 'welcome.htm'");
}

