var Geral = {

	__construct: function() {
		_this = Geral;
		$.ifixpng('pics/pixel.gif');
		$('div.thumbs,img[@src$=.png]').ifixpng(); //png transparent no IEca
		$("input[type='text'],textarea").resetDefaultValue();
		$("input[type='text'], input[type='password']").addClass("text");
		$("div#nav ul li:last").css("borderBottom","none");
		$("#container").append("<div class='clear'></div>");
		_this.iconsEmp();
		$("ul.fotos li").each(function(i) {
			if((i+1)%3  == 0) $(this).after("<div class='clear'></div>");
		});
		_this.popup();
	},

	iconsEmp: function() {
		$("div.icons div.message").css("visibility","hidden");
		$("div.icons a").hover(
			function() {
				var title = $(this).attr("title");
				var link = $(this).attr("rel");
				$("div.icons div.message").css({visibility:"visible",background:"url(pics/"+link+") no-repeat"}).text(title);
				return false;
			},
			function() { $("div.icons div.message").css("visibility","hidden"); }
		);
	},
	
	popup: function() {
		$("a.popup").click(function(e) {
			e.preventDefault();
			window.open(this.href, '_blank', 'width=360,height=516,resizable=1');	
			return false;
		});	
	},	validarEmail : function (email) {		email = email.toLowerCase();		tmpEmail = /^[\w-]+(\.[\w-]+)*@(([0-9a-z\d][0-9a-z\d-]{0,61}[0-9a-z\d]\.)+[0-9a-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/;		eval("tmpEmail = tmpEmail");		if (tmpEmail.test(email)) return true;		else return false;	},		validarContato : function(form){		var me = this;		var $form = $(form);		var msg = "";		if($form.find('#nome').val() == "" && msg == "") msg = "Preencha o seu nome";		if(!me.validarEmail($form.find('#email').val()) && msg == "") msg = "Preencha o seu email corretamente";		if($form.find('#telefone').val() == "" && msg == "") msg = "Preencha o seu telefone";		if($form.find('#mensagem').val() == "" && msg == "") msg = "Preencha a sua mensagem";		if(msg != "") alert(msg);		return msg == "";	}
}

$(document).ready(function(){
	Geral.__construct();
});