function suscripcionBoletin(email){

	//Copia el contenido original en el backup para poder usar el volver
	document.getElementById('newsletter_orig').innerHTML = document.getElementById('newsletter_fieldset').innerHTML;

	if (email != ''){
		if (validar_email(email)){
			getDataV1('suscripcionBoletin','ajax.php?object=suscripcionBoletin&email='+email,'newsletter_fieldset','');
		}
		else{
			document.getElementById('newsletter_fieldset_error').style.display = '';
			document.getElementById('newsletter_fieldset').style.display = 'none';
		}
	}
}

function newsletterVolver(){

	document.getElementById('newsletter_fieldset_error').style.display = 'none';
	document.getElementById('newsletter_fieldset').innerHTML = document.getElementById('newsletter_orig').innerHTML;
	document.getElementById('newsletter_fieldset').style.display = '';

}

//Añadir a favoritos desde la pagina de detalle de catalogo, con reload
function addProdFavorito(e,id_prod,reload,nom_prod){
	
	var caso = '';
	if (reload == 1)	caso = 'addProdFavorito';

	if (userLogin()){
		if (id_prod > 0){
			getDataV1(caso,'ajax.php?object=addProdFavorito&id_prod='+id_prod,'favorito_rta','');
		
			var inner_v = '<p class="title">' + nom_prod + '</p><p>ha sido a&ntilde;adido a tu lista de favoritos</p>';
			alertLoginFav('mostrar',inner_v,e,reload);
		}
	}
	else{
		var inner_v = '<p class="alert_two"><span>Para a&ntilde;adir este producto a tus favoritos debes ingresar<br />';
		inner_v += 'con tu c&eacute;dula y contrase&ntilde;a en  la parte superior derecha.<br /><br />Si a&uacute;n no eres cliente <br />';
		inner_v += 'platinum has</span><a href="registro/cliente/"> click aqu&iacute; </a><span>para registrarte.</span>';
		inner_v += '</p>';
		alertLoginFav('mostrar',inner_v,e,0);
	}
}


// visualizar un alerta, en caso de no estar logueado, con reload.
function addCom(e,id_prod,reload,nom_prod){
	
	if (userLogin()){
		var url_com1 = location.href;
	    var url_com2  = url_com1.split('\#');
		location.href = url_com2[0]+'#add_comentario';
	}
	else{
		
	    var inner_v = '<a href="#" onclick="alertLogin(\'ocultar\',\'\',event);return false;" class="closed">cerrar</a>';
        inner_v += '<p>Para a&ntilde;adir un comentario usted debe ser un usuario registrado</p>';
        inner_v += '<a href="#" onclick="alertLogin(\'ocultar\',\'\',event);location.reload();return false;" class="options">Ingresar</a><a href="registro/cliente/" class="options">Registrarse</a>';
      
		alertLogin('mostrar',inner_v,e,0);
	}
}


function delProdFavorito(e,id_prod,reload,nom_prod){
	
	var caso = '';
	if (reload == 1)	caso = 'delProdFavorito';
	
	if (id_prod > 0){
		getDataV1(caso,'ajax.php?object=delProdFavorito&id_prod='+id_prod,'favorito_rta','');
		
		var inner_v = '<p class="title">' + nom_prod + '</p><p><span>Producto eliminado de tu lista de favoritos</span></p>';
		alertLoginFav('mostrar',inner_v,e,reload);
		
	}
}

function userLogin(){
	if (document.getElementById('btn_login_out') == undefined)	return false;
	else					return true;
}


var actual = 1;
// GALERIA
function alertGaleria(accion,inner,e,reload,total,mover){
     
	//Ancho de la imagen de fondo del alert 
	var w_div = 510;
	var h_div = 610;

	//Valor de left para que siempre salga en el centro
	var left_v = (docwidth() - w_div) / 2;
	var top_v = (docVisibleHeight() - h_div) / 2;

	obj_fondo = document.getElementById('div_bcg');

	if(mover == 1 && actual > 1) actual--;
    if(mover == 2 && actual < total) actual++;	
		
	var img_actual = actual - 1;	
	
	var img_act = $("#imagen_"+img_actual).attr("value");

	if (accion == 'mostrar'){

		var inner_v = '';	    
		
		inner_v += '<div id="Gallery">';
		inner_v += '<div id="cornerGalleryUp" class="cornersGallery"></div>';
		inner_v += '<div id="contentGallery">';
		inner_v += '<div id="galleryPhoto">';
		inner_v += '<a class="cerrarGallery" href="#" onclick="alertGaleria(\'cerrar\',\'ok\',event,1,0,0); return false;"><span>cerrar</span></a>';		
		inner_v += '<img width="485px" height="510px" src="' + img_act + '" alt="Galeria" /> </div>';              
		inner_v += '<div id="cornerpagGalleryUp" class="cornersPagGallery"></div>';
		inner_v += '<div id="contentPagGallery">';
		inner_v += '<div class="paginacionGallery">';  
		
		if(actual > 1)
		inner_v += '<a class="bt_Galleryanterior" href="#" onclick="alertGaleria(\'mostrar\',\'ok\',event,1,' + total + ',1); return false;""><span>Anterior</span></a>'; 
		if(actual < total)
		inner_v += '<a class="bt_Gallerysiguiente" href="#" onclick="alertGaleria(\'mostrar\',\'ok\',event,1,' + total + ',2); return false;"><span>Siguiente</span></a>'; 
		inner_v += '<span>' + actual + ' de ' + total + '</span>';
		
		inner_v += '</div>';
		inner_v += '<img width="87" height="19" src="img/icon_gallery.gif"/> </div>';                    
		inner_v += '<div id="cornerpagGalleryBot" class="cornersPagGallery"></div>';
		inner_v += '</div>'; 
		inner_v += '<div id="cornerGalleryBot" class="cornersGallery"></div>'; 
		inner_v += '</div>';                   

		if ( obj_fondo == undefined){
			//Fondo negro
			fondo = document.createElement('div');

			fondo.id = 'div_bcg';
			fondo.style.background = "#6B6B6B";
			fondo.style.opacity =  0.50;
			fondo.style.filter = 'alpha(opacity=50)';
			fondo.style.width = docwidth()+'px';
			fondo.style.height = docheight()+'px';
			fondo.style.zIndex = 200;
			fondo.style.position = 'absolute';
			fondo.style.top = 0;
			fondo.style.left = 0;
			document.body.appendChild(fondo);
			
		}
		else{
			var alerta = document.getElementById('alert');
			if (alerta != undefined) document.body.removeChild(alerta);

			obj_fondo.style.display = '';
		} 

		var div = document.createElement('div');
		div.id = 'alert';
		div.style.zIndex = 500;
		div.style.left = left_v + 'px';
		div.innerHTML = inner_v;
		div.style.top = '100px';
		div.style.position = 'absolute';

		document.body.appendChild(div);
	}
	else{

		document.body.removeChild(document.getElementById('alert'));
		obj_fondo.style.display = 'none';
	}

}


// ALERT VISTA 360
function alertVista360(accion,inner,e,reload,archivo){

	//Ancho de la imagen de fondo del alert 
	var w_div = 509;
	var h_div = 600;

	//Valor de left para que siempre salga en el centro
	var left_v = (docwidth() - w_div) / 2;
	var top_v = (docVisibleHeight() - h_div) / 2;

	obj_fondo = document.getElementById('div_bcg');
	
	// Elemento Seleccionado
	//$("#vista").attr("style","background-position:bottom");

	if (accion == 'mostrar'){

		var inner_v = '';	 
		inner_v += '<div class="back">';
        inner_v += '<a id="close" href="#" onclick="alertVista360(\'cerrar\',\'ok\',event,1,\'no\'); return false;"><span>cerrar</span></a>';		
		inner_v += '</div>';
		inner_v += '<iframe id="marco" scrolling="no" frameborder="0" width="508" height="570" src="vista360/index.php?ruta_archivo=' + archivo +'" style="background:#ffffff;">';
		inner_v += '</iframe>';			
	
		if ( obj_fondo == undefined){
			//Fondo negro
			fondo = document.createElement('div');

			fondo.id = 'div_bcg';
			fondo.style.background = "#6B6B6B";
			fondo.style.opacity =  0.50;
			fondo.style.filter = 'alpha(opacity=50)';
			fondo.style.width = docwidth()+'px';
			fondo.style.height = docheight()+'px';
			fondo.style.zIndex = 200;
			fondo.style.position = 'absolute';
			fondo.style.top = 0;
			fondo.style.left = 0;
			document.body.appendChild(fondo);
			
		}
		else{
			var alerta = document.getElementById('alert');
			if (alerta != undefined) document.body.removeChild(alerta);

			obj_fondo.style.display = '';
		} 

		var div = document.createElement('div');
		div.id = 'alert';
		div.style.zIndex = 500;
		div.style.left = left_v + 'px';
		div.innerHTML = inner_v;
		div.style.top = '100px';
		div.style.position = 'absolute';
		div.style.overflow = 'hidden';

		document.body.appendChild(div);
	}
	else{

		document.body.removeChild(document.getElementById('alert'));
		obj_fondo.style.display = 'none';
	}

}


// ALERT CARACTERISTICAS
function alertCaracteristicas(accion,inner,e,reload,archivo){

	//Ancho de la imagen de fondo del alert 
	var w_div = 509;
	var h_div = 600;

	//Valor de left para que siempre salga en el centro
	var left_v = (docwidth() - w_div) / 2;
	var top_v = (docVisibleHeight() - h_div) / 2;

	obj_fondo = document.getElementById('div_bcg');
	
	// Elemento Seleccionado
	//$("#caract").attr("style","background-position:bottom");

	if (accion == 'mostrar'){

		var inner_v = '';	 
		inner_v += '<div class="back">';
        inner_v += '<a id="close" href="#" onclick="alertCaracteristicas(\'cerrar\',\'ok\',event,1,\'no\'); return false;"><span>cerrar</span></a>';		
		inner_v += '</div>';
		inner_v += '<iframe id="marco" scrolling="no" frameborder="0" width="510" height="553" src="vista360/index.php?ruta_archivo=' + archivo +'">';
		inner_v += '</iframe>';			
	
		if ( obj_fondo == undefined){
			//Fondo negro
			fondo = document.createElement('div');

			fondo.id = 'div_bcg';
			fondo.style.background = "#6B6B6B";
			fondo.style.opacity =  0.50;
			fondo.style.filter = 'alpha(opacity=50)';
			fondo.style.width = docwidth()+'px';
			fondo.style.height = docheight()+'px';
			fondo.style.zIndex = 200;
			fondo.style.position = 'absolute';
			fondo.style.top = 0;
			fondo.style.left = 0;
			document.body.appendChild(fondo);
			
		}
		else{
			var alerta = document.getElementById('alert');
			if (alerta != undefined) document.body.removeChild(alerta);

			obj_fondo.style.display = '';
		} 

		var div = document.createElement('div');
		div.id = 'alert';
		div.style.zIndex = 500;
		div.style.left = left_v + 'px';
		div.innerHTML = inner_v;
		div.style.top = '100px';
		div.style.position = 'absolute';

		document.body.appendChild(div);
	}
	else{

		document.body.removeChild(document.getElementById('alert'));
		obj_fondo.style.display = 'none';
	}

}



function validar_solicitud_descarga(clave){

 var clave_descarga = "zaqwesz";

 if(clave == "") {
 return false;
 }
 else if(clave != clave_descarga) {
 alert("Clave Erronea");
 return false; 
 }
 else {
 obj_fondo = document.getElementById('div_bcg');
 document.body.removeChild(document.getElementById('alert'));
 obj_fondo.style.display = 'none';
 return true;
 }

 }

 
function validar_formulario_descarga(nombre,email,telefono,celular,ciudad){
 
 var Error = "Los siguientes campos son requeridos:\n\n";
 
 if(nombre == "" || email == "" || telefono == "" || celular == "" || ciudad == "") {
 
 if(nombre == "") Error += "- Nombre\n";
 if(email == "") Error += "- E-mail\n";
 if(telefono == "") Error += "- Tel\xe9fono\n";
 if(celular == "") Error += "- Celular\n";
 if(ciudad == "") Error += "- Ciudad\n"; 
 
 alert(Error);
 return false;
 
 } else if (email != ""){
	if(!validar_email(email)){
	alert('Formato de Email incorrecto');
	return false;
    }	
 } else return true;

}


// ALERT SOLICITUD DESCARGA
function alertSolicitudDescarga(accion,inner,e,reload,archivo){

	//Ancho de la imagen de fondo del alert 
	var w_div = 389;
	var h_div = 225;

	//Valor de left para que siempre salga en el centro
	var left_v = (docwidth() - w_div) / 2;
	var top_v = (docVisibleHeight() - h_div) / 2;

	obj_fondo = document.getElementById('div_bcg');

	if (accion == 'mostrar'){

		var inner_v = '';	 
		inner_v += '<div id="requestPassword">';
        inner_v += '<div onclick="alertSolicitudDescarga(\'cerrar\',\'ok\',event,1,\'no\'); return false;" class="bt_cerrar_formulario"></div>';		
		inner_v += '<div class="password">';
		inner_v += ' <h2> Solicitud de descarga </h2>';
		inner_v += ' <p>Para descargar este archivo se necesita una contraseña:</p>';	
		inner_v += ' <div id="insertarPassword">';
        inner_v += ' <form>';		
		inner_v += ' <input class="selectPassword" type="password" id="clave" name="clave" value="" />';
		inner_v += ' <a href="' + archivo + '" target="_blank" class="btEnviarPassword" onclick="return validar_solicitud_descarga(document.getElementById(\'clave\').value);" />Enviar</a>';
		inner_v += ' </form>';	
		inner_v += ' </div>';
        inner_v += '<p>*Para obtener la contraseña debe diligenciar el formulario de descarga.';		
		inner_v += 'si no lo ha diligenciado <a href="#" onclick="alertFormularioDescarga(\'mostrar\',\'ok\',event,1,\'no\'); return false;">haga click aquí</a></p>';
		inner_v += '</div>';
		inner_v += '</div>';		
	
		if ( obj_fondo == undefined){
			//Fondo negro
			fondo = document.createElement('div');

			fondo.id = 'div_bcg';
			fondo.style.background = "#6B6B6B";
			fondo.style.opacity =  0.50;
			fondo.style.filter = 'alpha(opacity=50)';
			fondo.style.width = docwidth()+'px';
			fondo.style.height = docheight()+'px';
			fondo.style.zIndex = 200;
			fondo.style.position = 'absolute';
			fondo.style.top = 0;
			fondo.style.left = 0;
			document.body.appendChild(fondo);
			
		}
		else{
			var alerta = document.getElementById('alert');
			if (alerta != undefined) document.body.removeChild(alerta);
			obj_fondo.style.display = '';
		} 

		var div = document.createElement('div');
		div.id = 'alert';
		div.style.zIndex = 500;
		div.style.left = left_v + 'px';
		div.innerHTML = inner_v;
		div.style.position = 'fixed';
		div.style.top = top_v + 'px';
		
		if (getBrowser() == 'ie6'){
			div.style.position = 'absolute';
		}		

		document.body.appendChild(div);
		
	}
	else{

		document.body.removeChild(document.getElementById('alert'));
		obj_fondo.style.display = 'none';
	}

	return false;
	
}


// ALERT FORMULARIO DESCARGA
function alertFormularioDescarga(accion,inner,e,reload){

	//Ancho de la imagen de fondo del alert 
	var w_div = 387;
	var h_div = 403;

	//Valor de left para que siempre salga en el centro
	var left_v = (docwidth() - w_div) / 2;
	var top_v = (docVisibleHeight() - h_div) / 2;

	obj_fondo = document.getElementById('div_bcg');

	if (accion == 'mostrar'){

		var inner_v = '';	 
		inner_v += '<div id="download">';
        inner_v += '<div onclick="alertFormularioDescarga(\'cerrar\',\'ok\',event,1); return false;" class="bt_cerrar_formulario"></div>';		
		inner_v += '<div id="downloadText">';
		inner_v += ' <h2> Formulario de descarga </h2>';
		inner_v += ' <p>Diligencie este formulario para solicitar la clave de acceso para descargar PDFs y librerias CAD.</p>';	
		inner_v += ' <span>Todos los campos son obligatorios</span>';
        inner_v += ' <div>';		
		inner_v += ' <form name="form_descarga" action="" method="post">';
		inner_v += ' <label>Nombre</label>';
		inner_v += ' <input class="selectContact" type="text" id="nombre" name="nombre" value="" />';	
		inner_v += ' <label>E-mail</label>';
        inner_v += ' <input class="selectContact" type="text" id="email" name="email" value="" />';		
		inner_v += ' <label>Teléfono</label>';
		inner_v += ' <input class="selectContact" type="text" id="telefono" name="telefono" value="" />';
		inner_v += ' <label>Celular</label>';	
		inner_v += ' <input class="selectContact" type="text" id="celular" name="celular" value="" />';
        inner_v += ' <label>Ciudad</label>';		
		inner_v += ' <input class="selectContact" type="text" id="ciudad" name="ciudad" value="" />';
		inner_v += ' <input class="btEnviar bt_enviar_margin" type="submit" name="send" value="Enviar" onclick="return validar_formulario_descarga(document.getElementById(\'nombre\').value,document.getElementById(\'email\').value,document.getElementById(\'telefono\').value,document.getElementById(\'celular\').value,document.getElementById(\'ciudad\').value);" />';
		inner_v += ' </form>';	
		inner_v += ' </div>';		
	
		if ( obj_fondo == undefined){
			//Fondo negro
			fondo = document.createElement('div');

			fondo.id = 'div_bcg';
			fondo.style.background = "#6B6B6B";
			fondo.style.opacity =  0.50;
			fondo.style.filter = 'alpha(opacity=50)';
			fondo.style.width = docwidth()+'px';
			fondo.style.height = docheight()+'px';
			fondo.style.zIndex = 200;
			fondo.style.position = 'absolute';
			fondo.style.top = 0;
			fondo.style.left = 0;
			document.body.appendChild(fondo);
			
		}
		else{
			var alerta = document.getElementById('alert');
			if (alerta != undefined) document.body.removeChild(alerta);

			obj_fondo.style.display = '';
		} 

		var div = document.createElement('div');
		div.id = 'alert';
		div.style.zIndex = 500;
		div.style.left = left_v + 'px';
		div.innerHTML = inner_v;
		div.style.position = 'fixed';
		div.style.top = top_v + 'px';
	    
		if (getBrowser() == 'ie6'){
		  div.style.position = 'absolute';
		}		
		
		document.body.appendChild(div);
		
	}
	else{

		document.body.removeChild(document.getElementById('alert'));
		obj_fondo.style.display = 'none';
	}

	return false;
	
}


// ALERT LOGUEO
function alertLogin(accion,inner,e,reload,lenguaje){

	//Ancho de la imagen de fondo del alert 
	var w_div = 354;
	var h_div = 248;

	//Valor de left para que siempre salga en el centro
	var left_v = (docwidth() - w_div) / 2;
	var top_v = (docVisibleHeight() - h_div) / 2;

	obj_fondo = document.getElementById('div_bcg');

	if (accion == 'mostrar'){

		var inner_v = '';
		
		if(lenguaje == 1) {		
		inner_v += '<div id="login_sesion" class="Login">';
		inner_v += '<div class="Divclose">';
		inner_v += '<a href="#" onclick="alertLogin(\'cerrar\',\'ok\',event,1,1); return false;" class="cerrarAlert"><span class="cerrarNone">cerrar</span></a>';
		inner_v += '</div>';
		inner_v += '<span id="error_sesion" class="loginAlert" > Ingresa tus datos </span>';		
		inner_v += '  <form id="log_in" name="log_in" method="post" action="#">';              
		inner_v += '  <label>Usuario</label>';
		inner_v += '  <div class="cornerFieldsAlert cornerLeftL"></div>';
		inner_v += '  <input id="usuario" name="usuario" class="fieldAlert" type="text" value="Usuario" onfocus="ocultar_value_usuario(this);"  onblur="mostrar_value_usuario(this,1);" />';                    
		inner_v += '  <div class="cornerFieldsAlert cornerRightL"></div>'; 
		inner_v += '  <label>Contraseña</label>';
		inner_v += '  <div class="cornerFieldsAlert cornerLeftL"></div>';
		inner_v += '  <input id="pass" name="pass" class="fieldAlert" type="password" value="" />';                    
		inner_v += '  <div class="cornerFieldsAlert cornerRightL"></div>';
		inner_v += '  <a href="registro/usuario/" class="spaceAlerta">Registrarse</a>'; 
		inner_v += '  <a href="#" class="spaceAlerta" onclick="alertPass(\'mostrar\',\'ok\',event,1,1); return false;">Olvide Mi Contrase&ntilde;a</a>'; 
		inner_v += '  <input id="btn_login" name="send" class="btIngresar" type="submit" value="Ingresar" onclick="signIn(); return false;" />';                   
		inner_v += '  </form>';         
		inner_v += '  </div>';   
        } else {
        inner_v += '<div id="login_sesion" class="Login">';
		inner_v += '<div class="Divclose">';
		inner_v += '<a href="#" onclick="alertPass(\'cerrar\',\'ok\',event,1,2); return false;" class="closeAlert"><span class="cerrarNone">close</span></a>';
		inner_v += '</div>';
		inner_v += '<span id="error_sesion" class="loginAlert" > Enter your information </span>';		
		inner_v += '  <form id="log_in" name="log_in" method="post" action="#">';              
		inner_v += '  <label>User</label>';
		inner_v += '  <div class="cornerFieldsAlert cornerLeftL"></div>';
		inner_v += '  <input id="usuario" name="usuario" class="fieldAlert" type="text" value="User" onfocus="ocultar_value_usuario(this);"  onblur="mostrar_value_usuario(this,2);" />';                    
		inner_v += '  <div class="cornerFieldsAlert cornerRightL"></div>';  
		inner_v += '  <label>Password</label>';
		inner_v += '  <div class="cornerFieldsAlert cornerLeftL"></div>';
		inner_v += '  <input id="pass" name="pass" class="fieldAlert" type="password" value="" />';                    
		inner_v += '  <div class="cornerFieldsAlert cornerRightL"></div>';
		inner_v += '  <a href="registro/user/" class="spaceAlerta">Register</a>'; 
		inner_v += '  <a href="#" class="spaceAlerta" onclick="alertPass(\'mostrar\',\'ok\',event,1,2); return false;">Forget My Password</a>'; 
		inner_v += '  <input id="btn_login" name="send" class="btIngresar" type="submit" value="Sign in" onclick="signIn(); return false;" />';                   
		inner_v += '  </form>';         
		inner_v += '  </div>';   		
		}
		
		if ( obj_fondo == undefined){
			//Fondo negro
			fondo = document.createElement('div');

			fondo.id = 'div_bcg';
			fondo.style.background = "#6B6B6B";
			fondo.style.opacity =  0.50;
			fondo.style.filter = 'alpha(opacity=50)';
			fondo.style.width = docwidth()+'px';
			fondo.style.height = docheight()+'px';
			fondo.style.zIndex = 5;
			fondo.style.position = 'absolute';
			fondo.style.top = 0;
			fondo.style.left = 0;
			document.body.appendChild(fondo);
			
		}
		else{
			var alerta = document.getElementById('alert');
			if (alerta != undefined) document.body.removeChild(alerta);

			obj_fondo.style.display = '';
		} 

		var div = document.createElement('div');
		div.id = 'alert';
		div.style.zIndex = 500;
		div.style.left = left_v + 'px';
		div.innerHTML = inner_v;
		div.className = 'fixed';

		if (getBrowser() != 'ie'){
			div.style.top = top_v + 'px';
			div.style.position = 'fixed';
		}
		else{
			//crea el iframe para el combo de marca quede por debajo
			var iframe = document.createElement('iframe');
			iframe.id = 'iframe_bcg';
			iframe.style.width = docwidth() + 'px';
			iframe.style.height = docheight() + 'px';
			iframe.style.top = 0;
			iframe.style.left = 0;
			iframe.style.filter = 'alpha(opacity=0)';
			iframe.style.position = 'absolute';
			iframe.style.zIndex = 3;
			document.body.appendChild(iframe);

		}
		document.body.appendChild(div);
	}
	else{

		document.body.removeChild(document.getElementById('alert'));
		if (getBrowser() == 'ie')	document.body.removeChild(document.getElementById('iframe_bcg'));
		obj_fondo.style.display = 'none';
	}

}


// ALERT RECUPERAR PASSWORD
function alertPass(accion,inner,e,reload,lenguaje){

	//Ancho de la imagen de fondo del alert 
	var w_div = 354;
	var h_div = 248;

	//Valor de left para que siempre salga en el centro
	var left_v = (docwidth() - w_div) / 2;
	var top_v = (docVisibleHeight() - h_div) / 2;

	obj_fondo = document.getElementById('div_bcg');

	if (accion == 'mostrar'){

		var inner_v = '';
		
		if(lenguaje == 1) {		
		inner_v += '<div class="Login">';
		inner_v += '<div class="Divclose">';
		inner_v += '<a href="#" onclick="alertPass(\'cerrar\',\'ok\',event,1,1); return false;" class="cerrarAlert"><span class="cerrarNone">cerrar</span></a>';
		inner_v += '</div>';
		inner_v += '<span class="loginAlert" > Recuperar Contraseña </span>';		
		inner_v += '  <form id="registro" name="form4" action="registro/usuario/" method="POST" enctype="multipart/form-data">';              
		inner_v += '  <p class="lostPassword Puno">Por favor ingrese el correo electrónico con el cual se</p>';
		inner_v += '  <p class="lostPassword">registró en la página de Electricas Bogotá  para </p>';
		inner_v += '  <p class="lostPassword">enviarle sus datos de ingreso</p>';                    
		inner_v += '  <label>Correo Electrónico</label>';  
		inner_v += '  <div class="cornerFieldsAlert cornerLeftL"></div>';
		inner_v += '  <input id="email" name="email" class="fieldAlert" type="text" value="Correo electrónico" onfocus="ocultar_value_correo(this);"  onblur="mostrar_value_correo(this,1);" /> ';
		inner_v += '  <div class="cornerFieldsAlert cornerRightL"></div>';   
		inner_v += '  <input id="send" name="submit_recuperar" class="btIngresar" type="submit" value="Enviar" />';
		inner_v += '  </form>';         
		inner_v += '  </div>';   
        } else {
        inner_v += '<div class="Login">';
		inner_v += '<div class="Divclose">';
		inner_v += '<a href="#" onclick="alertPass(\'cerrar\',\'ok\',event,1,2); return false;" class="closeAlert"><span class="cerrarNone">cerrar</span></a>';
		inner_v += '</div>';
		inner_v += '<span class="loginAlert" > Lost Password </span>';		
		inner_v += '  <form id="registro" name="form4" action="registro/user/" method="POST" enctype="multipart/form-data">';              
		inner_v += '  <p class="lostPassword Puno">Please enter your email which posted</p>';
		inner_v += '  <p class="lostPassword">on the website of Bogota Generators </p>';
		inner_v += '  <p class="lostPassword">send your login information</p>';                    
		inner_v += '  <label>Email</label>';  
		inner_v += '  <div class="cornerFieldsAlert cornerLeftL"></div>';
		inner_v += '  <input id="email" name="email" class="fieldAlert" type="text" value="E-mail" onfocus="ocultar_value_correo(this);"  onblur="mostrar_value_correo(this,2);" /> ';
		inner_v += '  <div class="cornerFieldsAlert cornerRightL"></div>';    
		inner_v += '  <input id="send" name="submit_recuperar" class="btIngresar" type="submit" value="Send" />';
		inner_v += '  </form>';         
		inner_v += '  </div>';   	
		}
		
		if ( obj_fondo == undefined){
			//Fondo negro
			fondo = document.createElement('div');

			fondo.id = 'div_bcg';
			fondo.style.background = "#6B6B6B";
			fondo.style.opacity =  0.50;
			fondo.style.filter = 'alpha(opacity=50)';
			fondo.style.width = docwidth()+'px';
			fondo.style.height = docheight()+'px';
			fondo.style.zIndex = 5;
			fondo.style.position = 'absolute';
			fondo.style.top = 0;
			fondo.style.left = 0;
			document.body.appendChild(fondo);
			
		}
		else{
			var alerta = document.getElementById('alert');
			if (alerta != undefined) document.body.removeChild(alerta);

			obj_fondo.style.display = '';
		} 

		var div = document.createElement('div');
		div.id = 'alert';
		div.style.zIndex = 500;
		div.style.left = left_v + 'px';
		div.innerHTML = inner_v;
		div.className = 'fixed';

		if (getBrowser() != 'ie'){
			div.style.top = top_v + 'px';
			div.style.position = 'fixed';
		}
		else{
			//crea el iframe para el combo de marca quede por debajo
			var iframe = document.createElement('iframe');
			iframe.id = 'iframe_bcg';
			iframe.style.width = docwidth() + 'px';
			iframe.style.height = docheight() + 'px';
			iframe.style.top = 0;
			iframe.style.left = 0;
			iframe.style.filter = 'alpha(opacity=0)';
			iframe.style.position = 'absolute';
			iframe.style.zIndex = 3;
			document.body.appendChild(iframe);

		}
		document.body.appendChild(div);
	}
	else{

		document.body.removeChild(document.getElementById('alert'));
		if (getBrowser() == 'ie')	document.body.removeChild(document.getElementById('iframe_bcg'));
		obj_fondo.style.display = 'none';
	}

}


// ALERT AGREGAR CARRITO 
function alertAgregar(accion,inner,e,estado,lenguaje,id_detalle,cantidad,producto,nom_cat){
	
	inner = $("#inner_"+cantidad).attr("value");
	
	if(estado == 0) {	
	
	//Ancho de la imagen de fondo del alert 
	var w_div = 354;
	var h_div = 300;

	//Valor de left para que siempre salga en el centro
	var left_v = (docwidth() - w_div) / 2;
	var top_v = (docVisibleHeight() - h_div) / 2;

	obj_fondo = document.getElementById('div_bcg');	
	
	if (accion == 'mostrar'){

		var inner_v = '';
		
		if(lenguaje == 1) {		
		inner_v += '<div class="alertRegister">';
		
		if(inner == 'agregar')
		inner_v += '<p>Para añadir este producto al carrito de</p>';
		else
		inner_v += '<p>Para remover este producto del carrito de</p>';
		
		inner_v += '<p>compras debe ingresar su Usuario y</p>';
		inner_v += '<p>Contraseña en la parte superior derecha</p>';
		inner_v += '<div id="alertPdos">';		
		inner_v += '<p>Si aun no se ha registrado haga<a id="clickAlert"href="registro/usuario/"> click aquí</a></p>';              
		inner_v += '<p>para registrarse.</p>';
		inner_v += '</div>';
		inner_v += '<div class="aAlertdos">';                    
		inner_v += '<a href="#" onclick="alertAgregar(\'cerrar\',\'ok\',event,0,1,'+id_detalle+','+cantidad+',0,0); return false;">Aceptar</a>';            
		inner_v += '</div>';
		inner_v += '</div>';		
        } else {
        inner_v += '<div class="alertRegister">';
		
		if(inner == 'agregar')
		inner_v += '<p>To add this product to cart</p>';
		else
		inner_v += '<p>To remove this product from the cart</p>';
		
		inner_v += '<p>purchases must enter your Username and</p>';
		inner_v += '<p>Password at the top right</p>';
		inner_v += '<div id="alertPdos">';		
		inner_v += '<p>If you have not registered yet do<a id="clickAlert"href="registro/user/"> click here</a></p>';              
		inner_v += '<p>to register.</p>';
		inner_v += '</div>';
		inner_v += '<div class="aAlertdos">';                    
		inner_v += '<a href="#" onclick="alertAgregar(\'cerrar\',\'ok\',event,0,2,'+id_detalle+','+cantidad+',0,0); return false;">Ok</a>';            
		inner_v += '</div>';
		inner_v += '</div>';  	
		}
		
		if ( obj_fondo == undefined){
			//Fondo negro
			fondo = document.createElement('div');

			fondo.id = 'div_bcg';
			fondo.style.background = "#6B6B6B";
			fondo.style.opacity =  0.50;
			fondo.style.filter = 'alpha(opacity=50)';
			fondo.style.width = docwidth()+'px';
			fondo.style.height = docheight()+'px';
			fondo.style.zIndex = 5;
			fondo.style.position = 'absolute';
			fondo.style.top = 0;
			fondo.style.left = 0;
			document.body.appendChild(fondo);
			
		}
		else{
			var alerta = document.getElementById('alert');
			if (alerta != undefined) document.body.removeChild(alerta);

			obj_fondo.style.display = '';
		} 

		var div = document.createElement('div');
		div.id = 'alert';
		div.style.zIndex = 500;
		div.style.left = left_v + 'px';
		div.innerHTML = inner_v;
		div.className = 'fixed';

		if (getBrowser() != 'ie'){
			div.style.top = top_v + 'px';
			div.style.position = 'fixed';
		}
		else{
			//crea el iframe para el combo de marca quede por debajo
			var iframe = document.createElement('iframe');
			iframe.id = 'iframe_bcg';
			iframe.style.width = docwidth() + 'px';
			iframe.style.height = docheight() + 'px';
			iframe.style.top = 0;
			iframe.style.left = 0;
			iframe.style.filter = 'alpha(opacity=0)';
			iframe.style.position = 'absolute';
			iframe.style.zIndex = 3;
			document.body.appendChild(iframe);

		}
		
		document.body.appendChild(div);	
       		
	}
	else {

		document.body.removeChild(document.getElementById('alert'));
		if (getBrowser() == 'ie')	document.body.removeChild(document.getElementById('iframe_bcg'));
		obj_fondo.style.display = 'none';
			
	}
	
	    return false;	
	
	} // Fin del if de estado = 0
	
	else {	
	    
	//Ancho de la imagen de fondo del alert 
	var w_div = 354;
	var h_div = 300;

	//Valor de left para que siempre salga en el centro
	var left_v = (docwidth() - w_div) / 2;
	var top_v = (docVisibleHeight() - h_div) / 2;

	obj_fondo = document.getElementById('div_bcg');
	
	    
		if (accion == 'mostrar'){
        
        inner_v += '<div class="Alert">';
		inner_v += '<p class="alertFont" > ' + producto + ' </p>';
		inner_v += '<p > ' + nom_cat + ' </p>';
		
		if(lenguaje == 1) {		
				
		if(inner == 'agregar')
		inner_v += '<p class="infoCart"> Ha sido añadido al carrito</p>';
		else
		inner_v += '<p class="infoCart"> Ha sido removido del carrito</p>';
		
		inner_v += '<div class="aAlert">';		
		inner_v += '<a href="#" onclick="alertAgregar(\'cerrar\',\''+inner+'\',event,1,1,'+id_detalle+','+cantidad+',0,0); return false;">Aceptar</a>';        
		inner_v += '</div>';         
		inner_v += '</div>';   
        } else { 
		
		if(inner == 'agregar')
		inner_v += '<p class="infoCart"> Has been added to cart</p>';
		else
		inner_v += '<p class="infoCart"> Has been removed from cart</p>';
		
		inner_v += '<div class="aAlert">';		
		inner_v += '<a href="#" onclick="alertAgregar(\'cerrar\',\''+inner+'\',event,1,2,'+id_detalle+','+cantidad+',0,0); return false;">Ok</a>';        
		inner_v += '</div>';         
		inner_v += '</div>';   
		
		}
		
		if ( obj_fondo == undefined){
			//Fondo negro
			fondo = document.createElement('div');

			fondo.id = 'div_bcg';
			fondo.style.background = "#6B6B6B";
			fondo.style.opacity =  0.50;
			fondo.style.filter = 'alpha(opacity=50)';
			fondo.style.width = docwidth()+'px';
			fondo.style.height = docheight()+'px';
			fondo.style.zIndex = 5;
			fondo.style.position = 'absolute';
			fondo.style.top = 0;
			fondo.style.left = 0;
			document.body.appendChild(fondo);
			
		}
		else{
			var alerta = document.getElementById('alert');
			if (alerta != undefined) document.body.removeChild(alerta);

			obj_fondo.style.display = '';
		} 

		var div = document.createElement('div');
		div.id = 'alert';
		div.style.zIndex = 500;
		div.style.left = left_v + 'px';
		div.innerHTML = inner_v;
		div.className = 'fixed';

		if (getBrowser() != 'ie'){
			div.style.top = top_v + 'px';
			div.style.position = 'fixed';
		}
		else{
			//crea el iframe para el combo de marca quede por debajo
			var iframe = document.createElement('iframe');
			iframe.id = 'iframe_bcg';
			iframe.style.width = docwidth() + 'px';
			iframe.style.height = docheight() + 'px';
			iframe.style.top = 0;
			iframe.style.left = 0;
			iframe.style.filter = 'alpha(opacity=0)';
			iframe.style.position = 'absolute';
			iframe.style.zIndex = 3;
			document.body.appendChild(iframe);

		}
		
		document.body.appendChild(div);	
		
	}
	else {

		document.body.removeChild(document.getElementById('alert'));
		if (getBrowser() == 'ie')	document.body.removeChild(document.getElementById('iframe_bcg'));
		obj_fondo.style.display = 'none';
		
		if(inner == "agregar") {
		
		$("#carrito_"+cantidad).removeClass("butCarritodos");
        $("#carrito_"+cantidad).addClass("butRemoveDetail");
		
		if(lenguaje == 1)
		$("#carrito_"+cantidad).attr("value","Remover");	
		else
		$("#carrito_"+cantidad).attr("value","Remove");
		
		$("#cantidad_"+cantidad).removeClass("fDetail");
        $("#cantidad_"+cantidad).addClass("fDetaildos");
		
		$("#inner_"+cantidad).attr("value","remover");
		
		var num = $("#cantidad_"+cantidad).attr("value");	
		
		getDataV1('','ajax.php?object=AddProdCarrito&id_detalle='+id_detalle+'&cantidad='+num,'carrito_rta','');
		
        $("#total_items_carrito").text(parseInt($("#total_items_carrito").text())+1);		
		
		} else {		
		
		$("#carrito_"+cantidad).removeClass("butRemoveDetail");
        $("#carrito_"+cantidad).addClass("butCarritodos");
		
		if(lenguaje == 1)
		$("#carrito_"+cantidad).attr("value","Agregar al carrito");	
		else
		$("#carrito_"+cantidad).attr("value","Add to Cart");
		
		$("#cantidad_"+cantidad).removeClass("fDetaildos");
        $("#cantidad_"+cantidad).addClass("fDetail");
		
		$("#inner_"+cantidad).attr("value","agregar");
		
		var num = $("#cantidad_"+cantidad).attr("value");	
		
		getDataV1('','ajax.php?object=DelProdCarrito&id_detalle='+id_detalle+'&cantidad='+num,'carrito_rta','');
		
        $("#total_items_carrito").text(parseInt($("#total_items_carrito").text())-1);

        $("#item_carrito_"+cantidad).hide();			
		
		}
		
	}	
	
     return false;	
	
	} // Fin del else estado = 1
	   
} // Fin de la función



// ALERT ENVIAR A UN AMIGO
function alertFriend(accion,inner,e,reload,lenguaje){

	//Ancho de la imagen de fondo del alert 
	var w_div = 354;
	var h_div = 400;

	//Valor de left para que siempre salga en el centro
	var left_v = (docwidth() - w_div) / 2;
	var top_v = (docVisibleHeight() - h_div) / 2;

	obj_fondo = document.getElementById('div_bcg');

	if (accion == 'mostrar'){

		var inner_v = '';
		
		if(lenguaje == 1) {		
		inner_v += '<div class="SendFriend">';
		inner_v += '<h2> Enviar a un amigo</h2>';
		inner_v += '<p> Todos los campos son requeridos </p>';
		inner_v += '<p> Su Correo Electrónico</p>';
		inner_v += '<form id="form_friend" name="form_friend" action="" method="POST" enctype="multipart/form-data">';		
		inner_v += '  <div class="cornerFieldsSendTo cornerLeftF"></div>';            
		inner_v += '  <input id="email" name="email" class="fieldFriend" type="text" value="Correo electrónico" onfocus="ocultar_value_correo(this);"  onblur="mostrar_value_correo(this,1);" />';		
		inner_v += '  <div class="cornerFieldsSendTo cornerRightF"></div>'; 
		inner_v += '  <p>Correo Electrónico del destinatario</p>';                    
		inner_v += '  <div class="cornerFieldsSendTo cornerLeftF"></div>';            
		inner_v += '  <input id="email_a" name="email_a" class="fieldFriend" type="text" value="Correo electrónico" onfocus="ocultar_value_correo(this);"  onblur="mostrar_value_correo(this,1);" />';
		inner_v += '  <div class="cornerFieldsSendTo cornerRightF"></div>';
		inner_v += '  <label id="labelCheck">Recibir una copia de este Email</label>';                    
		inner_v += '  <input id="check" name="check" type="checkbox" />';
		inner_v += '  <input id="send_friend" name="send_friend" class="btFriend" type="submit" value="Enviar" />'; 
		inner_v += '  <a class="btCloseFriend" href="#" onclick="alertFriend(\'cerrar\',\'ok\',event,1,1); return false;">Cerrar</a>'; 
		inner_v += '</form>';                        
		inner_v += '</div>';   
        } else {
        inner_v += '<div class="SendFriend">';
		inner_v += '<h2> Send to a friend</h2>';
		inner_v += '<p> All fields are required </p>';
		inner_v += '<p> Your Email Address</p>';
		inner_v += '<form id="send_friend" name="send_friend" action="" method="POST" enctype="multipart/form-data">';		
		inner_v += '  <div class="fieldWrap">';
		inner_v += '  <div class="cornerFieldsSendTo cornerLeftF"></div>';              
		inner_v += '  <input id="email" name="email" class="fieldFriend" type="text" value="E-mail" onfocus="ocultar_value_correo(this);" onblur="mostrar_value_correo(this,2);" />';
		inner_v += '  <div class="cornerFieldsSendTo cornerRightF"></div>';
		inner_v += '  </div>';
		inner_v += '  <p>E-mail recipient</p>'; 
		inner_v += '  <div class="fieldWrap">';		
		inner_v += '  <div class="cornerFieldsSendTo cornerLeftF"></div>';            
		inner_v += '  <input id="email_a" name="email_a" class="fieldFriend" type="text" value="E-mail" onfocus="ocultar_value_correo(this);" onblur="mostrar_value_correo(this,2);" />';
		inner_v += '  <div class="cornerFieldsSendTo cornerRightF"></div>';
		inner_v += '  </div>';
		inner_v += '  <label id="labelCheck">Receive a copy of this Email</label>';                    
		inner_v += '  <input id="check" name="check" type="checkbox" />';
		inner_v += '  <input id="send_friend" name="send_friend" class="btFriend" type="submit" value="Send" />'; 
		inner_v += '  <a class="btCloseFriend" href="#" onclick="alertFriend(\'cerrar\',\'ok\',event,1,2); return false;">Close</a>'; 
		inner_v += '</form>';                        
		inner_v += '</div>';  		
		}
		
		if ( obj_fondo == undefined){
			//Fondo negro
			fondo = document.createElement('div');

			fondo.id = 'div_bcg';
			fondo.style.background = "#6B6B6B";
			fondo.style.opacity =  0.50;
			fondo.style.filter = 'alpha(opacity=50)';
			fondo.style.width = docwidth()+'px';
			fondo.style.height = docheight()+'px';
			fondo.style.zIndex = 5;
			fondo.style.position = 'absolute';
			fondo.style.top = 0;
			fondo.style.left = 0;
			document.body.appendChild(fondo);
			
		}
		else{
			var alerta = document.getElementById('alert');
			if (alerta != undefined) document.body.removeChild(alerta);

			obj_fondo.style.display = '';
		} 

		var div = document.createElement('div');
		div.id = 'alert';
		div.style.zIndex = 500;
		div.style.left = left_v + 'px';
		div.innerHTML = inner_v;
		div.className = 'fixed';

		if (getBrowser() != 'ie'){
			div.style.top = top_v + 'px';
			div.style.position = 'fixed';
		}
		else{
			//crea el iframe para el combo de marca quede por debajo
			var iframe = document.createElement('iframe');
			iframe.id = 'iframe_bcg';
			iframe.style.width = docwidth() + 'px';
			iframe.style.height = docheight() + 'px';
			iframe.style.top = 0;
			iframe.style.left = 0;
			iframe.style.filter = 'alpha(opacity=0)';
			iframe.style.position = 'absolute';
			iframe.style.zIndex = 3;
			document.body.appendChild(iframe);

		}
		document.body.appendChild(div);
	}
	else{
        
		if(accion == 'enviar') {
		getDataV1('','ajax.php?object=sendFriend&email='+email+'&email_a='+email_a,'carrito_rta','');
		}
		
		document.body.removeChild(document.getElementById('alert'));
		if (getBrowser() == 'ie')	document.body.removeChild(document.getElementById('iframe_bcg'));
		obj_fondo.style.display = 'none';
	}

}


// PRODUCTO FAVORITO
function alertLoginFav(accion,inner,e,reload){

	var reload_js = '';
	if (reload == 1)	reload_js = 'location.reload()';
	
	//Ancho de la imagen de fondo del alert 
	var w_div = 340;
	var h_div = 142;

	//Valor de left para que siempre salga en el centro
	var left_v = (docwidth() - w_div) / 2;
	var top_v = (docVisibleHeight() - h_div) / 2;

	obj_fondo = document.getElementById('div_bcg');

	if (accion == 'mostrar'){

		var inner_v = '<div class="log">' + inner + '</div>';
		inner_v += '<a href="#" onclick="alertLoginFav(\'ocultar\',\'\',event);'+reload_js+';return false;"><div class="bot_acept"><p>Aceptar</p></div></a>';


		if ( obj_fondo == undefined){
			//Fondo negro
			fondo = document.createElement('div');

			fondo.id = 'div_bcg';
			fondo.style.background = "#6B6B6B";
			fondo.style.opacity = 0.50;
			fondo.style.filter = 'alpha(opacity=50)';
			fondo.style.width = docwidth()+'px';
			fondo.style.height = docheight()+'px';
			fondo.style.zIndex = 5;
			fondo.style.position = 'absolute';
			fondo.style.top = 0;
			fondo.style.left = 0;
			document.body.appendChild(fondo);
		}
		else{
			var alerta = document.getElementById('alert');
			if (alerta != undefined) document.body.removeChild(alerta);

			obj_fondo.style.display = '';
		} 

		var div = document.createElement('div');
		div.id = 'alert';
		div.style.zIndex = 500;
		div.style.left = left_v + 'px';
		div.innerHTML = inner_v;
		div.className = 'fixed';

		if (getBrowser() != 'ie'){
			div.style.top = top_v + 'px';
			div.style.position = 'fixed';
		}
		else{
			//crea el iframe para el combo de marca quede por debajo
			var iframe = document.createElement('iframe');
			iframe.id = 'iframe_bcg';
			iframe.style.width = docwidth() + 'px';
			iframe.style.height = docheight() + 'px';
			iframe.style.top = 0;
			iframe.style.left = 0;
			iframe.style.filter = 'alpha(opacity=0)';
			iframe.style.position = 'absolute';
			iframe.style.zIndex = 3;
			document.body.appendChild(iframe);

		}
		document.body.appendChild(div);
	}
	else{

		document.body.removeChild(document.getElementById('alert'));
		if (getBrowser() == 'ie')	document.body.removeChild(document.getElementById('iframe_bcg'));
		obj_fondo.style.display = 'none';
	}

}


//usa jquery.dimensions
function docwidth(){
	return $(document).width();
}
function docheight(){
	return $(document).height();
}
function docVisibleHeight(){

	if (self.innerWidth)
	{
		HeightW = self.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientHeight)
	{
		HeightW = document.documentElement.clientHeight;
	}
	else if (document.body)
	{
		HeightW = document.body.clientHeight;
	}

	/*
	HeightS = document.body.scrollHeight;

	if (HeightW > HeightS)	return HeightW;
	else					return HeightS;
	*/

	return HeightW;
}

function validar_email(email_text){

	//re = /(\w+@[0-9a-zA-Z_]+?\.[a-zA-Z]{2,6})/;
	re = /^[\w-]+(?:\.[\w-]+)*@(?:[\w-]+\.)+[a-zA-Z]{2,7}$/;

	if(email_text.match(re))	return true
	else				return false;
}

function validarNum(e)
{
	tecla = (document.all) ? e.keyCode : e.which;
	if (tecla == 8) return true;
	patron = /\d/;
	te = String.fromCharCode(tecla);
	return patron.test(te);
}


//Elementos: String que tiene nombre_campo_forma,etiqueta_campo
//campo_email: valor del campo de email a validar, vacio si la forma no tiene este campo
function validar_forma(elementos,campo_email,idioma){
	
	var ElementosForma = elementos.split(",");
	
	if(idioma == 2)
	var Error = "The following fields are required:\n\n";
	else var Error = "Los siguientes campos son requeridos:\n\n";
	
	var Error_i = 0;

	for (i=0;i<ElementosForma.length;i++){
		if (document.getElementById(ElementosForma[i]).type == "text" || document.getElementById(ElementosForma[i]).type == "password" || document.getElementById(ElementosForma[i]).type == "textarea" || document.getElementById(ElementosForma[i]).type == "select-multiple" || document.getElementById(ElementosForma[i]).type == "select-one" || document.getElementById(ElementosForma[i]).type == "file"){
			if (document.getElementById(ElementosForma[i]).value == ""){
				Error += "- " + ElementosForma[i+1] + "\n";
				Error_i = 1;
			}
		}
		else if (document.getElementById(ElementosForma[i]).type == "radio" || document.getElementById(ElementosForma[i]).type == "checkbox"){
			if (document.getElementById(ElementosForma[i]).checked == false){
				Error += "- " + ElementosForma[i+1] + "\n";
				Error_i = 1;
			}
		}

		i++;
	}

	if (Error_i == 1){
		alert(Error);
		return false;
	}
	else{
		if (campo_email != ""){
			if(!validar_email(campo_email)){
				alert('Formato de Email incorrecto');
				return false;
			}	 
		}
		else
			return true;
	}
}

function validarFormContacto(){
		
	//Check email
	var e1 = document.getElementById("email").value;
	var e2 = document.getElementById("email2").value;

	if(e1 != e2){
		alert("Los email no coinciden");
		document.getElementById("email").focus();
		return false;
	}

	return validar_forma('nombre,Nombre,apellido,Apellido,email,Email,ciudad,Ciudad,comentario,Comentario',document.getElementById('email').value);
}	

function getClickX(e){

	var IE = document.all ? true:false;
	if (IE) { // grab the x-y pos.s if browser is IE
		tempX = e.clientX;

		if( document.documentElement && ( document.documentElement.scrollTop || document.documentElement.scrollLeft )){
			tempX += document.documentElement.scrollLeft;
		} 
		else if( document.body && ( document.body.scrollTop || document.body.scrollLeft )){
			tempX += document.body.scrollLeft;
		}
	} 
	else {  // grab the x-y pos.s if browser is NS
		tempX = e.pageX
	}

	// catch possible negative values in NS4
	if (tempX < 0){tempX = 0}

	return tempX;
}

function getClickY(e){

	var IE = document.all ? true:false;
	if (IE) { // grab the x-y pos.s if browser is IE
		tempY = e.clientY;

		if( document.documentElement && ( document.documentElement.scrollTop || document.documentElement.scrollLeft )){
			tempY += document.documentElement.scrollTop;
		} 
		else if( document.body && ( document.body.scrollTop || document.body.scrollLeft )){
			tempY += document.body.scrollTop;
		}
	} 
	else {  // grab the x-y pos.s if browser is NS
			tempY = e.pageY
	}

	// catch possible negative values in NS4
	if (tempY < 0){tempY = 0}

	return tempY;
}

function showDivEmail(e){

	var IE = document.all ? true:false;
	var offset_x = (docwidth() - (370)) / 2 ;
	var offset_y = 480;

	tempX = getClickX(e);
	tempY = getClickY(e);

	var obj = document.getElementById('sendToFriend');

	if (IE)	var disp = obj.currentStyle.display;
	else	 var disp = document.defaultView.getComputedStyle(obj, null).getPropertyValue("display"); 

	(disp == 'none') ? dis = 'block' : dis = 'none';

	obj.style.left = offset_x + 'px';
	var top =  (docVisibleHeight() - offset_y) / 2 ;

	obj.style.display = dis;
	
	obj.className='fixed';
	if (getBrowser() != 'ie'){
		obj.style.top = top + 'px';
		obj.style.position = 'fixed';
	}
	var obj_fondo = document.getElementById('div_bcg');

	if ( obj_fondo == undefined){
		//Fondo negro
		fondo = document.createElement('div');

		fondo.id = 'div_bcg';
		fondo.style.background = "#6B6B6B";
		fondo.style.opacity = 0.50;
		fondo.style.filter = 'alpha(opacity=50)';
		fondo.style.width = docwidth()+'px';
		fondo.style.height = docheight()+'px';
		fondo.style.zIndex = 5;
		fondo.style.position = 'absolute';
		fondo.style.top = 0;
		fondo.style.left = 0;
		document.body.appendChild(fondo);
	}
	else{
		obj_fondo.style.display = '';
	} 
	

}

function hideDivEmail(){
	document.getElementById('sendToFriend').style.display='none';
	document.getElementById('div_bcg').style.display='none';

	return false;
}

//Envia un contenido por email
function emailContenido(){

	you_f_n = document.getElementById('you_f_name').value;
	you_l_n = document.getElementById('you_l_name').value;
	you_e = document.getElementById('you_email').value;

	rec_f_n = document.getElementById('rec_f_name').value;
	rec_l_n = document.getElementById('rec_l_name').value;
	rec_e = document.getElementById('rec_email').value;

	copy_v = (document.getElementById('copy').checked == true) ? 1 : 0;
	url = window.location.href;

	if(validar_email(you_e) && validar_email(rec_e)){
		if (you_f_n != "" && you_l_n != "" && you_e != "" && rec_f_n != "" && rec_l_n != "" && rec_e != ""){

			str = 'you_f_name='+you_f_n+'&you_l_name='+you_l_n+'&you_email='+you_e+'&rec_f_name='+rec_f_n+'&rec_l_name='+rec_l_n+'&rec_email='+rec_e+'&copy='+copy_v+'&url='+url;

			getDataV1('','ajax.php?object=emailContenido&'+str,'rta_div_email','inner');
		}
		else	return false;
	}
	else	return false;


}

//Version Print
function printContenido(){

	var Url = location.href;
	Url = Url.replace(/.*\?(.*?)/,"$1");
	Variables = Url.split ("&");
	for (i = 0; i < Variables.length; i++) {
		Separ = Variables[i].split("=");
		eval ('var '+Separ[0]+'="'+Separ[1]+'"');
	}

	window.open('index2.php?print=1&mod=showContent&id_c='+id_c,'','width=600,height=600,top=100,left=100,scrollbars=1');
}

//Version Print Producto
function printProducto(){

	var Url = location.href;
	Url = Url.replace(/.*\?(.*?)/,"$1");
	Variables = Url.split ("&");
	for (i = 0; i < Variables.length; i++) {
		Separ = Variables[i].split("=");
		eval ('var '+Separ[0]+'="'+Separ[1]+'"');
	}

	window.open('index2.php?print=2&mod=showProduct&id_c='+id_c,'','width=900,height=600,top=100,left=100,scrollbars=1');
}

//Version PDF Contenido
function pdfContenido(){

	var Url = location.href;
	Url = Url.replace(/.*\?(.*?)/,"$1");
	Variables = Url.split ("&");
	for (i = 0; i < Variables.length; i++) {
		Separ = Variables[i].split("=");
		eval ('var '+Separ[0]+'="'+Separ[1]+'"');
	}

	location.href='index2.php?pdf=1&mod=showContent&id_c='+id_c,'','width=600,height=600,top=100,left=100,scrollbars=1';
}

//Version PDF Producto
function pdfProducto(){

	var Url = location.href;
	Url = Url.replace(/.*\?(.*?)/,"$1");
	Variables = Url.split ("&");
	for (i = 0; i < Variables.length; i++) {
		Separ = Variables[i].split("=");
		eval ('var '+Separ[0]+'="'+Separ[1]+'"');
	}

	location.href='index2.php?pdf=2&mod=showProducto&id_c='+id_c,'','width=600,height=600,top=100,left=100,scrollbars=1';
}

function showDivEnlarge (div_id,accion){


	var div = document.getElementById("div_" + div_id);
	var obj_fondo = document.getElementById('div_bcg');

	//var w_div = parseInt(div.style.width);
	var w_div = 521;
	var h_div = 400;
	//Valor de left para que siempre salga en el centro
	var left = (docwidth() - w_div) / 2;
	var top = (docVisibleHeight() - h_div) / 2;

	if (accion == 'mostrar'){
		div.style.left = left + 'px';
		div.style.display = '';
		div.className='fixed';
		if (getBrowser() != 'ie'){
			div.style.top = top + 'px';
			div.style.position = 'fixed';
		}

		if ( obj_fondo == undefined){
			//Fondo negro
			fondo = document.createElement('div');

			fondo.id = 'div_bcg';
			fondo.style.background = "#6B6B6B";
			fondo.style.opacity = 0.50;
			fondo.style.filter = 'alpha(opacity=50)';
			fondo.style.width = docwidth()+'px';
			fondo.style.height = docheight()+'px';
			fondo.style.zIndex = 5;
			fondo.style.position = 'absolute';
			fondo.style.top = 0;
			fondo.style.left = 0;
			document.body.appendChild(fondo);
		}
		else{

			obj_fondo.style.display = '';
		} 
	}
	else{
		div.style.display = 'none';
		obj_fondo.style.display = 'none';
	}
}

//Coloca el url a donde debe ir al cambiar la fecha del archivo de noticias, esto se hace para evitar multiples mm_aa en el url
function setUrlComboArchive(valor){

	url = location.href;

	url_tmp = url.split('?');
	args = url_tmp[1];
	url_t = args.split('&');

	args = '';
	for (var i=0;i<url_t.length;i++){

		par = url_t[i].split("=");

		if (par[0] == 'mm_aa')	par[1] = valor;

		if (par[0].indexOf('num_pag') == -1){
			if (args == '')	args = par[0] + '=' + par[1];
			else			args += "&" + par[0] + '=' + par[1];
		} 	
	}

	//Check si esta el parametro mm_aa
	if (url.indexOf('mm_aa') == -1){
		args += '&mm_aa=' + valor;
	}

	return url_tmp[0] + '?' + args;
}

//Retorna el valor de un parametro dado el url y el nombre del parametro
function getUrlParameter(url,parameter){
	url_t = url.split("&");

	for (var i=0;i<url_t.length;i++){

		par = url_t[i].split("=");

		if (par[0] == parameter)	return par[1];	
	}
}

//Login in
function signIn(){

	var u = document.getElementById('usuario').value;
	var p = document.getElementById('pass').value;

	if (u != 'Usuario' && p != 'Contrase&ntilde;a'){
		getDataV1('login','ajax.php?object=signIn&u='+u+'&p='+p,'login','inner');
	}
	
}

//Login out
function signOut(){	
	getDataV1('logout','ajax.php?object=signOut','login','inner');	
}

function focusLogin(obj){
	if(obj.value == 'Usuario')	obj.value = '';
}

function blurLogin(obj){
	if(obj.value == '') obj.value = 'Usuario';
}

function focusPassword(obj){

	var spane = document.getElementById("input_pass");
	
	if(obj.value == 'Contrase\xf1a'){
		spane.innerHTML = '<input name="pass" type="password" id="pass" value="" onfocus="focusPassword(this)" onblur="blurPassword(this)" class="input1" />';
		
	}

	setTimeout("document.getElementById('pass').focus()",10);
}

function blurPassword(obj){

	var spane = document.getElementById("input_pass");
	
	if(obj.value == ''){
		spane.innerHTML = '<input name="pass" type="text" id="pass" value="Contrase\xf1a" onfocus="focusPassword(this)" onblur="blurPassword(this)" class="input1" />';
	}
}


//Login volver
function loginVolver(){
	//coloca imagen loading
	//document.getElementById('btn_login_volver').style.display = 'none';
	//document.getElementById('btn_login_loading').style.display = '';

	getDataV1('','ajax.php?object=signOut','top_login','inner');
}


function changeInputType(oldObject, oType) {
	var newObject = document.createElement('input');
	newObject.type = oType;
	if(oldObject.size) newObject.size = oldObject.size;
	if(oldObject.value) newObject.value = oldObject.value;
	if(oldObject.name) newObject.name = oldObject.name;
	if(oldObject.id) newObject.id = oldObject.id;
	if(oldObject.className) newObject.className = oldObject.className;
	oldObject.parentNode.replaceChild(newObject,oldObject);

	return newObject;
}

function getBrowser() {
	var sBrowser = navigator.userAgent;

	if (sBrowser.toLowerCase().indexOf('msie') > 0) {
		if (sBrowser.toLowerCase().indexOf('msie 6.0') > 0)
		return 'ie6';
		else return 'ie';	
	}
	else
		return;
}

//Lista equivalente de tildes
//á = \xe1
//é = \xe9
//í = \xed
//ó = \xf3
//ú = \xfa
//ñ = \xf1
function latinChars(texto){

	var latin = Array("a","e","i","o","u","n");
	var web = Array("\xe1","\xe9","\xed","\xf3","\xfa","\xf1");


	for(var i=0;i<latin.length;i++){
		texto.replace(/latin[i]/,web[i]);
	}

	return texto;
}

function filtroContenidoHome(){
	var obj = document.getElementById('filtro_home');
	var id = obj.options[obj.selectedIndex].value;
	location.href = '?cf='+id;
}

function filtroProducto(url){
    var pagina="http://"+location.host+'/'
	var url_tmp  = url.split('?cf');
	var url_tmp2 = url_tmp[0].split('?pa');
	var obj = document.getElementById('filtro_p');
	var id = obj.options[obj.selectedIndex].value;
	var cont = url_tmp2[0].length;
	var cad_temp = url_tmp2[0].substr(cont-1, 1);
	if(cad_temp == '/')
	location.href = pagina+url_tmp2[0]+ '?cf='+id;
	else
	location.href = pagina+url_tmp2[0]+ '/?cf='+id;
}



function filtroProducto2(url){
    var pagina="http://"+location.host+'/';
	var url_tmp  = url.split('?cf');
	var url_tmp2 = url_tmp[0].split('?pa');
	var obj = document.getElementById('filtro_p');
	var id = obj.options[obj.selectedIndex].value;
	var cont = url_tmp2[0].length;
	var cad_temp = url_tmp2[0].substr(cont-1, 1);
	if(cad_temp == '/')
	location.href = pagina+url_tmp2[0]+ '?cf='+id;
	else
	location.href = pagina+url_tmp2[0]+ '?cf='+id;
}



function filtroContenidoHomeConsola(url){
	var obj = document.getElementById('filtro_home');
	var id = obj.options[obj.selectedIndex].value;
	location.href = url+ '?cf='+id;
}

function filtroContenidoSearch(url,crt){
	var obj = document.getElementById('filtro_home');
	var id = obj.options[obj.selectedIndex].value;
	location.href = url + '?crt='+crt+'&cf='+id;
}
