function addMenu(parIMGidx) {
//	if(window.parent.location.href.indexOf("cabana.htm") == -1 ) return;

	var posLEFT = 0, i=0;
	if( document.layers) posLEFT = window.innerWidth-100;
	if( document.all ) posLEFT = document.body.clientWidth-100;

	var links = new Array(" ","cabanamain.htm","clube.htm","papim.htm","pupi.htm","encomenda.htm");
	var tooltips = new Array(" ","Regressar à página principal", "Entrar no Clube do Papim", "Conheça o Papim", "Conheça o Pupi", "Encomendar os nossos CDs");

	if (posLEFT < 690) {
	    posLEFT=690;
		document.write("<img src='imagens/spacer.gif' width=770 height=1 alt=''>");
	}

	document.write("<div id='menu' style='position: absolute; top: 0px; left:" + posLEFT +"px'>");
	document.write("<table cellpadding=0 cellspacing=0 border=0 width=100%>");
	for (i=1;i<6;i++) {
		 if (parIMGidx == i) {
	         document.write("<tr><td align=right><img src='imagens/bar101" + i + ".gif' width=95 height=62 border='0' alt='" + tooltips[i] + "'></a></td></tr>");
		   } else {
	         document.write("<tr><td align=right><a href='" + links[i] + "' target='main'><img src='imagens/bar100" + i + ".gif' width=95 height=60 border='0' alt='" + tooltips[i] + "'></a></td></tr>");
		   }
		}
    document.write("<tr><td align=right><img src='imagens/bar1006.gif' width=95 height=5 border='0' alt=''></a></td></tr>");
	document.write("</table>");
	document.write("</div>");
}

function moveMenu() {
 var posLEFT = 0;
 if( document.layers && document.layers["menu"] ) {
	 posLEFT = window.innerWidth-100; 
	 if (posLEFT < 680) posLEFT=680;
	 document.layers["menu"].left = posLEFT; 
   }
   
 if( document.all && document.all["menu"] ) {
	 posLEFT = document.body.clientWidth-100;
	 if (posLEFT < 680) posLEFT=680;
	 document.all["menu"].style.posLeft = posLEFT;
   }
}

function addBackBtn(parCOR) {
	document.write("<a href='javascript: history.go(-1);'><img name='btnBack' src='imagens/btnBack" + parCOR + ".gif' width=71 height=17 border=0 onMouseOver=\"trocaImg('btnBack','btnBack6')\" onMouseOut=\"trocaImg('btnBack','btnBack" + parCOR +"');\">");
}

function trocaImg(parOBJ, parFILE) {
		 document.images[parOBJ].src = "imagens/" + parFILE + ".gif";
}
function encomendar(parCD) {
    var tmpENC = parent.header.encomenda.value;
    if (tmpENC.indexOf(parCD) == -1) parent.header.encomenda.value += parCD;
}

function clubeShow() {
	window.open("clubesecure.asp","jClube","toolbar=no,titlebar=no,status=no,menubar=no,resizable=yes,width=800,height=600,fullscreen=yes" );
}

function checkFlash() {
	var existeFlash = 0;

	navigator.plugins.refresh();
	if (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"] && navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin) 
	   { if (navigator.plugins && navigator.plugins["Shockwave Flash"]) existeFlash = 1; }

	return(existeFlash);
}

function add2cart(parELEMENTO) {
    parent.header.cart.value =+ parELEMENTO;
	alert(parent.header.cart.value);
}

function cartStatus() {
	document.write("<br>&nbsp;<br><img src='imagens/cart001.gif' width=10 height=8 alt='cesto de compras'>");
}

function insertFlash(parSWF, parW, parH, parBKG) {
	document.write("<OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'\n");
	document.write("codebase='http://active.macromedia.com/flash2/cabs/swflash.cab#version=4,0,0,0'\n");
	document.write(" ID=flashAnim WIDTH=" + parW + " HEIGHT=" + parH + ">\n");
	document.write("<PARAM NAME=movie VALUE='/swfs/" + parSWF + ".swf'>\n");
	document.write("<PARAM NAME=quality VALUE=high>\n");
	document.write("<PARAM NAME=scale VALUE=exactfit>\n");
	document.write("<PARAM NAME=bgcolor VALUE=" + parBKG + ">\n");
    document.write("<EMBED SRC='/swfs/" + parSWF + ".swf'>\n");
    document.write("swLiveConnect=FALSE WIDTH=" + parW + " HEIGHT=" + parH + "\n");
    document.write("QUALITY=high SCALE=exactfit\n");
    document.write("TYPE='application/x-shockwave-flash' ");
    document.write("PLUGINSPAGE='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' border=0>\n");
    document.write("</EMBED></OBJECT>");
}