/* =========================================================

// jquery.innerfade.js

// Datum: 2007-01-29
// Firma: Medienfreunde Hofmann & Baldes GbR
// Autor: Torsten Baldes
// Mail: t.baldes@medienfreunde.com
// Web: http://medienfreunde.com

// based on the work of Matt Oakes http://portfolio.gizone.co.uk/applications/slideshow/

// ========================================================= */


(function($) {

$.fn.innerfade = function(options) {

	this.each(function(){ 	
		
		var settings = {
			animationtype: 'fade',
			speed: 'normal',
			timeout: 2000,
			type: 'sequence',
			containerheight: 'auto',
			runningclass: 'innerfade'
		};
		
		if(options)
			$.extend(settings, options);
		
		var elements = $(this).children();
	
		if (elements.length > 1) {
		
			$(this).css('position', 'relative');
	
			$(this).css('height', settings.containerheight);
			$(this).addClass(settings.runningclass);
			
			for ( var i = 0; i < elements.length; i++ ) {
				$(elements[i]).css('z-index', String(elements.length-i)).css('position', 'absolute');
				$(elements[i]).hide();
			};
		
			if ( settings.type == 'sequence' ) {
				setTimeout(function(){
					$.innerfade.next(elements, settings, 1, 0);
				}, settings.timeout);
				$(elements[0]).show();
			} else if ( settings.type == 'random' ) {
				setTimeout(function(){
					do { current = Math.floor ( Math.random ( ) * ( elements.length ) ); } while ( current == 0 )
					$.innerfade.next(elements, settings, current, 0);
				}, settings.timeout);
				$(elements[0]).show();
			}	else {
				alert('type must either be \'sequence\' or \'random\'');
			}
			
		}
		
	});
};


$.innerfade = function() {}
$.innerfade.next = function (elements, settings, current, last) {

	if ( settings.animationtype == 'slide' ) {
		$(elements[last]).slideUp(settings.speed, $(elements[current]).slideDown(settings.speed));
	} else if ( settings.animationtype == 'fade' ) {
		$(elements[last]).fadeOut(settings.speed);
		$(elements[current]).fadeIn(settings.speed);
	} else {
		alert('animationtype must either be \'slide\' or \'fade\'');
	};
	
	if ( settings.type == 'sequence' ) {
		if ( ( current + 1 ) < elements.length ) {
			current = current + 1;
			last = current - 1;
		} else {
			current = 0;
			last = elements.length - 1;
		};
	}	else if ( settings.type == 'random' ) {
		last = current;
		while (	current == last ) {
			current = Math.floor ( Math.random ( ) * ( elements.length ) );
		};
	}	else {
		alert('type must either be \'sequence\' or \'random\'');
	};
	setTimeout((function(){$.innerfade.next(elements, settings, current, last);}), settings.timeout);
};
})(jQuery);





for(i=0;i<=8;i++){document.write('<img src="images/backgrounds/'+i+'.jpg" style="display:none"/>');}


function changeBg()
		{
				 
			var status  =  document.getElementById('status').value;
			if (status>7) {  return '';} 
			//var className  = 'bg'+status;
			
			/*var status2=status;
			if(status2>6)
			{
				status2=1;
			}			
			else status2++;
			
			$("#topcon").css('display', 'none');
			$("#topcon"+status+"").fadeTo(4000,"0");
			$("#topcon"+status2+"").fadeTo(4000,"1");

			//$("#topcon"+status2+"").css("visibility", "visible");

			$("#topcon"+status2+"").css('display', 'block');
						
			//$("#topcon"+status2+"").fadeTo(500,"1");
			//$("#topcon"+status+"").css("visibility", "hidden");
			$("#topcon"+status+"").css('display', 'none');
			
	                //$('#topcon').delay(100).attr('class',className);
			//$('#topcon1').delay(100).attr('class',className1);
			
			//$("#topcon1").delay(100).fadeTo("slow","1");*/
			
			if (status>6)
				{
					status = 1;
				}
			else
				{
					status++;
				}
			document.getElementById('status').value = status;
		}
		
function getchangedBg(ClassName)
		{
			
	 		
//			alert("Sujit");
			
			$.cookie ("theme",ClassName);
			$("#topcontainer").attr('class',$.cookie("theme"));
			//$("#topcon").attr('class',ClassName);
			/**/
			//$.cookie ("theme",ClassName);
			/**/
			//document.getElementById('status').value = 10;	
		}
			
		/* this will reset default theme 
			as  slider
		*/
		function defaultTheme()
			{$.cookie("theme",null);window.location.href=window.location;}
			
$(document).ready(function() { 
				try	
					{
				if (($.cookie("theme")) != null)
				{  
				$("#topcon").attr('class',$.cookie("theme"));
				// return '';
				 }
				 else
				 {
					$(document).ready(page.init);
					setInterval("changeBg();",8000);
				 }
					}
				catch(e)
					{
						
					}
});




