﻿// JScript File

    function showOrder(OrderID,OrderList){
        window.open("OrderView.aspx?InvoiceNumber=" + OrderID + "&OrderList=" + OrderList,"_blank","height=480,width=340,scrollbars=1");
        return;
    }
    
    function toggleElementVisible(element) {
        var displayValue = isIE() ? "inline" : "table-row";
        
        if (element.style.display == displayValue){
            element.style.display = "none";        
            /*if (window.event.srcElement.innerText == '-'){
                window.event.srcElement.innerText = '+'
            }*/
        }else{
            element.style.display = displayValue;
            /*if (window.event.srcElement.innerText == '+'){
                window.event.srcElement.innerText = '-'
            }*/
        }               
        
        return;        
    }
    
    function showElement(element){
        element.style.display="inline";
        return;
    }

    function hideElement(element){
        element.style.display="none";
        return;
    }  
    
    function managePassword(){
        window.open("ManagePassword.aspx","_blank","height=260,width=340,scrollbars=0");
        return;
    }
    
    function printBagTag(autoPrint,sourceID,clientAccountID,changeAccountRequestID,windowHeight,windowWidth){
        //sourceID - 0 = SPOTWEBSTAGE DATA, 1 = SPOT
        window.open("PrintBagTag.aspx?AutoPrint=" + autoPrint + "&SourceID=" + sourceID + "&ClientAccountID=" + clientAccountID + "&ChangeAccountRequestNumber=" + changeAccountRequestID,"_blank","height=" + windowHeight + ",width=" + windowWidth + ",scrollbars=0");
        return;
    }
    
    
       
    function showLength(textControl,displayControl,maxLength){  
        try{
            var elDisp = document.getElementById(displayControl);
            var elTxt = textControl;
            
            elDisp.innerText = elTxt.value.length.toString() + '/' + maxLength.toString();
            
            if (elTxt.value.length > maxLength){
                elDisp.style.color='red';
            }else{
                elDisp.style.color='black';
            }
            return;
        }catch(err){
        }
        
    }
    
    function findControl(suffix){
        var el;
        var mes;
        
        for (i = 0; i < document.forms[0].elements.length; i++) {
            mes += document.forms[0].elements[i].id + '\n';
            if (document.forms[0].elements[i].id.indexOf(suffix) >= 0) {
                el = document.forms[0].elements[i];
                break;
            }
        }
               
        return el;
    }
    
    function isIE() {
        return document.all != undefined;
    }
