var HScroll_Cur = 0;
var HScroll_Count = 1;
var HScroll_Interval = 0;
var HScroll_Play = 1;
var HScroll_Block =false;
var HScroll_Direction = 1;
var HScroll_Direction2 = 0;
var HScroll_Directions = ['left','right']
set_HScroll = function(mod){
   clearInterval();
   if(mod!=0 && mod!=HScroll_Direction){HScroll_Direction =mod;}
	var prev = HScroll_Cur;
	var direction = "right";
	var direction2 = "left";
	if (mod == -1){HScroll_Direction= 0;}
	if (mod == 1){HScroll_Direction= 1;}
	if(HScroll_Direction==1){HScroll_Direction2=0;}else{HScroll_Direction=1;}
	 var pos = HScroll_Cur + mod;
	 if (pos > HScroll_Count-1){pos = 0;}
	 if (pos < 0){pos = HScroll_Count-1;}
	 HScroll_Cur = pos;
	 HScroll_resize();
	 $(".HScroller_Item").each(function(index, value){
			if(index==pos){$(value).show("slide",{direction:"right"},"slow").delay(300);}
			if(index==prev){$(value).hide("slide",{direction:"left"},"slow");}
			})
	 $("#HscrollerPage").html(HScroll_Cur + 1 + ' of ' + HScroll_Count);
	 $("#HScroller").css("background-position", (20 + -(pos*20)) + "px -10px");
	 HScroll_Block = false;
	if(HScroll_Play==1)
		{
			clearInterval(HScroll_Interval);
		 HScroll_Interval = setInterval ( "set_HScroll(HScroll_Direction)", 5000 );
		}
}
HScroll_resize = function(){
	 var width = $("#HScroller").width();
	 $(".HScroller_Item").css("width", (width-10) +"px");
}
set_HScroll_Play = function(){
	if(HScroll_Play==0)
		{
			clearInterval(HScroll_Interval);
		  HScroll_Interval = setInterval ( "set_HScroll(HScroll_Direction)", 5000 );
		  HScroll_Play = 1;
		  $(".HScroller_PlayButton").attr("src","/images/control_pause_blue.png");
		} else {
		  clearInterval(HScroll_Interval);
 		  HScroll_Play = 0;
		 $(".HScroller_PlayButton").attr("src","/images/control_play_blue.png");
		}
};
$(document).ready(function(){  
  		HScroll_Count = $(".HScroller_Item").size();
		$(".HScroller_Item").hide();
		set_HScroll(1);
		$("#HscrollerPage").html(HScroll_Cur + ' of ' + HScroll_Count);
		$(window).resize(function(){HScroll_resize();})
		clearInterval(HScroll_Interval);
		HScroll_Interval = setInterval ( "set_HScroll(HScroll_Direction)", 5000 );
		setInterval("set_DateTime()",1000);
			$("A[name]").each(function(index,value){
			$("#HScrollerSummary").html($("#HScrollerSummary").html() + '<a href="#' +$(value).attr("name") + '">' + 
										$(value).next().html() + '</a><br />');
			$(document).pngFix({blankgif:'/images/ext.gif'});		   
		});
			$("#HorizMenu li").click(function(){
		window.location = $(this).children("a:first").attr("href");	  
	});
		
	

});
set_DateTime = function(){
	 var d = new Date(); 
	 $("#datetimesub").html(d+" ");
};

