if (typeof vcc != "object")
    vcc = new Object();

vcc.userAgent = navigator.userAgent.toLowerCase();
vcc.win = (vcc.userAgent.indexOf("win") > -1);
vcc.mac = (vcc.userAgent.indexOf("mac") > -1);
vcc.ie = (vcc.userAgent.indexOf("msie") > -1);
vcc.w3c = (document.getElementById && !vcc.ie);
vcc.opera = (vcc.userAgent.indexOf("opera") > -1);
vcc.safari = (vcc.userAgent.indexOf("safari") > -1);
vcc.ns6 = (vcc.userAgent.indexOf("netscape6") > -1);
vcc.version = (vcc.ie) ? parseFloat(navigator.appVersion.match(/MSIE\s(\d+\.\d+)/)[1]) : null;
vcc.ie7 = (vcc.ie && vcc.version > 6);

vcc.getObj = function(strLayer) {
    if(typeof(strLayer) == "object") return strLayer;
    var elmLayer = document.getElementById(strLayer);
    if (!elmLayer)
        elmLayer = document.getElementsByName(strLayer)[0];
    return elmLayer;
}

vcc.show = function() {
    for (var i=0; i<vcc.show.arguments.length; i++) {
        if ((elmLayer=vcc.getObj(vcc.show.arguments[i])))
            elmLayer.style.visibility = "visible";
    }
}

vcc.hide = function() {
    for (var i=0; i<vcc.hide.arguments.length; i++) {
        if ((elmLayer=vcc.getObj(vcc.hide.arguments[i])))
            elmLayer.style.visibility = "hidden";
    }
}

vcc.setDisplay = function(strLayer,strValue) {
    if (!(elmLayer=vcc.getObj(strLayer)))
        return false;
    elmLayer.style.display = strValue;
}

vcc.getX = function(strLayer,blnGlobal) {
    if (!(elmLayer=vcc.getObj(strLayer)))
        return false;
    var currentX = elmLayer.offsetLeft;
    if (blnGlobal) {
        while (elmLayer.offsetParent) {
            elmLayer = elmLayer.offsetParent;
            currentX += elmLayer.offsetLeft;
        }
    }
    return currentX;
}

vcc.getY = function(strLayer,blnGlobal) {
    if (!(elmLayer=vcc.getObj(strLayer)))
        return false;
    var currentY = elmLayer.offsetTop;
    if (blnGlobal) {
        while (elmLayer.offsetParent) {
            elmLayer = elmLayer.offsetParent;
            currentY += elmLayer.offsetTop;
        }
    }
    return currentY;
}

vcc.getW = function(strLayer) {
    if (!(elmLayer=vcc.getObj(strLayer)))
        return false;
    if (window.getComputedStyle) {
        var style=getComputedStyle(elmLayer, null);
        return parseInt(style.getPropertyValue('width'));
    }
    else if (elmLayer.style.pixelWidth)
        return elmLayer.style.pixelWidth;
    else if(elmLayer.offsetWidth)
        return elmLayer.offsetWidth;
}

vcc.getH = function(strLayer) {
    if (!(elmLayer=vcc.getObj(strLayer)))
        return false;
    if (window.getComputedStyle) {
        var style=getComputedStyle(elmLayer, null);
        return parseInt(style.getPropertyValue('height'));
    }
    else if (elmLayer.style.pixelHeight)
        return elmLayer.style.pixelHeight;
    else if(elmLayer.offsetHeight)
        return elmLayer.offsetHeight;
}

vcc.moveTo = function(strLayer, x, y, bRight) {
    if (!(elmLayer=vcc.getObj(strLayer)))
        return false;
    if (bRight) {
        if (x || x==0) elmLayer.style.right = x + "px";
    } 
    else {
        if (x || x==0) elmLayer.style.left = x + "px";
    }
    if (y || y==0) elmLayer.style.top = y + "px";
}

vcc.moveBy = function(strLayer, x, y, bRight) {
    vcc.moveTo(strLayer, vcc.getX(strLayer) + x, vcc.getY(strLayer) + y, bRight);
}

vcc.clip = function(strLayer,t,r,b,l) {
    if (!(elmLayer=vcc.getObj(strLayer)))
        return false;
    elmLayer.style.clip = "rect("+t+"px "+r+"px "+b+"px "+l+"px)";
}


vcc.preload = function(strName, strSrc, blnDoNotPreload) {
    if(blnDoNotPreload) eval(strName + " = new Object();");
    else eval(strName + " = new Image();");
    eval(strName+".src = '"+strSrc+"';");
}

vcc.createElement = function(strTagName, strId, objParent) {
    var objElement = document.createElement(strTagName);
    if (strId)
        objElement.id = strId;
    if (objParent)
        objParent.appendChild(objElement);
    return objElement;
}

vcc.setOpacity = function(strLayer, intValue) {
    if (!(objLayer=vcc.getObj(strLayer)))
        return false;
    if (vcc.ie)
        objLayer.style.filter = "alpha(opacity=" + intValue + ")";
    else if (vcc.w3c) {
        objLayer.style.MozOpacity = intValue/100;
    }
}

vcc.getDocumentWidth = function(blnContent) {
    var w;
    if (window.innerWidth) // Mozilla
        w = (blnContent) ? document.documentElement.offsetWidth : window.innerWidth
    else { // IE
        if (document.compatMode && document.compatMode != "BackCompat")
            w = (blnContent) ? document.documentElement.scrollWidth : document.documentElement.clientWidth;
        else
            w = (blnContent) ? document.body.scrollWidth : document.body.clientWidth;
    }
    return w;
}

vcc.getDocumentHeight = function(blnContent) {
    var h;
    if (window.innerHeight) // Mozilla
        h = (blnContent) ? document.documentElement.offsetHeight : window.innerHeight;
    else { // IE
        if (document.compatMode && document.compatMode != "BackCompat")
            h = (blnContent) ? document.documentElement.scrollHeight : document.documentElement.clientHeight;
        else
            h = (blnContent) ? document.body.scrollHeight : document.body.clientHeight;
    }
    return h;
}

vcc.addEvent = function(strLayer, strEvent, strFunction, bRemove) {
    if (!(elmLayer=vcc.getObj(strLayer)))
        return false;
    if (bRemove) {
        if (elmLayer.removeEventListener) {
            elmLayer.removeEventListener(strEvent, eval(strFunction), false);
        } else if (elmLayer.detachEvent) {
            elmLayer.detachEvent("on" + strEvent, eval(strFunction));
        }
    }
    else {
        if (elmLayer.addEventListener) {
            elmLayer.addEventListener(strEvent, eval(strFunction), false);
        } else if (elmLayer.attachEvent) {
            elmLayer.attachEvent("on" + strEvent, eval(strFunction));
        } else { // For browsers that don't have any of the addEventListener or attachEvent methods, we create a attachEvent method (NN4.x and IE 5.x on Mac)
            if (!eval("elmLayer.addedEventFunctions_" + strEvent))
                eval("elmLayer.addedEventFunctions_" + strEvent + " = ''");
            eval("elmLayer.addedEventFunctions_" + strEvent + " += '" + strFunction + "(); '");
            eval("elmLayer.on" + strEvent + " = new Function('" + eval("elmLayer.addedEventFunctions_" + strEvent) + "')");
        }
    }
}

vcc.getElementsByAttribute = function (strAttribute, strSearchValue, elmLayer, strTagName, bParentAxis, bPartialMatch) {
    strTagName = strTagName || "*";
    elmLayer = vcc.getObj(elmLayer) || document;
    var arElements = [];    
    if (bParentAxis) {
        // Look for parents
        while ((elmLayer = elmLayer.parentNode)) {
            var sAttrValue = elmLayer.getAttribute(strAttribute);
            if ((!strTagName || elmLayer.nodeName == strTagName) && 
                ((strAttribute == "class" && (elmLayer.className == strSearchValue || (bPartialMatch && elmLayer.className.indexOf(strSearchValue) > -1))) ||
                (strSearchValue && (elmLayer.getAttribute(strAttribute) == strSearchValue || (bPartialMatch && sAttrValue && sAttrValue.indexOf(strSearchValue) > -1))) || 
                (!strSearchValue && sAttrValue))) {
                    arElements.push(elmLayer);
            }
        }
    }
    else {
        // Look for children
        var arAllElements = elmLayer.getElementsByTagName(strTagName);
        var arElements = [];
        for (var i=0; i<arAllElements.length; i++) {
            var sAttrValue = arAllElements[i].getAttribute(strAttribute);
            if ((strAttribute == "class" && (arAllElements[i].className == strSearchValue || (bPartialMatch && arAllElements[i].className.indexOf(strSearchValue) > -1))) || 
                (strSearchValue && (sAttrValue == strSearchValue || (sAttrValue && sAttrValue.indexOf(strSearchValue) > -1))) ||
                (!strSearchValue && sAttrValue)) {
                    arElements.push(arAllElements[i]);
            }
        }
    }
    return arElements.slice(0);
}

vcc.elementGetElementsByName = function (strName, strTagName, elmLayer) {
    strTagName = strTagName || "*";
    elmLayer = elmLayer || document;
    var arAllElements = elmLayer.getElementsByTagName(strTagName);
    var arElements = [];
    for (var i=0; i<arAllElements.length; i++) {
        if (arAllElements[i].name == strName)
            arElements[arElements.length] = arAllElements[i];
    }
    return arElements.slice(0);
}

vcc.openWindow = function(strURL,strName,strOptions,bDoNotReturnWindow) {
    if (!strOptions) strOptions = "location=yes,resizable=yes,scrollbars=yes,status=yes,toolbar=yes,";
    else {
        //parse the strOptions variable to get width and height
        var arWidth = strOptions.match(/width=[0-9]+/i);
        var arHeight = strOptions.match(/height=[0-9]+/i);
        if (arWidth != null) {
            //Center window horizontally
            var intWidth = arWidth[0].substring(arWidth[0].lastIndexOf("=") + 1);
            var x = (screen.width - intWidth) / 2;
            x = (x<0) ? 0 : x
            strOptions += ",left=" + x;
        }
        if (arHeight != null) {
            //Center window vertically
            var intHeight = arHeight[0].substring(arHeight[0].lastIndexOf("=") + 1);
            var y = (screen.height - intHeight) / 2;
            y = (y<0) ? 0 : y
            strOptions += ",top=" + y;
        }
    }
    var popup = window.open(strURL,strName,strOptions);
    if (!bDoNotReturnWindow)
        return popup;
}

vcc.getQS = function(strWhich){
    var re = new RegExp( "[&\?]"+strWhich+"=([^&]*)&?", "i" );
    re.exec(window.location.href);
    return RegExp.$1;
}

vcc.setCookie = function(strName, strValue, objExpires, strPath) {
    var strCookie = strName + "=" + escape(strValue)
    if(objExpires) strCookie += ";expires=" + objExpires.toGMTString()
    if(strPath) strCookie += ";path=" + strPath
    document.cookie = strCookie
}

vcc.getCookie = function(strName) {
    var t=document.cookie.match(new RegExp(strName + "=([^;]*)"))
    return (t)?unescape(t[1]):t
}

vcc.delCookie = function(strName) {
    if (vcc.getCookie(strName)) document.cookie = strName + "=" + "; expires=Thu, 01-Jan-70 00:00:01 GMT"
}

if(!Array.prototype.push || [0].push(true)==true) {
    Array.prototype.push = function() {
        for(var i=0;i<arguments.length;i++){
            this[this.length]=arguments[i]
        };
        return this.length;
    }
}

String.prototype.trim = function(blnLeft, blnRight) {
    if(blnLeft) return this.replace(/^\s*/,'')
    else if(blnRight) return this.replace(/\s*$/,'')
    else return this.match(/^\s*([^\s]*)\s*$/)[1]
}

/// <summary>
/// Returns the first parent element with the specified nodeName
/// </summary>
/// <param name="strLayer">Id of the element whose parent you want to find.</param>
/// <param name="strParentNodeName">Name of the parent node.</param>
/// <param name="iDepth">Integer specifying number of levels to iterate before "giving up". Optional, default:15</param>
/// <returns>A HTML element</returns>
vcc.getParentNode = function(strLayer, strParentNodeName, iDepth) {
    var elmLayer = vcc.getObj(strLayer);
    if (!elmLayer)
        return;
    iDepth = iDepth || 15;
    elmTmpParent = elmLayer.parentNode;
    if (!elmTmpParent)
        return;
    for (var i=0; i<iDepth; i++) {
        if (elmTmpParent.nodeName == strParentNodeName.toUpperCase())
            return elmTmpParent;
        else
            elmTmpParent = elmTmpParent.parentNode;
    }
    return false;
}

/// <summary>
/// Searches through the document for an element with an id that contains a certian string. If there is a hit, the element is returned.
/// </summary>
/// <param name="strId">The partial id that should be used for the search</param>
/// <param name="strNodeName">If specified, only elements with this nodename is searched. (optional)</param>
/// <returns>An element.</returns>
vcc.getElementByIdFragment = function (strId, strNodeName) {
    strNodeName = strNodeName || "*";
    var arElements = document.getElementsByTagName(strNodeName);
    for (var i=0; i<arElements.length; i++) {
        if (arElements[i].id && arElements[i].id.indexOf(strId) > -1)
            return(arElements[i]);
    }
    return null;
}

vcc.printPage = function(objTargetFrame){
    if(window.print || (vcc.ie && vcc.win)){
        if(!objTargetFrame){
            if(window.print) window.print()
            else if(vcc.ie && !vcc.mac) vbPrintPage()
        }
        else{
            if(window.print && vcc.ie){
                objTargetFrame.focus()
                window.print()
            } 
            else if(window.print) objTargetFrame.print()
            else if(vcc.ie && !vcc.mac){
                objTargetFrame.focus()
                setTimeout("vbPrintPage()", 100)
            } 
        }
    }
}

if(vcc.ie && !window.print && !vcc.mac){
    with(document){
        writeln('<OBJECT ID="WB" WIDTH="0" HEIGHT="0" CLASSID="clsid:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>')
        writeln('<' + 'SCRIPT LANGUAGE="VBScript">')
        writeln('Sub window_onunload')
        writeln('  On Error Resume Next')
        writeln('  Set WB = nothing')
        writeln('End Sub')
        writeln('Sub vbPrintPage')
        writeln('  On Error Resume Next')
        writeln('  WB.ExecWB 6, 1')
        writeln('End Sub')
        writeln('<' + '/SCRIPT>')
    }
}


vcc.getStyle = function (strLayer, sStyle) {
    if (!(elmLayer=vcc.getObj(strLayer))) return false;
    if (elmLayer.currentStyle)
        return elmLayer.currentStyle[sStyle];
    else if (document.defaultView && document.defaultView.getComputedStyle) {
        var oCss = document.defaultView.getComputedStyle(elmLayer, "");
        if (oCss)
            return document.defaultView.getComputedStyle(elmLayer, "").getPropertyValue(sStyle);
    }
    else if (window.getComputedStyle)
        return getComputedStyle(elmLayer, "").getPropertyValue(sStyle);
    else if (elmLayer.style)
        return elmLayer.style[sStyle];
}

vcc.getDocScroll = function() {
    if (typeof window.pageXOffset != "undefined")
        return {x:window.pageXOffset, y:window.pageYOffset}
    else if (typeof window.scrollX != "undefined")
        return {x:window.scrollX, y:window.scrollY};
    else if (vcc.ie) {
        if (document.compatMode && document.compatMode == "CSS1Compat")
            return {x:document.body.parentNode.scrollLeft, y:document.body.parentNode.scrollTop};
        else
            return {x:document.body.scrollLeft, y:document.body.scrollTop};
    }
    return {x:0, y:0};
}

vcc.addCssRule = function(sSelector, sProperty) {
    if (!(vcc.ie && vcc.win)) {
        var arStyles = document.getElementsByTagName("style");
        if (arStyles && arStyles.length > 0 && document.createTextNode) {
            var oLastStyle = arStyles[arStyles.length - 1];
            var oRule = document.createTextNode(sSelector + " {" + sProperty + ";}");
            oLastStyle.appendChild(oRule);
        }
    }
    else if (document.styleSheets && document.styleSheets.length > 0) {
        var oLastStyle = document.styleSheets[document.styleSheets.length - 1];
        if (typeof oLastStyle.addRule == "object"){
            oLastStyle.addRule(sSelector, sProperty);
        }
    }
}

if (vcc.getQS("showerrors") == "true")
    vcc.setCookie("showerrors", "true", null, "/");
else if (vcc.getQS("showerrors") == "false")
    vcc.setCookie("showerrors", "false", null, "/");

vcc.showError = function(sError) {
    if (vcc.getCookie("showerrors") == "true" || vcc.getObj("controlpanel")) {
        var elmErrors = vcc.getObj("errors");
        if (!elmErrors) {
            elmErrors = document.createElement("div");
            document.body.appendChild(elmErrors);
            elmErrors.id = "errors";
            vcc.iErrors = 0;
        }
        elmErrors.innerHTML = "#" + vcc.iErrors + " " + sError + "<br/><br/>" + elmErrors.innerHTML;
        elmErrors.style.display = "block";
        vcc.setOpacity(elmErrors, 80);
        vcc.iErrors++;
    }
}

vcc.showBrowserTooOld = function(sLoadingDiv, sBrowserTooOld) {
    vcc.hide(sLoadingDiv);
    var elmOld = vcc.getObj("browserTooOld");
    elmOld.innerHTML = sBrowserTooOld;
    elmOld.style.display = "block";
}

vcc.appendUrlParam = function(sUrl, sName, sValue) {
    if (sUrl && sUrl.length > 0) {
        if (sUrl.indexOf("?") < 0)
            sUrl += "?";
        else
            sUrl += "&";
        sUrl += sName + "=" + escape(sValue);
    }
    return sUrl;
}


// This function now calls a wrapper function (vcc.trackEvent) instead of the supplied statistics function directly (dcsMultiTrack). This is because there are bugs in the externalinterface class (in IE at least) when sending empty strings as parameters.
vcc.trackEvent = function(sUrl, sTitle, sGroup, sSubGroup) {
    if (typeof dcsMultiTrack == "function") {
        sUrl = (sUrl == "[null]") ? "" : sUrl;
        sTitle = (sTitle == "[null]") ? "" : sTitle;
        sGroup = (sGroup == "[null]") ? "" : sGroup;
        sSubGroup = (sSubGroup == "[null]") ? "" : sSubGroup;
        dcsMultiTrack('DCS.dcsuri', sUrl, 'WT.ti', sTitle, 'WT.cg_n', sGroup, 'WT.cg_s', sSubGroup);
    }
}

// Browsercheck
var oBrowserCookie = vcc.getCookie("browserchecked"); 
if ((!document.getElementById || vcc.ns6) && (!oBrowserCookie || oBrowserCookie.length < 1)) {
    vcc.setCookie("browserchecked", "true", null, "/");
    location.href = "/oldbrowser.htm";
}


jsHover = function() {
var hEls = document.getElementById("nav0").getElementsByTagName("DIV");
for (var i=0, len=hEls.length; i<len; i++) {
  hEls[i].onmouseover=function() { this.className+=" jshover"; }
  hEls[i].onmouseout=function() { this.className=this.className.replace(" jshover", ""); }
}
}
if (window.attachEvent && navigator.userAgent.indexOf("Opera")==-1) window.attachEvent("onload", jsHover);


//my functions for popup
function questions()
{
NewWin=window.open("/questions_popup.php","qp","toolbar=0,status=0,scrollbars=0,width=665,height=457,menubar=0,location=0,directories=0,resizable=0"); 
}

