function attachEventListener(target, eventType, functionRef, capture) {
    if (typeof target.addEventListener != "undefined") {
        target.addEventListener(eventType, functionRef, capture);
    } else if (typeof target.attachEvent != "undefined") {
        target.attachEvent("on" + eventType, functionRef);
    } else {
        return false;
    }
    return true;
}

function getElementsByClass(searchClass, node, tag) {
	var classElements = new Array();
	if (node == null) node = document;
	if (tag == null) tag = "*";
	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	var pattern = new RegExp("(^|\\s)" + searchClass + "(\\s|$)");
	for (i = 0, j = 0; i < elsLen; i++) {
		if (pattern.test(els[i].className)) {
			classElements[j] = els[i];
			j++;
		}
	}
	return classElements;
}

function target_blank() {
	if (!document.getElementsByTagName) return;
	var i;
	var enlaces = document.getElementsByTagName("a");
	var cuantos = enlaces.length;
	for (i = 0; i < cuantos; i++) {
		if (enlaces[i].getAttribute("href") && enlaces[i].getAttribute("rel") == "external") enlaces[i].target = "_blank";
	}
}

	if (document.domain == "linux") {
		abs_path = "/indubrik07";
	}	
	else {
		abs_path = "http://www.indubrik.com";
	}

//Abre la ventana del Diseņa tu mueble
function PopupHtml( w, h, proyecto, visor) { 
   	 PopupCentrada(abs_path + "/disena_tu_mueble/disena_tu_mueble.php?init_proyectoId=" + proyecto + "&init_visor=" + visor, "" , w, h, 0);
   }
function PopupCentrada(mypage, myname, w, h, scroll) {
        var winl = (screen.width - w) / 2;
        var wint = ((screen.height - h -87) / 2);
		if (screen.height - h<87){
			wint=0;
			h=screen.height-87;
			scroll=1;
			w=w+17;
			winl-=14;
			alert("ho");
		}
		if (screen.width<w){
			winl=0;
			w=screen.width-10;
			scroll=1;
		}
        winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable=0,status=1';
        win = window.open(mypage, myname, winprops);
}
function buscarProductos() {
	document.getElementById("formBuscador").action="listaResultados.php";
	document.getElementById("formBuscador").accion.value="buscador";
	document.getElementById("formBuscador").submit();
}

//-->
attachEventListener(window, "load", target_blank, false);