// accessible popup window script by alex bovey | alex@bovey.co.uk
// degrades gracefully with no javascript
// sample usage: <a href="popup.html" onclick="popup(this.href,850,550);return false;" onkeypress="this.onclick()">open a popup</a>

var myWin;
function popup(location,width,height) {
	scrollbars = 1;
	status = 1;
	LeftPosition = (screen.width-width) / 2;
	TopPosition = (screen.height-height) / 2;
	attributes = 'scrollbars='+scrollbars+'toolbar=0,location=0,directories=0,status='+status+',menubar=0,resizable=no,height='+height+',width='+width+',top='+TopPosition+',left='+LeftPosition;
	myWin = window.open(location, 'popup', attributes)
	myWin.focus();
	return false;
}


$(document).ready(function(){

	// offers list hover state
	$("div.hotlink").mouseover(function(){
		$(this).addClass("hover");
	});
	$("div.hotlink").mouseout(function(){
		$(this).removeClass("hover");
	});
	
	// make the whole box clickable
	$("div.hotlink").click(function(){
		if ($(this).children('div.footer').children('a').attr('onclick') != undefined) {
			popup($(this).children('div.footer').children('a').attr('href'),450,540);
		} else {
			window.location = $(this).children('div.footer').children('a').attr('href');		
		}
	});

});

