// JavaScript Document
$(document).ready(function() {
	
	$("#vowExclusiveExePassword").click(function() {
		$("#vowExclusiveLoginForm").hide();
		$("#vowExclusivePasswordForm").show();
	});
	
	$("#vowExclusiveExeLogin").click(function() {
		$("#vowExclusiveLoginForm").show();
		$("#vowExclusivePasswordForm").hide();
	});
	
	
	
	$("#vowExclusiveLogin").click(function() {
		var form = $("#VowExclusiveLoginForm").serialize();
		$.ajax({
			type: "POST",
			url: "http://"+location.host+"/vow/index.php?"+form,
			success: function(data){
				if(data==1) window.open("http://"+location.host+"/vow/index.php?overlord=vowStart","_parent");
				else if(data==2) window.open("http://"+location.host+"/vow/admin/index.php?overlord=vowStartAgent","_parent");
				else if(data==3) alert("Your Login Failed. This could mean that you do not have any clients in the system, you are logging in from the wrong domain or are not setup for VOW.");
				else alert("Your login failed. This could mean the following.\n\n1. Your credentials were incorrect. Click the password retrieval link to have your password emailed to you.\n\n2. You are not registered for this website. Please create an account by using the signup form on this page or by clicking the Sign Up link.");
			}
		}); 
	});
	
	
	
	$("#vowExclusiveGetPassword").click(function() {
		var form = $("#VowExclusivePasswordRetrival").serialize();
		$.ajax({
			type: "POST",
			url: "http://"+location.host+"/vow/index.php?"+form,
			success: function(data){
				if(data){ 
					alert(data);
					$("#vowExclusiveLoginForm").show();
					$("#vowExclusivePasswordForm").hide();
				} else alert("Could not retrieve your password This could mean the following.\n\n1. Your credentials were incorrect and you are not registered for this website.\nPlease create an account by using the signup form on this page or by clicking the Sign Up link.");
			}
		}); 
	});
	
});

