// JavaScript Document

function activa(opcio)
{
	document.getElementById(opcio).style.background="#FFF url(imatges/boto_sup_hover.png)";
	document.getElementById(opcio).childNodes[0].style.color="#FFFFFF";
}

function activa_dins(opcio)
{
	document.getElementById(opcio).style.background="#FFF url(../imatges/boto_sup_hover.png)";
	document.getElementById(opcio).childNodes[0].style.color="#FFFFFF";
}

function desactiva(opcio,subOps,asseg)
{
	if (!subOps)
		if (!asseg)
			document.getElementById(opcio).style.background="#FFF url(imatges/boto_sup.png)";
		else
			document.getElementById(opcio).style.background="#FFF url(imatges/boto_sup.png)";
	else
	{
		document.getElementById(opcio).style.background="transparent";
		if (!asseg)
			document.getElementById("divMEopcio2").style.background="#FFF url(imatges/boto_sup.png)";
		else
			document.getElementById("divMEopcio2").style.background="#FFF url(imatges/boto_sup.png)";
	}
	
	document.getElementById(opcio).childNodes[0].style.color="#FFFFFF";
}

function desactiva_dins(opcio,subOps,asseg)
{
	if (!subOps)
		if (!asseg)
			document.getElementById(opcio).style.background="#FFF url(../imatges/boto_sup.png)";
		else
			document.getElementById(opcio).style.background="#FFF url(../imatges/boto_sup.png)";
	else
	{
		document.getElementById(opcio).style.background="transparent";
		if (!asseg)
			document.getElementById("divMEopcio2").style.background="#FFF url(../imatges/boto_sup.png)";
		else
			document.getElementById("divMEopcio2").style.background="#FFF url(../imatges/boto_sup.png)";
	}
	
	document.getElementById(opcio).childNodes[0].style.color="#FFFFFF";
}

function activa_esquerra(opcio)
{
	document.getElementById(opcio).style.background="#FFF url(imatges/boto_esquerra_hover.png)";
	document.getElementById(opcio).childNodes[0].style.color="#FFFFFF";
}

function activa_esquerra_dins(opcio)
{
	document.getElementById(opcio).style.background="#FFF url(../imatges/boto_esquerra_hover.png)";
	document.getElementById(opcio).childNodes[0].style.color="#FFFFFF";
}

function desactiva_esquerra(opcio,subOps,asseg)
{
	if (!subOps)
		if (!asseg)
			document.getElementById(opcio).style.background="#FFF url(imatges/boto_esquerra.png)";
		else
			document.getElementById(opcio).style.background="#FFF url(imatges/boto_esquerra.png)";
	else
	{
		document.getElementById(opcio).style.background="transparent";
		if (!asseg)
			document.getElementById("divMEopcio2").style.background="#FFF url(imatges/boto_esquerra.png)";
		else
			document.getElementById("divMEopcio2").style.background="#FFF url(imatges/boto_esquerra.png)";
	}
	
	document.getElementById(opcio).childNodes[0].style.color="#FFFFFF";
}

function desactiva_esquerra_dins(opcio,subOps,asseg)
{
	if (!subOps)
		if (!asseg)
			document.getElementById(opcio).style.background="#FFF url(../imatges/boto_esquerra.png)";
		else
			document.getElementById(opcio).style.background="#FFF url(../imatges/boto_esquerra.png)";
	else
	{
		document.getElementById(opcio).style.background="transparent";
		if (!asseg)
			document.getElementById("divMEopcio2").style.background="#FFF url(../imatges/boto_esquerra.png)";
		else
			document.getElementById("divMEopcio2").style.background="#FFF url(../imatges/boto_esquerra.png)";
	}
	
	document.getElementById(opcio).childNodes[0].style.color="#FFFFFF";
}

function desactiva_par(opcio,subOps,asseg)
{
	if (!subOps)
		if (!asseg)
			document.getElementById(opcio).style.background="#E4E4E4";
		else
			document.getElementById(opcio).style.background="#E4E4E4";
	else
	{
		document.getElementById(opcio).style.background="#E4E4E4";
		if (!asseg)
			document.getElementById("divMEopcio2").style.background="#E4E4E4";
		else
			document.getElementById("divMEopcio2").style.background="#E4E4E4";
	}
	
	document.getElementById(opcio).childNodes[0].style.color="#000000";
}

function desactiva_non(opcio,subOps,asseg)
{
	if (!subOps)
		if (!asseg)
			document.getElementById(opcio).style.background="#DADADA";
		else
			document.getElementById(opcio).style.background="#DADADA";
	else
	{
		document.getElementById(opcio).style.background="#DADADA";
		if (!asseg)
			document.getElementById("divMEopcio2").style.background="#DADADA";
		else
			document.getElementById("divMEopcio2").style.background="#DADADA";
	}
	
	document.getElementById(opcio).childNodes[0].style.color="#000000";
}

function clica(opcio)
{
	//document.getElementById(document.getElementById(opcio).childNodes[0].id).click();
	document.location.href=document.getElementById(opcio).childNodes[0].href
	//document.getElementById(opcio).children.tags('A')[0].click();
}

function mostraCapa(nomCapa)
{
	document.getElementById(nomCapa).style.visibility="visible"
}

function amagaCapa(nomCapa)
{
	document.getElementById(nomCapa).style.visibility="hidden"
}

function agafaParam(str)
{
	var retorn="";
	var index=0;
	var index2=0;
	if (document.location.search.length>0)
	{	
		index=document.location.search.indexOf(str+"=")+1+str.length;
		index2=document.location.search.indexOf("&",index);
		if (index2<index) index2=document.location.search.length;
		retorn=document.location.search.substring(index,index2);
	}
	if (retorn.length==0)
		retorn=0
	return retorn;
}



function hover(opcio)
{
	document.getElementById(opcio).style.background="#FFF url(imatges/boto_hover.png)";
	document.getElementById("text_"+opcio ).className="enllas_asseguranca_hover";
}

function nohover(opcio)
{
	document.getElementById(opcio).style.background="transparent";
	document.getElementById("text_"+opcio ).className="enllas_asseguranca";
	
}
