// Creator 2 - JS Object Development by Raquel,Pepe & Carlos in marchFIRST, 2001
function Creator(id,padre,left,top,width,height,vcolor,state,stack,contenido,tdiv){
	ie=(document.all)? true:false;
	nn4=(document.layers)? true:false;
	nn6=(!document.all && document.getElementById)? true:false;
	var iniArgs = arguments;
	if(nn4){
		document.layers[iniArgs[0]] = new Layer(iniArgs[4]);
		var aux=document.layers[iniArgs[0]];
		aux.name=iniArgs[0];
		aux.left=iniArgs[2];
		aux.top=iniArgs[3];
		if(iniArgs[5] != null){ aux.clip.height = iniArgs[5] }
		if(iniArgs[6] != null){ aux.bgColor = iniArgs[6] }
		(iniArgs[7] == "hide")? aux.visibility = "hide" : aux.visibility = "show";
		if(iniArgs[8] != null){ aux.zIndex = stack }
		if(iniArgs[9] != null){
			aux.document.open();
			aux.document.write(iniArgs[9]);
			aux.document.close();
		}
	}else if(ie){
		var aux='<DIV id=' + iniArgs[0] + ' style="position:absolute;left:' + iniArgs[2] + ';top:' + iniArgs[3] + ';width:' + iniArgs[4];
		if(iniArgs[5] != null) {
			aux+='; height:' + iniArgs[5];
			aux+='; clip:rect(0,'+iniArgs[4]+','+iniArgs[5]+',0)';
		}
		if(iniArgs[6]!=null){ aux += '; background-color:' + iniArgs[6] }	
		(iniArgs[7]=="hide")? aux+='; visibility:hidden' : aux+='; visibility:visible';
		if(iniArgs[8]!=null){ aux += '; z-index:' + iniArgs[8] }
		aux+='">';
		if(iniArgs[9]!=null){ aux += iniArgs[9] }
		aux+='</DIV>';
		document.body.insertAdjacentHTML("BeforeEnd",aux);
	}else if(nn6){
		nodo = document.getElementsByTagName("BODY").item(0);
		div = document.createElement("DIV");
		div.id=iniArgs[0]
		div.style.position = "absolute";
		nodo.appendChild(div);
		div.style.left=iniArgs[2];
		div.style.top=iniArgs[3];
		div.style.width=iniArgs[4];
		div.style.height=iniArgs[5];
		div.style.visibility=(iniArgs[7]=="show")? 'visible':'hidden';
		div.style.zIndex=iniArgs[8];
		div.style.backgroundColor = iniArgs[6];
		div.innerHTML = iniArgs[9];
	}
	if(tdiv=='yes') eval("div"+id+"=new motionDiv('div"+iniArgs[0]+"','"+iniArgs[0]+"')");
}

function reemplazacrc(theString, oldChar, newChar) {
	var i = 0;
	var j = theString.length;

	for(i=0; i < theString.length; i++) {
		if(theString.charAt(i) == oldChar) {
			theString = theString.substring(0,i) + newChar + theString.substring(i+1,theString.length);
			if(i > j) {
				break;
				}
			}
		}
	return theString;
}

function Ampliar(sDisplayPath,sPieImagen){
	var oParam=new Object();
	oParam.PieImagen=sPieImagen;
	window.open("/Valenciaport/aplicaciones/AmpliarImg.aspx?Path="+sDisplayPath+"&Pie="+sPieImagen,"IMG","menubar=no,toolbar=no,status=no,scrollbars=auto,resizable=no,width=498,height=500")
	//window.showModalDialog("/Valenciaport/aplicaciones/AmpliarImg.aspx?Path="+sDisplayPath+"&Pie="+sPieImagen,oParam);
	return;
}
function AbrirPDF(sDisplayPath){
	window.open("/Valenciaport/aplicaciones/PopupPDF.aspx?Path="+sDisplayPath, "PDF", "menubar=no,toolbar=no,status=no,scrollbars=no,resizable=yes");
	//window.showModalDialog("/Valenciaport/aplicaciones/PopupPDF.aspx?Path="+sDisplayPath);
	return;
}
function AbrirURL(URL,features){
	window.open(URL, "AbrirURL", features);
	return;
}

	function Resize(){
		var separacion;
		var ancho;
		var obj;
		ancho = document.body.clientWidth;
		separacion = ancho - 150;
			//alert(divmenu1)
			obj = RS_findObj("menu1",null)
			if (obj!=null){
				 desplazar();
			}
			obj = RS_findObj("up",null)

			if (obj!=null){
				reubicarScroll(separacion-25);
			}
		//Tratamiento del scroll
		if ((document.body.clientWidth >780)&&(document.body.clientHeight>580))
		{
  			document.body.scroll = "no";
  		}
		else
		{
			if ((document.body.clientWidth >760)&&(document.body.clientHeight>560)){
  			document.body.scroll = "no";
			}
			else
			{document.body.scroll = "yes";}
		}
	}

/*
~~ PUBLIC ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
RS_findObj( n, d )
--------------------------------------------------------------------------------
IN		:	n	nombre objeto a capturar
			d	document
--------------------------------------------------------------------------------
RETURN	:	Esta función devuelve un objeto sin importar donde se encuentre,
			para compatibilidad con Netscape.
--------------------------------------------------------------------------------
PRE		:	El formato de la llamada es
				obj = RS_findObj([nombre_objeto_a_capturar]);
			y en obj ya tienes asignado el objeto
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ RS ~~
*/
function RS_findObj( n, d )
{	var p, i, x;

	if( !d )
	{	
		d = document;
	}
	p = n.indexOf("?")
	if( (p > 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 = RS_findObj( n, d.layers[i].document );
	}
	if(!x && d.getElementById)
	{	
		x = d.getElementById(n);
	}
  
  return x;
} 

