function getposOffset(overlay, offsettype) {
    var totaloffset = (offsettype == "left") ? overlay.offsetLeft : overlay.offsetTop;
    var parentEl = overlay.offsetParent;
    while (parentEl != null) {
        totaloffset = (offsettype == "left") ? totaloffset + parentEl.offsetLeft : totaloffset + parentEl.offsetTop;
        parentEl = parentEl.offsetParent;
    }
    if (offsettype == "top") {
        totaloffset = totaloffset + 25;
    }
    if (offsettype == "left") {
        totaloffset = totaloffset - 250;
    }
    return totaloffset;
}

function overlay(curobj, subobj) {
    if (document.getElementById) {
        if (document.getElementById(subobj).style.display == "none") {
            var subobj = document.getElementById(subobj);
            //subobj.style.left=getposOffset(curobj, "left")+"px"
            //subobj.style.top=getposOffset(curobj, "top")+"px"
            subobj.style.display = "block";
        } else if (document.getElementById(subobj).style.display == "block") {
            document.getElementById(subobj).style.display = "none";
        }
    }
}

function overlayclose(subobj) {

}


/* replaced on jquery.functions.js
function ResizeContentDiv() {


    var LeftContentHeight = 0;
    var RightContentHeight = 0;
    var CenterContentHeight = 0;

    if (document.getElementById('Column_1')) {

        var LeftContent = document.getElementById('Column_1');
        LeftContentHeight = LeftContent.offsetHeight;
    }

    if (document.getElementById('Column_2')) {

        var CenterContent = document.getElementById('Column_2');
        CenterContentHeight = CenterContent.offsetHeight;
    }

    //if (document.getElementById('Column_3')) {
    //var RightContent = document.getElementById('Column_3');
    //RightContentHeight = RightContent.offsetHeight;
    //}


    var maxHeight = Math.max(LeftContentHeight, RightContentHeight, CenterContentHeight);

    if (document.getElementById('Column_1')) {

        LeftContent.style.height = maxHeight + "px";
    }
    if (document.getElementById('Column_2')) {
        CenterContent.style.height = maxHeight + "px";
    }
    //if (document.getElementById('Column_3')) {
    //RightContent.style.height = maxHeight + "px";
    //}
}

*/


/* this is crashing now, from old main nav menu.


function noenter() {
    return ! (window.event && window.event.keyCode == 13);
}

var cssmenuids = ["cssmenu1"]
var csssubmenuoffset = 0

function createcssmenu2() {
    for (var i = 0; i < cssmenuids.length; i++) {
        var ultags = document.getElementById(cssmenuids[i]).getElementsByTagName("ul")
        for (var t = 0; t < ultags.length; t++) {
            ultags[t].style.top = ultags[t].parentNode.offsetHeight + csssubmenuoffset + "px"

            ultags[t].parentNode.onmouseover = function () {
                this.style.zIndex = 100
                this.getElementsByTagName("ul")[0].style.visibility = "visible"
                this.getElementsByTagName("ul")[0].style.zIndex = 0
                //closeTab();	
            }
            ultags[t].parentNode.onmouseout = function () {
                this.style.zIndex = 0
                this.getElementsByTagName("ul")[0].style.visibility = "hidden"
                this.getElementsByTagName("ul")[0].style.zIndex = 100
            }
        }
    }
}

if (window.addEventListener) window.addEventListener("load", createcssmenu2, false)
else if (window.attachEvent) window.attachEvent("onload", createcssmenu2)

*/

var popupWin

function openNewWindow(wfile, wtitle, wwidth, wheight) {
    popupWin = window.open(wfile, wtitle, "toolbar=no,leftmargin=0,topmargin=0,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=" + wwidth + ",height=" + wheight);
    popupWin.focus();

}


function closeWindow() {
    if (window.opener) {
        window.opener.focus();
    }
    window.close();
}


function b_refer() {
    window.history.back();
}



/* This was from the old tab / flash panels at the top of the page



function showTab(tab) {
    alert(tab);
    $("#tShop").slideDown("slow");
    $("#tabsButtons").attr({
        src: "/images/findasection-on.gif",
        alt: "Find Your Section"
    });

    //hideHTMLTab();
    //alert(calleFlashMovie);	
    //showFlashSection(tab);
    //setTimeout("showFlashSection('" + tab +"')",5000);
}

function showTabMouseOver() {
    $("#tabsButtons").attr({
        src: "/images/findasection-on.gif",
        alt: "Find Your Section"
    });
}



function closeTab() {
    $('#miscLinks > ul').tabs({
        selected: null,
        fx: {
            height: 'show'
        }
    });
}

function hideHTMLTab() {
    $("#tabsButtons").hide();

}

function showHTMLTab() {
    $("#tabsButtons").show();

}


function showFlashSection(section) {
    if (document.getElementById) {
        calleFlashMovie = document.getElementById("pulltabswf");
        calleFlashMovie.showFlashSection(section);
    }
}

*/


function redirect(url) {
    window.location = url;
}


/* from to old flash media wall

$(document).ready(function () {
    var version = deconcept.SWFObjectUtil.getPlayerVersion();
    if (document.getElementById && version["major"] < 8) {
        if (document.getElementById('MediaWall')) {
            document.getElementById('MediaWall').innerHTML = "<p><span class='required'>This content requires Flash.</span>To view this content, Javascript must be enabled and you need the latest version of the Adoble Flash Player.<span class='getflash'><a href='http://www.adobe.com/go/getflashplayer' target='_blank'>Download the free Flash Player now!</a></span></p>";
            document.getElementById('MediaWall').style.background = "url('')";
        }
    }
});

*/


function StateOnChange(dropdown) {
    var myindex = dropdown.selectedIndex;
    var selstate = dropdown.options[myindex].value;
    var divtitlename = "rcw_states";
    var divallname = "all";
    var divs = document.getElementsByTagName('div');

    for (var i = 0; i < divs.length; i++) {
        if (divs[i].id == selstate) {
            divs[i].style.display = "block";
        } else {
            if (divs[i].title == divtitlename) {
                divs[i].style.display = "none";
            }

            if (divs[i].title == divallname) {
                divs[i].style.display = "none";
            }

        }
    }

    return true;
}
