/*
 *	@title		Gansevoort TCI Core JS
 *	@author		Daniel Petkovski
 *	@modified	April 9, 2010
*/


//##### Quick Book Date Formater #####//
function formatDate()
{
	// Retrieve Start Date String From Form //	
	var str 		= document.getElementById("arrivalDate").value;
	
	// Set Day and Year Variables //
	var curDay		= str.substr(0,2);
	var curYear		= str.substr(7,4);
	
	// Prepare Month Variable //
	var curMonth	= str.substr(3,3);
	var numMonth	= 0;
	var months		= new Array("Empty","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
	
	// Convert String Month to Numeric Month //
	for (i=0;i<=13;i++) {
		if (curMonth == months[i]) {
			if (i < 10) {
				var numStr = '0' + i;
				numMonth = numStr;
			} else {
				numMonth = i;
			}
		}
	}
	
	// Format and Return Arrival Date //
	var fullDate = "";
	fullDate = numMonth+'\/'+curDay+'\/'+curYear;
	document.getElementById("arrivalDate").value = fullDate;
}


//##### Initiate jQuery Date Picker #####//
jQuery(function()
{
	jQuery('.date-pick').datePicker({clickInput:true})
	jQuery('.date-pick').datePicker().val(new Date().asString()).trigger('change');
});


//##### Initiate jQuery Lightbox Plugin #####//
jQuery(document).ready(function(){
	jQuery(".lightbox").lightbox();
});


//##### Initiate External Links Fix for XHTML Compliance #####//
window.onload = externalLinks;