ActivePad = 0;
    OpenPad = null;
    BluePad = null;
    speedx = 10; speedy = 10;
    var menuy = 0; var menux = 0;
    function insertFiller(add) {
        if (document.all && document.all["content_panel"] && document.body.offsetHeight) {
            document.write('<img align="right" src="images/site_graphics/empty.gif" alt="" width="1" height="');
            document.write(document.body.offsetHeight - document.all["content_panel"].offsetTop - 69 + add);
            document.writeln('">');
        }
    }
    function pageLoad() {
        // Table-less design causes problem when content stretches.
        // This function stretches the shorter column to match the longer.
        if (!document.all) return; // MSIE
        L = document.all.content;
        R = document.all.rightcontent;
        if (L.offsetHeight > R.offsetHeight) R.style.height = "" + L.offsetHeight + "px";
        if (L.offsetHeight < R.offsetHeight) L.style.height = "" + R.offsetHeight + "px";
    }
    function setBluePad(nId) {

        // Called by pages in main frame as they are loaded (except 1st)
        document.getElementById('menupad' + BluePad).getElementsByTagName('div')[0].style.backgroundImage = 'url(images/site_graphics/buttons/main_menu_black.gif)';
        document.getElementById('menupad' + BluePad).getElementsByTagName('div')[0].name = 'url(images/site_graphics/buttons/main_menu_black.gif)';
        BluePad = nId;
//alert(nId);
        document.getElementById('menupad' + BluePad).getElementsByTagName('div')[0].style.backgroundImage = 'url(images/site_graphics/buttons/main_menu_blue.gif)';
        document.getElementById('menupad' + BluePad).getElementsByTagName('div')[0].name = 'url(images/site_graphics/buttons/main_menu_blue.gif)';
    }
    function setTopImage(src) {
        document.getElementById('top_image').src = src;
    }
    function insertMenu(nId) {
        // Creates a new menu pad.
        if (menux == 0) { img = "blue"; BluePad = nId; } else img = "black";
        document.write('<div style="position:absolute;z-index:15;top:' + getNextMenuY() + ';right:' + getNextMenuX() + ';" ');
        document.writeln('class="switchable" id="menupad' + nId + '">');
        document.write('<div style="width:134px; height:18px;');
        document.write("background-image:url(images/site_graphics/buttons/main_menu_");
        document.write(img);
        document.write('.gif);background-repeat:no-repeat;text-align:left;">');
    }
    function findSwitchableAncestor(srcElement) {
        // Called in a onclick handler. Returns null if event object not present or click was outside any menu pad.
        //if (event == null) return null;
        oMenu = srcElement;
        while (oMenu.className != 'switchable') {
            if (oMenu.parentNode == null) return null;
            oMenu = oMenu.parentNode;
        }
        return oMenu;
    }
    function document_OnClick(srcElement) {
        //	if (event.srcElement.tagName == 'a' && event.srcElement.target == 'main') {alert('link');return;}
        window.parent.frames[0].menuShow(srcElement);
    }
    function menuShow(srcElement) {
        // Make sure the correct pad is expanded and collapsed. Called in response to click anywhere.
        oMenu = findSwitchableAncestor(srcElement);
        if (oMenu == OpenPad && oMenu != null) {
            menuSwitch(oMenu, false);
            oMenu = OpenPad = null;
        }
        if (oMenu != null) menuSwitch(oMenu, true);
        if (OpenPad != null) menuSwitch(OpenPad, false);
        OpenPad = oMenu;
    }

    function menuSwitch(oMenu, bShow) {
        // The actual hiding and showing and color-changing of the menu pads.
        children = oMenu.getElementsByTagName('div');
        oMenu.style.zIndex = bShow ? 20 : 15;
        imageurl = bShow ? "url(images/site_graphics/buttons/main_menu_blue.gif)" : children[0].name;
        children[0].name = children[0].style.backgroundImage;
        display = bShow ? "block" : "none";
        children[0].style.backgroundImage = imageurl;
        children[1].style.display = display;
    }

    function getNextMenuY() {
        // Called by insertMenu() - side effect: increases global var menuy 
        return "" + (86 + menuy++ * 28) + "px";
    }
    function getNextMenuX() {
        // Called by insertMenu() - side effect: increases global var menux


        x = 0;
        switch (menux) {
            case 0:
            case 6:
                //x = 26;
                break;
            case 1:
            case 5:
                //x = 14;
                break;
            case 4:
                //x = 3;
            case 2:
                //x = 4;
                break;
        }
        menux++;

        //if(document.all) x += 582 + document.all['center_panel'].offsetLeft;
        //x += 582;
	x = 41;
        return "" + (x) + "px";
    }

    function redoMenuLayout() {
        menuy = 0; menux = 0;
        j = 0;
        divs = document.getElementsByTagName('div');
        for (i = 0; i < divs.length; i++) {
            if (divs[i].className == 'switchable') {
                divs[i].style.top = getNextMenuY();
                divs[i].style.right = getNextMenuX();
            }
        }
    }
    function setLanguage(lang, mainurl) {
        document.cookie = "SMLanguage=" + lang + ";";
        self.location.reload();
        //	if(mainurl != null) parent.main.location = mainurl;
        parent.main.location.reload();
    }

    var a;
    function faqReadMore(id) {
        a = window.open(null, null, "left=20,top=50,height=20,width=490,menubar=no,location=no,toolbar=no,scrollbars=yes");
        a.document.write(document.forms['ansform' + id].answer.value);
        a.document.close();
    }
    function ValidateForm(FormName, ReqFieldList, ErrorMessage) {
        ReqFields = ReqFieldList.split(";");
        MissingFields = "";
        j = 0;
        for (i = 0; i < ReqFields.length; i++) {
            field = ReqFields[i].split(",")[0];
            if (document.forms[FormName].elements[field].value == '') MissingFields += "\n" + ReqFields[i].split(",")[1].split("*")[0];
        }
        if (MissingFields.length > 0) alert(ErrorMessage + MissingFields);
        return MissingFields.length == 0;
    }

    var startPageBg = new Image();
    var startPageBgService = new Image();


    function makePuffheight() {

        var myTd = document.getElementById("puffCol");
        var myServiceTd = document.getElementById("ServicePuff");

        myTd.height = startPageBg.height;
        myServiceTd.height = startPageBgService.height;

        return false;
    }

