/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

function goLite(FRM,BTN)
{
    window.document.forms[FRM].elements[BTN].style.backgroundColor = "#FF7777";
    window.document.forms[FRM].elements[BTN].style.cursor='default';
}

function goDim(FRM,BTN)
{
    window.document.forms[FRM].elements[BTN].style.backgroundColor = "#EE7777";
}

Ext.ActionMessages = function(){
    var msgCt;
    return {
        showMsg : function(mes_context){
           
            if(!msgCt){
                msgCt = Ext.DomHelper.insertFirst(document.body, {id:'msg-div'}, true);
            }
            msgCt.alignTo(document, 't');
            var m = Ext.DomHelper.append(msgCt, {html:mes_context}, true);
            m.addListener('click',function(){msgCt.ghost("t", {remove:true});  } );
            m.slideIn('t');
        }
    };
}();

Ext.decodeEx = function(s) {
    if(navigator.userAgent.toLowerCase().indexOf("firefox") > -1) {
        var a=new Function("return "+ s);
        return a();
    }else {
        return eval("(" + s + ')');
    }
}

// for Ajax session timeout.
Ext.Ajax.on('requestcomplete',function(conn,response,options){
    if (typeof response.getResponseHeader != 'undefined'){
        if(typeof response.getResponseHeader.sessionstatus != 'undefined'){
          window.parent.location.href = response.responseText;
          options.success = null;
      }
    }
}, this);
   
var aBgColor = ["#F3F3F3","#FFFFFF","#dff2ec"];
//set the table rows color
function addTableListener(o)
{
       
    for (var i=0;i<o.rows.length ;i++ )
    {   
        if(i%2 != 0){
            o.rows[i].style.backgroundColor = aBgColor[0] ;
        }else{
            o.rows[i].style.backgroundColor = aBgColor[1];
        }
        o.rows[i].onmouseover = function(){setTrBgColor(this,true)}
        o.rows[i].onmouseout = function(){setTrBgColor(this,false)}
    }
}

function setTrBgColor(oTr,b)
{
    if(b){
        oTr.style.backgroundColor = aBgColor[2];
    }else{
        if(oTr.rowIndex % 2 != 0){
            oTr.style.backgroundColor = aBgColor[0];
        }else{
            oTr.style.backgroundColor = aBgColor[1];
        }}
        
}

function formatTextTip(value) {
	return value == null ? '' : ('<div class="over-flow:hidden" ext:qtip="' + value + '">' + value + '</div>');
}


function showWaiting(title, msg, text,iconCls){
    Ext.MessageBox.show({
        title:title,
        msg: msg,
        progressText: text,
        waitConfig: {
            interval:100
        },
        width:300,
        height:50,
        wait:true,
        icon:iconCls//custom class in msg-box.html
    });
}

function hideWaiting(){
    Ext.MessageBox.hide();
}
