
// JavaScript Document
var setWrapper = function() {
	$("body.home div#WrapperInner, div.Mask").css("height","auto");
	var windowHeight = $(window).height();
	var wrapperHeight = $("body").height();
	if (windowHeight<wrapperHeight) {$("body.home div#WrapperInner").height(wrapperHeight); $("div.Mask").height(wrapperHeight);}
	else {$("body.home div#WrapperInner").height(windowHeight);$("div.Mask").height(windowHeight)}	
}

var myGenericTicker = function (obj,timer,flag) {
	var myThis = $(obj);
	var Interval;
	var flag = flag;
	if (flag == null){flag=false}
	myThis.find("li:first").addClass("active");
		
	myThis.init = function(){
		$(this).find("li:last").addClass("last");
		Interval = setInterval(function() {myThis.startAnimate()},timer);
		
		if (flag){
			myThis.find("li").bind("mouseover", function() {
				myThis.stopAnimate();
			});
			
			myThis.find("li").bind("mouseout", function() {
				Interval = setInterval(function() {myThis.startAnimate()},timer);
			});
		}
					
	};
	
	myThis.stopAnimate = function() {
		clearInterval(Interval);
	};
	
	
	myThis.startAnimate = function() {
		var activeElement = myThis.find("li.active");
		var myClass =  activeElement.attr("class");
		
		activeElement.fadeOut("slow", function() {
			if (myClass == "last active") {$(this).removeClass("active").parent().find("li:first").fadeIn("slow").addClass("active");}
			else {$(this).removeClass("active").next().fadeIn("slow").addClass("active");}
														  
		});
	};
	
	if(myThis.find("li").length >1) {
		myThis.init();
	}
};


