$(document).ready(function(){
	
	var body_top_height = (document.body.clientHeight >= document.documentElement.clientHeight)?document.body.clientHeight:document.documentElement.clientHeight;
	$('body > .top').css({ height: body_top_height});
	
	/* PNGFIX start *******************************************************************/
		$(document).pngFix();
	/* PNGFIX end *********************************************************************/
	
	/* EXTERNAL LINKS start ***********************************************************/
	$('a[rel="external"]').click(function(){
		this.target = "_blank";
	});	
	/* EXTERNAL LINKS end *************************************************************/

	/* NAVIGATION start ***************************************************************/
	$('#nav ul > li.level1 > ul').prepend('<li class="top first"></li>');
	$('#nav ul ul ul').prepend('<li class="top"></li>');
	$('#nav ul ul').append('<li class="bottom"></li>');
	$('#nav ul ul').hide();
	//hover show next level
	$('#nav ul > li').hover(function() { $('ul:first', this).show(); $('a:first',this).addClass('hover'); },function() {$('ul:first', this).hide(); $('a:first',this).removeClass('hover'); });
	//add class for flyouts
	if ($('#nav ul ul ul,#nav-top ul ul ul').length > 0) { $('#nav ul ul ul',this).prev().parent().addClass('flyout'); }
	
	$('#nav li.level1:first').addClass('first');
	$('#nav li.level1:last').addClass('last');
	/* NAVIGATION end ****************************************************************/
	
	/* SIFR***************************************************************************/
	$('h1.title').flash(
		{ src: '/includes/media/font-swis721-md-bt.swf' },
		 { version: 8 },
			function(htmlOptions) {
				htmlOptions.flashvars.css = '*%20%7B%20color%3A%23'+RGBstring($(this).css('color'))+'%7D';
				htmlOptions.flashvars.txt = this.innerHTML;
				this.innerHTML = '<div>'+this.innerHTML+'</div>';
				var $alt = $(this.firstChild);
				htmlOptions.width = $(this).width(); //$alt.width()
				htmlOptions.height = $(this).height(); //$alt.height()
				$alt.addClass('alt');
				$(this).addClass('sifr-text-alt').prepend($.fn.flash.transform(htmlOptions));						
			}
		);
	/* SIFR**************************************************************************/
	
	//REMOVE BLANK LI's
	$('#details .col-right li').each(function(){		if($(this).html() == ''){	$(this).remove();	}	});
	//REMOVE BLANK LI's
	
	if($('#what-is').length >0){
		$('#what-is .cms').jScrollPane({showArrows:true,scrollbarWidth:14 });
	}
	if($('#ssbc-events').length >0){
		$('#ssbc-events .cms').jScrollPane({showArrows:true,scrollbarWidth:14 });
	}


	
}); //close document.ready

/* sIFR RGB conversion function start **********************************************/
function RGBstring(str) {
	str1 = str.replace("#","");
	str2 = str1.replace("rgb(","");
	str2 = str2.replace(")","");
	str2 = str2.split(",");
	if(navigator.appName == "Microsoft Internet Explorer"){ return str1; }
	else { return toHex(str2[0])+toHex(str2[1])+toHex(str2[2]); }
}
function toHex(N) {
 if (N==null) return "01";
 N=parseInt(N); if (N==0 || isNaN(N)) return "00";
 N=Math.max(0,N); N=Math.min(N,255); N=Math.round(N);
 return "0123456789ABCDEF".charAt((N-N%16)/16)
      + "0123456789ABCDEF".charAt(N%16);
}
/* sIFR RGB conversion function end *************************************************/

