﻿
hs.graphicsDir = '../highslide/graphics/';
hs.outlineType = 'rounded-white';
hs.wrapperClassName = 'draggable-header no-footer';
hs.allowSizeReduction = false;
// always use this with flash, else the movie will be stopped on close:
hs.preserveContent = false;


function OpenMessage(thisId) {
    if (document.getElementById(thisId).style.display == 'none')
    { document.getElementById(thisId).style.display = '' }
    else
    { document.getElementById(thisId).style.display = 'none' };
}


function ShowHide(hideThis, showThis) {
    document.getElementById(hideThis).style.display = 'none';
    document.getElementById(showThis).style.display = '';
}

function ShowHideHeaderMenu(hideThis, showThis) {
    if (hideThis != null) {
        document.getElementById(hideThis.id).style.display = 'none'
        //hideThis.style.display = 'none'
    }

    if (showThis != null) {
        document.getElementById(showThis.id).style.display = ''
        //showThis.style.display = '';            
    }
}

function ShowHideHeaderMenu2(hideThis, showThis, TopMenu, bShow) {
    if (bShow == true) {
        if (TopMenu.className != 'nav-selected')
            TopMenu.className = 'Popup-nav-selected';
    } else {
        if (TopMenu.className != 'nav-selected') {
            TopMenu.style.color = "#00235D";
            TopMenu.className = 'bg';
        }
    }

    if (hideThis != null) {
        document.getElementById(hideThis.id).style.display = 'none'
        //hideThis.style.display = 'none'
    }

    if (showThis != null) {
        document.getElementById(showThis.id).style.display = ''
        //showThis.style.display = '';
    }

}


function openCSUVideo(url, width, height) {
    var win = window.open(url, "VideoPlayer", "menubar=1,resizable=1,width=" + width + ",height=" + height);
    win.focus();
    win.opener = window;
}

function popupWindow(url, width, height) {
    var win = window.open(url, "PopWindow", "menubar=0,resizable=1,width=" + width + ",height=" + height);
    win.focus();
    win.opener = window;
}


function ChangeImage(thisId, imgPath) {
    document.getElementById(thisId).src = imgPath;
}


function DisplayDynamicClock() {
    setInterval("__doPostBack(' <%=upDynamicClock.ClientID%>','')", 1000);
}


function openChat() {
    var win = window.open('../chat/Chat.aspx?DepartmentID=1&DepartmentName=Enrollment Advisor', 'chat', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=495,height=259');
    win.focus();
    win.opener = window;
    return false;
}



function bookmark(url, title) {
    if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) {
        window.external.AddFavorite(url, title);
    } else { //else if (navigator.appName == "Netscape") {
        window.sidebar.addPanel(title, url, "");
        //} else {
        //alert("Press CTRL-D (Netscape) or CTRL-T (Opera) to bookmark");
    }
}

function OpenModal(modalPath, modalRecordId, modalCenter, modalScroll, modalStatus, modalResize, modalWidth, modalHeight) {
    if (modalPath != null && modalRecordId != null) {
        if (modalCenter == null)
            modalCenter = "yes";
        if (modalScroll == null)
            modalScroll = "yes";
        if (modalStatus == null)
            modalStatus = "no";
        if (modalResize == null)
            modalResize = "yes";
        if (modalWidth == null)
            modalWidth = "750px";
        if (modalHeight == null)
            modalHeight = "700px";

        var thisBody = document.body;
        thisBody.className = "Modal";

        var MyArgs = new Array(modalRecordId);
        var WinSettings = "center:" + modalCenter + ";scroll:" + modalScroll + ";status:" + modalStatus + ";resizable:" + modalResize + ";dialogWidth:" + modalWidth + ";dialogHeight:" + modalHeight;

        var MyArgs = window.showModalDialog(modalPath, MyArgs, WinSettings);

        //Only do PostBak on Success
        if (MyArgs != null && MyArgs.length > 0) {
            //Return Argument must be formatted as such "Page or Control" + "-" + "Method"
            if (MyArgs[0].indexOf('-') > 0) {
                isAspNet = (window.location.href.indexOf('.aspx') > -1);
                //if classic asp - do java reload
                if (!isAspNet) {
                    location.reload(true);
                }
                // else do ajax postback
                else {
                    var array = MyArgs[0].split("-");
                    //This way the Page/Control is the "__EVENTTARGET" AND the Method is the "__EVENTARGUMENT"
                    __doPostBack(array[0], array[1]);
                }

            }
            else {
                if (MyArgs[0].length > 0) {
                    window.location.href = MyArgs[0];
                }
            }
        }
        //Otherwise - do not run a PostBack

        thisBody.className = "Clear";
    }
}




/*
start uc_header script
*/

function URLEncode(clearString) {
    var output = '';
    var x = 0;
    clearString = clearString.toString();
    var regex = /(^[a-zA-Z0-9_.]*)/;
    while (x < clearString.length) {
        var match = regex.exec(clearString.substr(x));
        if (match != null && match.length > 1 && match[1] != '') {
            output += match[1];
            x += match[1].length;
        } else {
            if (clearString[x] == ' ')
                output += '+';
            else {
                var charCode = clearString.charCodeAt(x);
                var hexVal = charCode.toString(16);
                output += '%' + (hexVal.length < 2 ? '0' : '') + hexVal.toUpperCase();
            }
            x++;
        }
    }
    return output;
}

function SubmitOnEnter(myfield, e) {
    var keycode;
    if (window.event)
        keycode = window.event.keyCode;
    else if (e)
        keycode = e.which;
    else
        return true;
    if (keycode == 13) {
        SearchSite();
        return false;
    }
    else
        return true;
}



function getRootURL() {
    var baseURL = location.href;
    var rootURL = baseURL.substring(0, baseURL.indexOf('/', 7));
    if (baseURL.indexOf('localhost') == -1) {
        return rootURL + "/";
    } else {
        return rootURL + baseURL.substring(baseURL.indexOf('/', 8), baseURL.indexOf('/', baseURL.indexOf('/', 8) + 1)) + "/";
    }
}

function SearchSite() {

    document.location.href = getRootURL() + 'search.aspx?cx=013892573359394800413%3Afm3g9p9qu6a&cof=FORID%3A10&ie=UTF-8&q=' + document.getElementById('q').value + '&sa=Search#919';
}


/*
end uc_header script
*/
