
//*<function name="popup" type="" scope="public">
//*     <summary>
//*             This function opens a URL in a new window
//*     </summary>
//*     <param name="url" scope="in" type="string">
//*             URL to open in window
//*     </param>	
//*     <param name="style" scope="in" type="string">
//*             Size of popup. Enum: normal,
//*     </param>	
//*</function>	
function popup(url, style) {
	var w, h;
	var size;
	switch (style)
	{
		// create new layouts as needed
	
		case 'normal':
			w = 450;
			h = 530;
			break;
			
		case 'glossario':
			w = 600;
			h = 355;
			break;
			
		case 'cambios':
			w = 460;
			h = 350;
			break;		
	
		default:
			w = 300;
			h = 500;
	}
	
	size = "width=" + w + ", height=" + h;

	window.open(url, "_blank", "menubar=no, toolbar=no, resizable=yes, scrollbars=yes," + size);

}

//This function changes a picture from a document Source.
//Is used onmouseover events
//*<function name="movepic" type="" scope="public">
//*     <summary>
//*             This function changes source Image
//*     </summary>
//*</function>	
function movepic(img_name,img_src) {
	document[img_name].src=img_src;
}

//*<function name="InvoqueSearch" type="" scope="public">
//*     <summary>
//*             This function prepares querystring to invoque Serach Asp
//*     </summary>
//*</function>	
function InvoqueSearch()
{

	if (document.frmSimulacao.qu.value != '')
	{
		document.frmSimulacao.action = document.frmSimulacao.action + '?qu=@meta_description2 ' + escape(document.frmSimulacao.qu.value);
//		document.frmSimulacao.action = document.frmSimulacao.action + '?qu=@meta_description2 ' + document.frmSimulacao.qu.value;
		document.frmSimulacao.submit();
	}
}


/////////////////////////////////////////
//
//	Functions to show and hide Menus
//
////////////////////////////////////////

MostraMenu = new Array(0,0);

//*<function name="entrou" type="" scope="public">
//*     <summary>
//*             This function is used to show temporary menus.
//*             Is used when mouseover is fired
//*     </summary>
//*     <param name="Menu" scope="in" type="string">
//*             is the DIV id to show
//*     </param>	
//*     <param name="ObjectFrom" scope="in" type="string">
//*             object to get position in order to show temporary menu
//*     </param>	
//*     <param name="MenuNumber" scope="in" type="string">
//*             is the array position (used like a semaphore)
//*     </param>	
//*</function>	
function entrou(Menu, ObjectFrom, MenuNumber)
{	
	MostraMenu[MenuNumber] = 1;
	mostra(Menu, ObjectFrom, MenuNumber);
}

//*<function name="entrou2" type="" scope="public">
//*     <summary>
//*             This function is used to show temporary menus.
//*             Is used when mouseover is fired in the pemporary menu
//*     </summary>
//*     <param name="Menu" scope="in" type="string">
//*             is the DIV id to show
//*     </param>	
//*     <param name="MenuNumber" scope="in" type="string">
//*             is the array position (used like a semaphore)
//*     </param>	
//*</function>	
function entrou2(Menu, MenuNumber)
{
	MostraMenu[MenuNumber] = 1;
}

//*<function name="entrou" type="" scope="public">
//*     <summary>
//*             This function is used to hide temporary menus (in 1000 ms).
//*             Is used when mouseout is fired
//*     </summary>
//*     <param name="Menu" scope="in" type="string">
//*             is the DIV id to show
//*     </param>	
//*     <param name="MenuNumber" scope="in" type="string">
//*             is the array position (used like a semaphore)
//*     </param>	
//*</function>	
function saiu(Menu, MenuNumber)
{var Cmd;
	MostraMenu[MenuNumber] = 0;
	Cmd = 'Esconde("' + Menu + '",' + MenuNumber + ')';
	window.setTimeout(Cmd, 50);
}

//*<function name="mostra" type="" scope="public">
//*     <summary>
//*             This function is used to show temporary menus.
//*             Is used in "entrou" function
//*     </summary>
//*     <param name="Menu" scope="in" type="string">
//*             is the DIV id to show
//*     </param>	
//*     <param name="ObjectFrom" scope="in" type="string">
//*             object to get position in order to show temporary menu
//*     </param>	
//*     <param name="MenuNumber" scope="in" type="string">
//*             is the array position (used like a semaphore)
//*     </param>	
//*</function>	
function mostra(Menu, ObjectFrom, MenuNumber)
{	var Elem, ElemFrom
    var leftpos, topPos;

	Elem = document.getElementById(Menu);
	
	
	ElemFrom = document.getElementById(ObjectFrom);
	//alert(ElemFrom.offsetTop);
	leftpos = ElemFrom.offsetLeft;
	leftpos = leftpos + 153;
	topPos = ElemFrom.offsetTop;
	
	// if Menu is the Accés à Mon Compte
	if (MenuNumber == 1)
	{
		topPos = topPos + 50;
	}
	
	var teste, count, count2;
	count = 0;
	count2 = 0;
	for ( teste = ElemFrom; teste = teste.offsetParent; teste.tagname = 'body' )
	{ 
		count = count + teste.offsetTop
		count2 = count2 + teste.offsetLeft
		//alert(teste.tagName + ' - ' + teste.offsetTop + ' Total=' + count);
		//alert(teste.tagName + ' - ' + teste.offsetLeft + ' Total=' + count2);
	}
	topPos = topPos + count;
	leftpos = leftpos + count2;
	Elem.style.position='absolute'; 
	Elem.style.top = topPos + 'px';
	Elem.style.left = leftpos + 'px';
	//Elem.style.display = 'block';
	Elem.style.display = 'block';
	Elem.style.visibility = 'visible';
}

//*<function name="Esconde" type="" scope="public">
//*     <summary>
//*             This function is used to hide temporary menus.
//*             Is used in "saiu" function
//*     </summary>
//*     <param name="Menu" scope="in" type="string">
//*             is the DIV id to show
//*     </param>	
//*     <param name="MenuNumber" scope="in" type="string">
//*             is the array position (used like a semaphore)
//*     </param>	
//*</function>	
function Esconde(Menu, MenuNumber)
{	 var Elem;
	if (MostraMenu[MenuNumber] == 0)
	{
		Elem = document.getElementById(Menu);
		//Elem.style.display = 'none';
		Elem.style.display = 'none';
		Elem.style.visibility = 'hidden';
	}
}


function ShowProductVertical(item_to_show)
{ var Elem;
	
	//show item selected
	Elem = document.getElementById(item_to_show);
	
	//if (Elem.style.visibility == 'visible')
	//{Elem.style.visibility = 'hidden';}
	//else
	//{Elem.style.visibility = 'visible';}
	Elem.style.visibility = 'visible';
	Elem.style.display = 'block';
}


MostraMenuVertical = new Array(0,0);
function entrouVertical(Menu, ObjectFrom, MenuNumber)
{	
	MostraMenuVertical[MenuNumber] = 1;
	
	mostraVertical(Menu, ObjectFrom, MenuNumber);
	
}
function entrouVertical2(Menu, MenuNumber)
{
	MostraMenuVertical[MenuNumber] = 1;
}

function saiuVertical(Menu, MenuNumber, Img, ImgSrc)
{var Cmd;
	MostraMenuVertical[MenuNumber] = 0;
	Cmd = 'EscondeVertical("' + Menu + '",' + MenuNumber + ',"' + Img + '","' + ImgSrc + '")';
	window.setTimeout(Cmd, 50);
}

function mostraVertical(Menu, ObjectFrom, MenuNumber)
{	var Elem, ElemFrom;
    var leftpos;
	
	Elem = document.getElementById(Menu);
	
	Elem.style.position='absolute'; 
	ElemFrom = document.getElementById(ObjectFrom);
	//Elem.style.left='90px';
	leftpos = ElemFrom.offsetLeft;
	
	var teste, count, count2, topPos, Comprimento;
	count = 0;
	count2 = 0;
	topPos = 20;

	Comprimento = ElemFrom.offsetWidth;

	for ( teste = ElemFrom; teste = teste.offsetParent; teste.tagname = 'body' )
	{ 
		count = count + teste.offsetTop
		count2 = count2 + teste.offsetLeft
		//alert(teste.tagName + ' - ' + teste.offsetLeft + ' Total=' + count2);
	}
	
	topPos = topPos + count;
	leftpos = leftpos + count2;
	Elem.style.top = topPos + 'px';
	Elem.style.left = leftpos + 'px';
	Elem.style.width = Comprimento + 'px'; 
	
	Elem.style.visibility = 'visible';
	Elem.style.display = 'block';
}
function EscondeVertical(Menu, MenuNumber, Img, ImgSrc)
{	 var Elem;
	if (MostraMenuVertical[MenuNumber] == 0)
	{
		Elem = document.getElementById(Menu);
		Elem.style.visibility = 'hidden';
		Elem.style.display = 'none';
		//alert(Img);
		//alert(ImgSrc);
		movepic(Img,ImgSrc);
	}
}

function MiddleimageLoaded()
{	var DivElem, TableElem, leftpos, toppos;
	var teste, topPos, Comprimento;
	DivElem = document.getElementById('ImagemCentral');
	TableElem = document.getElementById('MiddleTD');
	
	count = 0;
	leftpos = 185;
	toppos = 190;
	for ( teste = TableElem; teste = teste.offsetParent; teste.tagname = 'body' )
	{ 
		leftpos = leftpos +  teste.offsetLeft;
		toppos = toppos + teste.offsetTop;
		//alert(teste.tagName + ' - ' + teste.offsetLeft + ' Total=' + leftpos);
		//alert(teste.tagName + ' - ' + teste.offsetTop + ' Total=' + toppos);
	}				
	DivElem.style.left = leftpos + 'px';
	DivElem.style.top = toppos + 'px';
}

var TitleColorNW, TitleColorNE, TitleColorSW, TitleColorSE
var TitleColorNW_over, TitleColorNE_over, TitleColorSW_over, TitleColorSE_over
TitleColorNW_over = '#0099EB'
TitleColorNE_over = '#F06F00'
TitleColorSW_over = '#71B811'
TitleColorSE_over = '#EDAE00'
