/**
 * this function is for simulation the bind() function like in mootools 
 */ 
jQuery.extend({
	  shove: function(fn, object) {
	    return function() {
	      return fn.apply(object, arguments);
	    };
	  }
});

/**
 * show ajax-tabs -> not visible for non-js-users
 */
jQuery(document).ready(function () {
	jQuery('.ajaxload').css('display','block');
});

/**
 * clear tabs with no content
 */
function jquery_nfcrgtabs_clearNonContentTabs(headerSelect,contentSelect) {
	var headers = jQuery(headerSelect);
	var contents = jQuery(contentSelect);
	contents.each(function (index) {
		if(jQuery.trim(jQuery(this).html()) == '') {
			jQuery(headers[index]).hide();
		}
	});
}

/**
 * this function hides all Tabs for nfcrgtabs
 */
function jquery_nfcrgtabs_hideAllTabElements(headerSelect,contentSelect,activeClass) {
	var headers = jQuery(headerSelect);
	var contents = jQuery(contentSelect);
	contents.each(function (index) {
		jQuery(this).hide();
	});
	headers.each(function (index) {
		jQuery(this).removeClass(activeClass);
	});
}

/**
 * this function shows tab with index i for nfcrgtabs
 */
function jquery_nfcrgtabs_showTabByIndex(headerSelect,contentSelect,activeClass,i) {
	var headers = jQuery(headerSelect);
	var header = (jQuery(headers).length > i) ? jQuery(headers[i]) : jQuery(headers[0]);
	var contents = jQuery(contentSelect);
	var content = (jQuery(contents).length > i) ? jQuery(contents[i]) : jQuery(contents[0]);
	header.addClass(activeClass);
	content.show();
	
	//ajaxload contents
	if(header.hasClass('ajaxload')) {
		header.removeClass('ajaxload');
		var headerLink = jQuery(header).children('a').attr('href');
		try {
			content.load(headerLink);
		} catch(e) { /* nothing */ }
	}
}

/* start-functionality: written out over product-detail */
