﻿/*
 * Include jqModal.js
 */
 
var ie6=$.browser.msie&&($.browser.version == "6.0");
 
$(document).ready(function() {
	if(ie6)
	{
		$('#dialog').jqm({overlay:100,overlayClass:'jqmOverlayIe6'});
		/*$(".jqmClose").click(function() {
			hidden();
		});*/
	}		
	else
		$('#dialog').jqm();
	
	$('img.dropshadow').wrap("<span class='wrap1'><span class='wrap2'>" +
     "<span class='wrap3'></span></span></span>");
  
  // Crappy hack to counter a black flash caused by the IE 'Guillotine' bug hack in the C# code
  $('.ieGuillotineHack').click(function() {
  });
});

function showImage(id, text) {
	swapImage("jqmLargeImage", "folder-images/papers/large/" + id + ".jpg", text, text);
	$('.jqmTitle').text(text);
	$('#dialog').tfsCenter();
	$('#dialog').jqmShow();	
}
 
/*
 * Displays an image in a modal window.
 * Example Use: When displaying a larger view of a thumbnail.
 */
function swapImage(classId, src, title, alt) {
	classId = '.' + classId;
	$(classId).attr({ 
			src: "images/ajax-loader.gif",
			title: "Loading...",
			alt: "Loading..."
  });
	$(classId).attr({ 
			src: src,
			title: title,
			alt: alt
  });
}

/* 
 * Centers an element on the screen
 */
$.fn.tfsCenter = function() {
	var left, top;
	left = ($(window).width() - $(this).width()) / 2;
	top = ($(window).height() - $(this).height()) /2;
	if(!ie6) $(this).css("position", "fixed"); else $(this).css("position", "absolute");
	$(this).css("left", left);
	$(this).css("top", top);
}
