	  var count=1;
	  var runstory;
	  var restartstory;
	  var oldcount=0;
	  var wantcount=0;
	  var waitforit=0;
	  var stopit=0;
	  var themaxer=9;
	  var therotated;
	  var rotating;
	  var restartrotating;
	  var closerit;
      function makeRound(){
	  $("#headline").corner("round 7px");
	  $("#sidebartop").corner("round 5px");
	  $("#sidebartopa").corner("round 3px");
	  }
	  function makeRoundin(){
	  $("h2").corner("round 7px right");
	  }
	  function makeRoundinbp(){
	  $("#bplays").corner("round 7px");
	  }
	  function makeRoundinvid(){
	  $("#grab-vcl-experience-sportsmedia_jb").corner("round 7px");
	  $("#grab-vcl-experience-spotlight-container").corner("round 7px");
	  }
	  function rotateit()
	  { 
		  for(var z=0; z<therotated.length; z++)
		  {
			  if(therotated[z].style.display=='block')
			  {
				  if(z==therotated.length-1)
				  {
					var thehideid="#"+therotated[z].id;
			 	 $(thehideid).animate({marginLeft:'-900px'},500,function(){
						for(var s=0; s<therotated.length; s++)
						{
							therotated[s].style.marginLeft='20px';
							therotated[s].style.display='block';
						}
					});
				  }
				  else
				  {
				  var thehideid="#"+therotated[z].id;
				  $(thehideid).animate({marginLeft:'-920px'},500,function(){$(this).css('display','none');});
				  }
			  break;
			  }
		  }
	  }
	  function startrotating()
	  {
		  rotating=setInterval("rotateit()",5000);
	  }
	  function closemenu()
	  {
		  for(var g=1; g<themaxer; g++)
		  {	
			 var whatsub="#sub"+g;
			 $(whatsub).css("display","none");
		  }	
		  $("#rotater").css("display","block");
	  }
	  function makenav()
	  {	
		  var therotater=document.getElementById("rotater");
		  therotated=therotater.getElementsByTagName("div");
		  var ranber=Math.floor(Math.random()*(therotated.length-1))
		  for(var z=0; z<therotated.length; z++)
		  {
			  if(z<=ranber)
			  {
			  	therotated[z].style.display='none';
			  }
			  else
			  {
				 therotated[z].style.display='block';
			  }
			  var thehideid="#"+therotated[z].id;
			  $(thehideid).mouseenter(function(){
				clearInterval(rotating);					   
			  });
			  $(thehideid).mouseleave(function(){
				startrotating();				   
			  });
			  
		  }
		  startrotating();
		  for(var k=1; k<themaxer; k++)
		  {
			  if(k==themaxer-1)
			  {var theid="#logoutlink";}else{var theid="#nav"+k;}
			  //alert(theid);
			  if(k==themaxer-1)
			  {
			    $(theid).mouseenter(function(){
					clearTimeout(closerit);
					for(var g=1; g<themaxer; g++)
					{	
						 var whatsub="#sub"+g;
						 $(whatsub).css("display","none");
					}	
					$("#rotater").css("display","block");
				});
			  }
			  else
			  {
				 	var theesub="#sub"+k;
					$(theesub).css("display","none");
					
					$(theesub).mouseleave(function(){
					clearTimeout(closerit);
					closerit=setTimeout("closemenu()",3000);
					});
					
					$(theid).mouseenter(function(){
					clearTimeout(closerit);
					var subnum=$(this).attr("id");
					var subnum1=subnum.replace(/nav/,'');
					var thesub="#sub"+subnum1;
					$("#rotater").css("display","none");
					for(var g=1; g<themaxer; g++)
		  			{	
						 var whatsub="#sub"+g;
						 if(whatsub!=thesub)
						 {
							 $(whatsub).css("display","none");
						 }
					}
					$(thesub).css("display","block");
				});
				
			  }
		  }
		  
		  $("#header").mouseenter(function(){
					clearTimeout(closerit);
					closerit=setTimeout("closemenu()",3000);
				});
		   $("#wholepage").mouseleave(function(){
					clearTimeout(closerit);
					closerit=setTimeout("closemenu()",3000);
				});
	  }
	  function gostory()
	  {
	  var zdex=5;
	  var maxh=0;
		  for(var k=1; k<6; k++)
		  {
		  document.getElementById('pic'+k).style.zIndex=zdex;
		  document.getElementById('pic'+k).style.position='absolute';
		  document.getElementById('pic'+k).style.top='36px';
		  document.getElementById('pic'+k).style.left='36px';
			  if(parseInt(document.getElementById('pic'+k).scrollHeight)>maxh)
			  {
			  maxh=parseInt(document.getElementById('pic'+k).scrollHeight);
			  } 
		  zdex--;
		  }
	    document.getElementById('headline').style.height=maxh+'px';
		  for(var k=1; k<6; k++)
		  {
		  document.getElementById('pic'+k).style.height=maxh+'px';
		  }
		//clean up spacing
		var gap=Math.round(((maxh+72)-(parseInt(document.getElementById('sidebartop').scrollHeight)+250))/2);	
		document.getElementById('sided').style.marginTop=gap+'px';
		document.getElementById('sided').style.marginBottom=gap+'px';
		$("#sd1").mouseenter(function(){if(window.waitforit==0){window.waitforit=1;pausestory(5); document.getElementById("pointer").href='/football';};});
		$("#sd2").mouseenter(function(){if(window.waitforit==0){window.waitforit=1;pausestory(1);document.getElementById("pointer").href='/baseball';};});
		$("#sd3").mouseenter(function(){if(window.waitforit==0){window.waitforit=1;pausestory(2);document.getElementById("pointer").href='/basketball';};});
		$("#sd4").mouseenter(function(){if(window.waitforit==0){window.waitforit=1;pausestory(3);document.getElementById("pointer").href='/hockey';};});
		$("#sd5").mouseenter(function(){if(window.waitforit==0){window.waitforit=1;pausestory(4);document.getElementById("pointer").href='/othersports';};});
		document.getElementById('headline').style.visibility="visible";
	  runstory=setInterval("storyline(1000)",3000);
	  }
	  function pausestory(which)
	  {
		window.count=which; stopstory();  
	  }
	  function resumestory()
	  {
		  document.getElementById("pointer").href='#';
		  runstory=setInterval("storyline(1000)",3000);
	  }
	  function stopstory()
	  {
		  clearInterval(runstory);
		  clearTimeout(restartstory);
		  storyline(1);
		  restartstory=setTimeout("resumestory()",6000);
		  window.waitforit=0;
	  }
	  function storyline(time)
	  {
		  
		  if(count==5)
		  {
		  	document.getElementById('pic5').style.zIndex=6;
			$('#pic4').fadeIn(1,function() {$('#pic3').fadeIn(1,function() {$('#pic2').fadeIn(1,function() {$('#pic1').fadeIn(1, function() {$('#pic5').fadeOut(time, function() {
			document.getElementById('pic5').style.zIndex=1;
			$('#pic5').fadeIn(time);
			});});});});});
		  	$('#pointer').animate({top: '4'}, time);
			count=1;
		  }
		  else
		  {	
		  	pic="#pic"+count;
			for(var i=1; i<count; i++)
			{
				var curentpic="#pic"+i;
				$(curentpic).fadeOut(time);
			}
		  	$(pic).fadeOut(time);
			for(var i=1+count; i<6; i++)
			{
				var curentpic="#pic"+i;
				$(curentpic).fadeIn(time);
			}
			var thetop=(((count)*48)+4)+'';
			$('#pointer').animate({top: thetop}, time);
			count++;

		  }
	  }
