﻿// JScript File

        function ActiveTabChanged(sender, e) {
        var active = sender.get_activeTab().get_headerText();
        var tabHeight = document.getElementById('Tabs');
        var bg = document.getElementById('main');
        bg.style.backgroundImage = 'url("images/bg_continue2.jpg")';
        bg.style.backgroundPosition = 'center';
        bg.style.backgroundRepeat = 'repeat-y';
        var img = document.getElementById('imgFeatures');
        var map = document.getElementById('Map');
        map.innerHTML='<area shape="rect" coords="70,55,189,69" href="sample.aspx" alt="Tournament Website" /><area shape="rect" coords="48,80,189,95" href="applications.aspx" alt="Tournament Applications" /><area shape="rect" coords="124,103,190,119" href="Scheduling.aspx" alt="Scheduling" /><area shape="rect" coords="71,125,190,145" href="scoring.aspx" alt="Scoring &amp; Standings" /><area shape="rect" coords="141,152,189,170" href="seeding.aspx" alt="Seeding" />';
            if (active == "Home") {
                img.src = 'images/features.jpg';
                //tabHeight.style.height = '390';
            }
            else if (active == "Features") {
                img.src = 'images/features.jpg';
                //tabHeight.style.height = '390';
            }
            else if (active == "Sample Site") {
                img.src = 'images/sampleWebsite.jpg';
                map.innerHTML='';
                //tabHeight.style.height = '390';
            }
            else if (active == "Tournaments") {
                img.src = 'images/sampleWebsite.jpg';
                map.innerHTML='';
                //tabHeight.style.height = '390';
            }
            else if (active == "Contact Us") {
                img.src = 'images/features.jpg';
                //tabHeight.style.height = '530';
            }
            else {
                img.src = 'images/features.jpg';
                //tabHeight.style.height = '390';
            }
        }
        
        function initialize() {
            var bg = document.getElementById('main');
            bg.style.backgroundImage = 'url("images/bg_continue2.jpg")';
            bg.style.backgroundPosition = 'center';
            bg.style.backgroundRepeat = 'repeat-y';
            preloadImages();
            var tabHeight = document.getElementById('Tabs');
            var queryString = window.top.location.search.substring(1);
            var page = null;
            if (queryString != null && queryString != "")
            
            page = getParameter(queryString, "page");
            /*
            if (page != null)
            {
            if (page == "Contact")
            tabHeight.style.height = '530';
            else
            tabHeight.style.height = '390';
            }
            else
            tabHeight.style.height = '390';
            */   
                
            
        }
        
        function getParameter ( queryString, parameterName ) {
            // Add "=" to the parameter name (i.e. parameterName=value)
            var parameterName = parameterName + "=";
            if ( queryString.length > 0 ) {
            // Find the beginning of the string
            begin = queryString.indexOf ( parameterName );
            // If the parameter name is not found, skip it, otherwise return the value
            if ( begin != -1 ) {
            // Add the length (integer) to the beginning
            begin += parameterName.length;
            // Multiple parameters are separated by the "&" sign
            end = queryString.indexOf ( "&" , begin );
            if ( end == -1 ) {
            end = queryString.length
            }
            // Return the string
            return unescape ( queryString.substring ( begin, end ) );
            }
            // Return "null" if no parameter has been found
            return "null";
            }
        } 

	    // This function makes our button glow
	    function glow(what)
	    {
		    what = document[what];
		    if (what == undefined || what == null) return;

		    what.src = "images/" + what.name + "_mo.gif";
	    }

	    function dim(what)
	    {
		    what = document.images[what];

		    if (what == undefined || what == null) return;
		    what.src = "images/" + what.name + ".gif";
	    }
	    
	    function preloadImages()
	    {
	     // Preload "What's Your Sport".
	    var n, m;
	    n = new Image();
	    n.src = "images/visit.gif";
	    m = new Image();
	    m.src = "images/visit_mo.gif";
	
	    var arrtabs = new Array("contact", "features", "home", "sample", "tournaments");
	    //Preload the tabs
	    var q, r, s, t;
	    for (i=0;i<arrtabs.length;i++)
	    {
	        q = new Image();
	        q.src = "images/tabs/" + arrtabs[i] + "_active.gif";
	        r = new Image();
	        r.src = "images/tabs/" + arrtabs[i] + "_active_mo.gif";
	        s = new Image();
	        s.src = "images/tabs/" + arrtabs[i] + "_inactive.gif";
	        t = new Image();
	        t.src = "images/tabs/" + arrtabs[i] + "_inactive_mo.gif";
        }
	    }