

function centra(){
	var aux = 0;
    var fondo = document.getElementById('idfondo');
	var alto = 768;
	var ancho = 1024;

	var hei = $(document).height();
	var wid = $(document).width();
    
    // if(wid > 1024){
        fondo.style.width = wid+'px';
    // }
    // if(hei > 900){
        fondo.style.height = hei+'px';
    // }
}

/***********************Crea el Objeto AJAX******************************/
function nuevoAjax(){ 
	var xmlhttp=false; 
	try{ 
		xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); 
	}catch(e){ 
		try{ 
			xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); 
		} 
		catch(E) { xmlhttp=false; }
	}
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') { xmlhttp=new XMLHttpRequest(); } 
	return xmlhttp; 
}

function direcciona(pagina){
	window.top.document.location.href=pagina;
}

function largo_textarea(tam,objeto){
   var txt = objeto.value.length;
   if(txt >tam){
       objeto.value = objeto.value.substr(0,tam);
       alert('El largo maximo para el campo es de '+tam+ ' caracteres');
   }
}




function cierra_load(){
    try{document.getElementById('espera').style.display = 'none';} catch(e){}
}

function controlador(pagina,capa,valores){
    $.ajax({
            url: pagina,
            data: valores,
            async:true,
            beforeSend: function(objeto){
                 try{ document.getElementById('espera').style.display = 'block';} catch(e){}
            },
            complete: function(objeto, exito){
                setTimeout('cierra_load();',700);
            },
            contentType: "application/x-www-form-urlencoded",
            dataType: "html",
            error: function(objeto, quepaso, otroobj){
                alert("Estas viendo esto por que fallé");
                alert("Pasó lo siguiente: "+quepaso + " " + otroobj);
            },
            global: true,
            ifModified: false,
            processData:true,
            success: function(datos){
                 document.getElementById(capa).innerHTML = datos;
            },
            timeout: 15000,
            type: "POST"
    });

}
bt_servicios = 'web';
bt_actual	 = 'uno';

/* General  Inicio */
function menu_principal(item){
	var m_srv  = document.getElementById('idmenu_servicios');
	var b_srv  = document.getElementById('srv_barra');
/* 	var img  = document.getElementById('idimagen_arriba');
	var sel  = document.getElementById('idimg_sel_arr');
	
	var m_uno  = document.getElementById('idbt_conocenos');
	var m_dos  = document.getElementById('idbt_gente');
	var m_tres = document.getElementById('idbt_intranet'); */
	switch(item){
		
		case 'inicio':
			// menu_limpia('bg_todo_m1',imagen);
			controlador('home.php','idcontenidos','');
			m_srv.style.zIndex = '0';
			try{clearInterval(intervalo);}catch(e){}
			break;
			
		case 'nosotros':
			// menu_limpia('bg_todo_m2',imagen);
			controlador('nosotros.php','idcontenidos','');
			m_srv.style.zIndex = '0';
			try{clearInterval(intervalo);}catch(e){}
			break;
		case 'servicios':
			// menu_limpia('bg_todo_m2',imagen);
			controlador('servicios_'+bt_servicios+'.php','idcontenidos','');
			m_srv.style.zIndex = '5';
			try{clearInterval(intervalo);}catch(e){}
			intervalo = window.setInterval("cambia_imagen_servicios()",3000);
			break;
			
		case 'contacto':
			// menu_limpia('bg_todo_m2',imagen);
			controlador('contacto.php','idcontenidos','');
			m_srv.style.zIndex = '0';
			try{clearInterval(intervalo);}catch(e){}
			break;
	}
}

function envia_busqueda(){
    var val1 = document.getElementById("cab_productos").value;
    if(val1 != '0'){
        var val2 = document.getElementById("cab_marca").value;
        var val3 = document.getElementById("cab_medida").value;
        var params = val1.split('_');
        
        var ifm = document.getElementById('carga_pagina');
        window.top.document.location.href='catalogo_producto.php?sbc_id=' + params[0] + '&cat_id=' + params[1] + '&mca_id=' + val2 + '&prd_id=' + val3;
    } else {
                alert('Seleccione un producto para su busqueda');
            }
}

function carga_medidas(){
    var val1 = document.getElementById("cab_productos").value;
    var val2 = document.getElementById("cab_marca").value;
    var params = val1.split('_');
    
    var ifm = document.getElementById('carga_pagina');
    ifm.src='carga_select_producto.php?sbc_id=' + params[0] + '&cat_id=' + params[0] + '&mca_id=' + val2;
}


function carga_marcas(valor){
    var ifm = document.getElementById('carga_pagina');
    var params = valor.split('_');
    ifm.src='carga_select_marca.php?sbc_id=' + params[0] + '&cat_id=' + params[1];
}

function pagina_marca(cat,sbc,ind){
//alert("1"+cat + "2"+sbc + "3"+ind)
    var par = 'cat_id=' + cat + '&sbc_id=' + sbc + '&indice=' + ind;
	controlador('catalogo_producto_marca.php','muestra_cuadros',par);
}

function pagina_producto(cat,sbc,mca,ind){
    var par = 'cat_id=' + cat + '&sbc_id=' + sbc + '&mca_id=' + mca + '&indice=' + ind;
	controlador('catalogo_producto_listado.php','muestra_cuadros',par);
}


function pagina_producto_tipo(cat,sbc,tpo,ind){
    var par = 'cat_id=' + cat + '&sbc_id=' + sbc + '&tpo_id=' + tpo + '&indice=' + ind;
	controlador('catalogo_producto_listado_tipo.php','muestra_cuadros',par);
}


/* General  Inicio */
function menu_servicios(item){
// logotipo');
// imagen');" 
// impresos');
// branding');
// fotografia'
// ilustracion


	
	
	switch(item){
		
		case 'web':
			controlador('servicios_web.php','idmuestra_servicios','');
			bt_servicios = 'web';
			clearInterval(intervalo);
			intervalo = window.setInterval("cambia_imagen_servicios()",3000);
			break;
			
		case 'logotipo':
			// menu_limpia('bg_todo_m2',imagen);
			controlador('servicios_logotipo.php','idmuestra_servicios','');
			bt_servicios = 'logotipo';
			clearInterval(intervalo);
			intervalo = window.setInterval("cambia_imagen_servicios()",3000);
			break;
		case 'imagen':
			controlador('servicios_imagen.php','idmuestra_servicios','');
			bt_servicios = 'imagen';
			clearInterval(intervalo);
			intervalo = window.setInterval("cambia_imagen_servicios()",3000);
			break;
		case 'impresos':
			controlador('servicios_impresos.php','idmuestra_servicios','');
			bt_servicios = 'impresos';
			clearInterval(intervalo);
			intervalo = window.setInterval("cambia_imagen_servicios()",3000);
			break;
		case 'branding':
			controlador('servicios_branding.php','idmuestra_servicios','');
			bt_servicios = 'branding';
			clearInterval(intervalo);
			intervalo = window.setInterval("cambia_imagen_servicios()",3000);
			break;
		case 'fotografia':
			controlador('servicios_fotografia.php','idmuestra_servicios','');
			bt_servicios = 'fotografia';
			clearInterval(intervalo);
			intervalo = window.setInterval("cambia_imagen_servicios()",3000);
			break;
		case 'ilustracion':
			controlador('servicios_ilustracion.php','idmuestra_servicios','');
			bt_servicios = 'ilustracion';
			clearInterval(intervalo);
			intervalo = window.setInterval("cambia_imagen_servicios()",3000);
			break;
	}
}


function m_uno(){
    direcciona('about.php');
	// activa_menu(objeto);
}

function m_dos(){
    direcciona('press.php');
	// activa_menu(objeto);
}

function m_tres(){
    direcciona('projects.php');
	// activa_menu(objeto);
}

function m_cuatro(){
    direcciona('contact.php');
	// activa_menu(objeto);
}

/************************************************************************/
function correo(){
	var nombre      = document.getElementById('nombre').value;
	var correo      = document.getElementById('correo').value;
    var telefono    = document.getElementById('telefono').value;
	var comentarios = document.getElementById('comentarios').value;
	var post ="nombre="+nombre+"&correo"+correo+"&telefono"+telefono+"&comentarios="+comentarios;
    controlador('inc/correo.php','idcontenidos',post);
    // ajax=nuevoAjax();
	// ajax.open("GET", "include/functions.php?"+post,true);
	// ajax.onreadystatechange=function(){
		// if (ajax.readyState==1) {
			// document.getElementById('res').innerHTML = "<h3>Enviando, espere un momento...</h3>";
		// }
		// if (ajax.readyState==4) {
                    // alert(ajax.responseText);
			// if(ajax.responseText == 1){
				// alert("Gracias por sus comentarios.!");
				// document.getElementById('res').innerHTML = "";
			// }else{
				// alert("Error al enviar comentarios!");
				// document.getElementById('res').innerHTML = "";
			// }
		// }
	// }
	// ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	// ajax.send(null);
}

/*Funciones validacion*/

      msg_error = '';
      obs_error = new Array();
      cnt_error = 1;
      
        //expresion_regular(id_objeto,tipo,obligatorio);
        // Ejemplo:
            //            expresion_regular('forename','cadena',true);

     function expresion_regular(id_objeto,tipo,obligatorio){
        
        var error = false;
        
        // Arreglo con todas las expresiones regulares 
        expresiones = new Array();
        expresiones['cadena']       = /.*/;
        expresiones['numero']       = /^[0-9]*$/;
        expresiones['correo']       = /^[\w-\.\']{1,}\@([\da-zA-Z-]{1,}\.){1,}[\da-zA-Z-]{2,}$/;
        expresiones['alfanumerico'] = /.*/;

        // Conocer el objeto
        var objeto = document.getElementById(id_objeto);
        var valor = objeto.value;
        // Validar si es un campo obligatorio
        if ( objeto.value != '' ){
            
            // Valida con expresiones regulares
            if( !expresiones[tipo].test(valor) ){
                error = true;
                msg_error += cnt_error+'.- Datos invalidos en el campo '+objeto.name+'\n';
            }
        } else  { 
                    if(obligatorio){
                        error = true;
                        msg_error += cnt_error+'.- El campo '+objeto.name+' es obligatorio\n';
                    }
               }
        
        // Verificar si hubo error
        if(error){
            // Colocar el error al campo
            obs_error.push(objeto);
            cnt_error++;            
            objeto.style.backgroundColor= '#FF6A6A';
            
        } else {
                    // Quitarle el error al campo
                    objeto.style.backgroundColor= 'transparent';
               }
               
        return error;
        
    } 
    
    
    
    function valida_contacto(){
        msg_error = '';
        obs_error = new Array();
        cnt_error = 1;
      
        var aObjetos = new Array();
            // Declarar arreglo con campos a validar
            aObjetos[0] = new Array('con_nombre','alfanumerico',true);
            aObjetos[1] = new Array('con_apellidos','alfanumerico',true);
            aObjetos[2] = new Array('con_telefono','alfanumerico',false);
			aObjetos[3] = new Array('con_email','correo',false);
			aObjetos[4] = new Array('con_comentarios','alfanumerico',true);



        for (var i=0; i<aObjetos.length; i++){
            datos = aObjetos[i].slice();            
            expresion_regular(datos[0],datos[1],datos[2]);
        }
        
        if(cnt_error > 1){
            // Informa de los errores
            alert(msg_error);
            // colocar foco en el primer elemento
            obs_error[0].focus();
            
            return false;
            
        } 
        
        return true;
    }
    
	
    function valida_pregunta(){
        msg_error = '';
        obs_error = new Array();
        cnt_error = 1;
      
        var aObjetos = new Array();
            // Declarar arreglo con campos a validar
            aObjetos[0] = new Array('pre_nombre','alfanumerico',true);
            aObjetos[1] = new Array('pre_apellidos','alfanumerico',true);
			aObjetos[2] = new Array('pre_email','correo',true);
			aObjetos[3] = new Array('pre_pregunta','alfanumerico',true);



        for (var i=0; i<aObjetos.length; i++){
            datos = aObjetos[i].slice();            
            expresion_regular(datos[0],datos[1],datos[2]);
        }
        
        if(cnt_error > 1){
            // Informa de los errores
            alert(msg_error);
            // colocar foco en el primer elemento
            obs_error[0].focus();
            
            return false;
            
        } 
        
        return true;
    }

	
    function valida_tema(){
        msg_error = '';
        obs_error = new Array();
        cnt_error = 1;
      
        var aObjetos = new Array();
            // Declarar arreglo con campos a validar
            aObjetos[0] = new Array('tem_nombre','alfanumerico',true);
            aObjetos[1] = new Array('tem_apellidos','alfanumerico',true);
			aObjetos[2] = new Array('tem_email','correo',false);
			aObjetos[3] = new Array('tem_usuario','alfanumerico',true);
			aObjetos[4] = new Array('tem_clave','alfanumerico',true);
			aObjetos[5] = new Array('tem_confirmacion','alfanumerico',true);

        for (var i=0; i<aObjetos.length; i++){
            datos = aObjetos[i].slice();            
            expresion_regular(datos[0],datos[1],datos[2]);
        }
        
        if(cnt_error > 1){
            // Informa de los errores
            alert(msg_error);
            // colocar foco en el primer elemento
            obs_error[0].focus();
            
            return false;
            
        } 
        
        return true;
    }
	
    function valida_usuario(){
        msg_error = '';
        obs_error = new Array();
        cnt_error = 1;
      
        var aObjetos = new Array();
            // Declarar arreglo con campos a validar
            aObjetos[0] = new Array('tem_usuarioa','alfanumerico',true);
            aObjetos[1] = new Array('tem_clavea','alfanumerico',true);

        for (var i=0; i<aObjetos.length; i++){
            datos = aObjetos[i].slice();            
            expresion_regular(datos[0],datos[1],datos[2]);
        }
        
        if(cnt_error > 1){
            // Informa de los errores
            alert(msg_error);
            // colocar foco en el primer elemento
            obs_error[0].focus();
            
            return false;
            
        } 
        
        return true;
    }
	
	function envia_tema(){
		var f = document.getElementById('formulario_tema');
		var a = document.getElementById('tem_clave');
		var b = document.getElementById('tem_confirmacion');
		var c = document.getElementById('tem_usuario');
		if( valida_tema() ){
			if(a.value == b.value){
				if(c.value.length < 6){
					alert('El nombre de usuario debe ser al menos de 6 caracteres');
					c.focus();
					return false;
				}else{ 
						if(a.value.length < 6){
							alert('La clave debe ser al menos de 6 caracteres');
							a.focus();
							return false;
						} else{	return true;}
					 }
			} else {alert('La clave y su confirmacion no coinciden');return false;}
		}
		return false;
	}
	
function envia_usuario(){
	var f = document.getElementById('formulario_tema');
	var a = document.getElementById('tem_clavea');
	var c = document.getElementById('tem_usuarioa');
	if( valida_usuario() ){
		if(c.value.length < 6){
			alert('El nombre de usuario debe ser al menos de 6 caracteres');
			c.focus();
			return false;
		}else{ 
				if(a.value.length < 6){
					alert('La clave debe ser al menos de 6 caracteres');
					a.focus();
					return false;
				} else{	return true;}
			 }
	}
	return false;
	}
	
	
function envia_contacto(){
	var nom = document.getElementById('con_nombre').value;
	var ape = document.getElementById('con_apellidos').value;
	var tel = document.getElementById('con_telefono').value;
	var ema = document.getElementById('con_email').value;
	var com = document.getElementById('con_comentarios').value;
	var par = "con_nombre="+nom+"&con_apellidos="+ape+"&con_telefono="+tel+"&con_email="+ema+"&con_comentarios="+com;
	if( valida_contacto() ){
		controlador('contacto_agrega.php','idcontenidos',par);
	}
}

function envia_pregunta(accion){
	var pub = '0';
    var obj_pub = document.getElementById('pre_publica1');
	
	if(obj_pub.checked == true) pub = '1';
	
	var nom = document.getElementById('pre_nombre').value;
	var ape = document.getElementById('pre_apellidos').value;
	var ema = document.getElementById('pre_email').value;
	var pre = document.getElementById('pre_pregunta').value;
	var par = "pre_nombre="+nom+"&pre_apellidos="+ape+"&pre_email="+ema+"&pre_pregunta="+pre+"&pre_publica="+pub;
	if( valida_pregunta() ){
		controlador('pregunta_agrega.php','idcontenidos',par);
	}
}


/*Menu barra*/
    
	function mueve_barra_h(objeto,index){
    	var tiempo = 1000;
    	// if(elemento == ''){elemento = document.getElementById(document.getElementById(objeto+'_sel').value)}
		var elemento = document.getElementById(index);
    	var morphbarra = $(objeto);
    	try{morphmueve.cancel();}catch(e){}

    	morphmueve = new Fx.Morph(morphbarra,{duration:tiempo,  transition: 'elastic:out'});
    	try{ 
	        var izq = elemento.offsetLeft;
			// alert(izq);
	        var anc = elemento.offsetWidth;
            // alert(anc);
		}catch(e){}
    	morphmueve.start({'left':izq, 'width':anc});
    
	}
    function fija_barra(objeto,elemento){
        document.getElementById(objeto+'_sel').value = elemento.id;
    }
	function mueve_barra_l(objeto,index){
    	var tiempo = 1000;
		var elemento = document.getElementById(index);
    	var morphbarra = $(objeto);
    	try{morphmueve_h.cancel();}catch(e){}

    	morphmueve_h = new Fx.Morph(morphbarra,{duration:tiempo,  transition: 'elastic:out'});
    	try{ 
	        var top = elemento.offsetTop;
	        var alt = elemento.offsetHeight;
		}catch(e){}
    	morphmueve_h.start({'top':top, 'height':alt});
    
	}
    
	function mueve_barra_s(objeto,index){
    	var tiempo = 1000;
    	//if(elemento == ''){elemento = document.getElementById(document.getElementById(objeto+'_sel').value)}
		var elemento = document.getElementById(index);
    	var morphbarra = $(objeto);
    	try{morphmueve.cancel();}catch(e){}

    	morphmueve = new Fx.Morph(morphbarra,{duration:tiempo,  transition: 'elastic:out'});
    	try{ 
	        var izq = elemento.offsetLeft;
			// alert(izq);
	        var anc = elemento.offsetWidth;
            // alert(anc);
		}catch(e){}
    	morphmueve.start({'left':izq, 'width':anc});
    
	}
/*Fin menu barra*/



/*   */

var mueve = 1;
var tiempo =1000;
function mueve_adelante(){
	var actual  = window.top.document.getElementById('home_index');
	var cuantos = window.top.document.getElementById('home_cuantos');
	if(true){
	
		mueve = 0;
		
		var siguiente = parseInt(actual.value)+1;
		if(siguiente > cuantos.value){siguiente=1}

		var en = 'foto_home_'+siguiente;
		var sa = 'foto_home_'+parseInt(actual.value);	
        
        var margen = ( (siguiente - 1) * 290)*-1;
        $("#"+en).css( { left:"-800px",top:margen+'px' });
        var margen2 = ( (actual.value -1) * 290)*-1;
        $("#"+sa).css( { left:"0px",top:margen2+'px' } );

		$("#"+en).animate( { left:"0px" }, { queue:true, duration:tiempo } )
        $("#"+sa).animate( { left:"800px" }, { queue:true, duration:tiempo } )
		
		actual.value = siguiente;

	}
		
}

function mueve_atras(){
	var actual  = window.top.document.getElementById('home_index');
	var cuantos = window.top.document.getElementById('home_cuantos');
	if(true){
	
		mueve = 0;
		
		var siguiente = parseInt(actual.value)+1;
		if(siguiente > cuantos.value){siguiente=1}

		var en = 'foto_home_'+siguiente;
		var sa = 'foto_home_'+parseInt(actual.value);	
        
        var margen = ( (siguiente - 1) * 290)*-1;
        $("#"+en).css( { left:"800px",top:margen+'px' });
        var margen2 = ( (actual.value -1) * 290)*-1;
        $("#"+sa).css( { left:"0px",top:margen2+'px' } );

		$("#"+en).animate( { left:"0px" }, { queue:true, duration:tiempo } )
        $("#"+sa).animate( { left:"-800px" }, { queue:true, duration:tiempo } )
		
		actual.value = siguiente;

	}

}

function mueve_adelante_about(){
	var actual  = window.top.document.getElementById('home_index');
	var cuantos = window.top.document.getElementById('home_cuantos');
	if(true){
	
		mueve = 0;
		
		var siguiente = parseInt(actual.value)+1;
		if(siguiente > cuantos.value){siguiente=1}

		var en = 'foto_home_'+siguiente;
		var sa = 'foto_home_'+parseInt(actual.value);	
        
        var margen = ( (siguiente - 1) * 290)*-1;
        $("#"+en).css( { left:"800px",top:margen+'px',opacity:"0" });
        var margen2 = ( (actual.value -1) * 290)*-1;
        $("#"+sa).css( { left:"0px",top:margen2+'px' } );

		// $("#"+en).animate( { left:"0px" }, { queue:true, duration:tiempo } )
        // $("#"+sa).animate( { left:"800px" }, { queue:true, duration:tiempo } )
		
		$("#"+en).animate( { opacity:"1",left:0 }, { queue:true, duration:tiempo } )
        $("#"+sa).animate( { opacity:"0",left:-800 }, { queue:true, duration:tiempo } )
		
		actual.value = siguiente;

	}
		
}
 /*   */
 
 function noticia_despliegue(ren){
    var nueva = document.getElementById('not_lista_'+ren);
    var indice = document.getElementById('cual_noticia');
    var anterior = document.getElementById('not_lista_'+indice.value);
    
    var par = "not_id="+ren;
	controlador('noticia_despliegue.php','idderecho',par);
  
    anterior.style.backgroundImage = "url('vacio.gif')";
    nueva.style.backgroundImage = "url('img/bg_azul.png')";
    
    indice.value = ren;
 } 
 function ir_press(ren){
    
    var pagina = "press.php?not_id="+ren;
    direcciona(pagina);
 }
 
 
 /* Projects */
 function mueve_atras_projects(){
	var actual  = window.top.document.getElementById('projects_index');
	var cuantos = window.top.document.getElementById('projects_cuantos');
	var mueve   = window.top.document.getElementById('cinta_projects');
    
    var tamano = parseInt(cuantos.value);
    var permitido = 784;
    var limite = ( (tamano * 196) - permitido) *-1;
    var actual_pos = parseInt(mueve.style.left);
	if(actual_pos > limite){
	
        var siguiente_pos = actual_pos - 784;
        var aux_pos = siguiente_pos+"px";
        $("#cinta_projects").animate( { left:aux_pos }, { queue:true, duration:1000 } )
	}

}
 function mueve_adelante_projects(){
	var actual  = window.top.document.getElementById('projects_index');
	var cuantos = window.top.document.getElementById('projects_cuantos');
	var mueve   = window.top.document.getElementById('cinta_projects');
    
    var tamano = parseInt(cuantos.value);
    var permitido = 784;
    var limite = -1;
    var actual_pos = parseInt(mueve.style.left);
	if(actual_pos <= limite){
	
        var siguiente_pos = actual_pos + 784;
        var aux_pos = siguiente_pos+"px";
        $("#cinta_projects").animate( { left:aux_pos }, { queue:true, duration:500 } )
	}

}


 function mueve_adelante_home(){
	var actual  = window.top.document.getElementById('home_index');
	var cuantos = window.top.document.getElementById('home_cuantos');
	if(true){
	
		mueve = 0;
		
		var siguiente = parseInt(actual.value)+1;
		if(siguiente > cuantos.value){siguiente=1}

		var en = 'foto_home_'+siguiente;
		var sa = 'foto_home_'+parseInt(actual.value);	
        
        var margen = ( (siguiente - 1) * 165)*-1;
        $("#"+en).css( { left:"0px",top:margen+'px',opacity:"0" });
        var margen2 = ( (actual.value -1) * 165)*-1;
        $("#"+sa).css( { left:"0px",top:margen2+'px' } );

		$("#"+en).css( { left:"600px", opacity:"0", position:'relative' });
        $("#"+sa).css( { left:"0px", opacity:"1", position:'relative' });
		
		// $("#"+en).animate( { opacity:"1" }, { queue:true, duration:2000 } )
        // $("#"+sa).animate( { opacity:"0" }, { queue:true, duration:2000 } )
		$("#"+en).animate( { left:"0px", opacity:"1" }, { queue:true, duration:2000 } )
        $("#"+sa).animate( { left:"-600px", opacity:"0" }, { queue:true, duration:2000 } )
		
		actual.value = siguiente;

}

}


 function cambia_project(ren){
    var nueva = document.getElementById('foto_projects_color_'+ren);
    var indice = document.getElementById('projects_index');
    var anterior = document.getElementById('foto_projects_color_'+indice.value);
    
    var par = "prj_id="+ren;
	controlador('project_despliegue.php','idmedio_projects',par);
    // alert(par);
  
    anterior.style.backgroundImage = "url('img/bg_tres_foto.png')";
    nueva.style.backgroundImage = "url('img/bg_tres_foto_sel.png')";

    var capa = document.getElementById('project_contenido');
    capa.innerHTML = '';
    capa.style.display = 'none';
    
    indice.value = ren;
 } 

 function project_menuout(ren){
    //var nueva = document.getElementById('foto_projects_color_'+ren);
    var indice = document.getElementById('menu_pjs_sel');
    //var anterior = document.getElementById('foto_projects_color_'+indice.value);
    
    if(indice.value != ren){
        var nueva = document.getElementById('mj_'+ren);
        nueva.src = "img/menu_pjs_"+ren+".png";
        // indice.value = ren;
    }
 } 
 
 function mj_uno(){
    var indice = document.getElementById('menu_pjs_sel');
    try{
        var anterior = document.getElementById('mj_'+indice.value);
        anterior.src = "img/menu_pjs_"+indice.value+".png";
    }catch(e){}
    var nueva = document.getElementById('mj_1');
    nueva.src = "img/menu_pjs_1_sel.png";

    var project = document.getElementById('projects_index');
    var par = "prj_id="+project.value;
	controlador('project_filmaker.php','project_contenido',par);
    
    var capa = document.getElementById('project_contenido');
    capa.className = 'transparente';
    capa.innerHTML = '';
    $("#project_contenido").show('clip',500);

    indice.value = '1';
 }
 
 
 function mj_dos(){
    var indice = document.getElementById('menu_pjs_sel');
    try{
        var anterior = document.getElementById('mj_'+indice.value);
        anterior.src = "img/menu_pjs_"+indice.value+".png";
    }catch(e){}
    var nueva = document.getElementById('mj_2');
    nueva.src = "img/menu_pjs_2_sel.png";

    var project = document.getElementById('projects_index');
    var par = "prj_id="+project.value;
	controlador('project_cast.php','project_contenido',par);
    
    var capa = document.getElementById('project_contenido');
    capa.className = 'transparente';
    capa.innerHTML = '';
    $("#project_contenido").show('clip',500);

    indice.value = '2';
 }
  
 
 function mj_tres(){
    var indice = document.getElementById('menu_pjs_sel');
    try{
        var anterior = document.getElementById('mj_'+indice.value);
        anterior.src = "img/menu_pjs_"+indice.value+".png";
    }catch(e){}
    var nueva = document.getElementById('mj_3');
    nueva.src = "img/menu_pjs_3_sel.png";

    var project = document.getElementById('projects_index');
    var par = "prj_id="+project.value;
	controlador('project_trailer.php','project_contenido',par);
    
    var capa = document.getElementById('project_contenido');
    capa.className = 'transparente';
    capa.innerHTML = '';
    capa.style.display = 'block';
    indice.value = '3';
 }
  
 
 function mj_cuatro(){
    var indice = document.getElementById('menu_pjs_sel');
    try{
        var anterior = document.getElementById('mj_'+indice.value);
        anterior.src = "img/menu_pjs_"+indice.value+".png";
    }catch(e){}
    var nueva = document.getElementById('mj_4');
    nueva.src = "img/menu_pjs_4_sel.png";

    var project = document.getElementById('projects_index');
    var par = "prj_id="+project.value;
	controlador('project_poster.php','project_contenido',par);
    
    var capa = document.getElementById('project_contenido');
    capa.className = 'medio_opaco';
    capa.innerHTML = '';
    $("#project_contenido").show('clip',500);

    // capa.style.display = 'block';
    
    indice.value = '4';
 }
 
function abre_registro(){
$("#formulario_registro").css( { left:"50%", top:"300px", marginleft:"-50px"});
$("#formulario_registro").toggle();
}
 /* Fin projects*/
 
/**/
 function muestra_llanta_x_marca(indice){
    var par = "mca_id="+indice;
	controlador('catalogo_listado_llantas_marca.php','muestra_cuadros',par);
}
 function muestra_llanta_detalle(indice){
    var par = "prd_id="+indice;
	controlador('catalogo_detalle_llantas_marca.php','muestra_cuadros',par);
}



 function muestra_producto_x_marca(mca,cat,sbc){
    var par = "mca_id="+ mca + "&cat_id="+cat + "&sbc_id="+sbc;
	controlador('catalogo_producto_listado.php','muestra_cuadros',par);
}
 function muestra_producto_detalle_tipo(prd,tpo,cat,sbc){
    var par = "prd_id="+prd + "&tpo_id="+ tpo + "&cat_id="+cat + "&sbc_id="+sbc;
	controlador('catalogo_producto_detalle.php','muestra_cuadros',par);
}


 function muestra_producto_detalle(prd,mca,cat,sbc){
    var par = "prd_id="+prd + "&mca_id="+ mca + "&cat_id="+cat + "&sbc_id="+sbc;
	controlador('catalogo_producto_detalle.php','muestra_cuadros',par);
}



 function busqueda_marca(mca,cat,sbc){
    var par = "mca_id="+ mca + "&cat_id="+cat + "&sbc_id="+sbc;
	controlador('catalogo_producto_listado.php','muestra_cuadros',par);
}



 function muestra_producto_x_tipo(tpo,cat,sbc){
    var par = "tpo_id="+ tpo + "&cat_id="+cat + "&sbc_id="+sbc;
	controlador('catalogo_producto_listado_tipo.php','muestra_cuadros',par);
}



      function cargaDsc(curr,next,opts) {
        var cad = next.toString();
        var lon = cad.length;
        // lon = lon - 5;
        var sta = cad.lastIndexOf("/");
        sta = sta +1;
        var fin = cad.lastIndexOf(".");
        lon = fin - sta;
        var id = cad.substr(sta,lon);
        var par = "obra_id="+ id;
        // alert(id);
        controlador('obra_consulta.php','iddescripcion_obra',par);
	  };

      function consulta_obra(id) {
        var par = "obra_id="+ id;
        // alert(id);
        controlador('obra_consulta.php','iddescripcion_obra',par);
	  };
/**/ 
 
 
/*Inicializa*/ 

$(document).ready(function() {  try{initMenus();}catch(e){} });

/*Fin Inicializa*/ 