// JavaScript Document

$(document).ready(function(){

	$('.gridRow .gridCol').each(function(){
		
		/* ---------------------
			the following checks: 
			1. if the .gridCol doesn't have a class that matches .gridCol-two,  hence singling out only columns of thirds, and
			2. if within the .gridCol, it contains all of a.viewDetails, a.thumbnail, and p.summary to make sure it's a split page.
		   --------------------- */
		if( !$(this).attr('class').match(/gridCol-two/) ){
			if($(this).children('a.viewDetails').size() == 1 && $(this).children('.thumbnail').size() == 1 && $(this).children('p.summary').size() == 1){
				//$('a.thumbnail', this).css({'opacity': 0.9});
				$(this).hover(function(){
					$('.thumbnail', this).css({'opacity':0.9});
				}, function(){
					$('.thumbnail', this).css({'opacity':1});
				});
			};
		}
	});
	
	/* ---------------------
		Switch off otherLocation selector with button OFF when javascript is turned ON. 
		--------------------- */
	$('#otherLocation').hide();
	$('#otherLocationJS').show().css({'visibility':'visible'});


	/* ---------------------
		Using Javascript to enable block rollover for .promo boxes (for IE6)
		--------------------- */
	$('.promo li').hover(function(){
		$('h3', this).css({'color':'#717171'});
	}, function(){
		$('h3', this).css({'color':'#9c9c9c'});
	});
	
	/* ---------------------
		Using Javascript to enable rollover for .landingGrid .gridCol h2 (for IE6)
		--------------------- */
	$('.landingGrid .gridCol').hover(function(){
		$('h2 a', this).css({'color':'#333333'});
	}, function(){
		$('h2 a', this).css({'color':'#a5a5a5'});
	});
	
	/* ---------------------
		Javascript to enable opacity hover on homepage #homePromo
		--------------------- */
	$('#homePromo .homePromoItem a').hover(function(){
		$(this).css({'opacity': 0.8});
	}, function(){
		$(this).css({'opacity': 1});
	});
	
	/* ---------------------
		Using Javascript to enable opacity rollover listing thumbnails
		--------------------- */
	$('ul.listings li .thumbnail a').hover(function(){
		$('img', this).css({'opacity':0.9});
	}, function(){
	$('img', this).css({'opacity':1});
	});
	
	
	
});



