var ruta_relativa="";
document.write("<script src='js/generic_finestres.js'></script>");
document.onmousedown=anularBotonDerecho; 
document.oncontextmenu=retorna_false;

estil_block="block";
var function_on_load=false;
if(navigator.appName != 'Microsoft Internet Explorer'){estil_block="none";}
document.write('<div id="capa_trans" style="z-index:1;display:'+estil_block+';position:absolute; top:0; left:0;width:100%; height:100%; background-color:#ffffff;filter:Alpha(Opacity=50); "   align="center"></div>');
document.write('<div id="capa_loading" style="z-index:1;display:'+estil_block+';position:absolute; top:0; left:0;width:100%; height:100%; "   align="center"><br><br><br><br><br><img src="images/logo_loading.gif" border="10" style="border:0px solid #cccccc "></div>');
function fnStartInit()
{
  // if (document.readyState=="interactive" ||document.readyState=="complete")
  //if ((document.readyState=="interactive" || document.readyState=="complete"))
   {
	  
      document.all.capa_trans.style.display="none";
	  document.all.capa_loading.style.display="none";
	  if(function_on_load)
	  {
			onload();
	  }
   }
}
function fnEndInit()
{
		//document.all.capa_trans.style.display="block";
		//document.all.capa_loading.style.display="block";
}
//document.onreadystatechange=fnStartInit;
// initialization hook up

// DOM2
if ( typeof window.addEventListener != "undefined" )
	window.addEventListener( "load", fnStartInit, false );

// IE 
else if ( typeof window.attachEvent != "undefined" ) {
	window.attachEvent( "onload", fnStartInit );
	window.attachEvent( "onunload", fnEndInit );
}

else {
	if ( window.onload != null ) {
		var oldOnload = window.onload;
		window.onload = function ( e ) {
			oldOnload( e );
			fnStartInit();
		};
	}
	else 
		window.onload = fnStartInit;
}

//FUNCIONS A CADA FINESTRA DEL WINDOWS


//-------------------------------------------------------------------------
function on(obj){obj.style.backgroundColor="#96B4C4";obj.style.color="#ffffff";}
function off(obj){obj.style.backgroundColor="";obj.style.color="";}
function on_border(obj){obj.style.borderColor='#cc0000'}
function off_border(obj){obj.style.borderColor='#ECE9D8'}
function anularBotonDerecho() {if (event.button==2) {
if(opener){
	if(opener.top.obre)opener.top.obre();}
else{
	if(top){if(top.obre)top.obre();}
	else{obre();}
}
}
}

function retorna_false()
{
return false; 
}
function download(ruta)
{
	x=300;
	y=100;
	t=(screen.availHeight-y)/2;
	l=(screen.availWidth-x)/2;
	win=window.open(ruta,'download_win','status=yes,menubar=yes,scrollbars=yes,resizable=yes,left='+l+',top='+t+',width='+x+',height='+y);
	//w_open(ruta,'download_win',300,200);
}

function preview(ruta)
{

	x=100;
	y=100;
	t=(screen.availHeight-y)/2;
	l=(screen.availWidth-x)/2;
	win=window.open('preview.php?src='+ruta,'preview','status=yes,scrollbars=no,left='+l+',top='+t+',width='+x+',height='+y);
}
function ToolTipOn(string){
	document.getElementById('ContentBoxHeadToolTip').value=string;
}
function ToolTipOff(){
	document.getElementById('ContentBoxHeadToolTip').value='';
}
blocks=new Array();
function cache_desplegats(block,que)
{
	blocks[block]=que;
}
function carga_cache(block)
{
	return blocks[block];
}
function ordenar(id_obj,ordre)
{
	nou_content=new Array();
	res="";
	previous_i=false;
	objecte=document.getElementById(id_obj);
	
	obj=objecte.parentNode
	var longitud = obj.childNodes.length
	for (var i=0; i<longitud; i++) { 
	if(obj.childNodes[i]==objecte && ((i>0 && ordre=="AMUNT")||(i<(longitud-1) && ordre=="AVALL")))
	{
		if(ordre=="AMUNT")
		{
			nou_content[i]=nou_content[i-1];
			nou_content[i-1]=obj.childNodes[i].outerHTML;
		}
		if(ordre=="AVALL")
		{
			previous_i=true;
			nou_content[i+1]=obj.childNodes[i].outerHTML;
		}
	}
	else
	{
		a=i
		if(previous_i){a=(i-1);previous_i=false}
		nou_content[a]=obj.childNodes[i].outerHTML;
	}
	}
	for (var i=0; i<nou_content.length; i++) { 
		res=res+nou_content[i];
	}
	obj.innerHTML=res
	for (var i=0; i<longitud; i++)
	{ 
		
		try
		{
			document.getElementById(obj.childNodes[i].id+"_ordre").value=i;
		}
		catch(error){}
		
	
	}
	nou_content=false;
	res=false;
}



