function s_ss(s_f, e_f, delay) {
 setTimeout(s_s(s_f,s_f,e_f, delay), delay);
}
function s_s(f, s_f, e_f, delay) {
 return (function() {
 $('#slideshow'+f).customFadeOut(850);
// $('#slideshow'+f+' img').customFadeOut();
 if (f == e_f) { f = s_f; } else { f = f + 1; }
 setTimeout("$('#slideshow"+f+"').customFadeIn(850);",850);
// $('#slideshow'+f+' img' ).customFadeIn();
 setTimeout(s_s(f, s_f, e_f, delay), delay + 850);
 })
}

$(function(){
	$.fn.customFadeIn = function(speed, callback) {
		$(this).fadeIn(speed, function() {
			if(!$.support.opacity)
				$(this).get(0).style.removeAttribute('filter');
			if(callback != undefined)
				callback();
		});
	};
	$.fn.customFadeOut = function(speed, callback) {
		$(this).fadeOut(speed, function() {
			if(!$.support.opacity)
				$(this).get(0).style.removeAttribute('filter');
			if(callback != undefined)
				callback();
		});
	};
	$.fn.customFadeTo = function(speed,to,callback) {
		return this.animate({opacity: to}, speed, function() {
			if (to == 1 && jQuery.browser.msie)
				this.style.removeAttribute('filter');
			if (jQuery.isFunction(callback))
				callback();
		});
	};

	s_ss(1, 8, 5000);
	//$('.promo_text').customFadeOut(7000);
	//if this is not the first tab, hide it
	jQuery(".tab:not(:first)").hide();
	
	//to fix u know who
	jQuery(".tab:first").show();
	
	//when we click one of the tabs
	jQuery(".htabs a").click(function(){
	//get the ID of the element we need to show
	jQuery(".htabs a").each(function(){
		$(this).removeClass('active');
	});
	jQuery(this).addClass('active');
	stringref = jQuery(this).attr("href").split('#')[1];
	
	//fix
	if (jQuery.browser.msie && jQuery.browser.version.substr(0,3) == "6.0") {
	jQuery('.tab#' + stringref).show();
	}
	else
	//display our tab fading it in
	jQuery('.tab#' + stringref).fadeIn();
	//hide the tabs that doesn't match the ID
	jQuery('.tab:not(#'+stringref+')').hide();
	//stay with me
	return false;
	});
});
