﻿(function($) {
	$.fn.equalHeights = function(minHeight, maxHeight) {
		tallest = (minHeight) ? minHeight : 0;
		this.each(function() {
			if($(this).height() > tallest) {
				tallest = $(this).height();
			}
		});
		if((maxHeight) && tallest > maxHeight) tallest = maxHeight;
		return this.each(function() {
			$(this).height(tallest).css("overflow","hidden");
		});
	}
})(jQuery);

function css_browser_selector(u){var ua = u.toLowerCase(),is=function(t){return ua.indexOf(t)>-1;},g='gecko',w='webkit',s='safari',o='opera',h=document.documentElement,b=[(!(/opera|webtv/i.test(ua))&&/msie\s(\d)/.test(ua))?('ie ie'+RegExp.$1):is('firefox/2')?g+' ff2':is('firefox/3.5')?g+' ff3 ff3_5':is('firefox/3')?g+' ff3':is('gecko/')?g:is('opera')?o+(/version\/(\d+)/.test(ua)?' '+o+RegExp.$1:(/opera(\s|\/)(\d+)/.test(ua)?' '+o+RegExp.$2:'')):is('konqueror')?'konqueror':is('chrome')?w+' chrome':is('iron')?w+' iron':is('applewebkit/')?w+' '+s+(/version\/(\d+)/.test(ua)?' '+s+RegExp.$1:''):is('mozilla/')?g:'',is('j2me')?'mobile':is('iphone')?'iphone':is('ipod')?'ipod':is('mac')?'mac':is('darwin')?'mac':is('webtv')?'webtv':is('win')?'win':is('freebsd')?'freebsd':(is('x11')||is('linux'))?'linux':'','js']; c = b.join(' '); h.className += ' '+c; return c;}; css_browser_selector(navigator.userAgent);

$(document).ready(function() {
		
	$.ajaxSetup ({
		cache: false
	});
		
	$('#dialog').dialog({
		autoOpen: false,
		resizable: false,
		modal: true,
		show: 'clip',
		hide: 'clip',
		width: 670,
		height: 590,
		maxHeight: 600,
		close: function(event, ui) {$(this).html("Loading...")}
	});
	
  $(".news").load('load/news.html');
	$(".scrollable").scrollable();
	$(".column").equalHeights(100,350);
	
	$(':not(.news) > .popup').live('click', function(event) 
	{
			var myFileName = $(this).attr("id");
			var myTitle = $(this).attr("title");
			$('#dialog').load('load/'+myFileName+'.html').dialog("option", "title", myTitle).dialog("open");	
			return false;
	});
	
	$('.news > .popup').live('click', function(event) 
	{
			var myContent = $(this).children('div.full-text').html();
			var myTitle = $(this).children('h3').html();
			if (myContent)
			{
				$('#dialog').html(myContent).dialog("option", "title", myTitle).dialog("open");	
			}
			return false;
	});
	
	$('.popup').live('mouseover', function(event) 
	{
			$(this).addClass("popup-hover");
	});
	
	$('.popup').live('mouseout', function(event) 
	{
			$(this).removeClass("popup-hover");
	});
	
});