/// <reference path="jquery-1.4.1.js"/>
/// <reference path="jquery-1.4.1-vsdoc.js"/>

var timeout = 8000;
var $u = jQuery.noConflict();

$u(document).ready(function() {
    $u(".JQueryBanner_Load").remove();
    $u(".HeaderControl").show();
    $u(".HeaderControl li").hide();
    $u(".HeaderControl li img").hide();

    var count = 0;
    while ($u(".HeaderControl:eq(" + count + ")").html()) {
        $u(".HeaderControl:eq(" + count + ") li:eq(0)").show();
        $u(".HeaderControl:eq(" + count + ") li:eq(0) img").show();
        $u(".HeaderControl:eq(" + count + ") li:eq(0) .Title").show();
        $u(".HeaderControl:eq(" + count + ") li:eq(0) .SubTitle").show();
        $u(".HeaderControl:eq(" + count + ") li:eq(0) .Content").show();
        count++;
    }
});

function fade(moduleID) {
    $u(".HeaderControl" + moduleID + " li").hide();
    $u(".HeaderControl" + moduleID + " li img").hide();
    $u(".HeaderControl" + moduleID + " li .Title").hide();
    $u(".HeaderControl" + moduleID + " li .SubTitle").hide();
    $u(".HeaderControl" + moduleID + " li .Content").hide();
    $u(".HeaderControl" + moduleID + " li:eq(0)").appendTo(".HeaderControl" + moduleID + " ul");
    $u(".HeaderControl" + moduleID + " li:eq(0)").fadeIn("slow", function () {
        $u(".HeaderControl" + moduleID + " li:eq(0) img").fadeIn("slow")
	});
    $u(".HeaderControl" + moduleID + " li:eq(0) .Title").show();
	$u(".HeaderControl" + moduleID + " li:eq(0) .SubTitle").show();
	$u(".HeaderControl" + moduleID + " li:eq(0) .Content").show()
}
function SlideToLeft(moduleID) {
    $u(".HeaderControl" + moduleID + " li img").hide();
    $u(".HeaderControl" + moduleID + " li").hide();
    $u(".HeaderControl" + moduleID + " li .Title").hide();
    $u(".HeaderControl" + moduleID + " li .SubTitle").hide();
    $u(".HeaderControl" + moduleID + " li .Content").hide();
  var d = 0;
  if ($u(".HeaderControl" + moduleID).height()) { d = $u(".HeaderControl" + moduleID).height() }
  $u(".HeaderControl" + moduleID + " li:eq(0)").show().css("zIndex", "1");
  $u(".HeaderControl" + moduleID + " li:eq(1)").show().css("marginTop", "-" + d + "px").css("zIndex", "0");
  $u(".HeaderControl" + moduleID + " li:first").css("color", "#cccccc").show().hide("slide", { direction: "left" }, "slow", 
	  function() {
	      $u(".HeaderControl" + moduleID + " li:eq(0)").appendTo(".HeaderControl" + moduleID + " ul");
	      $u(".HeaderControl" + moduleID + " li:eq(0)").css("marginTop", "0px").css("zIndex", "1").show();
	      $u(".HeaderControl" + moduleID + " li:eq(0) img").show(); $u(".HeaderControl" + moduleID + " li:eq(0) .Title").show();
	      $u(".HeaderControl" + moduleID + " li:eq(0) .SubTitle").show(); $u(".HeaderControl" + moduleID + " li:eq(0) .Content").show()
	   })
}
function SlideToRight(moduleID) {
    $u(".HeaderControl" + moduleID + " li").hide();
    $u(".HeaderControl" + moduleID + " li .Title").hide();
    $u(".HeaderControl" + moduleID + " li .SubTitle").hide();
    $u(".HeaderControl" + moduleID + " li .Content").hide();
    var d = 0; if ($u(".HeaderControl" + moduleID).height()) { d = $u(".HeaderControl" + moduleID).height() }
    $u(".HeaderControl" + moduleID + " li:eq(0)").show().css("zIndex", "1"); $u(".HeaderControl" + moduleID + " li:eq(1)").show().css("marginTop", "-" + d + "px").css("zIndex", "0");
    $u(".HeaderControl" + moduleID + " li:first").css("color", "#cccccc").show().hide("slide", { direction: "right" }, "slow", 
		function() {
		    $u(".HeaderControl" + moduleID + " li:eq(0)").appendTo(".HeaderControl" + moduleID + " ul"); $u(".HeaderControl" + moduleID + " li:eq(0)").css("marginTop", "0px").css("zIndex", "1").show();
		    $u(".HeaderControl" + moduleID + " li:eq(0) img").show(); $u(".HeaderControl" + moduleID + " li:eq(0) .Title").show();
		    $u(".HeaderControl" + moduleID + " li:eq(0) .SubTitle").show(); $u(".HeaderControl" + moduleID + " li:eq(0) .Content").show()
      	})
}
function SlideUp(moduleID) {
    $u(".HeaderControl" + moduleID + " li").hide(); $u(".HeaderControl" + moduleID + " li .Title").hide(); $u(".HeaderControl" + moduleID + " li .SubTitle").hide();
    $u(".HeaderControl" + moduleID + " li .Content").hide(); $u(".HeaderControl" + moduleID + " li img").hide(); $u(".HeaderControl" + moduleID + " li:eq(0)").show();
    $u(".HeaderControl" + moduleID + " li:eq(1)").show();
    $u(".HeaderControl" + moduleID + " li:eq(0)").slideUp("slow", 
		function() {
		    $u(".HeaderControl" + moduleID + " li img").show();
		    $u(this).appendTo(".HeaderControl" + moduleID + " ul"); $u(".HeaderControl" + moduleID + " li:eq(0) .Title").show();
		    $u(".HeaderControl" + moduleID + " li:eq(0) .SubTitle").show(); $u(".HeaderControl" + moduleID + " li:eq(0) .Content").show()
        })
}
function SlideDown(moduleID) {
    $u(".HeaderControl" + moduleID + " li").hide();
    $u(".HeaderControl" + moduleID + " li .Title").hide();
    $u(".HeaderControl" + moduleID + " li .SubTitle").hide();
    $u(".HeaderControl" + moduleID + " li .Content").hide();
    $u(".HeaderControl" + moduleID + " li:eq(1)").prependTo(".HeaderControl" + moduleID + " ul");
    $u(".HeaderControl" + moduleID + " li:eq(0)").hide(); $u(".HeaderControl" + moduleID + " li:eq(1)").show();
    $u(".HeaderControl" + moduleID + " li:eq(0)").slideDown("slow", 
		function() {
		    $u(".HeaderControl" + moduleID + " li img").show(); $u(".HeaderControl" + moduleID + " li:eq(1)").hide().appendTo(".HeaderControl" + moduleID + " ul");
		    $u(".HeaderControl" + moduleID + " li:eq(0) .Title").show(); $u(".HeaderControl" + moduleID + " li:eq(0) .SubTitle").show();
		    $u(".HeaderControl" + moduleID + " li:eq(0) .Content").show()
		})
}
function fadePrev(moduleID) {
    $u(".HeaderControl" + moduleID + " li").hide();
    $u(".HeaderControl" + moduleID + " li img").hide();
    $u(".HeaderControl" + moduleID + " li .Title").hide();
    $u(".HeaderControl" + moduleID + " li .SubTitle").hide();
    $u(".HeaderControl" + moduleID + " li .Content").hide();
    $u(".HeaderControl" + moduleID + " li img").show();
    $u(".HeaderControl" + moduleID + " li:last").prependTo(".HeaderControl" + moduleID + " ul");
    $u(".HeaderControl" + moduleID + " li:eq(0)").fadeIn("slow", function () { $u(".HeaderControl" + moduleID + " li:eq(0) img").fadeIn("slow") });
    $u(".HeaderControl" + moduleID + " li:eq(0) .Title").show();
    $u(".HeaderControl" + moduleID + " li:eq(0) .SubTitle").show();
    $u(".HeaderControl" + moduleID + " li:eq(0) .Content").show()
}
function SlideToLeftPrev(moduleID) {
 	var d = 0;
 	if ($u(".HeaderControl" + moduleID).height()) { d = $u(".HeaderControl" + moduleID).height() }
	$u(".HeaderControl" + moduleID + " li img").hide();
	$u(".HeaderControl" + moduleID + " li .Title").hide();
	$u(".HeaderControl" + moduleID + " li .SubTitle").hide();
	$u(".HeaderControl" + moduleID + " li .Content").hide();
	$u(".HeaderControl" + moduleID + " li:last").prependTo(".HeaderControl" + moduleID + " ul");
	$u(".HeaderControl" + moduleID + " li:eq(0)").hide().css("zIndex", "1");
	$u(".HeaderControl" + moduleID + " li:eq(1)").show().css("marginTop", "-" + d + "px").css("zIndex", "0");
	$u(".HeaderControl" + moduleID + " li:eq(0)").css("color", "#cccccc").hide().show("slide", { direction: "left" }, "slow", 
		function() {
		    $u(".HeaderControl" + moduleID + " li:eq(1)").hide().css("marginTop", "0px").css("zIndex", "1").show();
		    $u(".HeaderControl" + moduleID + " li:eq(0)").css("marginTop", "0px").css("zIndex", "1").show();
		    $u(".HeaderControl" + moduleID + " li:eq(0) img").show();
		    $u(".HeaderControl" + moduleID + " li:eq(0) .Title").show();
		    $u(".HeaderControl" + moduleID + " li:eq(0) .SubTitle").show();
		    $u(".HeaderControl" + moduleID + " li:eq(0) .Content").show() 
		})
}
function SlideToRightPrev(moduleID) { 
	var d = 0;
	if ($u(".HeaderControl" + moduleID).height()) { d = $u(".HeaderControl" + moduleID).height() }
	$u(".HeaderControl" + moduleID + " li").hide();
	$u(".HeaderControl" + moduleID + " li img").hide();
	$u(".HeaderControl" + moduleID + " li .Title").hide();
	$u(".HeaderControl" + moduleID + " li .SubTitle").hide();
	$u(".HeaderControl" + moduleID + " li .Content").hide();
	$u(".HeaderControl" + moduleID + " li:last").prependTo(".HeaderControl" + moduleID + " ul");
	$u(".HeaderControl" + moduleID + " li:eq(0)").hide().css("zIndex", "1");
	$u(".HeaderControl" + moduleID + " li:eq(1)").show().css("marginTop", "-" + d + "px").css("zIndex", "0");
	$u(".HeaderControl" + moduleID + " li:eq(0)").css("color", "#FFFFFF").hide().show("slide", { direction: "right" }, "slow", 
		function() {
		    $u(".HeaderControl" + moduleID + " li:eq(1)").hide().css("marginTop", "0px").css("zIndex", "1").show();
		    $u(".HeaderControl" + moduleID + " li:eq(0)").css("marginTop", "0px").css("zIndex", "1").show();
		    $u(".HeaderControl" + moduleID + " li:eq(0) img").show();
		    $u(".HeaderControl" + moduleID + " li:eq(0) .Title").show();
		    $u(".HeaderControl" + moduleID + " li:eq(0) .SubTitle").show();
		    $u(".HeaderControl" + moduleID + " li:eq(0) .Content").show() 
		}) 
}
function SlideDownPrev(moduleID) {
    $u(".HeaderControl" + moduleID + " li").hide();
    $u(".HeaderControl" + moduleID + " li .Title").hide();
    $u(".HeaderControl" + moduleID + " li .SubTitle").hide();
    $u(".HeaderControl" + moduleID + " li .Content").hide();
    $u(".HeaderControl" + moduleID + " li:last").prependTo(".HeaderControl" + moduleID + " ul");
    $u(".HeaderControl" + moduleID + " li:eq(1)").prependTo(".HeaderControl" + moduleID + " ul");
    $u(".HeaderControl" + moduleID + " li:eq(0)").show();
    $u(".HeaderControl" + moduleID + " li:eq(1)").show();
    $u(".HeaderControl" + moduleID + " li:eq(0)").slideUp("slow", 
		function() {
		    $u(".HeaderControl" + moduleID + " li:eq(1)").prependTo(".HeaderControl" + moduleID + " ul");
		    $u(".HeaderControl" + moduleID + " li img").show();
		    $u(".HeaderControl" + moduleID + " li:eq(0) .Title").show();
		    $u(".HeaderControl" + moduleID + " li:eq(0) .SubTitle").show();
		    $u(".HeaderControl" + moduleID + " li:eq(0) .Content").show() 
		}) 
}
function SlideUpPrev(moduleID) {
    $u(".HeaderControl" + moduleID + " li").hide();
    $u(".HeaderControl" + moduleID + " li .Title").hide();
    $u(".HeaderControl" + moduleID + " li .SubTitle").hide();
    $u(".HeaderControl" + moduleID + " li .Content").hide();
    $u(".HeaderControl" + moduleID + " li img").hide();
    $u(".HeaderControl" + moduleID + " li:last").prependTo(".HeaderControl" + moduleID + " ul");
    $u(".HeaderControl" + moduleID + " li:eq(0)").hide();
    $u(".HeaderControl" + moduleID + " li:eq(1)").show();
    $u(".HeaderControl" + moduleID + " li:eq(0) img").show("slow");
    $u(".HeaderControl" + moduleID + " li:eq(0)").slideDown("slow", 
		function() {
		    $u(".HeaderControl" + moduleID + " li:eq(1)").hide();
		    $u(".HeaderControl" + moduleID + " li:eq(0) .Title").show();
		    $u(".HeaderControl" + moduleID + " li:eq(0) .SubTitle").show();
		    $u(".HeaderControl" + moduleID + " li:eq(0) .Content").show() 
		}) 
}
function animate(j, moduleID) { 
var timer;   
	var f = function() {
	    if ($u(".HeaderControl" + moduleID + " .btns").html()) {
	        $u(".HeaderControl" + moduleID + " .btns .number").css("background", "#FFF").css("color", "#000")
	        var b = 0; var c = g + 1, a = 0; while (c >= 0) {
	            if ($u(".HeaderControl" + moduleID + " li:eq(1)").is("#m" + moduleID + "item" + c)) {
	                $u(".HeaderControl" + moduleID + " .btns .pag" + c).css("background", "#000").css("color", "#FFF")	
	            }else {
				    $u(".HeaderControl" + moduleID + " .btns .pag" + c).css("background", "transparent").css("color", "#000") 
				} 
				c--
	        }
	    }
    if ($u(".HeaderControl" + moduleID + " li:eq(1)").is(".effect1")) { fade(moduleID) }
	    else {
	        if ($u(".HeaderControl" + moduleID + " li:eq(1)").is(".effect2")) { SlideToLeft(moduleID) }
	        else {
	            if ($u(".HeaderControl" + moduleID + " li:eq(1)").is(".effect3")) { SlideToRight(moduleID) }
	            else {
	                if ($u(".HeaderControl" + moduleID + " li:eq(1)").is(".effect4")) { SlideUp(moduleID) } 
	                else {
	                    if ($u(".HeaderControl" + moduleID + " li:eq(1)").is(".effect5")) { SlideDown(moduleID) } 
	                } 
	            } 
	        } 
	    }
		clearTimeout(timer); timer = setTimeout(f, timeout)
	}; 
	var i = function() {
	    if ($u(".HeaderControl" + moduleID + " li:eq(1)").is(".effect1")) { fadePrev(moduleID) }
	    else {
	        if ($u(".HeaderControl" + moduleID + " li:eq(1)").is(".effect2")) { SlideToLeftPrev(moduleID) } 
			else {
			    if ($u(".HeaderControl" + moduleID + " li:eq(1)").is(".effect3")) { SlideToRightPrev(moduleID) } 
				else {
				    if ($u(".HeaderControl" + moduleID + " li:eq(1)").is(".effect4")) { SlideUpPrev(moduleID) } 
					else {
					    if ($u(".HeaderControl" + moduleID + " li:eq(1)").is(".effect5")) { SlideDownPrev(moduleID) } 
				    } 
				} 
			} 
		}
		clearTimeout(timer); timer = setTimeout(f, timeout)
	}; 
	if (j > 0) { timeout = j } 
	if ($u(".HeaderControl" + moduleID + " li:eq(1)").html()) {
	    $u(".HeaderControl" + moduleID + " .number:eq(0)").css("background", "#000").css("color", "#fff");
        var g = $u(".HeaderControl" + moduleID + " li").size();
        $u(".HeaderControl" + moduleID + " .Next"  ).click(function () { clearTimeout(timer); f() });
        $u(".HeaderControl" + moduleID + " .Next2" ).click(function () { clearTimeout(timer); f() });
        $u(".HeaderControl" + moduleID + " .Prev"  ).click(function () { clearTimeout(timer); i() });
        $u(".HeaderControl" + moduleID + " .Prev2" ).click(function () { clearTimeout(timer); i() });
        $u(".HeaderControl" + moduleID + " .number").click(function () {
            clearTimeout(timer);
            var b = 0;
            var c = g, a = 0;
            while (c > 0) {
                if ($u(this).is(".pag" + c)) { a = c; b = "#m" + moduleID + "item" + c }
                $u(".HeaderControl" + moduleID + " .btns .pag" + c).css("background", "transparent").css("color", "#000");
                c--
            }
            $u(this).css("background", "#000").css("color", "#fff");
            while (!$u(".HeaderControl" + moduleID + " li:eq(1)").is(b))
            { $u(".HeaderControl" + moduleID + " li:eq(0)").appendTo(".HeaderControl" + moduleID + " ul");}
            if ($u(".HeaderControl" + moduleID + " li:eq(1)").is(".effect1")) { fade(moduleID) }
            else {
                if ($u(".HeaderControl" + moduleID + " li:eq(1)").is(".effect2")) { SlideToLeft(moduleID) }
                else {
                    if ($u(".HeaderControl" + moduleID + " li:eq(1)").is(".effect3")) { SlideToRight(moduleID) }
                    else {
                        if ($u(".HeaderControl" + moduleID + " li:eq(1)").is(".effect4")) { SlideUp(moduleID) }
                        else {
                            if ($u(".HeaderControl" + moduleID + " li:eq(1)").is(".effect5")) { SlideDown(moduleID) }
                        }
                    }
                }
            }
            clearTimeout(timer); timer = setTimeout(f, timeout)
        });
     	clearTimeout(timer); timer = setTimeout(f, timeout)
	} 
	else {
	    $u(".HeaderControl" + moduleID + " .Prev").hide();
	    $u(".HeaderControl" + moduleID + " .Next").hide();
	    $u(".HeaderControl" + moduleID + " .Prev2").hide();
	    $u(".HeaderControl" + moduleID + " .Next2").hide();
	    $u(".HeaderControl" + moduleID + " .number").hide();
	    $u(".HeaderControl" + moduleID + " .numberBg").hide()
	}
};
