jQuery(document).ready(function(){  
	$=jQuery;

	$('.sidebar_image').remove().appendTo('#sidebar').prev('ul').remove().parent().css({background:'#000'});

	$('.slider, .reviews').slideUp(100);

	$('.details_click, .reviews_click').hover(function(){this.style.cursor = 'pointer';},function(){this.style.cursor = 'normal';});
	$('.details_click').click(function(){ 
		$P = $(this).parent().parent().find('.pr_stylist_details');
		$P.slideToggle(500);
		
	});
	$('.reviews_click').click(function(){ 
		$P = $(this).parent().find('.reviews');
		$P.slideToggle(500);
	});

	$('#sform').css({opacity:'.7'}).hover( function(){ $(this).css({opacity:'1'}); }, function(){ $(this).css({opacity:'.7'}); } );
	$('#q').focus( function(){ $('#sform').css({opacity:'1'}); }, function(){ $('#sform').css({opacity:'.3'}); } );

	/* for location/stylists page
	$('.pr_stylist').hover(
		function(){
				$(this).css({backgroundColor:'#000',color:'#fff'}); 
				$(this).find('h3').css({color:'#fff'});
				$(this).find('.pr_stylist_description').css({borderBottom:'1px solid #fff'});
				$(this).find('.pr_stylist_prices').css({ borderBottom:'1px solid #fff', borderTop:'1px solid #fff' });
				
		},
		function(){
			$(this).css({
					backgroundColor:'transparent',
					color:'#000'
			}); 
			$(this).find('h3').css({color:'#000'});
			$(this).find('.pr_stylist_description').css({borderBottom:'none'});
			$(this).find('.pr_stylist_prices').css({ borderBottom:'1px solid #000', borderTop:'1px solid #000' });
		}
	);
	*/
	$('.location_title span').hover(
		function(){
			$(this).css({cursor:'pointer'});
		},
		function(){
			$(this).css({cursor:'normal'});
		}
	);
	$('#map_anch').click(pr.map.show);
	
	pr.map.load();

	$('.pr_stylist_description img').each(function(){
		if( $(this).attr('src').substr( $(this).attr('src').length - 1, $(this).attr('src').length) == '/' ){
			this.src = $(this).attr('src') + 'noPhoto.png';
		}
	});

});

pr = {
	map: {
		load: function(){
			$('#loc_map').slideUp();

			if( $('.location_banner img').attr('src') !== undefined ){
				if( $('.location_banner img').attr('src').substr($('.location_banner img').attr('src').length - 1, $('.location_banner img').attr('src').length) == '/' ){
					pr.map.show();				
				}
			}
		},
		show: function(){
			$('.location_banner').slideToggle('slow');
			$('#loc_map').slideToggle('slow',function(){
				if (GBrowserIsCompatible()) {
				var map = new GMap2(document.getElementById("loc_map"));
				var latlng = new GLatLng(loc_long,loc_lat);
				map.setCenter(latlng, 15);
				map.addControl(new GSmallZoomControl());
				map.addControl(new GMapTypeControl());
				map.addOverlay(new GMarker(latlng));
				}
			});
			
		}
	}
}