﻿// Archivo JScript

function ChangeImage(obj,img){   
    var img_obj = obj.parentNode.getElementsByTagName('img');
    img_obj[0].src = img;    
    var btns = obj.parentNode.getElementsByTagName('input');    
    for (var i_tem = 0; i_tem < btns.length; i_tem++){ if (btns[i_tem].type == 'submit'){ btns[i_tem].className = 'btn_gallery'; } }
    obj.className = 'btn_gallery_selected';    
    return false;
}

function DownloadCatalog(src){ window.open(src); return false; }

function ShowDescription(idshow_obj, idhide_obj, obj){
    var objs = obj.parentNode.getElementsByTagName('input');            
    for (var i_tem = 0; i_tem < objs.length; i_tem++){
        if (objs[i_tem].type=='submit'){
            if(objs[i_tem].id.match("btn_info") != null){
                objs[i_tem].className='btn_data_producto';
            }else if(objs[i_tem].id.match("btn_desc") != null){
                objs[i_tem].className='btn_data_producto_selected';
            }
        }        
    }     
    document.getElementById(idhide_obj).style.display = 'none';
    document.getElementById(idshow_obj).style.display = 'block';           
    return false;
}

function ShowForm(idshow_obj, idhide_obj, obj){
	var objs = obj.parentNode.getElementsByTagName('input');            
    for (var i_tem = 0; i_tem < objs.length; i_tem++){
        if (objs[i_tem].type=='submit'){
            if(objs[i_tem].id.match("btn_desc") != null){
                objs[i_tem].className='btn_data_producto'    
            }else if(objs[i_tem].id.match("btn_info") != null){
                objs[i_tem].className='btn_data_producto_selected'    
            }
        }
    }     
    document.getElementById(idhide_obj).style.display = 'none';
    document.getElementById(idshow_obj).style.display = 'block';    
    return false;
}

//only v1
function ShowProduct(idshow_obj, id_title_obj){ 
    var show = true;
    if (document.getElementById(idshow_obj).style.display == "block"){ show = false; }    
    $('.data_producto').css('display', 'none');    
    obj_titulo = $('.titulo_producto_selected');
    obj_titulo.removeClass("titulo_producto_selected"); 
    obj_titulo.addClass("titulo_producto");     
    for (var i_tem = 0; i_tem < $('.titulo_producto').length; i_tem++){ $('.titulo_producto')[i_tem].onmouseout = changeTitleStyle;  }    
    if (show){
        var obj = document.getElementById(id_title_obj);
        obj.className = 'titulo_producto_selected';
        obj.onmouseout=function(){};    
        document.getElementById(idshow_obj).style.display = 'block';
    }            
    return false;
}

function changeTitleStyle() { this.className = 'titulo_producto'; }

function setMenu(name_servicio) {    
    var nodes = $('.menu_v_s2_ul');
	$('.menu_v_s2_ul').hide();	
	$("a[name=" + name_servicio + "]").parent().parent().show();
	$("a[name='" + name_servicio + "']").toggleClass("menu_v_s3_selected");	
	//alert($("a[name=" + name_servicio + "]").parent().parent().parent().attr('name'));	
	//$("a[name=" + name_servicio + "]").parent().parent().parent().unbind('hover');
	$("a[name=" + name_servicio + "]").parent().parent().parent().unbind('mouseleave');
	$("a[name=" + name_servicio + "]").parent().parent().parent().unbind('mouseenter');	
    //$('#' + id_servicio).parent().parent().show();
    //$('#' + id_servicio).toggleClass("menu_v_s3_selected");
}
