

// COLORS

var COLORLINE = "#000004";
var COLORMENU = "#D0D000";//"#ebde84";
var COLORMENUTEXT = "#E40000";


// PAGES, DOOR TYPES and OTHERS.. :)

var i = 2;

var special = 0;
var fantasy = 1;
var customized = i++;
var others = i++;

var gallery = i++;
var technology = i++;
var guarantee = i++;
var contact = i++;
var order = i++;


function showHeader(full)
{
	document.write('<link href="../common.css" rel="stylesheet" type="text/css">'); 	
	document.write('<BODY LANG="' + LANG + '" DIR="LTR">');
	
	if (full == undefined)
	{
		document.write('<div id="topbar">');
		document.write('<div style="border: 1px solid #AA0000; padding: 4px; background-color: white;">');
		document.write('<img id="selectedModelPicture" onclick="javascript:document.getElementById(\'topbar\').style.visibility=\'hidden\';"><br><b><center id="selectedModelName"></center></b></div></div>');
	}

	document.write('<table border="0" width="760" cellpadding="0" cellspacing="0" bgcolor="white">');
	
	if (full == undefined)
	{
		document.write('<tr><td colspan="5" align="right" valign="bottom" style="padding-bottom: 4px;">');
		document.write('<a href="index.html">' + TITLE);
		document.write('<img src="../images/ingeri2.jpg" style="border: 0px; position: absolute; left: 290px; top: 7px;" align="left">');
		document.write('<img id="menuPicture" style="visibility: hidden; border: 0px; position: absolute; left: 385px; top: 22px;" height="70" align="left">');
		document.write('</a>');
		document.write('<table style="border: 0px; margin: 0px; padding: 0px;"><tr><td><center><font color="' + COLORMENUTEXT + '">' + SUBTITLE + '</font><br></center></td></tr></table>');
		document.write('</td></tr>');
	}
}


function activateMenu(id, activate)
{
	var source = document.getElementById(id);
	var menuPicture = ml("menuPicture");
	
	menuPicture.src = source.src;
	menuPicture.style.visibility = (activate ? 'visible' : 'hidden');
}

function getMenuJS(page)
{
	return ' onmouseover="javascript:activateMenu(\'menu' + page + '\', 1);"' +
	' onmouseout="javascript:activateMenu(\'menu' + page + '\', 0);"';
}

function getMenuImage(page)
{
	return  '<img id="menu' + page + '" src="' + PAGEICONS[page] + '" height="40" border=0 align="left">';
}

function showMenu(page)
{
	B = '<strong>';
	B_ = '</strong>';
	
	document.write('<tr valign="top" style="background-color: ' + COLORMENU + '; line-height: 130%; padding-top: 80px;">');
	document.write('<td width="10%"><br></td>');
	document.write('<td width="22%"><a href="special.html"' + getMenuJS(special) + '>' + getMenuImage(special) + (page == special ? B : "") + PAGETITLES[special] + (page == special ? B_ : "") + '</a></td>');
	document.write('<td width="22%"><a href="fantasy.html"' + getMenuJS(fantasy) + '>' + getMenuImage(fantasy) + (page == fantasy ? B : "") + PAGETITLES[fantasy] + (page == fantasy ? B_ : "") + '</a></td>');
	document.write('<td width="23%"><a href="customized.html"' + getMenuJS(customized) + '>' + getMenuImage(customized) + (page == customized ? B : "") + PAGETITLES[customized] + (page == customized ? B_ : "") + '</a></td>');
	document.write('<td width="22%"><a href="others.html"' + getMenuJS(others) + '>' + getMenuImage(others) + (page == others ? B : "") + PAGETITLES[others] + (page == others ? B_ : "") + '</a></td>');
	document.write('</tr>');

	document.write('<tr valign="top" style="background-color: ' + COLORMENU + '; line-height: 130%; padding-bottom: 8px;">');
	document.write('<td colspan="9" align="center">');
	document.write('<a href="technology.html">' + (page == technology ? B : "") + PAGETITLES[technology] + (page == technology ? B_ : "") + '</a> &bull; ');
	document.write('<a href="guarantee.html">' + (page == guarantee ? B : "") + PAGETITLES[guarantee] + (page == guarantee ? B_ : "") + '</a> &bull; ');
	document.write('<a href="order.php" target="usidearta_order">' + (page == order ? B : "") + PAGETITLES[order] + (page == order ? B_ : "") + '</a> &bull; ');
	document.write('<a href="contact.html"><img border="0" src="../images/plic.png"> ' + (page == contact ? B : "") + PAGETITLES[contact] + (page == contact ? B_ : "") + '</a>');
	document.write('</td></tr>');
	/*
	if (LANG != "ro")
		document.write('<a href="../ro/index.html"><img src="../images/flags/ro.png" border="0"> Rom&acirc;n&#259;</a> ');
	if (LANG != "en")
		document.write('<a href="../en/index.html"><img src="../images/flags/en.png" border="0"> English</a> ');
	*/
	
	document.write('<tr><td><br></td></tr>');
	
	document.write('<tr>');
	document.write('<td colspan="9">');
	
	if (PAGETITLES[page])
		document.write('<H1 id="pagename"><font color="' + COLORMENUTEXT + '">' + PAGETITLES[page].replace(/<br>/i,'&nbsp;') + '</font></H1>');
}


function sd(id)
{
	var re = /(.*)_..(\..*)/;
	var src = document.getElementById(id).src;
	document.getElementById('selectedModelPicture').src = src.replace(re, "$1$2");
	document.getElementById('selectedModelName').innerHTML = id;

	stayTopRight();
}


function showDoors(doorsPerRow, align)
{
	var tdAlign = (align == 0 ? "center" : (align < 0 ? "left" : right));

	document.write('<table border="0" cellspacing="13">');
	
	var model;
	var i;
	var imgSrc;
	var col = 0;

	var lastModel = showDoors.arguments.length - 1;
	for (i = 2; i <= lastModel; i++)
	{
		if (col == 0)
			document.write('<tr>');
		
		model = showDoors.arguments[i];
		imgSrc = '../images/doors/' + model +'_70.jpg';
		
		document.write('<td align="' + tdAlign + '">');
		document.write('<a href="javascript:sd(\'' + model + '\');">');
		document.write('<img id="' + model + '" src="' + imgSrc + '" height="70" border="0">');
		document.write('<br><b>' + model +'</b></a></td>');

		col += 1;
			
		if (col == doorsPerRow)
		{
			col = 0;
			document.write('</tr>');
			//if (i < lastModel)
			//	document.write('<tr><td colspan=' + doorsPerRow + '><br></td></tr>');
		}
	}
	
	if (col > 0)
	{
		document.write('<td colspan=' + (doorsPerRow - col) + '><br></td>');
	}
	
	document.write('</table>');
}


function showFooter()
{
	document.write('<br></td>');
	document.write('</tr>');

	document.write('<tr valign="top" style="background-color: ' + COLORMENU + '; line-height: 130%;">');
	document.write('<td colspan="9">');
	document.write('' + COPYRIGHT + '');
	document.write('</td></tr>');

	document.write('</table>');

	document.write('</BODY>');
	document.write('</HTML>');
}




// Code below inspired from 
// Floating Top Bar script- © Dynamic Drive (www.dynamicdrive.com)

var ns = (navigator.appName.indexOf("Netscape") != -1) || window.opera;

function iecompattest()
{
	return (document.compatMode && document.compatMode != "BackCompat") ? document.documentElement : document.body;
}

function closebar()
{
	document.getElementById("topbar").style.visibility = "hidden";
}

function ml(id)
{
	var el = document.getElementById(id);
	if (document.layers)
		el.style = el;
	return el;
}

function stayTopRight()
{
	var pY = 4 + ns ? pageYOffset : iecompattest().scrollTop;
	if (pY < 202)
		pY = 202;

	var ftlObj = ml("topbar");
	ftlObj.style.top = pY + "px";
	ftlObj.style.visibility = "visible";

	ftlObj.scrollIntoView();
}

