// header text
if(typeof sIFR == "function"){
	sIFR.replaceElement("h1", named({sFlashSrc: "/flash/fontname.swf", sColor: "#70005f", sWmode: "Transparent"}));
	sIFR.replaceElement("h2.top", named({sFlashSrc: "/flash/fontname.swf", sColor: "#a2a2a2", sWmode: "Transparent"}));
};

// drop menu code
var timeout    = 500;
var closetimer = 0;
var ddmenuitem = 0;

function jsddm_open() { 
	jsddm_canceltimer();
	jsddm_close();
	ddmenuitem = $(this).find('ul').css('visibility', 'visible');
}
function jsddm_close() {
	if(ddmenuitem) ddmenuitem.css('visibility', 'hidden');
}
function jsddm_timer() {
	closetimer = window.setTimeout(jsddm_close, timeout);
}
function jsddm_canceltimer() {
	if(closetimer) {
		window.clearTimeout(closetimer);
		closetimer = null;
	}
}

// text resize code
var sitefunctions = {
	textresize : function(){
		// show text resizing links
		$(".FontSize").show();
		var $cookie_name = "sitename-FontSize";
		var originalFontSize = $("html").css("font-size");
		// if exists load saved value, otherwise store it
		if($.cookie($cookie_name)) {
			var $getSize = $.cookie($cookie_name);
			$("html").css({fontSize : $getSize + ($getSize.indexOf("px")!=-1 ? "" : "px")}); // IE fix for double "pxpx" error
		} else {
			$.cookie($cookie_name, originalFontSize);
		}
		// reset link
		$(".FontSizeReset").bind("click", function() {
			$("html").css("font-size", originalFontSize);
			$.cookie($cookie_name, originalFontSize);
		});
		// text "+" link
		$(".FontSizeInc").bind("click", function() {
			var currentFontSize = $("html").css("font-size");
			var currentFontSizeNum = parseFloat(currentFontSize, 10);
			var newFontSize = currentFontSizeNum*1.2;
			if(newFontSize, 11) {
				$("html").css("font-size", newFontSize);
				$.cookie($cookie_name, newFontSize);
			}
			return false;	
		});
		$(".FontSizeDec").bind("click", function() {
			var currentFontSize = $("html").css("font-size");
			var currentFontSizeNum = parseFloat(currentFontSize, 10);
			var newFontSize = currentFontSizeNum*0.8;
			if (newFontSize, 11) {
				$("html").css("font-size", newFontSize);
				$.cookie($cookie_name, newFontSize);
			}
			return false;
		});
	}
}

// select menu jump code
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

$(document).ready(function() {  
						   
	// drop menus
	$('#jsddm > li').bind('mouseover', jsddm_open)
	$('#jsddm > li').bind('mouseout',  jsddm_timer)
	
	// image changer
	$('#imagechanger').innerfade({
		speed: 'slow',
		timeout: 4000,
		type: 'sequence',
		containerheight: '230px'
	});
	
	// popup windows
	$(".fancybox").fancybox();
	
	$(".fancyframe").fancybox({
		'zoomSpeedIn': 0, 
		'zoomSpeedOut': 0, 
		'overlayShow': true ,
		'frameWidth': 600,
		'frameHeight': 480
	});	
	
	// news ticker
	$("#newsticker").css("display", "block");
	$("ul#ticker01").liScroll({travelocity: 0.04});

	// text resize buttons
	sitefunctions.textresize();	
	
	// back button
	$(".backbutton").click(function() { 
		history.go(-1);
		return false;
    });
	
	// make article-text the same height as the right column
	newHeight = $(".rightbox").height() - $(".pageboxes").height() - 20;
	if (newHeight > $(".article-text").height()) {
		if ($.browser.msie && $.browser.version == 6.0) { $(".article-text").css({'height': newHeight}); }
		$(".article-text").css({'min-height': newHeight}); 
	}

	// apply drop shadow
	$(".dropshadow").dropShadow({left: 0, top: 0, blur: 1, opacity: 0.6});				
	
});	
document.onclick = jsddm_close;				