currFeatureNum = 1;
rotDelay = 5000;
timestocycle = 2;
feature1times = timestocycle;

var strMyBrowser;
setMyBrowser();

var is = new Is()
var controls = new Array();
controls[1] = createMyObj("controlone");
controls[2] = createMyObj("controltwo");

var controlnumbers = new Array();
controlnumbers[1] = createMyObj("control1");
controlnumbers[2] = createMyObj("control2");

var features = new Array();
features[1] = createMyObj("main1");
features[2] = createMyObj("main2");

function nextFeature() {
     hideallfeatures();
     whiteoutallcontrols();
     replaceallunderlines();
     nextFeatureNum = currFeatureNum + 1;
     if ( nextFeatureNum == 3 ) nextFeatureNum = 1;
     showdiv(features[nextFeatureNum]);
     changecolor(controls[nextFeatureNum],"#DDDDDD");
     divunderline(controlnumbers[nextFeatureNum], "none");
     currFeatureNum = nextFeatureNum;
     clearTimeout(RotTimer);
     RotTimer = setInterval("nextFeature()", rotDelay);
     
     if ( currFeatureNum == 1 )
//          feature1times--;
     if (feature1times < 1 ) {
          clearTimeout(RotTimer);
     }
}

function lastFeature() {
     hideallfeatures();
     whiteoutallcontrols();
     replaceallunderlines();
     nextFeatureNum = currFeatureNum - 1;
     if ( nextFeatureNum == 0 ) nextFeatureNum = 2;
     showdiv(features[nextFeatureNum]);
     changecolor(controls[nextFeatureNum],"#DDDDDD");
     divunderline(controlnumbers[nextFeatureNum], "none");
     currFeatureNum = nextFeatureNum;
     clearTimeout(RotTimer);
     RotTimer = setInterval("nextFeature()", rotDelay);
}

function gotoFeature(featurenum) {
     hideallfeatures();
     whiteoutallcontrols();
     replaceallunderlines();
     nextFeatureNum = featurenum;
     showdiv(features[featurenum]);
     divunderline(controlnumbers[featurenum], "none");
     changecolor(controls[featurenum],"#DDDDDD");
     currFeatureNum = featurenum;
     clearTimeout(RotTimer);
     RotTimer = setInterval("nextFeature()", rotDelay);
}

function hideallfeatures() {
     hidediv(features[1]);
     hidediv(features[2]);
}

function whiteoutallcontrols() {
     changecolor(controls[1],"white");
     changecolor(controls[2],"white");
}
function replaceallunderlines() {
     divunderline(controlnumbers[1],"underline");
     divunderline(controlnumbers[2],"underline");
}

function divunderline(div, state) {
     if ( !is.ns4 ) div.textDecoration = state;
}

function pauseRotation()
{
     clearTimeout(RotTimer);
}

RotTimer = setInterval("nextFeature()", rotDelay);



function Is() {
    var agent = navigator.userAgent.toLowerCase();
    this.major = parseInt(navigator.appVersion);
    this.minor = parseFloat(navigator.appVersion);
    this.ns = ((agent.indexOf('mozilla')!=-1) && ((agent.indexOf('spoofer')==-1) && (agent.indexOf('compatible') == -1)));
    this.ns2 = (this.ns && (this.major == 2));
    this.ns3 = (this.ns && (this.major == 3));
    this.ns4 = (this.ns && (this.major == 4));
    this.ns5 = (this.ns && (this.major > 4));
    this.ie = (agent.indexOf("msie") != -1);
    this.ie3 = (this.ie && (this.major == 2));
    this.ie4 = (this.ie && (this.major >= 4));
    this.op3 = (agent.indexOf("opera") != -1);
    this.mac = (agent.indexOf("mac") != -1);
    this.client = ( (navigator.userAgent.indexOf('AOL')!=-1) || (navigator.userAgent.indexOf('CS 2000')!=-1) )? 1 : 0;
}


function setMyBrowser() {
   if (document.all) {
      strMyBrowser = "IE";
   } else {
      strMyBrowser = "Netscape";
   }
}

function createMyObj(divblock) {
    if (strMyBrowser == "IE") {
        return eval("document.all."+divblock+".style");
    } else if (is.ns5) {
        return document.getElementById(divblock).style;
    } else if (is.ns4) {
        return eval("document."+divblock);
    }
}

function changecolor(div,color) {
     if ( !is.ns4 ) div.background=color;         
}

function showdiv(div) {
     if (is.ns4)
        div.visibility="show";
     else 
        div.visibility="visible";
 
}
function hidediv(div) {
     if (is.ns4)
        div.visibility="hide";
     else 
        div.visibility="hidden";
 
}

