// JavaScript Document
$(document).ready(function () {   

	//PACKAGE ROTATOR
	$('#package_rotate').cycle({
		fx:      'fade', 
		speed:    2000, 
		cleartypeNoBg: 'true',
		timeout:  4200 
	});
	
	//RESBOX DATEPICKER
	$('#datepicker').datepicker({ 
		showOn: 'button',
		buttonImage: '/templates/images/datepicker.png',
		buttonImageOnly: true,
		
		dateFormat:'m/d/yy', 
		onClose: function(dateText) {
			strFilled = dateText.split('/');
			$("#month1").selectBox('value', strFilled[0]);
			$("#day1").selectBox('value', strFilled[1]);
			$("#year1").selectBox('value', strFilled[2])
		}
	});

	//SELECTBOX EFFECTS
	$("SELECT").selectBox();
	
	//FANCY BOX EFFECTS
	$("a.fancybox").fancybox({
		'transitionIn'	:	'fade',
		'transitionOut'	:	'fade',
		'speedIn'		:	500, 
		'speedOut'		:	300, 
		'overlayShow'	:	true
	});
	
	$(".fancyboxTD a").fancybox({
		'transitionIn'	:	'fade',
		'transitionOut'	:	'fade',
		'speedIn'		:	500, 
		'speedOut'		:	300, 
		'overlayShow'	:	true
	});

	
	$("a.swfFancybox").fancybox({
		'transitionIn'	:	'fade',
		'transitionOut'	:	'fade',
		'speedIn'		:	500, 
		'speedOut'		:	300, 
		'overlayShow'	:	true,
		'height'		:	'530px',
		'width'			:	'518px',
		'padding'		:	'0'
	});

	
	//FORM MESSAGES, HIGHLIGHTING AND VALIDATOR
	$("form").highlight();
	$(".msg").delay(3000).fadeOut(3000);
	
	var container = $('#formError');
	$("#form").validate({
		errorContainer: container,
		errorLabelContainer: $("ol", container),
		wrapper: 'li',
		meta: "validate",
		focusInvalid: false
	});
	
	var loginContainer = $('#formLoginError');
	$("#formLogin").validate({
		errorContainer: loginContainer,
		errorLabelContainer: $("ol", loginContainer),
		wrapper: 'li',
		meta: "validate",
		focusInvalid: false
	});

	var signupContainer = $('#formSignupError');
	$("#formSignup").validate({
		errorContainer: signupContainer,
		errorLabelContainer: $("ol", signupContainer),
		wrapper: 'li',
		meta: "validate",
		focusInvalid: false
	});

});
