var imgs=DIR+"/artworks";

//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) {
	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);
}

//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) {DHTMLALERT("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) {DHTMLALERT("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);
}


//CENTRAR LAYER
function showAndCenter(id) {
	if (typeof id=="string") {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.documentElement && !document.documentElement.scrollTop) {
		var altobody=document.documentElement.scrollTop;
	} else if (document.documentElement && document.documentElement.scrollTop) {
		var altobody=document.documentElement.scrollTop;
	} else if (document.body && document.body.scrollTop) {
		var altobody=document.body.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=(document.body.scrollLeft+(X))+"px";
	obj.style.top =(altobody +(Y) - 100)+"px";
}

//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";
	}
	
	activar_layer_transparente("ly_transparente");
}

function activar_layer_transparente(id_obj) {
	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 recomendar_web() {

	var ly_transparente=getObj("ly_transparente");
	var obj=getObj("ly_recomendar");

	if (obj.style.display=="") {
		obj.style.display="none";
		ly_transparente.style.display="none";
	} else {
		obj.style.display="";
		ly_transparente.style.display="";
		showAndCenter('ly_recomendar');
		form_recomendar.miemail.focus();
	}
}
