$(document).ready(function(){
	$(document)[0].oncontextmenu = function() { alert('Todos os direitos reservados.'); return false;}
	var theWindow        = $(window),
		$bg              = $("#bg"),
		aspectRatio      = $bg.width() / $bg.height();
	function resizeBg() {
		if ( (theWindow.width() / theWindow.height()) < aspectRatio ) {
			$bg
				.removeClass()
				.addClass('bgheight');
		} else {
			$bg
				.removeClass()
				.addClass('bgwidth');
		}
	}
	theWindow.resize(function() {
		resizeBg();
	}).trigger("resize");
	$("a[rel='screenshots']").colorbox();
	$(".iframe").colorbox({width:"90%", height:"90%", iframe:true });
	$("#phone").mask("99 9999.9999");
	$('#portfolio').jScrollPane({horizontalDragMinWidth:120,horizontalDragMaxWidth:120});
});
function chkForm(formname) {
	if (document.forms[formname].nome.value == "" || document.forms[formname].nome.value == "Nome") {
		alert("Preenchimento necessário: Nome! ");
		document.forms[formname].nome.focus();
		return;
	} else {
	}
	if (document.forms[formname].email.value == "" || document.forms[formname].email.value == "Nome") {
		alert("Preenchimento necessário: E-mail! ");
		document.forms[formname].email.focus();
		return;
	} else {
	}
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.forms[formname].email.value)) {
	} else {
		alert("E-mail ("+ document.forms[formname].email.value + ") inválido. Tente novamente. ");
		document.forms[formname].email.value="";
		document.forms[formname].email.focus();
		return;
	}
	if (document.forms[formname].assunto.value == "") {
		alert("Preenchimento necessário: Assunto! ");
		document.forms[formname].assunto.focus();
		return;
	} else {
	}
	if (document.forms[formname].mensagem.value == "" || document.forms[formname].mensagem.value == "Mensagem") {
		alert("Preenchimento necessário: Mensagem! ");
		document.forms[formname].mensagem.focus();
		return;
	} else {
	}
	if (document.forms[formname].assunto.value == "1") {
		if (document.forms[formname].anexo.value == "") {
			alert("Selecione um arquivo com CV ou Portfolio! ");
			document.forms[formname].anexo.focus();
			return;
		} else {
		}
	} else {
	}
	$("#send").disabled();
	$("#send").val("Enviando aguarde...");
	document.forms[formname].submit();
}
