﻿var rotateId = 1;
var rotateTimer;
var rotateImages = new Array();
function GetRotateLabel()
{
    return document.getElementById('rotateLabel');
}

function GetRotateImage()
{
    return document.getElementById('rotateImage');
}

function NextRotate()
{
    rotateId++;
    if(rotateId == 8)
        rotateId = 0;
    RefershRotate();
}

function DoRotate()
{
    NextRotate();
    myTimer = setTimeout("DoRotate();", 2000);
}

function RefershRotate()
{
    var label = GetRotateLabel();
    var image = GetRotateImage();
    switch(rotateId)
    {
        case 0:
        if(label != null) 
            label.innerHTML = 'Travel';
        break;
        
        case 1:
        if(label != null) 
            label.innerHTML = 'Automotive';
        break;
        
        case 2:
        if(label != null) 
            label.innerHTML = 'Food & Dining';
        break;
        
        case 3:
        if(label != null) 
            label.innerHTML = 'Health';
        break;
        
        case 4:
        if(label != null) 
            label.innerHTML = 'Real Estate';
        break;
        
        case 5:
        if(label != null) 
            label.innerHTML = 'Wireless';
        break;
        
        case 6:
        if(label != null) 
            label.innerHTML = 'Yellow Pages';
        break;
        
        case 7:
        if(label != null) 
            label.innerHTML = 'and more...';
        break;
    }
    
    if(image != null)
        image.src = rotateImages[rotateId];
        
}
