
function escriuBanner(str)
{
	txt = "";
	if (flashinstalled == 2){	//Hi ha flash instalat
		
		txt += '	<Object id="banner" codeBase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0"                                              ';
		txt += '		height="194" width="745" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">                                                                              ';
		txt += '		<PARAM NAME="Src" VALUE="img/banners/'+str+'.swf">                                                                                                                     ';
		txt += '		<PARAM NAME="WMode" VALUE="Transparent">                                                                                                                    ';
		txt += '		<PARAM NAME="Quality" VALUE="High">                                                                                                                         ';
		txt += '		<PARAM NAME="Menu" VALUE="0">                                                                                                                               ';
		txt += '		<embed name="banner" src="img/banners/'+str+'.swf" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"  ';
		txt += '			type="application/x-shockwave-flash" width="745" height="194" swliveconnect="true" wmode="transparent">                                                                     ';
		txt += '		</embed>                                                                                                                                                    ';
		txt += '	</OBJECT>																																						';		
	}
	else{	//NO hi ha flash instalat
		txt += '	<img src="img/banners/'+str+'.jpg">';
	}
	MM_setTextOfLayer("bannerDiv",'',txt);
}



function escriuSubmenu(colorFons, colorText)
{
	var strBackground, strLeft;
	if (is.ie){
		if (colorFons == "vermell"){
			strBackground = "background-color: #FF0000; layer-background-color: #FF0000; filter:alpha(opacity=35);"
		}
		else {
			strBackground = "background-color: #000000; layer-background-color: #000000; filter:alpha(opacity=35);"
		}
	}
	else{
		if (colorFons == "vermell"){
			strBackground = "background-image: url(img/fonsSubmenusVermell.png); layer-background-image: url(img/fonsSubmenusVermell.png);"
		}
		else {
			strBackground = "background-image: url(img/fonsSubmenus.png); layer-background-image: url(img/fonsSubmenus.png);"
		}
	}
	
	giLeft = subMenu.left;
	giAmplada = subMenu.amplada;
	giAltura = subMenu.altura;

	fonsSubmenu = "";
	iTop = 0;
	fonsSubmenu += '<div id="fonsSubmenuSup" style="position:absolute; top:' + iTop + 'px; left:' + giLeft + 'px; width:'+giAmplada+'px; height:7px; z-index:8; ' + strBackground + '; overflow:hidden; visibility:hidden;" ></div>';
	iTop = 7;
	for (i=0; i<9; i++){
		op = subMenu.retornaOpcio(i);
		if (op){
			h = op.altura;
		}
		else{
			h = 20;
			if (iTop > giAltura-h)	{
				h = giAltura - iTop;
				if (h < 0) h = 0;
			}
			if (i == 8 && iTop < giAltura-h){
				h = giAltura - iTop;
			}
		}
		amplada = giAmplada;
		if (op && op.seleccionada) amplada = 0;
		fonsSubmenu += '<div id="fonsSubmenu'+i+'" style="position:absolute; top:' + iTop + 'px; left:' + giLeft + 'px; width:'+amplada+'px; height:'+h+'px; z-index:8; ' + strBackground + '; visibility:hidden; overflow:hidden;"></div>';
		iTop += h;
	}
	
	fonsSubmenu += '<div id="fonsSubmenuInf" style="position:absolute; top:' + iTop + 'px; left:' + giLeft + 'px; width:'+giAmplada+'px; height:7px; z-index:8; ' + strBackground + '; overflow:hidden; visibility:hidden;" ></div>';
	
	iLeft = giLeft + 17;
	offsetV = 10;
	iTop = 0;
	txt = "";

	for (i=0; i<subMenu.retornaNumOp(); i++){
		op = subMenu.retornaOpcio(i);
		if (op){
			h = op.altura;
			text = op.text;
			link = op.link;
		}
		else{
			h = 20;
			text = "";
			link = "#";
		}
	
		amplada = giAmplada - 20;
		t = iTop + offsetV;
		if (colorText == "vermell")
			txt += '<div id="submenu'+i+'" style="position:absolute; top:' + t + 'px; left:' + iLeft + 'px; width:'+amplada+'px; height:'+h+'px; z-index:8; visibility:hidden;" class=vermell>';
		else
			txt += '<div id="submenu'+i+'" style="position:absolute; top:' + t + 'px; left:' + iLeft + 'px; width:'+amplada+'px; height:'+h+'px; z-index:8; visibility:hidden;" class=blanc>';
		txt += text;
		txt += '</div>';
		tt = iTop + 7;
		txt += '<div style="position:absolute; top:' + tt + 'px; left:'+giLeft+'px; width:'+giAmplada+'px; height:'+h+'px; z-index:9;" class=blanc>';
		txt += '	<a href="'+link+'" onMouseOver="selectOpcio('+i+')" onMouseOut="desSelectOpcio('+i+')"><img src="img/transparent.gif" width="'+giAmplada+'" height="'+h+'" border="0"></a>';
		txt += '</div>';
		iTop+=h;
	}

	MM_setTextOfLayer("submenuDiv",'',fonsSubmenu + txt);
}



function escriuSubmenu2nNivell(colorFons)
{
	var strBackground, strLeft;
	if (is.ie){
		if (colorFons == "vermell"){
			strBackground = "background-color: #FF0000; layer-background-color: #FF0000; filter:alpha(opacity=35);"
		}
		else {
			strBackground = "background-color: #000000; layer-background-color: #000000; filter:alpha(opacity=35);"
		}
	}
	else{
		if (colorFons == "vermell"){
			strBackground = "background-image: url(img/fonsSubmenusVermell.png); layer-background-image: url(img/fonsSubmenusVermell.png);"
		}
		else {
			strBackground = "background-image: url(img/fonsSubmenus.png); layer-background-image: url(img/fonsSubmenus.png);"
		}
	}
	
	giLeft = subMenu2n.left;
	giAmplada = subMenu2n.amplada;
	giAltura = subMenu2n.altura;

	fonsSubmenu = "";
	iTop = 0;
	fonsSubmenu += '<div id="fonsSubmenuSup2n" style="position:absolute; top:' + iTop + 'px; left:' + giLeft + 'px; width:'+giAmplada+'px; height:7px; z-index:8; overflow:hidden; visibility:hidden;" ></div>';
	iTop = 7;
	for (i=0; i<9; i++){
		op = subMenu2n.retornaOpcio(i);
		if (op){
			h = op.altura;
		}
		else{
			h = 0;
		}
		amplada = giAmplada;
		fonsSubmenu += '<div id="fonsSubmenu2n'+i+'" style="position:absolute; top:' + iTop + 'px; left:' + giLeft + 'px; width:'+amplada+'px; height:'+h+'px; z-index:8; ' + strBackground + '; visibility:hidden; overflow:hidden;"></div>';
		iTop += h;
	}
		
	iLeft = giLeft + 17;
	offsetV = 10;
	iTop = 0;
	txt = "";

	for (i=0; i<subMenu2n.retornaNumOp(); i++){
		op = subMenu2n.retornaOpcio(i);
		if (op){
			h = op.altura;
			text = op.text;
			link = op.link;
		}
		else{
			h = 20;
			text = "";
			link = "#";
		}
	
		amplada = giAmplada - 20;
		t = iTop + offsetV;
		txt += '<div id="submenu2n'+i+'" style="position:absolute; top:' + t + 'px; left:' + iLeft + 'px; width:'+amplada+'px; height:'+h+'px; z-index:8; visibility:hidden;" class=blanc align=right>';
		txt += text;
		txt += '</div>';
		tt = iTop + 7;
		txt += '<div style="position:absolute; top:' + tt + 'px; left:'+giLeft+'px; width:'+giAmplada+'px; height:'+h+'px; z-index:9;" class=blanc>';
		if (op && op.seleccionada){
			txt += '	<a href="'+link+'" ><img src="img/transparent.gif" width="'+giAmplada+'" height="'+h+'" border="0"></a>';
		}
		else{
			txt += '	<a href="'+link+'" onMouseOver="desSelectOpcio2n('+i+')" onMouseOut="selectOpcio2n('+i+')"><img src="img/transparent.gif" width="'+giAmplada+'" height="'+h+'" border="0"></a>';
		}
		txt += '</div>';
		iTop+=h;
	}

	MM_setTextOfLayer("submenu2nDiv",'',fonsSubmenu + txt);
}







