

/* Style Sheet switcher - JQuery */
	function switchStylestyle(styleName)
	{
		$('link[@rel*=style]').each(function(i) 
		{
			this.disabled = true;
			if (this.getAttribute('title') == styleName || this.getAttribute('title') == 'structure') {
				this.disabled = false;
			} 
		});
		createCookie('style', styleName, 365);
	}
	
	// cookie functions http://www.quirksmode.org/js/cookies.html
	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;
	}
	function eraseCookie(name)
	{
		createCookie(name,"",-1);
	}

	

	$.fn.hoverClass = function(c) {
		return this.each(function(){
			$(this).hover( 
				function() { $(this).addClass(c);  },
				function() { $(this).removeClass(c); }
			);
		});
	};
	


    var init = function() {
		/*$('.styleswitch').click(function() {
			
			switchStylestyle(this.getAttribute("rel"));
			return false;
		});*/
		var c = readCookie('style');
		if (c) switchStylestyle(c);
		

      
    }

	$(document).ready(function(){
		// $('.styleswitch').click(function() {
		// 	switchStylestyle(this.getAttribute("rel"));
		// 	return false;
		// });
		$("#ft .disclaimer").click(function(i){	
			i.preventDefault();	
			var disclaim = 	$("#ft #disclaimer")
			if (disclaim.css("display")==="none") {
					disclaim.slideDown(500, function(){
												if (this.style.display!="none") {
													$("html,body").animate({scrollTop: $("#ft").offset().top},1500)
												}
											} 
					);
				
			} else {
				disclaim.fadeOut(500, function(){
											if (this.style.display!="none") {
												$("html,body").animate({scrollTop: $("#ft").offset().top},500)
											}
										} 
				);
			}

		
		})
		
		
		$("ul.sf-menu").superfish(
			{
				delay:       1000,                            // one second delay on mouseout 
	            animation:   {opacity:'show',height:'show'},  // fade-in and slide-down animation 
	            speed:       'fast',                          // faster animation speed 
	            autoArrows:  false,                           // disable generation of arrow mark-up 
	            dropShadows: true                            // disable drop shadows
			}
			
			); 
			$(".lightbox").lightbox({fitToScreen: true});
			$('#hd h1').ifixpng(); 
			// $('.author').ifixpng(); 
			

        

			// $("#globalmenu li").hover(
			// 	function(){console.log($("ul", this))},
			// 	function(){ $("ul", this).fadeIn("fast"); }, 
			// 	function() { } 
			// );
			// if (document.all) {
			// 	$("#globalmenu li").hoverClass ("sfHover");
			// }



	});


    //addEvent(window, 'load', init, false);
	//	addEvent(window, 'load', sfHover, false)

