$(document).ready(function() {

	$('#tabs').tabs();

	$.fn.ezpz_tooltip.positions.topLeft1 = function(contentInfo, mouseX, mouseY, offset, targetInfo) {
		
		contentInfo['top'] = mouseY + 20;
		contentInfo['left'] = (screen.availWidth / mouseX) / 2 ;

		return contentInfo;
	};
	
	$.fn.ezpz_tooltip.positions.topLeft2 = function(contentInfo, mouseX, mouseY, offset, targetInfo) {
		contentInfo['top'] =  mouseY - contentInfo['height'] -10;
		contentInfo['left'] = ((screen.width / mouseX) / 2) + 650 ;

		return contentInfo;
	};

	$("#redirect-target-3").ezpz_tooltip({
		contentPosition: 'topLeft2'
	});
	
	$("#redirect-target-2").ezpz_tooltip({
		contentPosition: 'topLeft2'
	});
	
	$("#redirect-target-1").ezpz_tooltip({
		contentPosition: 'topLeft1'
	});
	
	
	$("#searchform").focus(function() {
	if( this.value == this.defaultValue ) {
		this.value = "";
	}
	}).blur(function() {
		if( !this.value.length ) {
			this.value = this.defaultValue;
		}
	});
	
	$("#header_round").corner("top 12px");
	$("#footer_round").corner("bottom 12px");
	
	if($("#branchid").val() != '-1' ) {
		$('#branchform').val("");
		$('#branchform').attr('disabled', 'disabled');
	}
	
	$("#branchform").click(function() {
		$('#branchform').val('');
	});
	
	$('#choosebranch-form').dialog({
		autoOpen: false,
		height: 200,
		modal: false
		}
	);
	
	$('#choosebranch-form-clearance').dialog({
		autoOpen: false,
		height: 200,
		modal: false
		}
	);
	
	$("a.choosebranch").click(function() {
		$("#choosebranch-form").dialog("open");
	});
	
	$("a.choosebranchclearance").click(function() {
		$("#choosebranch-form-clearance").dialog("open");
	});
	
	
	if($("#branchiddialog").val() != '-1' ) {
		$('#branchformzipdialog').val("");
		$('#branchformzipdialog').attr('disabled', 'disabled');
	}
	
	$("#branchformzipdialog").click(function() {
		$('#branchformzipdialog').val('');
	});
	
	$('a.choosebranch').bind('click.dontClick',function(e){
		e.preventDefault();
	});
	
});
