﻿// JScript File
   
    
   function hero(src,caption,top){
            this.src = src
            this.caption = caption
            this.top = (top || '30')
   }
    function doBackground(page){
        var heroarray = new Array()
        heroarray.push(new hero('butt1_hero.jpg','Fall team practice \'08','40'));
        heroarray.push(new hero('chico08_hero.jpg','Chico Tournament \'08 Team','20'));
        heroarray.push(new hero('shasta_hero.jpg','Lake Shasta pit stop, Fall 08','60'));
        heroarray.push(new hero('team_hero.jpg','2008-2009 Team'));
        heroarray.push(new hero('work_hero.jpg','Work party at borderline, fall 08','60'));
       // heroarray[0] = new hero('averi2.jpg','Summer Skiing on Lake Samish, Skier - Averi Creasia','90'));
       // heroarray[1] = new hero('buttholes.jpg','Hosting the 2007 All Stars','50'));
        heroarray.push(new hero('morn10.jpg', 'Sunrise after morning Skiing on lake Samish'));
       // heroarray[6] = new hero('speedo.jpg', 'Antics at the 2007 Night Jump Challenge','20'));
        heroarray.push(new hero('dane.jpg', 'Practice at Bow Lake, Skier - Dane Caldwell','95'));
        //heroarray[5] = new hero('chops.jpg', 'Glove insertion (after stuck threw it at his face) on Lake Samish, Idiot - Ian Casey'));
      //  heroarray[5] = new hero('skylake.jpg','Lakeside at Regionals 05','50'));
        //heroarray[8] = new hero('speedo2.jpg', 'In the Boat')); 
        heroarray.push(new hero('team.jpg','Team Shot at Davis\' After Chico Special 05', '20'));
        heroarray.push(new hero('chops2.jpg', 'Regionals 06 at Firebird Lake, AZ','65'));
       // heroarray.push(new hero('teamjump.jpg','Team Shot in REd Square'));
       // heroarray[10] = new hero('crane.jpg','Craig Batchelor - Wake Crossing Ejection Maneuver','70'));
        heroarray.push(new hero('averi.jpg','Regionals 05, Skier - Averi Creasia','75'));
        heroarray.push(new hero('morn1.jpg','Morning Skiing on Lake Samish','80'));
        heroarray.push(new hero('cali.jpg','On The Road to California for a Tournament'));
        heroarray.push(new hero('dane2.jpg','Regionals 05, Skier - Dane Caldwell','90'));
       // heroarray[15] = new hero('josh.jpg','Not on purpose...','40'));
        heroarray.push(new hero('ikeski.jpg','Chico 07: Skier - Kyle Mortenson','85'));
       // heroarray.push(new hero('speeder_aly.jpg','Official Business - Regionals 07','50'));
       // heroarray[18] = new hero('clawbuttcg.jpg','Chillin - Regionals 07'));
        heroarray.push(new hero('dirtyjump.jpg','All-Stars 06 - Kelsie Blanchard'));
        heroarray.push(new hero('regionals09_hero.jpg','WWU At Regionals 09','20'));
        heroarray.push(new hero('nationals09team_hero.jpg','Team At Nationals 09 - ','15'));
        heroarray.push(new hero('reg09postawards_hero.jpg','Nationals 09 - Post Award Ceremony','10'));
        
        var image = Math.round(Math.random()* (heroarray.length -1))

        var main = document.getElementById('main')
        main.style.backgroundImage = "url('/images/"+heroarray[image].src+"')"
        
        if(page == 'home'){
            var caption = document.getElementById('caption');
            caption.innerHTML = heroarray[image].caption;
            //window.onload = new Function('doAnalytics()');
            
            //docboxMO();
        }else{
            main.style.backgroundPosition =  'left ' + heroarray[image].top +'%';
        }
        
        //doAnalytics();
        
    }
/*
   function doAnalytics(){
        try{
            var links = document.getElementsByTagName('A')

            for(var i = 0; i < links.length; i++){
                var a = links[i]
                if(a.href.indexOf('wwuwaterski.com') == -1){
                    
                    if (a.addEventListener){
                        a.addEventListener('click',doPageview, false)
                    }else{
                        a.attachEvent('onclick',doPageview)
                    }
                
                }
            
            }
        }catch(rrr){
        
        }
   
   }
   
    function doPageview(e){
       
        if(!e){
             var e = window.event;
        }
        
        if(e.target){
            var obj = e.target;
        }else{
            var obj = e.srcElement;
        }
        
        var txt = ''
        
        if(obj.tagName == 'IMG'){
            txt = 'IMG|' + (obj.alt || obj.src)
        }else{
            if(obj.innerText){
                txt = obj.innerText;
            }else{
                txt = obj.textContent;
            }
        }

        if(txt != '') pageTracker._trackPageview('Link:' + txt);
    }
    
    if (window.addEventListener){
        window.addEventListener('load',doAnalytics, false)
    }else{
        window.attachEvent('onload',doAnalytics)
    }
    

    
    */