// JavaScript Document
var ER_NATURAL = /^[0-9]+$/;
var ER_EMAIL = /^[a-z0-9_\.\-]+@[a-z0-9_\-]+(\.[a-z0-9_\-]{2,20})*\.[a-z]{2,4}$/;
var ER_STR = /^([^ \t\n\r]([ \t\n\r]|[^ \t\n\r])*[^ \t\n\r])+$|^[^ \t\n\r]$/;
var ER_NATURAL_NOCERO = /^[1-9]+[0-9]*$/;
var ER_ENTERO = /^\-?[0-9]+$/;
var ER_DECIMAL_FORMATEADO = /^([1-9][0-9]{0,2}){1}((\.[0-9]{3})|[0-9]{3})*(,[0-9]{0,2})?$/;
var SEP_AND = "|&|";
var SEP_IGUAL = "|=|";

var ER_WEB_HTTP = new RegExp('^https?://(www\\.[a-z0-9]{1}[a-z0-9\\.\\-]*[a-z0-9]{1}\\.[a-z]{2,6}(\\.[a-z]{3})?(.*)?|([a-z0-9]{2,}\\.)?[a-z0-9]{1}[a-z0-9\\.\\-]*[a-z0-9]{1}\\.[a-z]{2,6}(\\.[a-z]{3})?(.*)?|[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}(.*)?)$');

/******************************************/
var imgRollOver = function(img, over){
	img = (typeof(img)=='object')? img : $(img);
	
	img.__over = over;
	img.__out = img.src;
	
	AddEvent(img, 'mouseover', function(){
		this.src = this.__over;
	}.closure(img));
	AddEvent(img, 'mouseout', function(){
		this.src = this.__out;
	}.closure(img));
}

/******************************************/


var aSolActs = new Object;
function cambiarSolapa(id, pos, on, off, event){
	if(!!aSolActs[id]){
		aSolActs[id]['tit'].className = off;
		aSolActs[id]['con'].style.display = 'none';
	}
	aSolActs[id] = new Object;
	aSolActs[id]['tit'] = $('titSolDeCont'+id+'Pos'+pos);
	aSolActs[id]['tit'].className = on;
	aSolActs[id]['con'] = $('conSolDeCont'+id+'Pos'+pos);
	aSolActs[id]['con'].style.display = 'block';
	
	if(event) StopEvent(event);
}

/******************************************/
function getScrollPos(){
	if(Nav.esOp) return {y:window.pageYOffset, x:window.pageXOffset};
	else return {y:document.documentElement.scrollTop, x:document.documentElement.scrollLeft};
}
function getWindowDims(){
	if(Nav.esOp) return {w:window.innerWidth, h:window.innerHeight};
	else return {w:document.documentElement.clientWidth, h:document.documentElement.clientHeight};
}
function getBodyWHAvaible(){
	if(Nav.esOp) return {w:window.innerWidth, h:window.innerHeight};
	else return {w:document.documentElement.clientWidth, h:document.documentElement.clientHeight};
}
function getBodyDims(){
	if(Nav.esOp) return {w:document.body.clientWidth, h:document.body.clientHeight};
	else return {w:document.body.offsetWidth, h:document.body.offsetHeight};
}

/******************************************/
function WScreen(){ return (Nav.esIE)? document.documentElement.clientWidth : window.innerWidth; }
function HScreen(){ return (Nav.esIE)? document.documentElement.clientHeight : window.innerHeight; }
function YPos(){ return (Nav.esIE)? document.documentElement.scrollTop : window.pageYOffset; }
function XPos(){ return (Nav.esIE)? document.documentElement.scrollLeft : window.pageXOffset; }
function HBody(){ return document.documentElement.scrollHeight; } //(Nav.esIE)? document.body.scrollHeight : document.body.offsetHeight;
function WBody(){ return document.documentElement.scrollWidth; }

/******************************************/
var centrarContenido = function(contenido){
	if(contenido && typeof(contenido) == "string")contenido = $(contenido);
	if(!contenido){
		alert("Error en funcion centrarContenido: Contenido inexistente");
		return false;
	}
	var scrll = getScrollPos();
	var dims = getBodyWHAvaible();
	contenido.style.top = (Math.round((dims.h - contenido.offsetHeight)/2)+scrll.y)+"px";
	contenido.style.left = (Math.round((dims.w - contenido.offsetWidth)/2)+scrll.x)+"px";
}
var MostrarContenido = function(contenido,e){
	if(contenido && typeof(contenido) == "string")contenido = $(contenido);	
	if(!contenido){
		alert("Error en funcion MostrarPopUp: Contenido inexistente");
		return false;
	}
	centrarContenido(contenido);
	contenido.style.visibility = "visible";
	if(e)StopEvent(e);
	
}
var OcultarContenido = function(contenido,e){
	if(contenido && typeof(contenido) == "string")contenido = $(contenido);	
	contenido.style.visibility = "hidden";
	contenido.style.top = '-'+(contenido.offsetHeight+100)+"px";
	if(e)StopEvent(e);
}
var blockeadorGeneral = null;
var mostrarBlockeador = function(mostrar){
	if(!blockeadorGeneral){
		blockeadorGeneral = $("blockeadorGeneral");
		if(Nav.esIE || Nav.esIE7) blockeadorGeneral.style.filter = 'alpha(opacity=45)';
		else blockeadorGeneral.style.MozOpacity = ".45";
		
	}
	if(mostrar){
		var alto = HScreen();
		if(alto < HBody())alto = HBody();
		var scrn = getBodyDims();
		blockeadorGeneral.style.display = "block";
		blockeadorGeneral.style.height = alto+"px";
		blockeadorGeneral.style.width = scrn.w+"px";
	}
	else blockeadorGeneral.style.display = "none";
}
var solAntList = null;
var cambiarSolapaLista = function(contenedor,clase,titSol,indiceSolapa,e){
	$(contenedor).className = clase;
	if(!solAntList)solAntList = $('solListado');
	if(solAntList)solAntList.className = '';
	try{
		oCookie.set('solOrden', titSol.id);
	}
	catch(e){}
	titSol.className = 'on';
	solAntList = titSol;
	if(e)StopEvent(e);
}
var solapaListaDefecto = function(){
	var id = oCookie.get('solOrden');
	sol = $(id);
	if(sol){
		FireEvent(sol,'click');
	}
}

/******************************************/
var solapaLista = function(conf){
	var oConf = conf;
	var solAnt = null;
	if(!oConf.indice)oConf.indice = '';

	this.cambiarSolapaLista = function(titSol,clase,e){
		$(oConf.contenedor).className = clase;
		if(!solAnt){
			if(this.defecto == 'galeria')solAnt = $('solListado'+oConf.indice);		
			else solAnt = $('solGaleria'+oConf.indice);
		}
		if(solAnt)solAnt.className = '';

		try{
			oCookie.set('solOrden'+oConf.indice, titSol.id);
		}
		catch(e){}		
		titSol.className = 'on';
		solAnt = titSol;
		if(e)StopEvent(e);
	}
	
	this.solapaListaDefecto = function(forzada){
		var id = oCookie.get('solOrden'+oConf.indice);
		sol = $(id);
		if(sol && !forzada){
			FireEvent(sol,'click');
		}
		else{
			if(this.defecto == 'galeria')FireEvent($('solGaleria'+oConf.indice),'click');
			else FireEvent($('solListado'+oConf.indice),'click');
		}
		
	}
}
var mostrarSubMenu = function(id, e){
	var desde = hasta = 0, obj = $(id);
	//

	if(obj && (e || e == 'init')){
		if(parseInt(obj.style.height) == 0 || obj.style.height=='') desde = 0, hasta = obj.scrollHeight;
		else if(parseInt(obj.style.height) == obj.scrollHeight || obj.style.height=='auto') desde = obj.scrollHeight, hasta = 0;
		
		if(desde != hasta){
			var tm = new Tween(obj.style, 'height', Tween.strongEaseOut, desde, hasta, 2, 'px');
			tm.start();
		}
	}
	if(e && e != 'init')StopEvent(e);
}
var mostrarSubMenuAnim = function(id, e){
	var desde = hasta = 0, obj = $(id);
	//

	if(obj && (e || e == 'init')){
		if(parseInt(obj.style.height) == 0 || obj.style.height=='') desde = 0, hasta = obj.scrollHeight;
		else if(parseInt(obj.style.height) == obj.scrollHeight || obj.style.height=='auto') desde = obj.scrollHeight, hasta = 0;
		
		if(desde != hasta){
			var tm = new Tween(obj.style, 'height', Tween.strongEaseOut, desde, hasta, 0.8, 'px');
			tm.start();
		}
	}
	if(e && e != 'init')StopEvent(e);
}

var mostrarSubMenuMedia = function(icono,id){
	var menu = $('ulCategoriaMedia' + id);
	if(icono.className == 'menos'){
		if(menu.offsetHeight > 0)return false
		icono.className = 'mas';
	}
	else{
		if(menu.offsetHeight != menu.scrollHeight)return false;
		icono.className = 'menos';
	}
	if($('ulCategoriaMedia' + id)){
		mostrarSubMenuAnim('ulCategoriaMedia' + id,'init');
	}
}
var verSubTop = function(obj,subMenu,display){
	
	var men = $(subMenu);
	if(men){
		if(!Nav.esIE && display == 'block'){
			//obj.style.position = 'absolute';
			men.style.marginTop = obj.offsetHeight+'px';
			//obj.style.position = '';	
		}
		
		men.style.display = display;
	}
}

/******************************************/
function getElementPos(ele){
	var p = ele.style.position;
	ele.style.position = 'relative';
	var x = ele.offsetLeft;
	var y = ele.offsetTop;
	ele.style.position = p;
	return {'x':x, 'y':y};
}
function setOpacity(opa, ele){
	if(!window.innerWidth){ ele.style.filter = 'alpha(opacity='+opa+')'; }
	else{ ele.style.opacity = (opa / 100); }
}

/******************************************/
var setBusqueda = function(url,e){
	oCookie.unset('clavePrivada');
	oCookie.set('clavePrivada', $('clavePrivada').value);
	oCookie.unset('paginaBusqueda');
	oCookie.set('paginaBusqueda', 1);

	document.location = url;
	if(e)StopEvent(e);
}
var setPagina = function(anex,pagina,e){
	oCookie.unset('pagina'+anex);
	oCookie.set('pagina'+anex, pagina);
	if(e)StopEvent(e);
}
var analizarEnterBuscar = function(e){
	if(e.keyCode == 13){
		FireEvent($('btnBuscar'),'click');	
		StopEvent(e);
	}
}

/******************************************/
function writeInElement(elem, tld, name, acc, inner){
	elem['href'] = 'mailto:' + acc + '@' + name + '.' + tld;
	if(inner){ elem['innerHTML'] = acc + '@' + name + '.' + tld; }
}

/******************************************/
function serialize( mixed_value ) {
    // http://kevin.vanzonneveld.net
    // +   original by: Arpad Ray (mailto:arpad@php.net)
    // +   improved by: Dino
    // +   bugfixed by: Andrej Pavlovic
    // +   bugfixed by: Garagoth
    // %          note: We feel the main purpose of this function should be to ease the transport of data between php & js
    // %          note: Aiming for PHP-compatibility, we have to translate objects to arrays
    // *     example 1: serialize(['Kevin', 'van', 'Zonneveld']);
    // *     returns 1: 'a:3:{i:0;s:5:"Kevin";i:1;s:3:"van";i:2;s:9:"Zonneveld";}'
    // *     example 2: serialize({firstName: 'Kevin', midName: 'van', surName: 'Zonneveld'});
    // *     returns 2: 'a:3:{s:9:"firstName";s:5:"Kevin";s:7:"midName";s:3:"van";s:7:"surName";s:9:"Zonneveld";}'
 
    var _getType = function( inp ) {
        var type = typeof inp, match;
        var key;
        if (type == 'object' && !inp) {
            return 'null';
        }
        if (type == "object") {
            if (!inp.constructor) {
                return 'object';
            }
            var cons = inp.constructor.toString();
            if (match = cons.match(/(\w+)\(/)) {
                cons = match[1].toLowerCase();
            }
            var types = ["boolean", "number", "string", "array"];
            for (key in types) {
                if (cons == types[key]) {
                    type = types[key];
                    break;
                }
            }
        }
        return type;
    };
    var type = _getType(mixed_value);
    var val, ktype = '';
    
    switch (type) {
        case "function": 
            val = ""; 
            break;
        case "undefined":
            val = "N";
            break;
        case "boolean":
            val = "b:" + (mixed_value ? "1" : "0");
            break;
        case "number":
            val = (Math.round(mixed_value) == mixed_value ? "i" : "d") + ":" + mixed_value;
            break;
        case "string":
            val = "s:" + mixed_value.length + ":\"" + mixed_value + "\"";
            break;
        case "array":
        case "object":
            val = "a";
            /*
            if (type == "object") {
                var objname = mixed_value.constructor.toString().match(/(\w+)\(\)/);
                if (objname == undefined) {
                    return;
                }
                objname[1] = serialize(objname[1]);
                val = "O" + objname[1].substring(1, objname[1].length - 1);
            }
            */
            var count = 0;
            var vals = "";
            var okey;
            var key;
            for (key in mixed_value) {
                ktype = _getType(mixed_value[key]);
                if (ktype == "function") { 
                    continue; 
                }
                
                okey = (key.match(/^[0-9]+$/) ? parseInt(key) : key);
                vals += serialize(okey) +
                        serialize(mixed_value[key]);
                count++;
            }
            val += ":" + count + ":{" + vals + "}";
            break;
    }
    if (type != "object" && type != "array") val += ";";
    return val;
}
function unserialize(data){
    // http://kevin.vanzonneveld.net
    // +     original by: Arpad Ray (mailto:arpad@php.net)
    // +     improved by: Pedro Tainha (http://www.pedrotainha.com)
    // +     bugfixed by: dptr1988
    // +      revised by: d3x
    // +     improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // %            note: We feel the main purpose of this function should be to ease the transport of data between php & js
    // %            note: Aiming for PHP-compatibility, we have to translate objects to arrays 
    // *       example 1: unserialize('a:3:{i:0;s:5:"Kevin";i:1;s:3:"van";i:2;s:9:"Zonneveld";}');
    // *       returns 1: ['Kevin', 'van', 'Zonneveld']
    // *       example 2: unserialize('a:3:{s:9:"firstName";s:5:"Kevin";s:7:"midName";s:3:"van";s:7:"surName";s:9:"Zonneveld";}');
    // *       returns 2: {firstName: 'Kevin', midName: 'van', surName: 'Zonneveld'}
    
    var error = function (type, msg, filename, line){throw new window[type](msg, filename, line);};
    var read_until = function (data, offset, stopchr){
        var buf = [];
        var chr = data.slice(offset, offset + 1);
        var i = 2;
        while(chr != stopchr){
            if((i+offset) > data.length){
                error('Error', 'Invalid');
            }
            buf.push(chr);
            chr = data.slice(offset + (i - 1),offset + i);
            i += 1;
        }
        return [buf.length, buf.join('')];
    };
    var read_chrs = function (data, offset, length){
        buf = [];
        for(var i = 0;i < length;i++){
            var chr = data.slice(offset + (i - 1),offset + i);
            buf.push(chr);
        }
        return [buf.length, buf.join('')];
    };
    var _unserialize = function (data, offset){
        if(!offset) offset = 0;
        var buf = [];
        var dtype = (data.slice(offset, offset + 1)).toLowerCase();
        
        var dataoffset = offset + 2;
        var typeconvert = new Function('x', 'return x');
        var chrs = 0;
        var datalength = 0;
        
        switch(dtype){
            case "i":
                typeconvert = new Function('x', 'return parseInt(x)');
                var readData = read_until(data, dataoffset, ';');
                var chrs = readData[0];
                var readdata = readData[1];
                dataoffset += chrs + 1;
            break;
            case "b":
                typeconvert = new Function('x', 'return (parseInt(x) == 1)');
                var readData = read_until(data, dataoffset, ';');
                var chrs = readData[0];
                var readdata = readData[1];
                dataoffset += chrs + 1;
            break;
            case "d":
                typeconvert = new Function('x', 'return parseFloat(x)');
                var readData = read_until(data, dataoffset, ';');
                var chrs = readData[0];
                var readdata = readData[1];
                dataoffset += chrs + 1;
            break;
            case "n":
                readdata = null;
            break;
            case "s":
                var ccount = read_until(data, dataoffset, ':');
                var chrs = ccount[0];
                var stringlength = ccount[1];
                dataoffset += chrs + 2;
                
                var readData = read_chrs(data, dataoffset+1, parseInt(stringlength));
                var chrs = readData[0];
                var readdata = readData[1];
                dataoffset += chrs + 2;
                if(chrs != parseInt(stringlength) && chrs != readdata.length){
                    error('SyntaxError', 'String length mismatch');
                }
            break;
            case "a":
                var readdata = {};
                
                var keyandchrs = read_until(data, dataoffset, ':');
                var chrs = keyandchrs[0];
                var keys = keyandchrs[1];
                dataoffset += chrs + 2;
                
                for(var i = 0;i < parseInt(keys);i++){
                    var kprops = _unserialize(data, dataoffset);
                    var kchrs = kprops[1];
                    var key = kprops[2];
                    dataoffset += kchrs;
                    
                    var vprops = _unserialize(data, dataoffset);
                    var vchrs = vprops[1];
                    var value = vprops[2];
                    dataoffset += vchrs;
                    
                    readdata[key] = value;
                }
                
                dataoffset += 1;
            break;
            default:
                error('SyntaxError', 'Unknown / Unhandled data type(s): ' + dtype);
            break;
        }
        return [dtype, dataoffset - offset, typeconvert(readdata)];
    };
    return _unserialize(data, 0)[2];
}

/******************************************/
var menuHermanaAnterior = null;
var mostrarMenuHermanas = function(idCategoria,e){
	if($('menuHermanas'+idCategoria)){
		if($('menuHermanas'+idCategoria).intervalo)$('menuHermanas'+idCategoria).intervalo = clearInterval($('menuHermanas'+idCategoria).intervalo);
		if(menuHermanaAnterior && menuHermanaAnterior.id != 'menuHermanas'+idCategoria)menuHermanaAnterior.style.display = 'none';
		$('menuHermanas'+idCategoria).style.display = 'inline';
		menuHermanaAnterior = $('menuHermanas'+idCategoria);
	}
	if(e)StopEvent(e);
}
var ocultarMenuHermanas = function(idCategoria,conTime){
	if($('menuHermanas'+idCategoria)){
		if(conTime){
			$('menuHermanas'+idCategoria).intervalo = setTimeout(function(){
				$('menuHermanas'+idCategoria).style.display = 'none';	
				},500);
		}
		else{
			$('menuHermanas'+idCategoria).style.display = 'none';			
		}
	}
}

/******************************************/
var INTERVAL_ARBOL = 0;
var arbolAnterior = null;
function verSubMenuArbol(menu,nivel,display,e){
	if(menu){
		if(!display)display = 'none';
		menu.style.display = display;
		if(display == 'block'){
			menu.widthTemp = menu.offsetWidth;
			if(nivel > 0){
				menu.parentNode.parentNode.style.display = 'inline';
				menu.parentNode.style.display = 'inline';
				menu.style.marginLeft = (menu.offsetWidth-2)+'px';					
				if(!Nav.esIE)menu.style.marginTop = (-menu.parentNode.childNodes[1].offsetHeight-1)+'px';
				else menu.style.marginTop = (-menu.parentNode.childNodes[0].offsetHeight-1)+'px';
			}
		 }
	 }
}
function verMenuArbolPrincipal(obj,display){
	if(display == 'inline'){
		clearInterval(INTERVAL_ARBOL);		
		obj.style.marginLeft = '-10px';
		if(arbolAnterior && arbolAnterior.id != obj.id)arbolAnterior.style.display = 'none';
	}
	arbolAnterior = obj;
	obj.style.display = display;
}
function ocultarArbolPrincipal(){
	clearInterval(INTERVAL_ARBOL);
	INTERVAL_ARBOL = setTimeout(function(){
		if(arbolAnterior){
			verMenuArbolPrincipal(arbolAnterior,'none');
		}
	},500);
}
function hideFlashes(b){
	objs = document.getElementsByTagName('embed');
	for (var i = 0; i < objs.length; i++) {
		var ele = objs[i];
		ele.style.visibility = (b)? 'hidden' : 'visible';
	}
}

/******************************************/
function setearAntSig(idC, orden, tipo){
	oCookie.set('idC' + tipo, idC);
	oCookie.set('orden' + tipo, orden);
}
function desetearAntSig(tipo){
	oCookie.unset('idC' + tipo);
	oCookie.unset('orden' + tipo);
}

/******************************************/
var cargarHTMLRequest = function(html){
	if(!$('htmlTemporal')){
		var div = document.createElement('div');
		div.id = 'htmlTemporal';
		div.style.display = 'none';
		document.body.appendChild(div);
	}
	$('htmlTemporal').innerHTML = html;
	while($('htmlTemporal').childNodes.length > 0){
		document.body.appendChild($('htmlTemporal').firstChild);	
	}
}

/******************************************/
var oRecomendar = new function(){
	var listener = function(){
		var d = req.respuestaXML;
		if(d){
			cargarHTMLRequest(d.firstChild.data);
			oRecomendar = new layer('Recomendar', 'recomendar');
			oRecomendar.addField($('nombreRecomendar'), 		'nombre', 		ER_STR, 	false);
			oRecomendar.addField($('emailRecomendar'), 			'email', 		ER_EMAIL, 	false);
			oRecomendar.addField($('nombreAmigoRecomendar'), 	'nombreAmigo', 	ER_STR, 	false);
			oRecomendar.addField($('emailAmigoRecomendar'), 	'emailAmigo', 	ER_EMAIL, 	false);
			oRecomendar.addField($('mensajeRecomendar'), 		'mensaje', 		ER_STR, 	false);
			oRecomendar.moreInfo = 'idElemento' + SEP_IGUAL + this.idTemp + SEP_AND;
			oRecomendar.moreInfo += 'idSeccion' + SEP_IGUAL + this.idSeccionTemp + SEP_AND;		
			if(this.idCategoria)oRecomendar.moreInfo += 'idCategoria' + SEP_IGUAL + this.idCategoria + SEP_AND;		
			AddEvent($('cerrarRecomendar'), 'click', oRecomendar.close);
			AddEvent($('enviarRecomendar'), 'click', function(){
				oRecomendar.send();
			});
			
			oRecomendar.mostrarFormulario = function(boton,id, idSeccion, e){
				oRecomendar.moreInfo = 'idElemento' + SEP_IGUAL + id + SEP_AND;
				oRecomendar.moreInfo += 'idSeccion' + SEP_IGUAL + idSeccion + SEP_AND;		
				oRecomendar.open(boton,'');
				
				if(e)StopEvent(e);

			}
			
			if(Nav.esIE){ $('layRecomendar').style.visibility = 'visible'; }
			oRecomendar.open(this.botonTemp,'');
			
		}
	}.closure(this);
	
	this.mostrarFormulario = function(boton,id, idSeccion, e){
		if(!req){
			this.botonTemp = boton;
			this.idTemp = id;
			this.idSeccionTemp = idSeccion;
			
			if(Nav.esIE6)var es = '1'
			else var es = '';
			req = new Request(listener);
			req.pedir(DIR_SERVER_ROOT + 'requests/cargar.php','file' + SEP_IGUAL +'../includes/popRecomendar.php' + SEP_AND + 'esIE6' + SEP_IGUAL + es + SEP_AND);
		}
		if(e)StopEvent(e);
	}
	var req = null;
}

/******************************************/
var SCRIPTS_SETEADOS = new Array();
var incluirScript = function(src){
	if(!SCRIPTS_SETEADOS[src]){
		var script = document.createElement('script');			
		script.type = 'text/javascript';
		script.src = src;
		document.body.appendChild(script);
		SCRIPTS_SETEADOS[src] = true;
	}
}

/******************************************/
var oConsConf = new Object();
oConsConf.iniciar = function(){
	if(this.idCategoria)oConsultaProducto.idCategoria = this.idCategoria;
	oConsultaProducto.consultar(this.aTemp,this.idProductoActual);
}
var oConsultaProducto = new function(){
	var seteando = false;

	this.consultar = function(a,idProducto,e){

		if(!seteando){
			seteando = true;
			oConsConf.aTemp = a;
			oConsConf.idProductoActual = idProducto;
			if(this.idCategoria)oConsConf.idCategoria = this.idCategoria;
			incluirScript(DIR_ROOT_INTERFAZ_CENTRAL + 'js/oConsultaProducto.js');			
			
		}
		if(e)StopEvent(e);
	}
}

var oEditContConf = new Object();
oEditContConf.iniciar = function(){
	oEditarContenido.editarContenido(this.idContTemp,this.tipoContenido);
}
var oEditarContenido = new function(){
	var seteando = false;

	this.analizarLogueo = function(){
		if(oCookie.get('dc') && Nav.esIE){
			if($('contBtnEditarContenido'))$('contBtnEditarContenido').style.display = 'block';
							
		}
	
	}


	this.editarContenido = function(idContenido,tipoContenido,e){
		if(!seteando){
			seteando = true;
			oEditContConf.idContTemp = idContenido;
			oEditContConf.tipoContenido = tipoContenido;
			incluirScript(DIR_ROOT_INTERFAZ_CENTRAL + 'js/EditarContenido.js');			
			
		}
		if(e)StopEvent(e);
	}
}

/******************************************/
var oVideoConf = new Object();
oVideoConf.iniciar = function(){
	oVideo.loadVideo(this.aTemp,this.idVideo,this.w,this.h);
}
var oVideo = new function(){
	var seteando = false;
	this.loadVideo = function(a,idVideo,w,h){
		if(!seteando){
			seteando = true;
			oVideoConf.aTemp = a;
			oVideoConf.idVideo = idVideo;
			oVideoConf.w = w;
			oVideoConf.h = h;
			incluirScript(DIR_ROOT_INTERFAZ_CENTRAL + 'js/oVideo.js');			
		}
	}
}

/******************************************/
var buscarImagenDentro = function(div){
	var i,j;
	for(i = 0; i < div.childNodes.length;i++){
		if(div.childNodes[i].tagName && div.childNodes[i].tagName.toLowerCase() == 'a'){
			for(j=0;j<div.childNodes[i].childNodes.length;j++){
				if(div.childNodes[i].childNodes[j].tagName && div.childNodes[i].childNodes[j].tagName.toLowerCase() == 'img')return div.childNodes[i].childNodes[j];
			}
		}
		else if(div.tagName.toLowerCase() == 'a' && div.childNodes[i].tagName && div.childNodes[i].tagName.toLowerCase() == 'img'){
			return div.childNodes[i];
		}
	}
	
}

/******************************************/
var buscarContenido = function(){
	if(!Nav.esIE6)$('formBusqueda').submit();	
	else{
		var url = $('formBusqueda').action + '?seccion=' + $('seccion').value + '&buscar=' + $('buscar').value;
		alert(url);
		document.location = url;
	}
}


