﻿for( i=1 ; i<cpAD.length ; i++ )
{ 
	//alert( cpAD.length + " -----(1-5) " + i ) ;
	preloadedimages[i] = new Image() ; 
	preloadedimages[i].src = cpAD[i] ; 
} 

function jump2url()
{ 
	jumpUrl = cpADlink[adNum] ; 
	jumpTarget = '_blank' ; 
	if( jumpUrl != '' )
	{ 
		if(	jumpTarget != '' )
		{
		    var re = /\D*(\d+)\D*/;
			window.open(jumpUrl,jumpTarget) ;
			issue = jumpUrl.replace(re,"$1");
			Clk(this, "FP_live_"+issue);
		}
		else location.href = jumpUrl ; 
	} 
}


function changeimg( n )
{
	adNum = n-1 ;
	switch(n)
	{
		case 0:
		{
		    try
		    {
			    //alert( "changeimg case 0 --- n=" + n +" --- " + "adNum = n-1 = " + adNum ) ;  
			    document.getElementById("img1").src="images/ad/1-2.gif";
			    document.getElementById("img2").src="images/ad/2-1.gif";
			    document.getElementById("img3").src="images/ad/3-1.gif";
			    document.getElementById("img4").src="images/ad/4-1.gif";
			    document.getElementById("img5").src="images/ad/5-1.gif";
			}
			catch(e){}
			break;
		}
		case 1:
		{
		    try
		    {
			    document.getElementById("img1").src="images/ad/1-1.gif";
			    document.getElementById("img2").src="images/ad/2-2.gif";
			    document.getElementById("img3").src="images/ad/3-1.gif";
			    document.getElementById("img4").src="images/ad/4-1.gif";
			    document.getElementById("img5").src="images/ad/5-1.gif";
			}catch(e){}
			break;
		}
		case 2:
		{
		    try
		    {
			    document.getElementById("img1").src="images/ad/1-1.gif";
			    document.getElementById("img2").src="images/ad/2-1.gif";
			    document.getElementById("img3").src="images/ad/3-2.gif";
			    document.getElementById("img4").src="images/ad/4-1.gif";
			    document.getElementById("img5").src="images/ad/5-1.gif";
			}catch(e){}
			break;
		}
		case 3:
		{
		    try
		    {
			document.getElementById("img1").src="images/ad/1-1.gif";
			document.getElementById("img2").src="images/ad/2-1.gif";
			document.getElementById("img3").src="images/ad/3-1.gif";
			document.getElementById("img4").src="images/ad/4-2.gif";
			document.getElementById("img5").src="images/ad/5-1.gif";
			}catch(e){}
			break;
		}
		case 4:
		{
			//alert( "changeimg case 4 --- n=" + n +" --- " + "adNum = n-1 = " + adNum ) ;  
		    try
		    {
			document.getElementById("img1").src="images/ad/1-1.gif";
			document.getElementById("img2").src="images/ad/2-1.gif";
			document.getElementById("img3").src="images/ad/3-1.gif";
			document.getElementById("img4").src="images/ad/4-1.gif";
			document.getElementById("img5").src="images/ad/5-2.gif";
			}catch(e){}
			break;
		}
		case 5:
		{
		    try
		    {
			document.getElementById("img1").src="images/ad/1-1.gif";
			document.getElementById("img2").src="images/ad/2-1.gif";
			document.getElementById("img3").src="images/ad/3-1.gif";
			document.getElementById("img4").src="images/ad/4-1.gif";
			document.getElementById("img5").src="images/ad/5-1.gif";
			}catch(e){}
			break;
		}
	}

	window.clearInterval( theTimer ) ;
	nextAd();
}


function nextAd()
{
	//adNum = 6 --- coll= 0
	//alert( "nextAd" + " --- " + "adNum = " + adNum + " --- " + "coll = " + coll ) ; 
	coll++;
	if( coll > 1 )
	{
		switch( adNum+1 )
		{
			case 0:
			{
		    try
		    {
				//alert( "nextAd --- switch( adNum+1 ) = " + adNum+1 + " --- " + "case 0 " + " --- " + "coll = " + coll + " --- " + "adNum=" + adNum ) ;  
				document.getElementById("img1").src="images/ad/1-2.gif";
				document.getElementById("img2").src="images/ad/2-1.gif";
				document.getElementById("img3").src="images/ad/3-1.gif";
				document.getElementById("img4").src="images/ad/4-1.gif";
				document.getElementById("img5").src="images/ad/5-1.gif";
			}catch(e){}
			break;
			}
			case 1:
			{
				//adNum = 0 
				//alert( "nextAd --- switch( adNum+1 ) = " + adNum+1 + " --- " + "case 1 " + " --- " + "coll = " + coll + " --- " + "adNum=" + adNum ) ;  
		    try
		    {

				document.getElementById("img1").src="images/ad/1-1.gif";
				document.getElementById("img2").src="images/ad/2-2.gif";
				document.getElementById("img3").src="images/ad/3-1.gif";
				document.getElementById("img4").src="images/ad/4-1.gif";
				document.getElementById("img5").src="images/ad/5-1.gif";
			}catch(e){}
			break;
			}
			case 2:
			{
				//adNum = 1
		    try
		    {
				document.getElementById("img1").src="images/ad/1-1.gif";
				document.getElementById("img2").src="images/ad/2-1.gif";
				document.getElementById("img3").src="images/ad/3-2.gif";
				document.getElementById("img4").src="images/ad/4-1.gif";
				document.getElementById("img5").src="images/ad/5-1.gif";
			}catch(e){}
			break;
			}
			case 3:
			{
				//adNum = 2
		    try
		    {
				document.getElementById("img1").src="images/ad/1-1.gif";
				document.getElementById("img2").src="images/ad/2-1.gif";
				document.getElementById("img3").src="images/ad/3-1.gif";
				document.getElementById("img4").src="images/ad/4-2.gif";
				document.getElementById("img5").src="images/ad/5-1.gif";
			}catch(e){}
			break;
			}
			case 4:
			{
				//adNum = 3
		    try
		    {
				document.getElementById("img1").src="images/ad/1-1.gif";
				document.getElementById("img2").src="images/ad/2-1.gif";
				document.getElementById("img3").src="images/ad/3-1.gif";
				document.getElementById("img4").src="images/ad/4-1.gif";
				document.getElementById("img5").src="images/ad/5-2.gif";
			}catch(e){}
			break;
			}
			case 5:
			{
				//adNum = 4
		    try
		    {
				document.getElementById("img1").src="images/ad/1-1.gif";
				document.getElementById("img2").src="images/ad/2-1.gif";
				document.getElementById("img3").src="images/ad/3-1.gif";
				document.getElementById("img4").src="images/ad/4-1.gif";
				document.getElementById("img5").src="images/ad/5-1.gif";
			}catch(e){}
			break;
			}
			case 6:
			{
				//adNum = 5
		    try
		    {
				document.getElementById("img1").src="images/ad/1-2.gif";
				document.getElementById("img2").src="images/ad/2-1.gif";
				document.getElementById("img3").src="images/ad/3-1.gif";
				document.getElementById("img4").src="images/ad/4-1.gif";
				document.getElementById("img5").src="images/ad/5-1.gif";
			}catch(e){}
			break;
			}
			case 7:
			{
				//alert( "nextAd case 6 : " + adNum ) ;
				//adNum = 6 , 调试大半天，原来是这里还要再加一个，否则到了最后一个回头显示第一个会一闪而过
		    try
		    {
				document.getElementById("img1").src="images/ad/1-2.gif";
				document.getElementById("img2").src="images/ad/2-1.gif";
				document.getElementById("img3").src="images/ad/3-1.gif";
				document.getElementById("img4").src="images/ad/4-1.gif";
				document.getElementById("img5").src="images/ad/5-1.gif";
				adNum=0;
			}catch(e){}
			break;
			}
		}
	}

	if(adNum<cpAD.length-1)
	{
		document.images.cpADrush.src=cpAD[adNum];
		document.images.cpADrush.alt=cpADalt[adNum];
		adNum++ ; 
	}
	else 
	{
		adNum=0;
		document.images.cpADrush.src=cpAD[adNum]; 
		document.images.cpADrush.alt=cpADalt[adNum];
	}

	setTransition() ;
	document.images.cpADrush.src=cpAD[adNum] ; 
	document.images.cpADrush.alt=cpADalt[adNum];
	playTransition() ; 
	displayStatusMsg() ;
	theTimer = setTimeout("nextAd()", 5000) ; 
}


function setTransition()
{ 
	if (document.all)
	{ 
		document.images.cpADrush.filters.revealTrans.Transition=23; 
		document.images.cpADrush.filters.revealTrans.apply(); 
	} 
} 


function playTransition()
{ 
	if (document.all) 
	document.images.cpADrush.filters.revealTrans.play() 
} 


function displayStatusMsg() 
{ 
	//status = cpADmsg[adNum] ; 
	document.returnValue = true; 
} 

