function tb_show() {//function called when the user clicks on a thickbox link

	if (typeof document.body.style.maxHeight === "undefined") {//if IE 6
		$("body","html").css({height: "100%", width: "100%"});
		$("html").css("overflow","hidden");
		$("#overlay").before("<iframe id='gallery_HideSelect'></iframe>");
		$("#overlay, #gallery_window").show();
		tb_position();
		$("#overlay").click(tb_remove);
	}else{//all others
		$("#overlay, #gallery_window").show();
		tb_position();
		$("#overlay").click(tb_remove);
	}
	
	if(tb_detectMacXFF()){
		$("#overlay").addClass("overlayMacFFBGHack");//use png overlay so hide flash
	}else{
		$("#overlay").addClass("overlayBG");//use background and opacity
	}
}

function tb_position() {
	GALLERY_WIDTH = 560;
	GALLERY_HEIGHT = 540;
	$("#gallery_window").css({marginLeft: '-' + parseInt((GALLERY_WIDTH / 2),10) + 'px', width: GALLERY_WIDTH + 'px'});
	if ( !(jQuery.browser.msie && jQuery.browser.version < 7)) { // take away IE6
		$("#gallery_window").css({marginTop: '-' + parseInt((GALLERY_HEIGHT / 2),10) + 'px'});
	}
}

function tb_remove() {
 	$("#gallery_window").fadeOut("fast",function(){$('#gallery_HideSelect').trigger("unload").unbind().remove();});
	$("#overlay, #gallery_window").hide();
	if (typeof document.body.style.maxHeight == "undefined") {//if IE 6
		$("body","html").css({height: "auto", width: "auto"});
		$("html").css("overflow","");
	}
	document.onkeydown = "";
	document.onkeyup = "";
	return false;
}

function tb_detectMacXFF() {
  var userAgent = navigator.userAgent.toLowerCase();
  if (userAgent.indexOf('mac') != -1 && userAgent.indexOf('firefox')!=-1) {
    return true;
  }
}



