// SEVEN Basic Javascript

//rollovwer image --------------------------------- begin
$(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);
	});
	$("input.rolloverimagen").mouseover(function (){
			var newImage = $(this).attr('src').replace(/^(.*?)(\.(?:gif|jpg|png))$/, "$1_over$2");
			$(this).attr('src', newImage);
	});
	$("input.rolloverimagen").mouseout(function (){
			var newImage = $(this).attr('src').replace('_over', '');
			$(this).attr('src', newImage);
	});
	$("a.menuboton").mouseout(function (){
			$(this).toggleClass("menuboton_over");
	});
	$("a.menuboton").mouseover(function (){
			$(this).toggleClass("menuboton_over");
	});
	$("#menuleft dd ul li a").mouseout(function (){
			$(this).toggleClass("submenuleft_over");
	});
	$("#menuleft dd ul li a").mouseover(function (){
			$(this).toggleClass("submenuleft_over");
	});
	$("#menuleft dt span.menuseccion").mouseout(function (){
			$(this).toggleClass("menuseccion_over");
	});
	$("#menuleft dt span.menuseccion").mouseover(function (){
			$(this).toggleClass("menuseccion_over");
	});
	
	$("#impresion").click(function (){
		$.jPrintArea("#imprime_pdf");
	});

	$(".showPanelLink").click (showPanelEv);
	
	var isEdit = (document.getElementById ('tooltpl') !== null) && (parent.document.getElementById('tool') !== null);
	$(".showPanel").each (function() {
	    this.style.display = isEdit? '': 'none';
	});
});
//rollovwer image --------------------------------- end

function showPanelEv (ev) {
    var id = ev.target.id.substr (5);
    showPanel (id);
    ev.stopPropagation();
    return false;
}

function showPanel(panel) {
    div = document.getElementById(panel);

    if (div.style.display=='none') {
	   div.style.display = '';
    } else {
        div.style.display = 'none';
    }
}
