Array.prototype.in_array = function(p_val) {
	for(var i = 0, l = this.length; i < l; i++) {
		if(this[i] == p_val) {
			return true;
		}
	}
	return false;
}

jQuery().ready(function(){
	// Animated navigation
	if ( jQuery("#navigation li").length > 0) {
		jQuery('#navigation').accordion({
			active: false,
			header: '.head',
			navigation: true,
			event: 'mouseover',
			autoheight: false,
			animated: 'slide'
		});
		navrefs = new Array();
		j=0;
		jQuery('#navigation').find('a').each(function(i) {
			navrefs[j] = jQuery(this).attr('href');
			j++;
		});
		locstr = location.pathname+location.search;
		if (!navrefs.in_array(locstr.substr(1))) {
			jQuery('#navigation').activate(0);
		} else {
			jQuery('#navigation').activate('#active');
		}
	}

	jQuery(".jqfancybox").fancybox({
		"hideOnContentClick": 0,
		"zoomSpeedIn":1000,
		"zoomSpeedOut":1000,
		"overlayShow":1,
		"overlayOpacity":0.4
	});
	
	if (jQuery('fieldset.measurements') != null) {
		jQuery('fieldset.measurements').append('<img src="fileadmin/assets/wsap/Kleidung/so_messen.jpg">');
	}
	
	if (jQuery(".powermailfe_all_table") != null) {
		jQuery(".powermailfe_all_table").tablesorter({sortList: [[0,0]]});

		total8 = jQuery('.pfe_all_td_uid22').sum();
		jQuery('#total8').text(total8);
		
		total4 = jQuery('.pfe_all_td_uid23').sum();
		jQuery('#total4').text(total4);
		
	}

	// PNG-Fix (in our case: logo)
	jQuery.pngfix('/clear.gif'); // this is optional
	jQuery('img[@src$=.png], #logo').pngfix();
});
