﻿//
// chat
//
var _iTabIdx = 0; 
var _divPage0 = "#divPage0";
var _divPage1 = "#divPage1";  


//
// init
//
$(document).ready(function() {

    // tabs
    $(".tabHorz a").click(function() {
        $(".tabHorz a").removeClass("tabFocus");
        $(this).addClass("tabFocus");
        return bcChangeTab($(this).attr("rel"));
    });

    // set current tabs + store state in hidden field
    $(".tabHorz a[rel='" + _iTabIdx + "']").addClass("tabFocus");
    
    // val from cookie is not default=0? switch panel.
    if (_iTabIdx > 0) bcChangeTab(_iTabIdx); 
    
});


//
// change tab
//
function bcChangeTab(iIdx) {
    switch (iIdx) {
        case "1":
            {
                $(_divPage0).hide();
                $(_divPage1).show();
                break;
            }
        default:
            {
                iIdx = "0";
                $(_divPage0).show();
                $(_divPage1).hide();
            }
    }        
    return false;
}


//
// open chat
//
function bcOpenBiggerChat() {
	var iBrowserVer = parseInt(navigator.appVersion);
	var iWidth  = 620;
	var iHeight = 480;
	var iLefPos = 0;
	var iTopPos = 0;
	if (iBrowserVer > 3) {
		iLefPos = (screen.width) ? (screen.width-iWidth)/2 : 0;
		iTopPos = (screen.height) ? (screen.height-iHeight)/2 : 0;
	}
	var oWin=window.open("../chat/rooms.aspx","BCCHATROOMS","top="+ iTopPos+",left="+ iLefPos +",resizable=yes,height=" + iHeight + ",width=" + iWidth);
	oWin.focus();
	return false;	
}