
var FieldsToBeCleared = {
	Textbox: '#signupForm > li > input[type=text],.searchInput,.searchContainer > input[type=text]',
	Textarea: '#signupForm > li > textarea'	,
	PasswordLabel: '.labelTest label',
	PasswordInput: '.labelTest input',
	searchTextLabel: '.labelGroup label',
	searchTextInput: '.labelGroup input'
	
}

/* PW CLEARING */
	$(FieldsToBeCleared.searchTextLabel).css('display', 'inline-block');
	
	$(FieldsToBeCleared.searchTextLabel).each( function(){
		if( $(this).parent(0).children('input').attr('value')){
			$(this).hide();
			$(this).parent(0).children('input').val($(this).parent(0).children('input').attr('value'));
			
		}else{
			
		};								  
													  
	});
	
	$(FieldsToBeCleared.searchTextLabel).click( function(){
		$(this).hide();
		$(this).parent(0).children('input').focus();
	});
	
	$(FieldsToBeCleared.searchTextInput).focus( function(){
		$(this).parent(0).children('label').hide()
	});
	
	$(FieldsToBeCleared.searchTextInput).blur( function(){
														
		if( $(this).attr('value')){
		
		}else{
	
			$(this).parent(0).children('label').show();
		}
	});
function newWindow(){
		
		
			var windowName = 'New Window';
			var url = $(this).attr('href');
			window.open(url, windowName, 'toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes'); 
			return false;
			
		
	}
$(document).ready(function(){
						   
						   
// NEW WINDOW HANDLER
	

	$("ul.tabs").tabs("div.panes > div");
	
	$("ul.galleryTabs").tabs("div.galleryPanes > div");
	// UNIT PAGE GALLERY HANDLER
	$('#photoGallery .galleryThumbnailLink').click( function(){
		var imageLink = $(this).attr('href');
		$('#photoGallery .galleryPresenter img').attr('src', imageLink) 
		$('#photoGallery #mainImage').attr('href', imageLink) 
		return false;
	});
	
	$('#floorPlanGallery .galleryThumbnailLink').click( function(){
		var imageLink = $(this).attr('href');
		$('#floorPlanGallery .galleryPresenter img').attr('src', imageLink) 
		$('#floorPlanGallery #mainImage').attr('href', imageLink) 
		return false;
	});
	
	$('.slideShow').mouseenter(function(){
	
		$('#slideNext').fadeIn();
		$('#slidePrev').fadeIn();
	
	});
	
	$('.slideShow').mouseleave(function(){
	
		$('#slideNext').fadeOut();
		$('#slidePrev').fadeOut();
	});



	$('.fancy').fancybox({
		
		'overlayColor': '#000000',
		'padding' : 0
	
	});
	
	$('.planFancy').fancybox({
		
		'width' : 590,
		'height' : 558,
		'scrolling' : 'no',
		'autoDimensions' : false,
		'centerOnScroll' : true,
		'overlayColor': '#000000',
		'padding' : 0
	
	});
	
	$('.cycle').cycle({
		fx:    'fade', 
		pause:  0,
		timeout: 5000,
		speed: 2500
	});

			

});

	function onAfter(curr, next, opts) {
		var index = opts.currSlide;
		$('#prev')[index == 0 ? 'hide' : 'show']();
		$('#next')[index == opts.slideCount - 1 ? 'hide' : 'show']();
	}
	
	$('.propertySlideShow').after('<div id="nav">').cycle({ 
		fx:     'scrollHorz', 
		prev:   '#slidePrev',
		pager:  '#nav', 
		next:   '#slideNext', 
		speed:   500,
		after:   onAfter, 
		timeout: 0,
		pagerAnchorBuilder: function(idx, slide) { 
			// return selector string for existing anchor 
			return '<a href="#" class="navDot"></a>'; 
		} 
	});
	
	

