$(function(){
	/***
	 * Generic functions that come out of the box
	 */
	
	/*E-mail Exclusives Input Clear*/
	$("input[name=EMAIL]").focus(function()
	{
		$(this).val("");		
		$(this).blur(function()
		{
			if($(this).val()=="")
				$(this).val("Enter email here");
		});
	});
	
	/*Lightbox Event Handler*/
	if($("a.lightbox").length>0){
		$("a.lightbox").lightBox({
			imageBtnPrev 	: assets+'images/lightbox-btn-prev.gif',
			imageBtnNext 	: assets+'images/lightbox-btn-next.gif',
			imageBtnClose	: assets+'images/lightbox-btn-close.gif',
			imageLoading   	: assets+'images/lightbox-ico-loading.gif',
			fixedNavigation	: true
		});
	}
	
	/*Datepicker Event Handler*/
	$("a.datepickeropen").click(function(){		
		$("#sitewrapper").after('<div id="datepicker">&nbsp;</div>');
		$("#datepicker").css({'display':'none','position':'absolute','z-index':'100','left':$(this).offset().left,'top':$(this).offset().top});
				
		var opts;
		var arr = $(this).attr("rel").split("_");
		
		switch(arr[0])
		{	
			case "res":
				opts = {
					dateFormat:'yy-mm-dd',
					onSelect: function(dateText){
						$("input[name=arrival]").val(dateText);
						$("#datepicker").remove();
					}
				}				
			break;
			case "text":
				opts = {
					dateFormat:'m-d-yy',					
					onSelect: function(dateText){						
						$("."+arr[1]).val(dateText);									
						$("#datepicker").remove();
					}
				}
			break;
		}
		
		$("#datepicker").datepicker(opts);
		$("#datepicker").toggle();
		
		return false;
	});
	
	/**
	 * End Generic Functions
	 */
});