﻿
var swithchBtnHMax = 38;
var swithchBtnHMin = 17;


function swithcBtnOver(fx_btn) {  
    switchBtnOVerDown(fx_btn);
}

var swithTimeOut

function switchBtnOVerDown(fx_id) {

    clearTimeout(swithTimeOut);

    var fx_btn = document.getElementById(fx_id);
    
    if (cnxAjaxXinfo=='index') {
    
        if (fx_id=='switchbtn_community') {
            document.getElementById('switchbtn_store').style.height='17px'
        }
        if (fx_id=='switchbtn_store') {
            document.getElementById('switchbtn_community').style.height='17px'
        }
    
    }
    
    var curh = fx_btn.style.height;
    
    if ((curh=='') || (curh==null)) {
        curh = '17';
    }        
    
    curh = curh.replace('px', '')
    
    curh = curh.valueOf();    
    
    curh = curh * 1
    
    //alert(curh);
    
    if (curh >= swithchBtnHMax) {
        fx_btn.style.height = swithchBtnHMax + 'px';
    } else {
        fx_btn.style.height = (curh + 4) + 'px';
        swithTimeOut = setTimeout('switchBtnOVerDown(\'' + fx_id + '\')', 25)
    }
    
}

function swithcBtnOut(fx_btn) {  
    switchBtnOutUp(fx_btn);
}



function switchBtnOutUp(fx_id) {

    clearTimeout(swithTimeOut);

    var fx_btn = document.getElementById(fx_id);
    
    fx_btn.style.height = '17px';

}






function tbappg(fx_title, fx_app, fx_params, fx_form) {    
    var var_postdata = '';
    var var_modal = '';
    
    
    if (fx_params.indexOf('modal=true')>=0) {
        var_modal = '&modal=true'
    }
    if (fx_title!='x') {
        tb_show(fx_title,'#TB_inline?height=320&width=500&inlineId=tbapploading' + var_modal)
        if (fx_params=='') {
            fx_params = 'p=s'
        }
    }        
    if (fx_form!='') {
        if (document.getElementById(fx_form)!=null) {
            var_postdata = formData2QueryString(document.getElementById(fx_form))
        }            
    }
    ajaxgetdata('/site/web/tb/' + fx_app + '/ajax_app.cnx?' + fx_params, var_postdata, 'TB_ajaxContent','TB_ajaxContent', 1);
}





//===================================================================
// SIFR
//===================================================================

if(typeof sIFR == 'function'){
    sIFR.replaceElement('div.aboutmentop', named({sFlashSrc: '/graphics/sifr/fango.swf', sColor: '#F25F19', sBgColor: '#000000', sWmode: 'opaque'}));
    sIFR.replaceElement('div.aboutmentopwhite', named({sFlashSrc: '/graphics/sifr/fango.swf', sColor: '#FFFFFF', sBgColor: '#000000', sWmode: 'opaque'}));
};




//===================================================================
// Session Timeout
//===================================================================

var sotInNext = 1000 * 60 * 20;
// var sotInNext = 1000 * 10;
var sotTimer;
var sotTimerConfirm;

function sotSet() {
    sotTimer = setTimeout('sotConfirmGone()', sotInNext)
}


function sotConfirmGone() {
    sotTimerConfirm = setTimeout('sotSignout()',1000*20);
    tbappg('Session Timeout', 'sot', 'modal=true', '');
    
}

function sotKeep() {
    ajaxgetdata('/ctl/mods/keepalive.cnx?rnd=' + Math.random(), '', '', '', 1);
    tb_remove();
    sotReset();
}

function sotSignout() {
    window.location='/index.htm?sessionlogout=true&cnx_tpage=info&info=account&sot=show'
}

function sotReset() {
    clearTimeout(sotTimerConfirm);
    clearTimeout(sotTimer);
    sotSet();
}

sotSet();