// JavaScript Document
$(document).ready(function(){
	$("#jobList a").not($(".notpop")).not($(".delete")).each(function(){
		$(this).bind("click",function(){
			url = this.href;
			window.open(url, "viewJob", 'width=605,scrollbars=yes');
			return false;
		});
	});
	$("#seekerList a").not($(".delete")).each(function(){
		$(this).bind("click",function(){
			url = this.href;
			window.open(url, "viewSeeker", 'width=605,scrollbars=yes');
			return false;
		});
	});
	$(".delete").each(function(){
		$(this).bind("click",function(){
			url = this.href;
			if(confirm("Delete this?"))
			{
				redirecturl(url);
				var index = url.indexOf('deleteJob');
				if(index > 0)
				{
					window.open('http://www.equinestaff.com.au/story.php','Horse Staff - Success Story', 'height=400, width=400, toolbar= no, menubar=no, scrollbars=yes, resizable=no, location=no, status=no,top=100,left=50');				
				}				
			}
			return false;
		});
	});
});

function aa(){
	middleHeight = $("#middle").outerHeight(true);
	leftHeight = $("#leftBox").outerHeight(true);
	rightHeight = $("#rightBox").outerHeight(true);
	maxHeight = Math.max(leftHeight, rightHeight);
	if(middleHeight < maxHeight)
	{
		$("#middle").height(maxHeight);
	}
}

function checkEmail(obj, csType, customerId)
{
	var email = $(obj).val();
	if('' == email)
	{
		$("#email_check").val(1);
		$("#email_check_result").html('');
		return false;
	}
	$.post(appUrl+"/Index/checkEmail", {email:email, csType:csType, customerId:customerId}, function(xml){
		var result = $("result", xml).text();
		if(0 == result)
		{
			$("#email_check").val(0);
			$("#email_check_result").html('The E-mail has been used.');
		}
		else
		{
			$("#email_check").val(1);
			$("#email_check_result").html('');
		}
	});
}

function checkName(obj, customerId)
{
	var username = $(obj).val();
	if('' == username)
	{
		$("#name_check").val(1);
		$("#name_check_result").html('');
		return false;
	}
	$.post(appUrl+"/Index/checkName", {username:username, customerId:customerId}, function(xml){
		var result = $("result", xml).text();
		if(0 == result)
		{
			$("#name_check").val(0);
			$("#name_check_result").html('The User Name has been used.');
		}
		else
		{
			$("#name_check").val(1);
			$("#name_check_result").html('');
		}
	});
}