
isIE6 = /msie|MSIE 6/.test(navigator.userAgent);


function FixMyPng() {
    if (isIE6) {
        var oeTags = '<!--[if lt IE 7.]> '
                + '<style type="text/css"> '
                + ' #wrap,.dnn_bot_left,.dnn_bot_right,.dnn_mid_left,.dnn_mid_right,.Test img{ '
                + 'behavior: url("' + getOut() + 'Scripts/iepngfix.htc"); '
                + '} '
                + ' </style> ';
        
        oeTags = oeTags + ' <!--[if lt IE 7.]> '
                + '<style type="text/css"> '
                + ' .fixit div{ '
                + 'behavior: url("' + getOut() + 'Scripts/iepngfix.htc"); '
                + '} '
                + ' </style> ';
                +' <![endif]--> ';
        document.write(oeTags);
    }
}


//alert(getOut() + 'portals/0/Flash/');
function getServer() {
   // alert("I am running");
    return getOut() + 'portals/0/Flash/'
}

function showHide(elementid) {
    if (document.getElementById(elementid).style.display == 'none') {
        document.getElementById(elementid).style.display = '';
    } else {
        document.getElementById(elementid).style.display = 'none';
    }
}


function set508() {
    skinpath = '<%= SkinPath %>' + 'images/';
    On = skinpath + 'ON508.png';
    OnHover = skinpath + 'ON508Hover.png';
    Off = skinpath + 'OFF508.png';
    OffHover = skinpath + 'OFF508Hover.png';
    Current = document.getElementById('img508').src;
    Current = Current.substring(Current.indexOf('/', 8), Current.length);


    switch (Current) {
        case On:
            setCookie('status508', 'off');
            document.getElementById('img508').src = OffHover;
            break;
        case OnHover:
            setCookie('status508', 'off');
            document.getElementById('img508').src = OffHover;
            break;
        case OffHover:
            setCookie('status508', 'on');
            document.getElementById('img508').src = OnHover;
            break;
        case Off:
            setCookie('status508', 'on');
            document.getElementById('img508').src = OnHover;
            break;
        default:
            setCookie('status508', 'off');
            document.getElementById('img508').src = OffHover;
    }
}


function hideShow() {
    skinpath = '<%= SkinPath %>' + 'images/';
    On = skinpath + 'ON508.png';
    OnHover = skinpath + 'ON508Hover.png';
    Off = skinpath + 'OFF508.png';
    OffHover = skinpath + 'OFF508Hover.png';
    Current = document.getElementById('img508').src;
    Current = Current.substring(Current.indexOf('/', 8), Current.length);
    switch (Current) {
        case On:
            document.getElementById('img508').src = OnHover;
            break;
        case OnHover:
            document.getElementById('img508').src = On;
            break;
        case OffHover:
            document.getElementById('img508').src = Off;
            break;
        case Off:
            document.getElementById('img508').src = OffHover;
            break;
        default:
            document.getElementById('img508').src = On;
    }
}


//Hide or show the necesary 'div'
function isAccessible(accessibleID, notAccessibleID) {
    if (getCookie("status508") == "on")//Then 508 is off
    {

        //Hide 508 div's
        hideDiv(accessibleID);

        //Show flash
        showDiv(notAccessibleID);
    }
    else {
        //Hide flash
        hideDiv(notAccessibleID);
        //Show 508 div's
        showDiv(accessibleID);
    }
}

function hideDiv(elementID) {
    var Element = document.getElementById(elementID);
    if (Element != null) {
        document.getElementById(elementID).style.visibility = 'visible';
        document.getElementById(elementID).style.display = '';
    }
}

function showDiv(elementID) {
    var Element = document.getElementById(elementID);
    if (Element != null) {
        document.getElementById(elementID).style.visibility = 'hidden';
        document.getElementById(elementID).style.display = 'none';
    }


}


//508 Accessibility
//---------------------------------------------------------------------------------------------------------------
//==============Cookie related to the accessibility status===================//               

function readCookie(name) //Get the cookie 'value'
{
    var nameEQ = name + "=";
    var ca = document.cookie.split(';');
    for (var i = 0; i < ca.length; i++) {
        var c = ca[i];
        while (c.charAt(0) == ' ') c = c.substring(1, c.length);
        if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
    }
    return null;
}

function getCookie(c_name)//If the cookie requested exist, return the name.
{
    var results = document.cookie.match('(^|;) ?' + c_name + '=([^;]*)(;|$)');
    if (results) {
        return (readCookie(c_name));
    }
    else
        return null;
}

function setCookie(c_name, value)//Create the cookie and call 'isAccessible()'
{
    deleteCookie(c_name);
    var expires = "";
    document.cookie = c_name + "=" + escape(value) + expires + "; path=/";
    isAccessible('accessible508', 'notAcessible508');
}

function deleteCookie(name) {

    if (getCookie(name) != null) {
        document.cookie = name + '=; expires=Thu, 01-Jan-70 00:00:01 GMT;';
    }
}



//If the cookie exist, show the respective accessible button,
//if not, create a new cookie with 'off' status. 
function checkCookie() {
    status508 = getCookie('status508');
    SkinPath = '<%= SkinPath %>';

    if (status508 != null) {
        if (status508 == 'on') {
            document.getElementById('img508').src = SkinPath + 'images/ON508.png';
        }
        else if (status508 == 'off') {
            document.getElementById('img508').src = SkinPath + 'images/OFF508.png';
        }
        if (document.getElementById('notAcessible508') != null) {
            isAccessible('accessible508', 'notAcessible508');
        }
    }
    else {
        setCookie('status508', 'off');
        document.getElementById('img508').src = SkinPath + 'images/OFF508.png';
    }
}
//==============Show and hide accessible button===================//










function OpenPDF(URL) {
    URL = getOut() + 'Resource-Library/pdfs/' + URL; day = new Date();
    id = day.getTime();
    eval("page" + id + " = window.open(URL, '_blank');");
}






function popUp(URL) {
        URL = getOut() + 'PopUps/' + URL; day = new Date();
        id = day.getTime();
        eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=800,height=275,left = 0,top = 0');");
        }

function popUpScroll(URL) {
            URL = getOut() + 'PopUps/' + URL; day = new Date();
            id = day.getTime();
            eval("page" + id + " = window.open(URL, '_blank','height=400,width=800,scrollbars=yes');");
        }

        function changeView(objChange) {
            if (document.getElementById(objChange).style.visibility == 'visible') {
                document.getElementById(objChange).style.display = "none";
                document.getElementById(objChange).style.visibility = "hidden";
            }
            else {
                document.getElementById(objChange).style.display = "block";
                document.getElementById(objChange).style.visibility = "visible";
            }

        }

        function playmovie() {
            var movie = thisMovie('movie');
            movie.Play();
           // changeView('PlayMovie');
        }


function playflash() {
    var movie = thisMovie('movie');
    thisMovie('movie').Play();
}

function LoadFlash()
{

  // alert(movieIsLoaded(thisMovie('movie')));
   if(movieIsLoaded(thisMovie('movie')))
   {
   thisMovie('movie').Play();
   }
}

 function movieIsLoaded(theMovie) {
            if (typeof (theMovie) != "undefined") {
                return theMovie.PercentLoaded() == 100;
            } else {
                return false;
            }
        }


function getOut() {
    var strpath = document.location.pathname;
    var intDeep = countInstances(strpath, "/");
    var intStart = 1;
    var strOut = ""
    while (intStart <= intDeep - 1) {
        strOut += "../";
        intStart += 1;
    }
    return strOut;

} 

function OpenLink(URL) {
        URL = getOut() +  URL; 
        window.open(URL, '_self');


}
function GetFlash(URL) {
    URL = getOut() + 'portals/0/Flash/' + URL;
    return URL;
}



function GetImage(URL) {
        URL = getOut() + 'portals/0/' + URL; 
        return URL;
} 



function FindPath(URL) {
        URL = getOut() +  URL; 
        return URL;
} 


function countInstances(string, word) {
    var substrings = string.split(word);
    return substrings.length - 1;
    var path = document.location.pathname;
}

function ReturnPath(URL) {
    var strGetOut = getOut();
    if (strGetOut == "") {
        URL = "";
    }
    else {
        URL = getOut() + URL;
    }
    return URL;
}


function thisMovie(movieName) {
    // IE and Netscape refer to the movie object differently.
    // This function returns the appropriate syntax depending on the browser.

    if (getIEVersionNumber() >= '6'  ) {
        return document[movieName]
    }
    else {
        if (navigator.appName.indexOf("Microsoft") != -1) {
            return window[movieName]
        } else {

        return document.embeds[movieName];
        }
    }
}

function getIEVersionNumber() {
    var ua = navigator.userAgent;
    var MSIEOffset = ua.indexOf("MSIE ");

    if (MSIEOffset == -1) {
        return 0;
    } else {
        return parseFloat(ua.substring(MSIEOffset + 5, ua.indexOf(";", MSIEOffset)));
    }
}



function WriteFlashStop(MovieName, width, height) {
        var oeTags = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'
            + 'width="' + width + '" height="' + height + '"'
            + 'codebase = "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" id="movie">'
            + '<param name="movie" value="' + GetFlash(MovieName) + '" /><param name="quality" value="high" /><param name="Play" value="false" /><param name="loop" value="false" /><param name="bgcolor" value="#ffffff" />'
            + '<param name="FlashVars" value="path=' + GetFlash('') + '">'
            + '<embed id="movie" src="' + GetFlash(MovieName) + '" quality="high" bgcolor="#ffffff" '
            + 'width="' + width + '" height="' + height + '" name="movie" align="middle"'
            + 'Play="false"'
            + 'loop="false"'
            + 'quality="high"'
            + 'allowScriptAccess="sameDomain"'
            + 'type="application/x-shockwave-flash"'
            + ' FlashVars="path=' + GetFlash('') + '" '
            + 'pluginspage="http://www.macromedia.com/go/getflashplayer">'
            + '<\/embed>'
            + '<\/object>';
        document.write(oeTags);   // embed the flash movie
        // alert(oeTags);
        //document.getElementById("testcommand1").Play();
}


function WriteFlash(MovieName, width, height)
{

            var oeTags = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'
            + 'width="' + width + '" height="' + height + '"'
            + 'codebase = "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" name="movie"  id="movie">'
            + '<param name="movie" value="' + GetFlash(MovieName) + '" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" />'
            + '<param name="FlashVars" value="path=' + GetFlash('') + '">'
            + '<embed  src="' + GetFlash(MovieName) + '" quality="high" bgcolor="#ffffff" '
            + 'width="' + width + '" height="' + height + '" name="movie"  id="movie" align="middle"'
            + 'Play="true"'
            + 'loop="false"'
            + 'quality="high"'
            + 'allowScriptAccess="sameDomain"'
            + 'type="application/x-shockwave-flash"'
            + ' FlashVars="path=' + GetFlash('') + '" '
            + 'pluginspage="http://www.macromedia.com/go/getflashplayer">'
            + '<\/embed>'
            + '<\/object>';
            document.write(oeTags);   // embed the flash movie
            //alert(oeTags);
            //document.getElementById("testcommand1").Play();
         
 }
 
 
 
 
 
 
 
 
 
 
  

//508 End
//---------------------------------------------------------------------------------------------------------------





