var left11 = 0;
var count ;
var obj ;
var ul_width = 0;
var cur = 0;
var Left1 = 0;
var timer;
$(document).ready(
				  
				  
					
					function() {
						$('#topmenu td').each(
								function(){
									$(this).find('ul').parent().addClass("root");
								}
							)
						$('#topmenu td.root a').click(
												function() {
															$(this).parent().find('ul').css('width', $(this).parent().width());	
															$(this).parent().find('ul').slideDown(500);
															return false;
															});
						
						$('#topmenu td').hover(
												function() {},
												function ()	{
															$(this).find('ul').slideUp(300);
															}
												);
						$('#leftmenu li').hover(
												function() {
															$(this).find('ul').show(500);
															},
												function ()	{
															$(this).find('ul').hide(300);
															}
												);
						
					$(window).resize(function(){
						
						wid = $(window).width();
						if (wid < 998){
							wid = (998 - 800) / 2;
						} else {
							wid = ($(window).width() - 800) / 2;
							$("#pn1").css("width", wid+"px");
						}
					});
					wid = ($(window).width() - 800) / 2;
			
					$("#pn1").css("width", wid+"px");
					count = $("#ticker01 li").length;
					obj = document.getElementById("ticker01").getElementsByTagName("LI");

					
						
					for (var i=0; i<count; i++){
						ul_width += $(obj[i]).width() ;
					}
					$("#ticker01").css("width", ul_width);
					
					
				
					
						animate1 (0);				


/*$("#ticker01").hover(
							function(){
								left11 = $("#ticker01").css("left");
								$("#ticker01").stop();
timer = 0;
								//alert(left11);
								//$("#ticker01").css("left", left11);
								$("#ticker01").animate({ 
									left: left11
								  }, 1 , "linear");
							}, 
							function(){
								
								
								animate1 (parseInt(left11.replace("px", "")));								
//								str_replace();
					
									
							}
						);*/
});


function animate1 (status){
	$("#ticker01").animate({ 
							left: -ul_width/2+"px"
						  }, 1500*count*(ul_width+2*status)/ul_width , "linear");
						$("#ticker01").animate({ 
							left: 0
						  }, 1 , "linear");
						
						
	timer = window.setInterval(function()
					{
						
						$("#ticker01").animate({ 
							left: -ul_width/2+"px"
						  }, 1500*count , "linear");
						$("#ticker01").animate({ 
							left: 0
						  }, 1 , "linear");

					}, 1500*count); 
}
