// JavaScript Document
jQuery(document).ready(function() {
    jQuery("#accordion").accordion({ 
    autoHeight: false,
    collapsible: true
});
 	// Add pdf icons to pdf links
	jQuery("a[href$='.pdf']").addClass("pdf");
	// Add txt icons to document links (doc, rtf, txt)
	jQuery("a[href$='.exe']").addClass("exe");
	// Add zip icons to Zip file links (zip, rar)
	jQuery("a[href$='.zip'], a[href$='.rar']").addClass("zip"); 
	});


jQuery(document).ready(function() {
	var hash = window.location.hash.substr(1);
	var href = jQuery('#accordion li a').each(function(){
		var href = jQuery(this).attr('href');
		if(hash==href.substr(0,href.length-5)){
			var toLoad = hash+'.html #ajaxContent';
			jQuery('#ajax').load(toLoad);
		}											
	});

	jQuery('#accordion li a').click(function(){
								  
		var toLoad = jQuery(this).attr('href')+' #ajaxContent';
		
		jQuery('#ajax').hide('fast',loadContent);
		jQuery('#load').remove();
		jQuery('#mainOne').append('<span id="load">LOADING...</span>');
		jQuery('#load').fadeIn('normal');
		window.location.hash = jQuery(this).attr('href').substr(0,jQuery(this).attr('href').length-5);
		
function loadContent() {
			jQuery('#ajax').load(toLoad,'',showNewContent());
			//jQuery(this).ajaxStop(function(){
			jQuery.getScript("http://zsk.de/tl_files/zsk/js/mailmask.js");
		//})
		};
				
		function showNewContent() {
			jQuery('#ajax').show('normal',hideLoader());
		}
		function hideLoader() {
			jQuery('#load').fadeOut('normal');
			
		}
		return false;
		
	});

});


jQuery(document).ready(function(){

	// hide #back-top first
	jQuery("#back-top").hide();
	
	// fade in #back-top
	jQuery(function () {
		jQuery(window).scroll(function () {
			if (jQuery(this).scrollTop() > 400) {
				jQuery('#back-top').fadeIn();
			} else {
				jQuery('#back-top').fadeOut();
			}
		});

		// scroll body to 0px on click
		jQuery('#back-top a').click(function () {
			jQuery('body,html').animate({
				scrollTop: 0
			}, 800);
			return false;
		});
	});

});


sfHover = function() {
	var sfEls = document.getElementById("meta").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

