
//Copyright (c), 2001, Innovagency

NS=(document.layers && !document.all)?1:0
NS6=(document.getElementById && !document.all)?1:0

//******************************
// General
//******************************
function SubmitTo( sForm_IN, sField_IN, sLink_IN, sUrlExtra_IN ) {
	var iIndex = eval( 'document.' + sForm_IN + '.' + sField_IN + '.selectedIndex' );
	if (iIndex != 0) { 
		window.location.href = sLink_IN + sUrlExtra_IN + eval( 'window.document.' + sForm_IN + '.' + sField_IN + '.options[' + iIndex + '].value' ) ; 
	}
}

function SubmitToWithString( sForm_IN, sField_IN, sLink_IN, sUrl_IN, sUrlExtra_IN ) {
	var iIndex = eval( 'document.' + sForm_IN + '.' + sField_IN + '.selectedIndex' );
	var sValue = eval( 'window.document.' + sForm_IN + '.' + sField_IN + '.options[' + iIndex + '].value' )
	var vStringIDS = sValue.split( '|' )
	if (iIndex != 0) { 
		if (vStringIDS.length != 2) {
			window.location.href = sLink_IN + sUrl_IN + sValue ; 
		} else {
			window.location.href = sLink_IN + sUrl_IN + vStringIDS[0]  + sUrlExtra_IN + vStringIDS[1] ; 
		}
	}
}

//******************************
// Rollover Imagens
//******************************

function MM_swapImgRestore() {
	var i,x,a=document.MM_sr;
	for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) {
	var p,i,x;
	if(!d) d=document;
	if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document;
		n=n.substring(0,p);
	}
	if(!(x=d[n])&&d.all) x=d.all[n];
	for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) {
		x = MM_findObj(n,d.layers[i].document);
	}
	if(!x && document.getElementById) x=document.getElementById(n);
	return x;
}

function MM_swapImage() {
	var i,j=0,x,a=MM_swapImage.arguments;
	document.MM_sr=new Array;
	for(i=0;i<(a.length-2);i+=3) {
		if ((x=MM_findObj(a[i]))!=null) {
			document.MM_sr[j++]=x;
			if(!x.oSrc) x.oSrc=x.src;
			x.src=a[i+2];
		};
	};
}


//******************************
// Change Colours
//******************************
function changeRowColor( RowName_IN, Color_IN) {
	if (NS6) 	{
		document.getElementById( RowName_IN ).style.backgroundColor = Color_IN;
	} else {
		document.all( RowName_IN ).style.backgroundColor = Color_IN;
	}
}

function changeColor( RowName_IN, Color_IN, Color2_IN ) {
	if (NS6) 	{
		if (document.getElementById( RowName_IN ).style.backgroundColor.toLowerCase() == Color_IN.toLowerCase()) {
			document.getElementById( RowName_IN ).style.backgroundColor = Color2_IN;
		} else {
			document.getElementById( RowName_IN ).style.backgroundColor = Color_IN;
		}
	} else {
		if (document.all( RowName_IN ).style.backgroundColor.toLowerCase() == Color_IN.toLowerCase()) {
			document.all( RowName_IN ).style.backgroundColor = Color2_IN;
		} else {
			document.all( RowName_IN ).style.backgroundColor = Color_IN;
		}
	}

}

var sRowOld = '';
var sRowColourOld = '';
function changeRowColorSpecial( RowName_IN, Color_IN) {

	if (NS6) 	{
		if(sRowOld!='') { document.getElementById(sRowOld).style.backgroundColor = sRowColourOld; }
		sRowColourOld = document.getElementById(RowName_IN).style.backgroundColor;
		sRowOld = RowName_IN;

		document.getElementById( RowName_IN ).style.backgroundColor = Color_IN;
	} else {
		if(sRowOld!='') { document.all( sRowOld ).style.backgroundColor = sRowColourOld; }
		sRowColourOld = document.all(RowName_IN).style.backgroundColor;
		sRowOld = RowName_IN;

		document.all( RowName_IN ).style.backgroundColor = Color_IN;
	}
}


//******************************
// Popups normais
//******************************
function SimplePopUp( sUrl_IN ) {
	var popWin;

	popWin = window.open( sUrl_IN, 'PopUp','top=50,left=50,resizable=1,scrollbars=1,toolbar=0,menubar=0,width=620,height=450,');
}


function PopUpwithDimensions( sUrl_IN, iWidth_IN, iHeight_IN ) {
	var popWin;
//	var winleft = (screen.width - 300) / 2;
//	var wintop = (screen.height - 150) / 2;

//	popWin = window.open( sUrl_IN, 'PopUpNavigator','left=' + winleft + ',top=' + wintop + ',resizable=1,scrollbars=0,toolbar=0,menubar=0,width=' + iWidth_IN + ',height=' + iHeight_IN + ',');
// 2003-05-08 TN
	//popWin = window.open( sUrl_IN, 'PopUpNavigator','top=50,left=50,resizable=1,scrollbars=0,toolbar=0,menubar=0,width=' + iWidth_IN + ',height=' + iHeight_IN + ',');
	popWin = window.open( sUrl_IN, '','top=50,left=50,resizable=1,scrollbars=0,toolbar=0,menubar=0,width=' + iWidth_IN + ',height=' + iHeight_IN + ',');
}

function PopUpwithDimensionsAndScroll( sUrl_IN, iWidth_IN, iHeight_IN ) {
	var popWin;
//	var winleft = (screen.width - 300) / 2;
//	var wintop = (screen.height - 150) / 2;

//	popWin = window.open( sUrl_IN, 'PopUpNavigator','left=' + winleft + ',top=' + wintop + ',resizable=1,scrollbars=0,toolbar=0,menubar=0,width=' + iWidth_IN + ',height=' + iHeight_IN + ',');
// 2003-05-08 TN
	//popWin = window.open( sUrl_IN, 'PopUpNavigator','top=50,left=50,resizable=1,scrollbars=0,toolbar=0,menubar=0,width=' + iWidth_IN + ',height=' + iHeight_IN + ',');
	popWin = window.open( sUrl_IN, '','top=50,left=50,resizable=1,scrollbars=1,toolbar=0,menubar=0,width=' + iWidth_IN + ',height=' + iHeight_IN + ',');
}

function PopUpwithDimensionsScroll( sUrl_IN, iWidth_IN, iHeight_IN ) {
	var popWin;
//	var winleft = (screen.width - 300) / 2;
//	var wintop = (screen.height - 150) / 2;

//	popWin = window.open( sUrl_IN, 'PopUpNavigator','left=' + winleft + ',top=' + wintop + ',resizable=1,scrollbars=0,toolbar=0,menubar=0,width=' + iWidth_IN + ',height=' + iHeight_IN + ',');
// 2003-05-08 TN
	//popWin = window.open( sUrl_IN, 'PopUpNavigator','top=50,left=50,resizable=1,scrollbars=0,toolbar=0,menubar=0,width=' + iWidth_IN + ',height=' + iHeight_IN + ',');
	popWin = window.open( sUrl_IN, '','top=50,left=50,resizable=0,scrollbars=1,toolbar=0,menubar=0,width=' + iWidth_IN + ',height=' + iHeight_IN + ',');
}

function PopUpSamewithDimensions( sName_IN, sUrl_IN, iWidth_IN, iHeight_IN ) {
	var popWin;
//	var winleft = (screen.width - 300) / 2;
//	var wintop = (screen.height - 150) / 2;

//	popWin = window.open( sUrl_IN, 'PopUpNavigator','left=' + winleft + ',top=' + wintop + ',resizable=1,scrollbars=0,toolbar=0,menubar=0,width=' + iWidth_IN + ',height=' + iHeight_IN + ',');
// 2003-05-08 TN
	//popWin = window.open( sUrl_IN, 'PopUpNavigator','top=50,left=50,resizable=1,scrollbars=0,toolbar=0,menubar=0,width=' + iWidth_IN + ',height=' + iHeight_IN + ',');
	popWin = window.open( sUrl_IN, sName_IN,'top=50,left=50,resizable=1,scrollbars=0,toolbar=0,menubar=0,width=' + iWidth_IN + ',height=' + iHeight_IN + ',');
}

function PopUpAndPrint( sUrl_IN ) {
	var popWin;
	popWin = window.open( sUrl_IN, 'Print','resizable=1,scrollbars=1,toolbar=0,menubar=0,width=813,');
	popWin.print();
}


//**********************************************
// Popups de distribuidores | NOT USED ANYMORE (I HOPE)
//**********************************************

function PopUpDistribuidor( sTextName_IN, sTextAddress_IN, sTextContact_IN, sTextClose_IN, sTextPrint_IN, bPrint_IN ) {
	var popWin;
	var winleft = (screen.width - 300) / 2;
	var winUp = (screen.height - 150) / 2;
	var winHeight = 170;
	var stringAux = '"' + sTextName_IN + '", "' + sTextAddress_IN + '", "' + sTextContact_IN + '", "' + sTextClose_IN + '", "' + sTextPrint_IN + '"';
	if (bPrint_IN == 0) { winHeight = 220; } 

	popWin = window.open('','Distribuidor' + bPrint_IN,'top=' + winUp + ',left=' + winleft + ',resizable=1,scrollbars=0,toolbar=0,menubar=0,width=300,height=' + winHeight);
	popWin.document.writeln("<html>");
	popWin.document.writeln("<head><script language='javascript' src='/site/custom/objectstyle/scripts/soporset.js'></script></head>");
	popWin.document.writeln("<body>");
	popWin.document.writeln("<center><img src='/site/resources/design/logoSoporsetBig.gif' border=0></center>");
	popWin.document.writeln("<font style='font-size:11px;' color='#595959' face='Trebuchet MS, sans-serif'><b>" + sTextName_IN + "</b></font><br>");
	popWin.document.writeln("<font style='font-size:11px;' color='#595959' face='Trebuchet MS, sans-serif'>" + sTextAddress_IN + "</font><br>");
	popWin.document.writeln("<font style='font-size:11px;' color='#595959' face='Trebuchet MS, sans-serif'>" + sTextContact_IN + "</font><br><br>");

	popWin.document.writeln("<center><table cellspacing=0 cellpadding=0 border=0>");
	popWin.document.writeln("<tr><td width=10><img src='/site/resources/design/spacer.gif' border=0></td><td colspan=7 height=1 background='/site/resources/design/barra_h4.gif'><img src='/site/resources/design/spacer.gif' border=0></td>");
	popWin.document.writeln("<td width=15><img src='/site/resources/design/spacer.gif' border=0></td>");
	popWin.document.writeln("<td colspan=7 height=1 background='/site/resources/design/barra_h4.gif'><img src='/site/resources/design/spacer.gif' border=0></td></tr>");
	popWin.document.writeln("<tr><td width=10><img src='/site/resources/design/spacer.gif' border=0></td><td width=1 bgcolor='#7B7B73'><img src='/site/resources/design/spacer.gif' border=0></td><td><a href='javascript:window.print();'><img src='/site/resources/design/imgPrintLeftOrange.gif' border=0></a></td><td width=1 bgcolor='#7B7B73'><img src='/site/resources/design/spacer.gif' border=0></td>");
	popWin.document.writeln("<td width=3 bgcolor=#EAE5E2><img src='/site/resources/design/spacer.gif' border=0></td>");
	popWin.document.writeln("<td bgcolor=#EAE5E2><a href='javascript:window.print();'><font style='font-size:9px;text-decoration:none;' color='#7F7D71' face='Trebuchet MS, sans-serif'>" + sTextPrint_IN + "</font></a></td>");
	popWin.document.writeln("<td width=3 bgcolor=#EAE5E2><img src='/site/resources/design/spacer.gif' border=0></td>");
	popWin.document.writeln("<td width=1 bgcolor=#7F7D71><img src='/site/resources/design/spacer.gif' border=0></td>");
	popWin.document.writeln("<td width=15><img src='/site/resources/design/spacer.gif' border=0></td>");
	popWin.document.writeln("<td width=1 bgcolor='#7B7B73'><img src='/site/resources/design/spacer.gif' border=0></td><td><a href='javascript:window.close();'><img src='/site/resources/design/imgCloseLeftOrange.gif' border=0></a></td><td width=1 bgcolor='#7B7B73'><img src='/site/resources/design/spacer.gif' border=0></td>");
	popWin.document.writeln("<td width=3 bgcolor=#EAE5E2><img src='/site/resources/design/spacer.gif' border=0></td>");
	popWin.document.writeln("<td bgcolor=#EAE5E2><a href='javascript:window.close();'><font style='font-size:9px;text-decoration:none;' color='#7F7D71' face='Trebuchet MS, sans-serif'>" + sTextClose_IN + "</font></a></td>");
	popWin.document.writeln("<td width=3 bgcolor=#EAE5E2><img src='/site/resources/design/spacer.gif' border=0></td>");
	popWin.document.writeln("<td width=1 bgcolor=#7F7D71><img src='/site/resources/design/spacer.gif' border=0></td></tr>");
	popWin.document.writeln("<tr><td width=10><img src='/site/resources/design/spacer.gif' border=0></td><td colspan=7 height=1 background='/site/resources/design/barra_h4.gif'><img src='/site/resources/design/spacer.gif' border=0></td>");
	popWin.document.writeln("<td width=15><img src='/site/resources/design/spacer.gif' border=0></td>");
	popWin.document.writeln("<td colspan=7 height=1 background='/site/resources/design/barra_h4.gif'><img src='/site/resources/design/spacer.gif' border=0></td></tr>");
	popWin.document.writeln("</table></center>");

	popWin.document.writeln("</body>");
	popWin.document.writeln("</html>");	
	popWin.document.close();
}

function PopUpDistribuidorNavigator( sTextName_IN, sTextAddress_IN, sTextContact_IN, sTextClose_IN, sTextPrint_IN, bPrint_IN ) {
	var popWin;
	var winleft = (screen.width - 300) / 2;
	var winUp = (screen.height - 150) / 2;
	var winHeight = 240;

	popWin = window.open('','Distribuidor' + bPrint_IN,'top=' + winUp + ',left=' + winleft + ',resizable=1,scrollbars=0,toolbar=0,menubar=0,width=300,height=' + winHeight);
	popWin.document.writeln("<html>");
	popWin.document.writeln("<head><script language='javascript' src='/site/custom/objectstyle/scripts/soporset.js'></script></head>");
	popWin.document.writeln("<body topmargin=0 leftmargin=0 marginheight=0 marginwidth=0 text=#000000 bgcolor=#FFFFFF>");
	popWin.document.writeln("<table width=300 height=130 cellspacing=0 cellpadding=0 border=0><tr><td width=10><img src='/site/resources/design/spacer.gif' border=0></td><td width=290 align=top>");
	popWin.document.writeln("<font style='font-size:11px;' color='#595959' face='Trebuchet MS, sans-serif'><b>" + sTextName_IN + "</b></font><br>");
	popWin.document.writeln("<font style='font-size:11px;' color='#595959' face='Trebuchet MS, sans-serif'>" + sTextAddress_IN + "</font><br>");
	popWin.document.writeln("<font style='font-size:11px;' color='#595959' face='Trebuchet MS, sans-serif'>" + sTextContact_IN + "</font><br><br>");
	popWin.document.writeln("</td></tr></table>");
	popWin.document.writeln("<table cellspacing=0 cellpadding=0 border=0>");
	//popWin.document.writeln("<td><a href='javascript:window.print();'><img src='/site/resources/design/icom_imprimir.gif' border=0></a></td><td>&nbsp;</td><td><a href='javascript:window.print();'><font style='font-size:11px;text-decoration:none;' color='#FA9023' face='Trebuchet MS, sans-serif'><b>" + sTextPrint_IN + "</b></a></td>");
	//popWin.document.writeln("<td>&nbsp;</td><td><a href='javascript:window.close();'><font style='font-size:11px;text-decoration:none;' color='#FA9023' face='Trebuchet MS, sans-serif'><b>" + sTextClose_IN + "</b></a></td></tr>");
	popWin.document.writeln("<tr><td width=10><img src='/site/resources/design/spacer.gif' border=0></td><td colspan=7 height=1 background='/site/resources/design/barra_h4.gif'><img src='/site/resources/design/spacer.gif' border=0></td>");
	popWin.document.writeln("<td width=15><img src='/site/resources/design/spacer.gif' border=0></td>");
	popWin.document.writeln("<td colspan=7 height=1 background='/site/resources/design/barra_h4.gif'><img src='/site/resources/design/spacer.gif' border=0></td></tr>");
	popWin.document.writeln("<tr><td width=10><img src='/site/resources/design/spacer.gif' border=0></td><td width=1 bgcolor='#7B7B73'><img src='/site/resources/design/spacer.gif' border=0></td><td><a href='javascript:window.print();'><img src='/site/resources/design/imgPrintLeft.gif' border=0></a></td><td width=1 bgcolor='#7B7B73'><img src='/site/resources/design/spacer.gif' border=0></td>");
	popWin.document.writeln("<td width=3 bgcolor=#EAE5E2><img src='/site/resources/design/spacer.gif' border=0></td>");
	popWin.document.writeln("<td bgcolor=#EAE5E2><a href='javascript:window.print();'><font style='font-size:9px;text-decoration:none;' color='#7F7D71' face='Trebuchet MS, sans-serif'>" + sTextPrint_IN + "</font></a></td>");
	popWin.document.writeln("<td width=3 bgcolor=#EAE5E2><img src='/site/resources/design/spacer.gif' border=0></td>");
	popWin.document.writeln("<td width=1 bgcolor=#7F7D71><img src='/site/resources/design/spacer.gif' border=0></td>");
	popWin.document.writeln("<td width=15><img src='/site/resources/design/spacer.gif' border=0></td>");
	popWin.document.writeln("<td width=1 bgcolor='#7B7B73'><img src='/site/resources/design/spacer.gif' border=0></td><td><a href='javascript:window.close();'><img src='/site/resources/design/imgCloseLeft.gif' border=0></a></td><td width=1 bgcolor='#7B7B73'><img src='/site/resources/design/spacer.gif' border=0></td>");
	popWin.document.writeln("<td width=3 bgcolor=#EAE5E2><img src='/site/resources/design/spacer.gif' border=0></td>");
	popWin.document.writeln("<td bgcolor=#EAE5E2><a href='javascript:window.close();'><font style='font-size:9px;text-decoration:none;' color='#7F7D71' face='Trebuchet MS, sans-serif'>" + sTextClose_IN + "</font></a></td>");
	popWin.document.writeln("<td width=3 bgcolor=#EAE5E2><img src='/site/resources/design/spacer.gif' border=0></td>");
	popWin.document.writeln("<td width=1 bgcolor=#7F7D71><img src='/site/resources/design/spacer.gif' border=0></td></tr>");
	popWin.document.writeln("<tr><td width=10><img src='/site/resources/design/spacer.gif' border=0></td><td colspan=7 height=1 background='/site/resources/design/barra_h4.gif'><img src='/site/resources/design/spacer.gif' border=0></td>");
	popWin.document.writeln("<td width=15><img src='/site/resources/design/spacer.gif' border=0></td>");
	popWin.document.writeln("<td colspan=7 height=1 background='/site/resources/design/barra_h4.gif'><img src='/site/resources/design/spacer.gif' border=0></td></tr>");
	popWin.document.writeln("</table>");
	popWin.document.writeln("<table width=300 cellspacing=0 cellpadding=0 border=0><tr><td height=15><img src='/site/resources/design/spacer.gif' border=0></td></tr><tr><td background='/site/resources/design/barra_h4.gif'><img src='/site/resources/design/spacer.gif' border=0></td></tr><tr><td height=10><img src='/site/resources/design/spacer.gif' border=0></td></tr><tr><td align=right><img src='/site/resources/design/logoNavigatorNormal.gif' border=0></td></tr></table>");	
	popWin.document.writeln("</body>");
	popWin.document.writeln("</html>");	
	popWin.document.close();
}


function PopUpDistribuidorPioneer( sTextName_IN, sTextAddress_IN, sTextContact_IN, sTextClose_IN, sTextPrint_IN, bPrint_IN ) {
	var popWin;
	var winleft = (screen.width - 300) / 2;
	var winUp = (screen.height - 150) / 2;
	var winHeight = 240;

	popWin = window.open('','Distribuidor' + bPrint_IN,'top=' + winUp + ',left=' + winleft + ',resizable=1,scrollbars=0,toolbar=0,menubar=0,width=300,height=' + winHeight);
	popWin.document.writeln("<html>");
	popWin.document.writeln("<head><script language='javascript' src='/site/custom/objectstyle/scripts/soporset.js'></script></head>");
	popWin.document.writeln("<body topmargin=0 leftmargin=0 marginheight=0 marginwidth=0 text=#000000 bgcolor=#FFFFFF>");
	popWin.document.writeln("<table width=300 height=130 cellspacing=0 cellpadding=0 border=0><tr><td width=10><img src='/site/resources/design/spacer.gif' border=0></td><td width=290 align=top>");
	popWin.document.writeln("<font style='font-size:11px;' color='#595959' face='Trebuchet MS, sans-serif'><b>" + sTextName_IN + "</b></font><br>");
	popWin.document.writeln("<font style='font-size:11px;' color='#595959' face='Trebuchet MS, sans-serif'>" + sTextAddress_IN + "</font><br>");
	popWin.document.writeln("<font style='font-size:11px;' color='#595959' face='Trebuchet MS, sans-serif'>" + sTextContact_IN + "</font><br><br>");
	popWin.document.writeln("</td></tr></table>");
	popWin.document.writeln("<table cellspacing=0 cellpadding=0 border=0>");
	popWin.document.writeln("<tr><td width=10><img src='/site/resources/design/spacer.gif' border=0></td><td colspan=7 height=1 background='/site/resources/design/barra_h4.gif'><img src='/site/resources/design/spacer.gif' border=0></td>");
	popWin.document.writeln("<td width=15><img src='/site/resources/design/spacer.gif' border=0></td>");
	popWin.document.writeln("<td colspan=7 height=1 background='/site/resources/design/barra_h4.gif'><img src='/site/resources/design/spacer.gif' border=0></td></tr>");
	popWin.document.writeln("<tr><td width=10><img src='/site/resources/design/spacer.gif' border=0></td><td width=1 bgcolor='#7B7B73'><img src='/site/resources/design/spacer.gif' border=0></td><td><a href='javascript:window.print();'><img src='/site/resources/design/imgPrintLeftRed.gif' border=0></a></td><td width=1 bgcolor='#7B7B73'><img src='/site/resources/design/spacer.gif' border=0></td>");
	popWin.document.writeln("<td width=3 bgcolor=#EAE5E2><img src='/site/resources/design/spacer.gif' border=0></td>");
	popWin.document.writeln("<td bgcolor=#EAE5E2><a href='javascript:window.print();'><font style='font-size:9px;text-decoration:none;' color='#7F7D71' face='Trebuchet MS, sans-serif'>" + sTextPrint_IN + "</font></a></td>");
	popWin.document.writeln("<td width=3 bgcolor=#EAE5E2><img src='/site/resources/design/spacer.gif' border=0></td>");
	popWin.document.writeln("<td width=1 bgcolor=#7F7D71><img src='/site/resources/design/spacer.gif' border=0></td>");
	popWin.document.writeln("<td width=15><img src='/site/resources/design/spacer.gif' border=0></td>");
	popWin.document.writeln("<td width=1 bgcolor='#7B7B73'><img src='/site/resources/design/spacer.gif' border=0></td><td><a href='javascript:window.close();'><img src='/site/resources/design/imgCloseLeftRed.gif' border=0></a></td><td width=1 bgcolor='#7B7B73'><img src='/site/resources/design/spacer.gif' border=0></td>");
	popWin.document.writeln("<td width=3 bgcolor=#EAE5E2><img src='/site/resources/design/spacer.gif' border=0></td>");
	popWin.document.writeln("<td bgcolor=#EAE5E2><a href='javascript:window.close();'><font style='font-size:9px;text-decoration:none;' color='#7F7D71' face='Trebuchet MS, sans-serif'>" + sTextClose_IN + "</font></a></td>");
	popWin.document.writeln("<td width=3 bgcolor=#EAE5E2><img src='/site/resources/design/spacer.gif' border=0></td>");
	popWin.document.writeln("<td width=1 bgcolor=#7F7D71><img src='/site/resources/design/spacer.gif' border=0></td></tr>");
	popWin.document.writeln("<tr><td width=10><img src='/site/resources/design/spacer.gif' border=0></td><td colspan=7 height=1 background='/site/resources/design/barra_h4.gif'><img src='/site/resources/design/spacer.gif' border=0></td>");
	popWin.document.writeln("<td width=15><img src='/site/resources/design/spacer.gif' border=0></td>");
	popWin.document.writeln("<td colspan=7 height=1 background='/site/resources/design/barra_h4.gif'><img src='/site/resources/design/spacer.gif' border=0></td></tr>");
	popWin.document.writeln("</table>");
	popWin.document.writeln("<table width=300 cellspacing=0 cellpadding=0 border=0><tr><td height=15><img src='/site/resources/design/spacer.gif' border=0></td></tr><tr><td background='/site/resources/design/barra_h4.gif'><img src='/site/resources/design/spacer.gif' border=0></td></tr><tr><td height=5><img src='/site/resources/design/spacer.gif' border=0></td></tr><tr><td align=center><img src='/site/resources/design/logoPioneerMail.gif' border=0></td></tr></table>");	
	popWin.document.writeln("</body>");
	popWin.document.writeln("</html>");	
	popWin.document.close();
}

function PopUpDistribuidorInaset( sTextName_IN, sTextAddress_IN, sTextContact_IN, sTextClose_IN, sTextPrint_IN, bPrint_IN ) {
	var popWin;
	var winleft = (screen.width - 300) / 2;
	var winUp = (screen.height - 150) / 2;
	var winHeight = 300;

	popWin = window.open('','Distribuidor' + bPrint_IN,'top=' + winUp + ',left=' + winleft + ',resizable=1,scrollbars=0,toolbar=0,menubar=0,width=300,height=' + winHeight);
	popWin.document.writeln("<html>");
	popWin.document.writeln("<head><script language='javascript' src='/site/custom/objectstyle/scripts/soporset.js'></script></head>");
	popWin.document.writeln("<body topmargin=0 leftmargin=0 marginheight=0 marginwidth=0 text=#000000 bgcolor=#FFFFFF>");

popWin.document.writeln("<table height='100%' cellspacing=0 cellpadding=0 border=0><tr><td height=74>");

	popWin.document.writeln("<table width=300 height=74 cellspacing=0 cellpadding=0 background='/site/resources/design/inaset/imgHeaderPopupDistribuidor.gif' border=0><tr><td colspan=2 height=10><img src='/site/resources/design/spacer.gif' border=0></td></tr>");
	popWin.document.writeln("<tr><td align=right valign=top><a href='javascript:window.close();'><img src='/site/resources/design/inaset/botClose.gif' border=0></a></td><td width=10><img src='/site/resources/design/spacer.gif' border=0></td></tr></table>");

popWin.document.writeln("</td></tr><tr><td valign=top>");

	popWin.document.writeln("<table width=300 cellspacing=0 cellpadding=0 border=0><tr><td colspan=2 height=1 bgcolor='#A5AE9D'><img src='/site/resources/design/spacer.gif' border=0></td></tr><tr><td colspan=2 height=15><img src='/site/resources/design/spacer.gif' border=0></td></tr><tr><td width=10><img src='/site/resources/design/spacer.gif' border=0></td><td width=290 align=top>");
	popWin.document.writeln("<font style='font-size:11px;' color='#595959' face='Trebuchet MS, sans-serif'><b>" + sTextName_IN + "</b></font><br>");
	popWin.document.writeln("<font style='font-size:11px;' color='#595959' face='Trebuchet MS, sans-serif'>" + sTextAddress_IN + "</font><br>");
	popWin.document.writeln("<font style='font-size:11px;' color='#595959' face='Trebuchet MS, sans-serif'>" + sTextContact_IN + "</font><br><br>");
	popWin.document.writeln("</td></tr></table>");

popWin.document.writeln("</td></tr><tr><td valign=bottom>");

	popWin.document.writeln("<table width=300 cellspacing=0 cellpadding=0 border=0>");
	popWin.document.writeln("<tr><td width=10><img src='/site/resources/design/spacer.gif' border=0></td><td><table cellspacing=0 cellpadding=0 border=0><tr><td width=1 style='background-position:bottom;background-repeat:no-repeat;' background='/site/resources/design/Inaset/filletInterior.gif'><img src='/site/resources/design/spacer.gif' border=0></td>");
	popWin.document.writeln("<td><a href='javascript:void(0);' onclick='window.print();'><img src='/site/resources/design/Inaset/botPrint.gif' border=0></a></td><td width=1 style='background-position:bottom;background-repeat:no-repeat;' background='/site/resources/design/Inaset/filletInterior.gif'><img src='/site/resources/design/spacer.gif' border=0></td>");
	popWin.document.writeln("<td width=4><img src='/site/resources/design/spacer.gif' border=0></td><td valign=bottom><a href='javascript:void(0);' onclick='window.print();'><font style='font-size:11px;' color='#A13534' face='Trebuchet MS, sans-serif'; ><b>" + sTextPrint_IN + "</b></font></a></td><td width=4><img src='/site/resources/design/spacer.gif' border=0></td>");
	popWin.document.writeln("<td width=1 style='background-position:bottom;background-repeat:no-repeat;' background='/site/resources/design/Inaset/filletInterior.gif'><img src='/site/resources/design/spacer.gif' border=0></td></tr><tr><td colspan=7 height=1 background='/site/resources/design/Inaset/picotado7.gif'><img src='/site/resources/design/spacer.gif' border=0></td></tr></table></td></tr><tr><td colspan=2 height=10><img src='/site/resources/design/spacer.gif' border=0></td></tr>");
	popWin.document.writeln("<tr><td colspan=2 height=1 background='/site/resources/design/inaset/picotado7.gif'><img src='/site/resources/design/spacer.gif' border=0></td></tr><tr><td colspan=2 height=3><img src='/site/resources/design/spacer.gif' border=0></td></tr></table>");	

popWin.document.writeln("</td></tr></table>");

	popWin.document.writeln("</body>");
	popWin.document.writeln("</html>");	
	popWin.document.close();
}

/****************************/
/*	Show/Hide TD's						   */
/****************************/
/*	Para a página de produtos		   */
/****************************/
var INTERVAL = 1000;
var timerID = null;
var selected='';
var selectedExtra='';

function ShowHidden( sName, sSuffix ) {
	var elem;
	var elemExtra;

	// IE
	if (document.all) {
		elem = document.all[sName];
		elemExtra = document.all[sName + sSuffix];
	// Netscape 6
	} else if (document.getElementById) {
		elem = document.getElementById(sName);
		elemExtra = document.getElementById(sName + sSuffix);
	}

	if ( selected == '' ) {
		elemExtra.style.display = 'none';
		elem.style.display = 'block';
		clearTimeout(timerID);
	} else {
		if ( selected != elem ) {
			//selected.style.display = 'none';
			//selectedExtra.style.display = 'block';
			clearTimeout(timerID);
			timerID = setTimeout( 'HiddenSelected();', INTERVAL );
		}
		if ( elem.style.display == 'none' ) {
			elemExtra.style.display = 'none';
			elem.style.display = 'block';
			HiddenSelected();
			clearTimeout(timerID);
		} else {
			//elem.style.display = 'none';
			//elemExtra.style.display = 'block';
			clearTimeout(timerID);
			timerID = setTimeout( 'HiddenSelected();', INTERVAL );
		}
	}

	// IE
	if (document.all) {
		selected = document.all[sName];
		selectedExtra = document.all[sName + sSuffix];
	// Netscape 6
	} else if (document.getElementById) {
		selected = document.getElementById(sName);
		selectedExtra = document.getElementById(sName + sSuffix);
	}
}

function HiddenSelected( ) {
	if ( selected != '' ) {
		selected.style.display = 'none';
		selectedExtra.style.display = 'block';
		selected = '';
		selectedExtra = '';
	}
	clearTimeout(timerID);
}

var selectedTD = "";
var FirstSelectedTD="";

function SetSelectedTD( sName ) {

	FirstSelectedTD = sName;
/*
	// IE
	if (document.all) {
		selectedTD = document.all[sName];
	// Netscape 6
	} else if (document.getElementById) {
		selectedTD = document.getElementById(sName);
	}
*/
}

function ShowHideTD( sName ) {
	var elem;
	var bSelect=true;

	// IE
	if (document.all) {
		elem = document.all[sName];
	// Netscape 6
	} else if (document.getElementById) {
		elem = document.getElementById(sName);
	}

	if ( selectedTD == '' ) {
		elem.style.display = 'block';
	} else {
		if ( selectedTD != elem ) {
			selectedTD.style.display = 'none';
		}
		if ( elem.style.display == 'none' ) {
			elem.style.display = 'block';
		} else {
			bSelect = false
			elem.style.display = 'none';
			if (FirstSelectedTD != '' ) {
				ShowHideTD( FirstSelectedTD );
				//SetSelectedTD( FirstSelectedTD );
			}
		}
	}

	if (bSelect) {
		// IE
		if (document.all) {
			selectedTD = document.all[sName];
		// Netscape 6
		} else if (document.getElementById) {
			selectedTD = document.getElementById(sName);
		}
	}
}


var selectedTDSpecial = "";
var FirstSelectedTDSpecial="";

function SetSelectedTDSpecial( sName ) {
	/*
	if (document.all) {
		selectedTDSpecial = parent.document.all[sName];
	} else if (parent.document.getElementById) {
		selectedTDSpecial = parent.document.getElementById(sName);
	}
	*/
	FirstSelectedTDSpecial = sName;
}

function ShowHideTDSpecial( sName ) {
	var elem;
	var bSelect=true;

	// IE
	if (document.all) {
		elem = parent.document.all[sName];
	// Netscape 6
	} else if (parent.document.getElementById) {
		elem = parent.document.getElementById(sName);
	}
	if ( selectedTDSpecial == '' ) {
		elem.style.display = 'block';
	} else {
		if ( selectedTDSpecial != elem ) {
			selectedTDSpecial.style.display = 'none';
		}
		if ( elem.style.display == 'none' ) {
			elem.style.display = 'block';
		} else {
			bSelect = false
			elem.style.display = 'none';
			if (FirstSelectedTDSpecial != '' ) {
				ShowHideTDSpecial( FirstSelectedTDSpecial );
			}
		}
	}

	if (bSelect) {
		// IE
		if (document.all) {
			selectedTDSpecial = parent.document.all[sName];
		// Netscape 6
		} else if (document.getElementById) {
			selectedTDSpecial = parent.document.getElementById(sName);
		}
		selectedTDSpecial = elem;
	}
}

/****************************/
/*	Change Colours							*/
/****************************/
var sSpanFontOlder = '';
var sSpanFontValueOlder = '';

function IN_SelectFontColorInaset(sPrefix_IN, sFontColorId_IN, sColour_IN ) {

	if(!NS){
		//if (sSpanFontOlder != sFontColorId_IN) {
			if(sSpanFontOlder!='') {
				document.all(sPrefix_IN+sSpanFontOlder).innerHTML = sSpanFontValueOlder;
			}
			sSpanFontValueOlder = document.all(sPrefix_IN+sFontColorId_IN).innerHTML;
			document.all(sPrefix_IN+sFontColorId_IN).innerHTML = '<font color="' + sColour_IN + '">'+document.all(sPrefix_IN+sFontColorId_IN).innerHTML+'</font>';
			sSpanFontOlder = sFontColorId_IN ;
		//}
	}	
}

var sSpanFontOlderSpecial = '';
var sSpanFontValueOlderSpecial = '';

function IN_SelectFontColorInasetSpecial(sPrefix_IN, sFontColorId_IN, sColour_IN ) {
	if(!NS){
			if(sSpanFontOlderSpecial!='') {
				document.all(sPrefix_IN+sSpanFontOlderSpecial).innerHTML = sSpanFontValueOlderSpecial;
			}
			sSpanFontValueOlderSpecial = document.all(sPrefix_IN+sFontColorId_IN).innerHTML;
			document.all(sPrefix_IN+sFontColorId_IN).innerHTML = '<font color="' + sColour_IN + '">'+document.all(sPrefix_IN+sFontColorId_IN).innerHTML+'</font>';
			sSpanFontOlderSpecial = sFontColorId_IN ;
	}	
}

/******************/
var sTipsOlder = '';
var sValueOlder = '';

function IN_SelectFontColor(sFontColorId_IN){
	if(!NS){
		if(sTipsOlder!='') {
			document.all('spanTips'+sTipsOlder).innerHTML = sValueOlder;
			MM_swapImage('imgTips' + sTipsOlder,'','/site/resources/design/products-icondir_11.jpg',1);
		}
		sValueOlder = document.all('spanTips'+sFontColorId_IN).innerHTML;
		document.all('spanTips'+sFontColorId_IN).innerHTML = '<font color="#CC0000">'+document.all('spanTips'+sFontColorId_IN).innerHTML+'</font>';
		MM_swapImage('imgTips' + sFontColorId_IN,'','/site/resources/design/products-icondir_11_hi.jpg',1);
		sTipsOlder = sFontColorId_IN ;
	}	
}

function MM_swapImgRestoreNew( sID_IN ) {
	var i,x,a=document.MM_sr;
	if (sID_IN != sTipsOlder) {
		for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
	}
}

var sOfficeOlder = '';
var sValueOfficeOlder = '';

function IN_SelectFontColorOffice(sFontColorId_IN){
	if(!NS){
		if(sOfficeOlder!='') {
			document.all('spanOfficeName'+sOfficeOlder).innerHTML = sValueOfficeOlder;
		}
		sValueOfficeOlder = document.all('spanOfficeName'+sFontColorId_IN).innerHTML;
		document.all('spanOfficeName'+sFontColorId_IN).innerHTML = '<font color="#CC0000">'+document.all('spanOfficeName'+sFontColorId_IN).innerHTML+'</font>';
		sOfficeOlder = sFontColorId_IN ;
	}	
}







/**************************************************/
/**************************************************/
/*		BANANA									  */
/**************************************************/
/**************************************************/

// ---------------------------------------------- //
// ---- Função de aquisição do objecto layer ---- //
// ---------------------------------------------- //
// [oLayer_IN] - ID da layer a obter
// ---------------------------------------------- //
function IN_getLayer(oLayer_IN, doc) { //v1.0
	var i,tLayer;if(!doc) doc=document;
	if(!(tLayer=doc[oLayer_IN])&&!(doc.all)) tLayer=doc.getElementById(oLayer_IN);
	if(!tLayer&&!(tLayer=doc[oLayer_IN])&&doc.all) tLayer=doc.all[oLayer_IN];
	for(i=0;!tLayer&&doc.layers&&i<doc.layers.length;i++) tLayer=IN_getLayer(oLayer_IN,doc.layers[i].document);
	return tLayer;
}

// ---------------------------------------------- //
// - Função para todos verem qual a layer Parente //
// ---------------------------------------------- //
// ---------------------------------------------- //
// [oLayer] - ID da layer a obter o seu parente
// [alerter] - Variável que a acciona um Alert
//			   com o nome da layer parente
//			   para debug, nao fazer referencia
//             se nao for o caso de debug
// ---------------------------------------------- //
function IN_findParent(oLayer) { //v1.0
	layer=IN_getLayer(oLayer);
	strResult=(NS)?layer.parentLayer.id:layer.parentNode.id;
	if(!strResult)strResult=false;
	return strResult;
}

// ---------------------------------------------- //
// --- Função para o IE ler os valores do Clip -- //
// ---------------------------------------------- //
// [oLayer] - ID da layer a obter os valores
// [which] - 0=top, 1=right, 2=bottom, 3=left
// ---------------------------------------------- //
function IN_ieGetClips(oLayer,which) { //v1.0
		fClip=IN_getLayer(oLayer);
		Clip=fClip.style.clip;		
		iClip=parseInt(Clip.substring(5,Clip.length-1).split(" ")[which]);
		return iClip;
}

// ---------------------------------------------- //
// - Função de Mostrar Layer e esconder restantes //
// ---------------------------------------------- //
// [oLayer] - ID da layer a ser mostrada
//			  se 'all' mostra todas as que se
//			  encontram no array de controle
// ---------------------------------------------- //
function IN_hideShowLayers(oLayer_IN) { //v1.0
	var i,lArray;lArray=new Array('teste','teste1');
	if(oLayer_IN=='all'){for (i=0;i<lArray.length;i++){IN_layer1=IN_getLayer(lArray[i]);if(NS){IN_layer1.visibility='show';for(j=0;j<IN_layer1.document.layers.length;j++) {IN_layer1.document.layers[j].visibility='show';}}else{IN_layer1.style.visibility='visible';for(j=0;j<IN_layer1.childNodes.length;j++) {if(IN_layer1.childNodes[j]) {IN_layer1.childNodes[j].style.visibility='visible';}}}}
	}else{IN_oLayer=IN_getLayer(oLayer_IN);for (i=0;i<lArray.length;i++){IN_layer2=IN_getLayer(lArray[i]);if(NS){IN_layer2.visibility='hide';for(j=0;j<IN_layer2.document.layers.length;j++) {IN_layer2.document.layers[j].visibility='hide';}}else{IN_layer2.style.visibility='hidden';for(j=0;j<IN_layer2.childNodes.length;j++) {if(IN_layer2.childNodes[j]) {IN_layer2.childNodes[j].style.visibility='hidden';}}}}
		if(IN_oLayer){if(NS){IN_oLayer.visibility='show';for(j=0;j<IN_oLayer.document.layers.length;j++) {IN_oLayer.document.layers[j].visibility='show';}}else{IN_oLayer.style.visibility='visible';for(j=0;j<IN_oLayer.childNodes.length;j++) {if(IN_oLayer.childNodes[j]) {IN_oLayer.childNodes[j].style.visibility='visible';}}}}
	}
}

// ---------------------------------------------- //
// - Função de controlo de visibilidade --------- //
// ------ de uma layer -------------------------- //
// ---------------------------------------------- //
// [oLayer] - ID da layer a ser alterada
// [strStatus] - visible,hidden
// ---------------------------------------------- //
function IN_setVisibility(oLayer_IN,strStatus) { //v1.0
	oLayer=IN_getLayer(oLayer_IN);if(NS){oLayer.visibility=strStatus;}else{oLayer.style.visibility=strStatus;}
}

// ---------------------------------------------- //
// - Função de controlo de posição -------------- //
// ------ de uma layer -------------------------- //
// ---------------------------------------------- //
// [oLayer] - ID da layer a ser alterada
// [coordX] - coordenada no Eixo X
// [coordX] - coordenada no Eixo X
// [keepInside] - true ou false,
//				  define se a layer se mantem
//				  sempre dentro da parente ou se pode
//				  receber valores que façam com
//				  que esta desapareça
// ---------------------------------------------- //
function IN_setPositionLayer(oLayer,coordX,coordY,keepInside) { //v1.0
	var IN_oLayer,oParent,IN_oParent,thisClipTop,thisClipLeft,thisClipRight,thisClipBottom,parentClipTop,parentClipLeft,parentClipRight,parentClipBottom
	IN_oLayer=IN_getLayer(oLayer);oParent=IN_findParent(oLayer);if(keepInside){IN_oParent=IN_getLayer(oParent);}
	thisClipTop=(NS)?IN_oLayer.clip.top:IN_ieGetClips(oLayer,3);thisClipLeft=(NS)?IN_oLayer.clip.left:IN_ieGetClips(oLayer,0);thisClipRight=(NS)?IN_oLayer.clip.right:IN_ieGetClips(oLayer,1);thisClipBottom=(NS)?IN_oLayer.clip.bottom:IN_ieGetClips(oLayer,2);
	if(IN_oParent)parentClipTop=(NS)?IN_oParent.clip.top:IN_ieGetClips(oParent,3);if(IN_oParent)parentClipLeft=(NS)?IN_oParent.clip.left:IN_ieGetClips(oParent,0);if(IN_oParent)parentClipRight=(NS)?IN_oParent.clip.right:IN_ieGetClips(oParent,1);if(IN_oParent)parentClipBottom=(NS)?IN_oParent.clip.bottom:IN_ieGetClips(oParent,2);
	coordX=parseInt(coordX);coordY=parseInt(coordY);
	if(NS){
		if(!isNaN(coordX)){if(coordX>parentClipRight-thisClipRight && keepInside){IN_oLayer.left=parentClipRight-thisClipRight;} else if (coordX<parentClipLeft && keepInside) {IN_oLayer.left=parentClipLeft;} else {IN_oLayer.left=coordX;}}
		if(!isNaN(coordY)){if(coordY>parentClipBottom-thisClipBottom && keepInside){IN_oLayer.top=parentClipBottom-thisClipBottom;} else if (coordY<parentClipTop && keepInside) {IN_oLayer.top=parentClipTop;} else {IN_oLayer.top=coordY;}}
	}else{
		if(!isNaN(coordX)){if(coordX>parentClipRight-thisClipRight && keepInside){IN_oLayer.style.left=parentClipRight-thisClipRight;} else if (coordX<parentClipLeft && keepInside) {IN_oLayer.style.left=parentClipLeft;} else {IN_oLayer.style.left=coordX;}}
		if(!isNaN(coordY)){if(coordY>parentClipBottom-thisClipBottom && keepInside){IN_oLayer.style.top=parentClipBottom-thisClipBottom;} else if (coordY<parentClipTop && keepInside) {IN_oLayer.style.top=parentClipTop;} else {IN_oLayer.style.top=coordY;}}
	}
}



/**************************************************/
/**************************************************/
function showGrupoMenu(){
	var iLeftFix = 8;
	var iLevel1Top;
	var iLayerGrupoTop;
	var oLayer = IN_getLayer('oDivGrupoMenu');
	var docWidth = (NS)?window.innerWidth:document.body.offsetWidth-4;
	var tableWidth = 770;
	var oLayerLeft;
	var oLayerTop;
	var iInitialLeft = (docWidth<=tableWidth)?iLeftFix+2:(((docWidth-tableWidth)/2)-iLeftFix);
	oLayerLeft=iInitialLeft+4;
	iLayerGrupoTop = oLayerTop;
	IN_setPositionLayer("oDivGrupoMenu",oLayerLeft,oLayerTop,false);IN_setVisibility("oDivGrupoMenu", "visible");
}

