
(function( $ ){
	$.fn.themeCycle = function( options, content ) {
	var settings = {
	  'seconds'         : 1700,
	  'speed'			: 'fast'
	};
	if ( options ) { 
		$.extend( settings, options );
	}
	var length = content.length - 1;
	var current = 0;
	var s = settings;
	
	return this.each(function() {     
		var obj = $(this);
		var text = $("p", this);
		var title = $("h3", this);
		var ok = 1;
		
		fadeInAll();
		function fadeInAll() {
				text.html(content[current][0]);
				title.html(content[current][1]);
			obj.fadeIn(s.speed, function() {
				
				if(ok == obj.length) {
					ok = 0;
				setTimeout(function() {
					fadeOutAll();
				},s.seconds);
				}
				ok++;
			});
		}
		function fadeOutAll() {
			obj.fadeOut(s.speed, function() {
			if(ok == obj.length) {
					ok = 0;
				if(current == length) {
					current = 0;
				}else{
					current++;
				}
			
				fadeInAll();
			}
			ok++;
			});
		}
	});
};
})( jQuery );

(function( $ ){
	$.fn.themeShow = function(to,from,content) {
		var title = $("h3", this);
		var text = $("p", this);
		
		if($(this).css('display') == 'none'){
				text.html(content[to][0]);
				title.html(content[to][1]);
				$(this).fadeIn(500);
			
		}
	
		if(from != undefined){
			$(this).fadeOut(500,function(){
				text.html(content[to][0]);
				title.html(content[to][1]);
				$(this).fadeIn(500);
			});
		}
	};
})( jQuery );

  

/*
$.preLoadImages = function() {
    var args_len = arguments.length;
    for (var i = args_len; i--;) {
      var cacheImage = document.createElement('img');
      cacheImage.src = arguments[i];
      cache.push(cacheImage);
	}
}
*/

