﻿/* Script developed by Josh Squires of Structured Systems International
Please leave author credits if used */

var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;

var currentElement = "";
var _global = this;

function setClass(obj,cls) {
    var elementObj;
    if (isIE && isWin && !isOpera) elementObj = eval("document.all." + obj);
    else elementObj = eval('document.getElementById("' + obj + '")');
    elementObj.className = cls;
}

function openAnimation(obj, objH) {
    var elementObj;
    if (isIE && isWin && !isOpera) elementObj = eval("document.all." + obj);
    else elementObj = eval('document.getElementById("' + obj + '")');

    if (_global["closeAnimation" + obj + "ID"] != "undefined") clearTimeout(_global["closeAnimation" + obj + "ID"]);

    var cHeight = (isNaN(parseInt(elementObj.style.height))) ? 0 : parseInt(elementObj.style.height);
    var nHeight = (cHeight < parseInt(objH)) ? cHeight + 5 : cHeight;
    elementObj.style.height = nHeight + "px";
    if (nHeight != parseInt(objH)) _global["openAnimation" + obj + "ID"] = setTimeout(function() { openAnimation(obj, objH); }, 10);
}

function closeAnimation(obj, objH) {
    var elementObj;
    if (isIE && isWin && !isOpera) elementObj = eval("document.all." + obj);
    else elementObj = eval('document.getElementById("' + obj + '")');

    if (currentElement != elementObj.id) {
        if (_global["openAnimation" + obj + "ID"] != "undefined") clearTimeout(_global["openAnimation" + obj + "ID"]);
        var cHeight = (isNaN(parseInt(elementObj.style.height))) ? parseInt(objH) : parseInt(elementObj.style.height);
        var nHeight = (cHeight > 0) ? cHeight - 5 : cHeight;
        elementObj.style.height = nHeight + "px";
        if (cHeight != 0) {
            _global["closeAnimation" + obj + "ID"] = setTimeout(function() { closeAnimation(obj, objH); }, 10);
        }
    }
}
function displayDiv(obj,toggle) {
    var elementObj;
    if (isIE && isWin && !isOpera) elementObj = eval("document.all." + obj);
    else elementObj = eval('document.getElementById("' + obj + '")');
    if(toggle==0) elementObj.style.visibility = "hidden";
    else  elementObj.style.visibility = "visible";
}
// Start Alert Message Popup Script
// (Edit/Change the verbiage on AlertMessage.aspx to change the alert message for this popup)
// (Remove the // in front of the next line to turn ON popup, Place // in front of the next line to turn OFF popup)
//window.addEvent('domready', function(){SqueezeBox.open('AlertMessage.htm'), {handler: 'iframe', size: {x: 600, y: 400}, closeBtn: true}});
//End Alert Message Popup Script
