var imgs=DIR+"/artworks";

//CAMBIAR COLOR TR
function mOvr(src,clrOver) {
	if(clrOver=='') {clrOver = '#B9D7EA'};
	defaultColor = src.bgColor;
	src.bgColor = clrOver;
}
function mOut(src) {
	src.bgColor = defaultColor;
}

//BOOKMARK
function SetBookMark() {
var title=url_tobookmark;
if( window.sidebar && window.sidebar.addPanel ) {
window.sidebar.addPanel(title,location.href,'');
} else {
window.external.AddFavorite(location.href,title);
}
}
//AGREGAR CLASE
function MO2(ly,clases) {
	//alert(ly+"-->"+clases+"->"+ly.innerHTML);
	if (!ly) ly=getObj(ly);
	if (ly==null) {return}

	class_def = "class";
	if (BrowserDetect.browser=="Explorer")
		class_def = "className";

	var cn = setget_attr(ly,class_def);
	var oc = setget_attr(ly,'oldclass');
	if (clases==undefined)
	{
		if (oc!=undefined)
			setget_attr(ly,class_def,oc);
		return;
	}

	setget_attr(ly,'oldclass', cn);
	setget_attr(ly,class_def,cn+" "+clases);
//	ly.className=cn+" "+clases;
}

//OCULTAR LAYERS
function force_hide(ly) {
	veclayers=ly.split(",");
	for (var i=0;i<veclayers.length;i++) {
		ly=document.getElementById(veclayers[i]);
		if (ly!=null) {ly.style.visibility="hidden";}
	}
}
function force_unhide(ly) {
	veclayers=ly.split(",");
	for (var i=0;i<veclayers.length;i++) {
		ly=document.getElementById(veclayers[i]);
		if (ly!=null) {ly.style.visibility="visible";}
	}
}
function force_display(ly) {
	veclayers=ly.split(",");
	for (var i=0;i<veclayers.length;i++) {
		ly=document.getElementById(veclayers[i]);
		if (ly!=null) {ly.style.display="";}
	}
}
function force_undisplay(ly) {
	veclayers=ly.split(",");
	for (var i=0;i<veclayers.length;i++) {
		ly=document.getElementById(veclayers[i]);
		if (ly!=null) {ly.style.display="none";}
	}
}
function hide_unhide(id_obj) {
	obj=getObj(id_obj);
	if(obj==null) {alert("objeto:"+id_obj+"no encontrado."); return;}
	if (obj.style.visibility=="visible") {
		obj.style.visibility="hidden";
	} else {
		obj.style.visibility="visible";
	}
}
function display_undisplay(id_obj) {
	obj=getObj(id_obj);
	if(obj==null) {alert("objeto:"+id_obj+"no encontrado."); return;}
	if (obj.style.display=="") {
		obj.style.display="none";
	} else {
		obj.style.display="";
	}
}


function str_replace(str,s,t)
{
	return str.split(s).join(t);
}
//MODIFICAR ALTO ELEMENTO
function resize_obj(id_obj, px) {
	obj=getObj(id_obj);
	if (obj.style.height==undefined) return;
	aux_h=parseInt(str_replace(obj.style.height,"px",""));
	aux_h+=px;
	if (aux_h<=0) return;
	obj.style.height=aux_h;
}

//CENTRAR LAYER
function showAndCenter(id, img) {

	var obj = id;
	if (typeof obj != "object") 
		obj=getObj(id);
	
	ancho_layer=obj.style.width;
	ancho_layer=ancho_layer.replace("px","");
	alto_layer=obj.style.height;
	alto_layer=alto_layer.replace("px","");

	if (document.body && document.body.scrollTop) 
	{
		var altobody=document.body.scrollTop;
	} else if (document.documentElement && !document.documentElement.scrollTop) {
		var altobody=document.documentElement.scrollTop;
	} else if (document.documentElement && document.documentElement.scrollTop) {
		var altobody=document.documentElement.scrollTop;
	}

	var X = ((document.body.scrollWidth-ancho_layer)/2);
	var Y = ((screen.availHeight-alto_layer)/2);

	obj.style.zIndex=1001;
	obj.style.display="";
	obj.style.visibility="visible";
	obj.style.left=parseInt((document.body.scrollLeft+(X)))+"px";
	obj.style.top =parseInt((altobody +(Y) - 100))+"px";

//	alert("ancho_layer:"+ancho_layer+"\n"+"alto_layer:"+alto_layer+"\n"+"altobody:"+altobody+"\n"+"X:"+X+"\n"+"Y:"+Y+"\n");
}

//LIMPIAR LAYER
function clean_layer(ly) {
var ly=document.getElementById(ly);
if (ly!=null)
	ly.innerHTML="";
}
function change_imgsource(elemento,imgsource){
	var o=getObj(elemento);
	if (o!=null)
		o.src = imgsource;
}

//alert dinamico
function DHTMLALERT(msg)
{
	var dalert_msg = getObj("dhtml_alert_MSG");

	if (!dalert_msg)
		return;
	if (msg!="")
	{
		dalert_msg.innerHTML = msg;
		showAndCenter("dhtml_alert");
	} else {
		var dalert = getObj("dhtml_alert");
		dalert_msg.innerHTML = "";
		dalert.style.display="none";
		if (obj_focus!=null) {obj_focus.focus();obj_focus=null;}
	}

	activar_layer_transparente("ly_transparente");
}

function activar_layer_transparente(id_obj) {
	var obj=getObj(id_obj);
	if (obj.style.display=="") {
		obj.style.display="none";
	} else {
		obj.style.display="";
		obj.style.width=getPageSize()[0];
		obj.style.height=getPageSize()[1];
	}
}

function getPageSize(){
	var xScroll, yScroll;

	if (window.innerHeight && window.scrollMaxY) {
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}

	var windowWidth, windowHeight;
	if (self.innerHeight) {// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}

	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else {
		pageHeight = yScroll;
	}

	if(xScroll < windowWidth){
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}
	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)
	return arrayPageSize;
}

function forzar_mostrar_layer_transparente() {
	obj=getObj("ly_transparente");
	obj.style.display="";
	obj.style.width=getPageSize()[0];
	obj.style.height=getPageSize()[1];
}

function forzar_ocultar_layer_transparente() {
	obj=getObj("ly_transparente");
	if (obj==null)
	{
		alert("layer_transparente no encontrado"); return;
	}
	obj.style.display="none";
}

