﻿// JScript File

var ImgActiveID;


function setBGimg() {

    document.body.style.backgroundImage="url('images/bg041-125l.jpg')";

}


function menuClick(arg) {

    parent.frames['mainFr'].window.location=arg;
    
}



function SponsorMouseOver(picID) {

    var imgNext;
    var imgActive;
    
    imgActive = document.getElementById(ImgActiveID);
    if (imgActive != null) {
        imgActive.style.borderStyle = "none";
        imgActive.style.borderColor="";
        imgActive.style.borderWidth="";
    }
    
    imgNext = document.getElementById(picID);
    if(imgNext != null || imgNext == undefined) {
        imgNext.style.borderStyle = "solid";
        imgNext.style.borderColor = "red";
        imgNext.style.borderWidth = "thick";
    }
    ImgActiveID = picID;
    return false;
      
}


function hlt(obj){
	obj.style.backgroundColor="#e0e0e0";
}

function resetColor(obj){
	obj.style.backgroundColor="";
}


imgArr = new Array();
idxArr = new Array();

function initPhotoPage() {

    var refThumbs = document.getElementById('refThumbs');
    objContent(refThumbs,document.title);
    setPhotoPath('thumbs');
    
    var thumbDiv = document.getElementById('thumbDiv'); 
    var thumbCount=0;
    
    for (var iNode=0; iNode < thumbDiv.childNodes.length; iNode++) {
        var oNode = thumbDiv.childNodes.item(iNode);
        if(oNode.src){
            imgArr[thumbCount]=oNode.id;
            idxArr[oNode.id]=thumbCount;
            thumbCount++;
        }
    }  


}

function thumbMouseOver(thumbObj) {

  
    var divPop = document.getElementById('divPop');
    var imgPop = document.getElementById('imgPop');
    var thumbWidth = thumbObj.width;
    var thumbHeight = thumbObj.height;
    
    imgPop.src = thumbObj.title;
    imgPop.width = thumbWidth * 3;
    imgPop.height = thumbHeight * 3;
    
    var x = getPageOffsetLeft(thumbObj);
    var y = getPageOffsetTop(thumbObj);
    
    
    if (x<500)
        x = x + thumbWidth;        
    else
        x = x - imgPop.width;        
     
    if (y<300)
        y = y + thumbHeight;        
    else
        y = y - imgPop.height;        
    
    // For Firefox, adjust position.
    if (Browser.isIE==false)
        y +=37;
        
    divPop.style.left = x + "px";
    divPop.style.top = y + "px";
    divPop.style.visibility = "visible";
   
}



function thumbMouseOut() {

    var divPop = document.getElementById('divPop');
    divPop.style.visibility = 'hidden';
}


function nextPhoto(inc) {
    
    var imgIso = document.getElementById('imgIso');
    var curIdx = idxArr[imgIso.alt]+inc;
    if(curIdx<0)
        curIdx=imgArr.length-1;
    else if(curIdx>=imgArr.length)
        curIdx=0;
    setPhoto(document.getElementById(imgArr[curIdx]));
    
}

function setPhoto(thumbObj)  {

    var imgIso = document.getElementById('imgIso');
    imgIso.src = thumbObj.title;
    imgIso.alt = thumbObj.id;
    var refPhoto = document.getElementById('refPhoto');
    objContent(refPhoto,thumbObj.id);
    var spanCrsr = document.getElementById('spanCrsr');
    objContent(spanCrsr,(idxArr[thumbObj.id]+1)+'/'+imgArr.length);
    setPhotoPath('photo');
   
}


function setPhotoPath(pathPos) {
    
    switch(pathPos) {
    
        case 'thumbs':
            document.getElementById('refPhoto').style.display='none';
            document.getElementById('spanNav').style.display='none';
            document.getElementById('imgIso').style.display='none';
            document.getElementById('thumbDiv').style.display='';
            break;
                        
        case 'photo':
            document.getElementById('refPhoto').style.display='';
            document.getElementById('spanNav').style.display='';
            document.getElementById('imgIso').style.display='';
            document.getElementById('thumbDiv').style.display='none';
    }    
}



function setHistory(yr) {

    var frmObj = document.getElementById('ifrHistory');
    var imgObj = document.getElementById('imgHistory');
    frmObj.src = 'history' + yr + '.htm';
    
    switch(yr) {
    
        case '09':  imgObj.src='photos/101000/HofmannFinalTable_Red.jpg';   break;
        case '08':  imgObj.src='photos/100900/FinalTable2_Red.jpg';         break;
        case '07':  imgObj.src='photos/100400/Champ07.jpg';                 break;
        case '06':  imgObj.src='photos/100300/Champ06_Red.jpg';             break;
        case '05':  imgObj.src='photos/100200/Champ05_Red.jpg';             break;
        case '04':  imgObj.src='photos/100100/Champ04_Red.jpg';             break;
    
      }          
       
       
}


var imgOpac = 99.99;
var imgIntroLeft, imgIntroMain;
var divIntro, t;

function initHome() {

    if(document.all)  //ie
        parent.frames['mainFr'].self.document.body.style.textAlign='center';
    
    var docFr=parent.frames['mainFr'].self.document;
    var divTop=docFr.getElementById('divTop');
    var divSS=docFr.getElementById('divSlideShow');    
    var ww = docFr.documentElement.clientWidth;
    
    divTop.style.width=(ww-300)+'px';
    divSS.style.top=(getPageOffsetTop(divTop)-15)+'px';
    
    var docFr=parent.frames['leftFr'].self.document;
    if(docFr.getElementById('imgIntro').style.visibility=='hidden')
        initHomePostIntro();
    

}    


function initHomePostIntro() {
    
    var docFr=parent.frames['mainFr'].self.document;
    var divSS=docFr.getElementById('divSlideShow');    
    var vidObj=docFr.getElementById('video2009');    
    imgSS1=docFr.getElementById('img1SlideShow');
    imgSS2=docFr.getElementById('img2SlideShow');
    capSS=docFr.getElementById('spanSSCap');
        
    imgSS1.src=imgSSPath+imgSSArr[imgSSIdx];
    objContent(capSS,capSSArr[imgSSIdx]);
    imgSS1.style.visibility='visible';
    divSS.style.visibility='visible';
    vidObj.style.visibility='visible';
    tIFOut=window.setTimeout("fadeImg('"+imgSS1.id+"')", rotateTime);
    
    
}


function initIntro() {


    if(parent.frames.length>0){
        imgIntroLeft=parent.frames['leftFr'].self.document.getElementById('imgIntro');
        imgIntroMain=parent.frames['mainFr'].self.document.getElementById('imgIntro');
        divIntro=parent.frames['mainFr'].self.document.getElementById('divIntro');
    }

    if(imgIntroMain!=undefined && imgIntroMain!=null){
        var ww = parent.frames['mainFr'].self.document.documentElement.clientWidth;
        divIntro.style.width=(ww)+'px';
        imgIntroLeft.style.visibility='visible';
        imgIntroMain.style.visibility='visible';
        t=window.setTimeout('fadeImgIntro()', rotateTime);
    }
    
}


function fadeImgIntro() {
    
    
    if(imgOpac>0){
        setOpacity(imgIntroLeft,imgOpac);
        setOpacity(imgIntroMain,imgOpac);
        t=window.setTimeout('fadeImgIntro()', 100);
    }    
    else {
        setOpacity(imgIntroLeft,0); 
        setOpacity(imgIntroMain,0); 
        imgIntroLeft.style.visibility='hidden';
        imgIntroMain.style.visibility='hidden';
        divIntro.style.display='none'; 
        clearTimeout(t);
        initHomePostIntro();
        
    }
    imgOpac=imgOpac-3;    

}

