function Navigate(url) {
    window.location.href = url;
}


$(document).ready(function(){
    if(window.location.href.indexOf('textonly=y') == -1)
    {
        $('head').append('<link rel="stylesheet" href="/Uploads/27/Files/52894294style.css" type="text/css" />');
    }
    else
    {
        $('#aTextOnly').html('Design');
        $('img').css('visibility','hidden');
    }

    $('#divSmallA').click(function(){
        EnlargeText(-1);
    });
    $('#divBigA').click(function(){
        EnlargeText(1);
    });

});

function textOnly()
{
    var textOnlyStr = 'textonly=y';
    var qStr = '?';
    var newLocation = window.location.href;
    
    if(newLocation.indexOf('textonly=y') > -1) { 
        textOnlyStr = 'textonly=n';
    }

    newLocation = newLocation.replace('?textonly=y',''); 
    newLocation = newLocation.replace('&textonly=y',''); 
    newLocation = newLocation.replace('?textonly=n',''); 
    newLocation = newLocation.replace('&textonly=n',''); 

    if(newLocation.indexOf('?') > -1) { qStr = '&'; }

    window.location.href = newLocation + qStr + textOnlyStr;
}

var areImagesHidden = false;
var ruleArray = new Array("body","h1","h2","h3","col_1","col_2","blueboldtext","grayboldtext","divgraybar");

function toggleImages() {
    var imgs = document.getElementsByTagName("img");
    var i;
    for (i = 0; i < imgs.length; i++) {
        if (areImagesHidden == false) {
            imgs[i].style.visibility = "hidden";
        }
        else {
            imgs[i].style.visibility = "visible";
        }
    }

    areImagesHidden = !areImagesHidden;
}

function EnlargeText(increment) {
    var qStr = "";
    var rule;

    for (var i = 0; i < ruleArray.length; i++) {
        rule = GetStyleSheetRule(ruleArray[i]);
        if (rule != null) {
            curFontSize = parseInt(rule.style.fontSize.replace("px", ""));
            newFontSize = curFontSize + increment;
            rule.style.fontSize = newFontSize.toString() + "px";
            if (i > 0) {
                qStr += ",";
            }
            qStr += ruleArray[i] + ":" + newFontSize.toString();
        }
    }
    setFontSizeService = new Request('setFontSize.asp', "cmd=set&data=" + qStr, setFontOnLoad, setFontOnComplete, setFontOnError);
    setFontSizeService.loadText();
}

function GetStyleSheetRule(theRule) {
    if (document.styleSheets) {
        if (document.styleSheets.length > 0) {
            var ss = document.styleSheets[0];
            var rules;
            var curFontSize;
            var newFontSize;
            var rtnRule;

            if (ss.cssRules) {
                rules = ss.cssRules;
            }
            else if (ss.rules) {
                rules = ss.rules;
            }

            for (var i = 0; i < rules.length; i++) {
                if (rules[i].selectorText.toLowerCase().indexOf(theRule) > -1) {
                    rtnRule = rules[i];
                    if (rtnRule.style.fontSize) {
                        break;
                    }
                }
            }

            return rtnRule;
            //return rules[0];            
        }

    }

    return null;
}


var scriptsOn = 0;
if ((navigator.appName == 'Netscape' && parseFloat(navigator.appVersion) >= 3) || (parseFloat(navigator.appVersion) >= 4)) {
    scriptsOn = 1;
}

//ignore all the following scripting with older browsers
if (scriptsOn == 1) {
    var pathPrefix = ""
    //set the interior pages images
    HomePhoto = new Array();
    HomePhoto[1] = new Array("/Uploads/27/Images/4327home_green_image_01.jpg", "James Michaels plays his guitar");
    HomePhoto[2] = new Array("/Uploads/27/Images/4328home_green_image_02.jpg", "Adjustment counselor Shawn Dobbs shares encouraging and entertaining stories with six Focus Group clients in the Socialization Room.");
    HomePhoto[3] = new Array("/Uploads/27/Images/4329home_green_image_03.jpg", "Katrina Anderson's guide dog Sally lounges on her bed");
    HomePhoto[4] = new Array("/Uploads/27/Images/4330home_green_image_04.jpg", "Bernie Wilmer supervises a sign shop job by the solvent printer");
    HomePhoto[5] = new Array("/Uploads/27/Images/4331home_green_image_05.jpg", "Katrina walking with Leader Dog, Sally.");
    HomePhoto[6] = new Array("/Uploads/27/Images/4332home_green_image_06.jpg", "Matt, a client at Bosma Rehab Center sets the table for his Family Meal while, Kathy, Personal Management Instructor, cleans up in the background.");
    HomePhoto[7] = new Array("/Uploads/27/Images/4333home_green_image_07.jpg", "Matt having an Orientation and Mobility lesson with Instructor, Bill");
    HomePhoto[8] = new Array("/Uploads/27/Images/4334home_green_image_08.jpg", "Assistive Technology Instructor Bill assisting David, a client to build a computer.");

    if (navigator.appName == 'Netscape' || parseFloat(navigator.appVersion) >= 4) {
        homeBigSrc = (HomePhoto[(Math.round((HomePhoto.length - 2) * Math.random()) + 1)][0]);
    }
    else {
        homeBigSrc = HomePhoto[1][0];
    }

    //set the interior pages images
    InteriorPhoto = new Array();
    InteriorPhoto[1] = new Array("/Uploads/27/Images/4314green_interior_image_01.jpg", "Bobbie ready to greet the clients, staff, and guests as they enter the Rehab Center.");
    InteriorPhoto[2] = new Array("/Uploads/27/Images/4315green_interior_image_02.jpg", "Betty in the lighting lab");
    InteriorPhoto[3] = new Array("/Uploads/27/Images/4316green_interior_image_03.jpg", "Two hands repairing a door knob");
    InteriorPhoto[4] = new Array("/Uploads/27/Images/4317green_interior_image_04.jpg", "Reading a Braille book");
    InteriorPhoto[5] = new Array("/Uploads/27/Images/4318green_interior_image_05.jpg", "Learning to use a pill box");
    InteriorPhoto[6] = new Array("/Uploads/27/Images/4319green_interior_image_06.jpg", "Adam Rodenbeck skis one handed off the boom of  a ski boat, skiing up a big spray of water on Morse Reservoir");
    InteriorPhoto[7] = new Array("/Uploads/27/Images/4320green_interior_image_07.jpg", "Rehab clients, one wearing chef�s hat, pose in Personal Management kitchen");

    if (navigator.appName == 'Netscape' || parseFloat(navigator.appVersion) >= 4) {
        interiorBigSrc = (InteriorPhoto[(Math.round((InteriorPhoto.length - 2) * Math.random()) + 1)][0]);
    }
    else {
        interiorBigSrc = InteriorPhoto[1][0];
    }

}

// display randomized image
function showImage() {
	document.write('<img src=');
	var rn = (Math.round((HomePhoto.length - 2) * Math.random()) + 1);
	document.write(HomePhoto[rn][0]);
	document.write(" alt=\"");
	document.write(HomePhoto[rn][1]);
	document.write("\"");
	document.write(' border="0" id="imgGreenHomeImage" alt="James Michaels plays his guitar" />');
}

// display randomized image
function showImageInterior() {
	document.write('<img src=');
	var rn = (Math.round((InteriorPhoto.length - 2) * Math.random()) + 1);
	document.write(InteriorPhoto[rn][0]);
	document.write(" alt=\"");
	document.write(InteriorPhoto[rn][1]);
	document.write("\"");
	document.write(' border="0" id="imgGreenInteriorImage" alt="Bobbie ready to greet the clients, staff, and guests as they enter the Rehab Center." />');
}

//account for different browsers' object models
var NNDoc = (navigator.appName.indexOf('Microsoft') != -1) ? "" : "document.";

/*
var setBosmaPageReq;

function loadBosmaPage(id) {
    //setBosmaPageReq = new Request('http://www.bosma.org/api/getpage.asp?p='+id, '', setBosmaPageOnLoad, setBosmaPageOnComplete, setBosmaPageOnError);
    //setBosmaPageReq.method('GET');
    //setBosmaPageReq.loadHTML();
}
function setBosmaPageOnLoad() {
    alert('loading');
}
function setBosmaPageOnComplete() {
    var html = setBosmaPageReq.html();
    var divLeftColText = '<div id="LeftColumn">';
    var divRightColText = '<div id="RightColumn">';
    var startIndex = 0;

    var leftCol = html.substring(divLeftColText.length, html.indexOf("</div>") - 1);
    var rightCol = "";

    if (html.indexOf(divRightColText) > -1) {
        rightCol = html.substring( html.indexOf(divRightColText) + divRightColText.length, html.indexOf("</div>", html.indexOf(divRightColText)) - 1 );
    }
    document.getElementById('divBosmaLeftCol').innerHTML = leftCol;
    document.getElementById('divBosmaRightCol').innerHTML = rightCol;
}
function setBosmaPageOnError() {
    alert("error: " + setBosmaPageReq.errorMessage());
}
*/