var flag=false;
function DrawImage(ImgD,iwidth,iheight){
    //参数(图片,允许的宽度,允许的高度)
    var image=new Image();
    image.src=ImgD.src;
    if(image.width>0 && image.height>0){
    flag=true;
    if(image.width/image.height>= iwidth/iheight){
        if(image.width>iwidth){  
        ImgD.width=iwidth;
        ImgD.height=(image.height*iwidth)/image.width;
        }else{
        ImgD.width=image.width;  
        ImgD.height=image.height;
        }
        ImgD.alt=image.width+"×"+image.height;
        }
    else{
        if(image.height>iheight){  
        ImgD.height=iheight;
        ImgD.width=(image.width*iheight)/image.height;        
        }else{
        ImgD.width=image.width;  
        ImgD.height=image.height;
        }
        ImgD.alt=image.width+"×"+image.height;
        }
    }
} 
function show(i){
document.getElementById("div"+i).style.display="block";
if(document.getElementById("hidden1").value!=""&&document.getElementById("hidden1").value!="div"+i){
document.getElementById(document.getElementById("hidden1").value).style.display="none";
}
document.getElementById("hidden1").value="div"+i;
}
function open_newwindow(url){
window.open(url,"CompatibleModels","width=500,height=500,left=0,top=0,scrollbars=no,resizable=no,menubar=0");  
} 

var bannerAD=new Array();
var bannerADlink=new Array();
var adNum=0;
/*bannerAD[0]="http://electricbike.uk.com/images/christmas.gif";
bannerADlink[0]="http://www.electricbike.uk.com";*/
bannerAD[0]="http://electricbike.uk.com/images/PowerSmart-b1-778.jpg";
bannerADlink[0]="http://www.electricbike.uk.com";
bannerAD[1]="http://electricbike.org.uk/PowerSmart/PowerSmart-b6.jpg";
bannerADlink[1]="http://www.electricbike.uk.com/cate_products_list.php/1_Electric%20Bike%20with%20Battery%20&%20Charger";
bannerAD[2]="http://electricbike.uk.com/images/kiril1.jpg";
bannerADlink[2]="http://www.electricbike.uk.com/products_detals.php/1_Electric%20Bike%20with%20Battery%20&%20Charger/9_XEB0001K.A";
bannerAD[3]="http://electricbike.uk.com/images/kiril2.jpg";
bannerADlink[3]="http://www.electricbike.uk.com/products_detals.php/1_Electric%20Bike%20with%20Battery%20&%20Charger/10_XEB0002K.A";
bannerAD[4]="http://electricbike.uk.com/images/kiril3.jpg";
bannerADlink[4]="http://www.electricbike.uk.com/products_detals.php/1_Electric%20Bike%20with%20Battery%20&%20Charger/11_XEB0003K.A";
bannerAD[5]="http://electricbike.uk.com/images/kiril4.jpg";
bannerADlink[5]="http://www.electricbike.uk.com/products_detals.php/1_Electric%20Bike%20with%20Battery%20&%20Charger/12_XEB0004K.A";
bannerAD[6]="http://electricbike.uk.com/images/kiril6.jpg";
bannerADlink[6]="http://www.electricbike.uk.com/products_detals.php/5_Li-ion%20Battery%20Only/504_XEB0004";
var preloadedimages=new Array();
for (i=1;i<bannerAD.length;i++){
preloadedimages[i]=new Image();
preloadedimages[i].src=bannerAD[i];
}

function setTransition(){
if (document.all){
bannerADrotator.filters.revealTrans.Transition=Math.floor(Math.random()*23);
bannerADrotator.filters.revealTrans.apply();
}
}

function playTransition(){
if (document.all)
bannerADrotator.filters.revealTrans.play()
}

function nextAd(){
if(adNum<bannerAD.length-1)adNum++ ;
else adNum=0;
setTransition();
document.images.bannerADrotator.src=bannerAD[adNum];
playTransition();
theTimer=setTimeout("nextAd()", 3000);
}

function jump2url(){
jumpUrl=bannerADlink[adNum];
jumpTarget='';
if (jumpUrl != ''){
if (jumpTarget != '')window.open(jumpUrl,jumpTarget);
else location.href=jumpUrl;
}
}
function displayStatusMsg() { 
status=bannerADlink[adNum];
document.returnValue = true;
}