$(document).ready(function() {
    $('a[rel*=facebox]').facebox()

		$(function(){
			$('.submitBtn').hover(
				// mouseover
				function(){ $(this).addClass('submitBtnHover'); },

				// mouseout
				function(){ $(this).removeClass('submitBtnHover'); }
			);	
		});	

		$(function() {
			$("#report #begin_date").datepicker({
				showOn: 'button',
				buttonImage: '/images/calendar_24.gif',
				buttonImageOnly: true  
			});
			$("#report #end_date").datepicker({
				showOn: 'button',
				buttonImage: '/images/calendar_24.gif',
				buttonImageOnly: true  
			});
		});

		$("#subscription_form").validate({
	    rules: {
				billing_email:			"required",
				billing_first_name: "required",
				billing_last_name: 	"required",
				billing_address: 		"required",
				billing_city: 			"required",
				billing_state: 			"required",
				billing_zip: 				"required",
				card_number: 				"required",
				expiration_month: 	"required",
				expiration_year: 		"required",
				ccv: 								{required: true,
														 number: true}
	    },
	    messages: {
				billing_email:			"Please enter your email address",
				billing_first_name: "Please enter your first name",
				billing_last_name: 	"Please enter your last name",
				billing_address: 		"Please enter your address",
				billing_city:  			"Please enter your city",
				billing_state: 			"Please enter your state", 
				billing_zip: 				"Please enter your zip",
				card_number: 				"Please enter your credit card number",
				expiration_month: 	"Please enter your credit card's expiration month",
				expiration_year: 		"Please enter your credit card's expiration year",
				ccv: 								{required: "Please enter your CCV", number: "Must be a number"}
	    },

		submitHandler: function(form) {
			if( this.valid() ){
				$.blockUI({message: '<h1>Please wait while your payment is processed. Thank you!</h1>', padding: 50});
				this.submit();
			}
		}
	});
	
	

	// rounder corners on home page
  settings = {
          			tl: { radius: 20 },
			          tr: { radius: 20 },
			          bl: { radius: 20 },
			          br: { radius: 20 },
				        antiAlias: true,
				        autoPad: true,
				        validTags: ["div"]
	}

  $('.round').corner(settings);


	// rounder corners on home page
  settings2 = {
          			tl: { radius: 10 },
			          tr: { radius: 10 },
			          bl: { radius: 10 },
			          br: { radius: 10 },
				        antiAlias: true,
				        autoPad: true,
				        validTags: ["div"]
	}

  $('.round2').corner(settings2);




});

function checkClientForm(){
	if(!$('#client_name').val().length)
	{	
		alert('Client name is required.');
		$('#client_name').css({'background-color':'red'});
		return false;
	}
	return true;
	
	
}
function checkProjectForm(){
	if(!$('#project_name').val().length)
	{	
		alert('Project name is required.');
		$('#project_name').css({'background-color':'red'});
		return false;
	}
	return true;
}
function checkTaskForm(){
	if(!$('#task_name').val().length)
	{
		alert('Task name is required.');
		$('#task_name').css({'background-color':'red'});
		return false;
	}
	return true;
}


var running_clock = false;

//show busy msg when loading
function clock_loading(busy_id){
	$(busy_id).show;
}
//disable link after clicked
function disable_link(link_id){
	$(link_id).disabled=true;
}
