$().ready(function(){
    //lightbox
    $('a[@rel*=lightbox]').lightBox({
        fixedNavigation:true,
        imageBtnClose: '/interface/images/lightbox/lightbox-btn-close.gif',
        imageBtnPrev: '/interface/images/lightbox/lightbox-btn-prev.gif',
        imageBtnNext: '/interface/images/lightbox/lightbox-btn-next.gif'
    });
    
    // external urls
    $('a').click(function(){
	    if((this.href.match(/^http/i) && !this.href.match(location.host)) || this.rel=='external'){
		    window.open(this.href,'_');
		    return false;
	    }
	});
	if(document.getElementById('flash-content')){
		var flashvars = {};
		var params = {};
		var attributes = {};

		swfobject.embedSWF("/interface/flash/slideshow.swf", "flash-content", "751", "406", "9.0.0","", flashvars, params, attributes);
	}
	
// This code creates an alert for < ie6 browser only.
// It will inform the EU that the browser should be updated to ie7/8, Firefox or Opera
// The end user will also be given the option of continuing without upgrading.
// if the USER agrees to carry on without upgrading then a cookie will be set to not show the alert message again on subsequent pages.
	if($.browser.msie && $.browser.version <7){
	    if(!readCookie("ie6agreement")){	    
			var update_html = '';
			update_html+= "<div id=\"ie6alert\">";
			update_html+= "\t<div class=\"message\">";
			update_html+= "\t\t<h4>Important Information</h4>";
			update_html+= "\t\t<p>We've spotted that you are using an out-of-date version of Internet Explorer.<br />It's time to upgrade to a better browser such as <a href=\"http://www.microsoft.com/windows/products/winfamily/ie/default.mspx\">Explorer</a>, <a href=\"http://www.mozilla.com/en-US/firefox/?from=getfirefox\">Firefox</a> or <a href=\"http://www.opera.com\">Opera</a>. <br />If you dont wish to upgrade at this time please <a class=\"agree\" href=\"#\">close this alert</a></p>";
			update_html+= "\t</div>";
			update_html+= "</div>";
	
			$('body').append(update_html);
			
			$(window).resize(function(){
				// calculate the correct width of the dialog
				var dialog_padding = 40;
				var dialog_width = ($('body').width() -dialog_padding);
				$('#ie6alert')
					.css({width:dialog_width})
					.fadeIn(2000);
				
			});
			$(window).trigger('resize');
			
			$('.agree').click(function(){
				$('#ie6alert').fadeOut('slow');
				createCookie("ie6agreement",1);
				return false;
			});
		}
	}
	
	function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
 }

	function readCookie(name) {
		var nameEQ = name + "=";
		var ca = document.cookie.split(';');
			for(var i=0;i < ca.length;i++) {
			var c = ca[i];
			while (c.charAt(0)==' ') c = c.substring(1,c.length);
			if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

	
});


