$(document).ready(function(){
	 
	$(".js_showgallery").click(function(){
		$("#casenav li").removeClass("current");
	  	$(this).parents("li").addClass("current");
		$("#caseimg img.galleryimage:first").css({ "position" : "absolute", "z-index" : "2" }).fadeOut(function(){ $(this).remove(); });
		$("#caseimg").prepend('<img src="'+this.href+'" alt="" width="460" height="290" class="galleryimage" />').children("img:first").css({ "display":"none", "position" : "absolute", "z-index" : "1" }).fadeIn("slow");
		return false;
	});

	$(".js_print").click(function(){
		window.print();
	});
	if (navigator.userAgent.indexOf("MSIE 6")!=-1) {
		jQuery("img").each(function() {
			var reg=/\.png$/;
			if (this.src.match(reg)) {
				var imgsrc=this.src;
				this.style.width=this.width+"px";
				this.style.height=this.height+"px";
				this.src = "/x.gif";
				this.runtimeStyle.backgroundImage = "none";
				this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + imgsrc + "', sizingMethod='scale')";
			}
		});
	}
	$("a.pdf, a[rel=external]").click(function(){
		var winprefs="";
		var s=this.search;
		if (s) {
			var m=s.match(/[\?&]w=([0-9]+)&?/);
			var w=(m[1])?m[1]:"auto";
			m=s.match(/[\?&]h=([0-9]+)&?/);
			var h=(m[1])?m[1]:"auto";
			winprefs=(w||h)?"toolbar=0,location=1,status=1,scrollbars=1,width="+w+",height="+h:"";
		}
		window.open(this.href,s,winprefs);
		return false;
	});

});
