function DESemail(emailname,emailserver) {
	document.write("<a href='mailto:" + emailname + "@" + emailserver +"'>");
	document.write(emailname + "@" + emailserver); 
	document.write("</a>"); 
}

// Accessible Pop Ups
function DESopen(url,width,height,toolbar,scroll) {
	window.open(url, "", "scrollbars="+scroll+",toolbar="+toolbar+",height="+ height +",width="+width);
	return false;
}



$(document).ready(function(){

	
	
	$("#cms-faqs a").toggle(
		function(){
			$(this).parent().find(".answer").slideDown("fast");
		},function(){
			$(this).parent().find(".answer").slideUp("fast");
		}
	);
	
	$("#products li a").hover(function(){
	  $(this).find("span").css("background","url(../../img/design/prod_cat_overlay.png) -102px 0px no-repeat");
	},function(){
	  $(this).find("span").css("background","url(../../img/design/prod_cat_overlay.png) 0px 0px no-repeat");
	});
	
	$("ul.thumbs li a").hover(function(){
	  $(this).find("span").css("background","url(../../img/design/thumb_overlay.png) -76px 0px no-repeat");
	},function(){
	  $(this).find("span").css("background","url(../../img/design/thumb_overlay.png) 0px 0px no-repeat");
	});
	
	
	//  Photo Gallery
	$("ul.thumbs a").click(function() {
		
		//alert('shite');
		//return false;
		
		$("#image img").fadeOut('fast').remove();
		$("#preloading").css("display","block");
		var randomnumber=Math.floor(Math.random()*150)
		var newSrc = $(this).get(0).href;
		/*
			Add a random number to image to make browser load again
			Ensures .onload works in IE/Opera
			Rubbish hack, would like to improve
		*/
		var newSrc = ''+newSrc+'?ran='+randomnumber+'';

		var nextImg = new Image();
		nextImg.src = newSrc;
		
		var nextImgHTML = '<img src="'+newSrc+'" with="303" height="328" /><span></span>';
		nextImg.onload = function()
		{
			$("#preloading").css("display","none");
			// Safari didn't like append, don't know why I used it anyways!!
			//$("#image").append(nextImg);
			$("#image").html(nextImgHTML);
			$("#image img").fadeIn('medium');
		}
			
		//if (nextImg.complete) {
		//	nextImg.onload();
		//}
		$("ul.thumbs a").removeClass("current");
		$(this).addClass("current");
		
		return false;
	});

	
	var piHeight = $("#page_image img").attr("height");
	$("#page_image img").after('<span class="pi_bottom" style="height:'+piHeight+'"></span><span class="pi_top"></span>');
	
	
	$('#header_flash').flash(
  	{
  		src: '/incs/flash/minster_flash.swf',
  		wmode: "transparent",
  		width: 236,
  		quality: "high",
  		bgColor: "#D31017",
  		height: 90
  	},
  	{ update: false }
  );
    

}); // End jQuery