$(document).ready(
	function() {
		$("#eXTReMe").css('display', 'none');
		$("#btnSubmit").click(
			function(e) {
				var vError = false;
				
				if(jQuery.trim($("#email").val()) == "")
				{
					jsShowErrorInputMsg("email", '');
					if(!vError) focusto = 'email';
					vError = true;
				} else {
					jsHideErrorInputMsg("email");
				}
				if(jQuery.trim($("#login").val()) == "")
				{
					jsShowErrorInputMsg("login", '');
					if(!vError) focusto = 'login';
					vError = true;
				} else {
					jsHideErrorInputMsg("login");
				}
				if(jQuery.trim($("#password").val()) == "")
				{
					jsShowErrorInputMsg("password", '');
					if(!vError) focusto = 'password';
					vError = true;
				} else {
					jsHideErrorInputMsg("password");
				}
				if(jQuery.trim($("#re_password").val()) == "")
				{
					jsShowErrorInputMsg("re_password", '');
					if(!vError) focusto = 're_password';
					vError = true;
				} else {
					jsHideErrorInputMsg("re_password");
				}
				if(jQuery.trim($("#password").val()) != jQuery.trim($("#re_password").val()))
				{
					jsShowErrorInputMsg("password", '');
					jsShowErrorInputMsg("re_password", '');
					if(!vError) focusto = 're_password';
					vError = true;
				} else {
					jsHideErrorInputMsg("password");
					jsHideErrorInputMsg("re_password");
				}
				if(jQuery.trim($("#site").val()) == "" || jQuery.trim($("#site").val()) == "http://")
				{
					jsShowErrorInputMsg("site", '');
					if(!vError) focusto = 'site';
					vError = true;
				} else {
					jsHideErrorInputMsg("site");
				}
				
				if(!vError)
				{
					$("#frmSubmit").submit();
				} else {
					$("#" + focusto).focus();
				}
			}
		);
		$("#addGallery").click(
			function(e) {
				var vError = false;
				
				/*if(jQuery.trim($("#login").val()) == "")
				{
					jsShowErrorInputMsg("login", '');
					if(!vError) focusto = 'login';
					vError = true;
				} else {
					jsHideErrorInputMsg("login");
				}
				if(jQuery.trim($("#password").val()) == "")
				{
					jsShowErrorInputMsg("password", '');
					if(!vError) focusto = 'password';
					vError = true;
				} else {
					jsHideErrorInputMsg("password");
				}*/
				if(jQuery.trim($("#description").val()) == "")
				{
					jsShowErrorInputMsg("description", '');
					if(!vError) focusto = 'description';
					vError = true;
				} else {
					jsHideErrorInputMsg("description");
				}
				if(jQuery.trim($("#url").val()) == "")
				{
					jsShowErrorInputMsg("url", '');
					if(!vError) focusto = 'url';
					vError = true;
				} else {
					jsHideErrorInputMsg("url");
				}
				if(jQuery.trim($("#Img1").val()) == "")
				{
					jsShowErrorInputMsg("Img1", '');
					if(!vError) focusto = 'Img1';
					vError = true;
				} else {
					jsHideErrorInputMsg("Img1");
				}
				/*if(jQuery.trim($("#code").val()) == "")
				{
					jsShowErrorInputMsg("code", '');
					if(!vError) focusto = 'code';
					vError = true;
				} else {
					jsHideErrorInputMsg("code");
				}*/
				if(!vError)
				{
					$("#frmGallery").submit();
				} else {
					$("#" + focusto).focus();
				}
			}
		);
		$("#btnContact").click(
			function(e) {
				var vError = false;
				
				if(jQuery.trim($("#name").val()) == "")
				{
					jsShowErrorInputMsg("name", '');
					if(!vError) focusto = 'name';
					vError = true;
				} else {
					jsHideErrorInputMsg("name");
				}
				if(jQuery.trim($("#email").val()) == "")
				{
					jsShowErrorInputMsg("email", '');
					if(!vError) focusto = 'email';
					vError = true;
				} else {
					jsHideErrorInputMsg("email");
				}
				if(jQuery.trim($("#subject").val()) == "")
				{
					jsShowErrorInputMsg("subject", '');
					if(!vError) focusto = 'subject';
					vError = true;
				} else {
					jsHideErrorInputMsg("subject");
				}
				if(jQuery.trim($("#message").val()) == "")
				{
					jsShowErrorInputMsg("message", '');
					if(!vError) focusto = 'message';
					vError = true;
				} else {
					jsHideErrorInputMsg("message");
				}
				if(jQuery.trim($("#code").val()) == "")
				{
					jsShowErrorInputMsg("code", '');
					if(!vError) focusto = 'code';
					vError = true;
				} else {
					jsHideErrorInputMsg("code");
				}
				if(!vError)
				{
					$("#frmContact").submit();
				} else {
					$("#" + focusto).focus();
				}
			}
		);
		$("#btnLookup").click(
			function(e) {
				var vError = false;
				
				if(jQuery.trim($("#login").val()) == "")
				{
					jsShowErrorInputMsg("login", '');
					if(!vError) focusto = 'login';
					vError = true;
				} else {
					jsHideErrorInputMsg("login");
				}
				if(jQuery.trim($("#email").val()) == "")
				{
					jsShowErrorInputMsg("email", '');
					if(!vError) focusto = 'email';
					vError = true;
				} else {
					jsHideErrorInputMsg("email");
				}
				if(!vError)
				{
					$("#frmForgot").submit();
				} else {
					$("#" + focusto).focus();
				}
			}
		);
		$("#bookmark").click(
			function(e) {
				url = "http://perufornication.com/"
				title = "Perufornication - Nude Babes Teens & Lesbians"
				if (document.all)
				{
					window.external.AddFavorite(url, title);
				} else if (window.sidebar) {
					window.sidebar.addPanel(title, url, "");
				}
				e.preventDefault();
			}
		);
	}
)
