$(document).ready(function (){
	$("img.rolloverimagen").mouseover(function (){
			var newImage = $(this).attr('src').replace(/^(.*?)(\.(?:gif|jpg|png))$/, "$1_over$2");
			$(this).attr('src', newImage);
	});
	$("img.rolloverimagen").mouseout(function (){
			var newImage = $(this).attr('src').replace('_over', '');
			$(this).attr('src', newImage);
	});
	
	$(document).pngFix(); //-- Para png´s transparentes
	
	$("#PRESENTACION").mouseover(function (){
		$("#submenu_1").css({ display: "block" });
	});
	
	$("#PRESENTACION").mouseout(function (){
		$("#submenu_1").css({ display: "none" });
	});
	
	$("#CAMPOS_ACTV").mouseover(function (){
		$("#submenu_2").css({ display: "block" });
	});
	
	$("#CAMPOS_ACTV").mouseout(function (){
		$("#submenu_2").css({ display: "none" });
	});
	
	$("#REFERENCIAS").mouseover(function (){
		$("#submenu_3").css({ display: "block" });
	});
	
	$("#REFERENCIAS").mouseout(function (){
		$("#submenu_3").css({ display: "none" });
	});

	$("#r").change (function(ev) {
        var sl = ev.target;
        sl.className = sl.options[sl.selectedIndex].className;
	});

	$("#c").change (linkSelectType);
	var selparent = document.getElementById ('c');
	if (selparent!=null)
		linkSelectTypeVal (selparent.options[selparent.selectedIndex].value);
	
});

function linkSelectType (ev) {
    var valueparent = ev.target.options[ev.target.selectedIndex].value;
    linkSelectTypeVal (valueparent);
}

function linkSelectTypeVal (valueparent) {
    var selchild = document.getElementById('t');
    for (var i = selchild.options.length; i >= 0; i--) selchild.options[0] = null;
    selchild.options[0] = new Option (_l_all, '');
    var selected = -1;
    for (var i = 0; i < select_t.length; i++) {
        if (select_t[i].idparent == valueparent) {
            if (select_t[i].selected) selected = selchild.options.length;
            selchild.options[selchild.options.length] = new Option (select_t[i].txt, select_t[i].id);
        }
    }
    if (selected > -1) selchild.selectedIndex = selected;
}