$(document).ready(function() {
	
	$('#clientimages div').hide();
	$('#clientimages div:first-child').show();
	$('#clientlist div:first-child').addClass('bold');
	
	$('#clientlist div').each(function(){
		$(this).addClass('pointer');
		if($(this).hasClass('no-image')){
			$(this).removeClass('pointer');
		} else {
			
		}
	});  
	
	$('#clientlist div').bind("click", switchImg);
	$('#sidebar.contact div a').click(function(){
		id = $(this).attr('ref');
		safeScroll(id);
	});
	
	$('#clientlist div.pointer').hover(
	function(){
		var id = $(this).attr('id').replace('client-','');
		var img = 'image-'+id;
		$('#clientimages div').hide();
		$("#clientimages div#"+img).show();
		$("#clientimages div#"+img+" div.mag").show();
		$('#clientlist div').removeClass('bold');
		$(this).addClass('bold');
	},function(){
		
	});
	
	
	
}); 

function switchImg(){
	var id = $(this).attr('id').replace('client-','');
	var img = 'image-'+id;
	$('#clientimages div').hide();
	$("#clientimages div#"+img).show();
	$('#clientlist div').removeClass('bold');
	$(this).addClass('bold');
}

    
function safeScroll(id){
	$('html,body').animate({scrollTop: $('#'+id).offset().top},'slow');
}     

function mag(){
	var imgC = 1;
	$('img.lightbox-enabled').each(function(){
		var imgH = $(this).height();
		var imgW = $(this).width(); 
		$(this).after('<div id="mag_'+imgC+'" class="mag"><img class="mag" src="http://www.wolverineleathers.com/wp-content/themes/blank/images/mag.png" alt="(+)"/></div>');
		//$('div#mag_'+imgC).css('height',imgH+'px').css('width',imgW+'px');
		//var Hoffset = imgH - 50;
		//$('div#mag_'+imgC+' img.mag').css('marginTop',Hoffset+'px');
		imgC = imgC+1;
	});               
	
	
}
