
$(document).ready(function() {
	
	// Change images between Colour/B&W when hovered over
	$(".hoverCol").hover(
		function () {
			var img = $(this).attr('src');
			img = img.substring(0,img.indexOf(".png"));
			img += '-c.png';
			$(this).attr('src',img);
		}, 
		function () {
			var img = $(this).attr('src');
			img = img.substring(0,img.indexOf("-c.png"));
			img += '.png';
			$(this).attr('src',img);
		}
	);

	// Click on thumbnail to change large image that's shown
	$(".thumb").click(function(){
		$(this).closest('.popup').find(".big_image").attr("src",this.rel);
//		$(".big_image").attr("src",this.rel);
	});
	
})

function openLayerBC()
{

 tWidth = $(document).width();
 tHeight = $(document).height();
 //$("select").fadeOut('fast');
 $('#filter').css("width",tWidth+"px");
 $('#filter').css("height",tHeight+"px");
// $('#filter').css('z-index',9990);
 $("#filter").css("opacity", 0.6);
 $('#filter').fadeIn('fast');
 //$('#filter').bind("click",closePopup1);

 } 	
function closePopup1(anchor)
  {
	  $('#filter').fadeOut('fast');
	  //o = document.getElementById(divid);
	  //o.style.display = o.style.display=='block'?'none':'block';
	  //document.getElementById('filter').style.display='block'?'none':'block';
		$(anchor).closest('.popup').css('display','none');
  }



function openPopUp1(divid,parent,width)
	{
		if (width === undefined) {
			width = 905;
		}
		openLayerBC();
	
		ww = $(document).width();
		
		//alert(st);
		newLeft = (ww/2)-((width+30)/2);  // '30' is the padding we need to allow for
		$('#'+divid+' .popup_block').css('width',width);
		$('#'+divid+' .popup_field').css('width',width);		
		$('#'+divid+' .popup_middle').css('width',width);				
		$('#'+divid).css('z-index',2000000);
		$('#'+divid).css("left",newLeft);
		$('#'+divid).css("top",$(window).scrollTop()+5); 
		$('#'+divid).fadeIn('normal');
	}
	
