
var autoRotate = 1;
var autoRotateTime = new Date();
var autoRotateCurrent = 0;

$j(document).ready(function() {
 	 setTimeout(autoRotateBio, 6000);
});



//autoRotate = 0;
//		autoRotateTime = new Date();


function change_Banner(Banner_id)
{
		var Banner_bio = '#' + Banner_id;
		//alert (Banner_id);
		$j('#bannerAd').fadeOut('1000',function() 
					{
							
							var html = $j(Banner_bio).html();
							//alert(html);
							$j('#bannerAd').html(html);
							$j('#bannerAd').delay(200).fadeIn('slow');
					});
} //end funtion 

function manualRotateBio(Banner_id)
{
			autoRotate = 0;
			autoRotateTime = new Date();
			change_Banner(Banner_id);
}



function autoRotateBio()
{
				//alert(Diff + '  ' + autoRotate);
				var Diff = new Date() - autoRotateTime;
					if(autoRotate == 1)
					{
			
							autoRotateCurrent = autoRotateCurrent  +1;
							if (autoRotateCurrent == arrayMaxLength)
									{
											autoRotateCurrent = 0;
									}
							//alert(autoRotateCurrent);		
							change_Banner(BannerArray[autoRotateCurrent]);			
							autoRotate = 0;						
						}		else
								{
											if (Diff > 30000)
												{
															autoRotate = 1;
												}
								
								} //end if
						
				setTimeout(autoRotateBio, 3000);	
		
			
  }  
