$(function(){
	//Disable Right Click
	$("html").rightClick( function(el) {
        alert("Images protected.");
    });
	//Validate
	$(".validate").each(function(){
		$(this).validate({errorElement: 'span'});
	});  
	// PNG
	$('img[@src$=.png]').ifixpng();
	//Menu Hover
	$("#menu li").find("img:first").each(function(){
		var _loader = new Image();
		$(_loader).attr("src", $(this).attr("src").replace(".gif", "_on.gif"));
	});
	$("#menu li").find("img:first").hover(
		function(){$(this).attr("src", $(this).attr("src").replace(".gif", "_on.gif"));},
		function(){$(this).attr("src", $(this).attr("src").replace("_on", ""));}
	);
	//Search Pop
	$("#subMenu").children("li.search").find('a:first').click(function(){
		if (opened == false) {
			$("#searchPop").slideDown(200);
			opened = true;
			return false;
		}else{
			$("#searchPop").slideUp(100);
			opened = false;
			return false;
		};
	})
	$("#close").click(function(){
		$("#searchPop").slideUp(100);
		return false;
	})
	$("#main").click(function(){
		if (opened == true) {
			$("#searchPop").slideUp(100);
			opened = false;
			return false;
		}
	})
});

var opened = false;

//Popup Function
function popup(u, w, h, n, s, r, ext){
	var janela;
	var topo 	= 0;
	var esq 	= 0;
	var scrl 	= (s) ? 'yes' : 'no';
	var red 	= (r) ? 'yes' : 'no';
	janela = window.open (u, n, 'width=' + w + ', height=' + h + ', top=' + topo + ', left=' + esq + ', scrollbars=' + scrl + ', resizable=' +  red+ ', statusbar=no');
	janela.focus();
}
