﻿function loadBoxTitle(skinName, titleVar, movName, divName) {
    var fo = new FlashObject("/Files/Assets/" + skinName + "/box_title.swf", movName, "130", "80", "8", "#ffffff"); 
    fo.addParam("FlashVars", "titleVar=" + titleVar);
    fo.write(divName);
}
var totalDailyBox = 0;
var dailyBoxToShow = 0;
var skinName = '';
function displayDailyBox(id) {
    dailyBoxToShow = id;
    document.getElementById('divDailyLeftLoader').style.display = 'block';
    document.getElementById('divDailyMiddleLoader').style.display = 'block';
    document.getElementById('divDailyRightLoader').style.display = 'block';
    for (var i=1; i <= totalDailyBox; i++) {
        document.getElementById('tblDailyLeft_' + i).style.display = 'none';
        document.getElementById('tblDailyMiddle_' + i).style.display = 'none';
        document.getElementById('tblDailyRight_' + i).style.display = 'none';
        var className = skinName + '_table_cell';
        if (id == i) {
            className = skinName + '_table_cell_h';
            document.getElementById('tblDailyLeftTable_' + i).onclick = null;
            document.getElementById('tblDailyLeftTable_' + i).onmouseover = null;
            document.getElementById('tblDailyLeftTable_' + i).onmouseout = null;
            document.getElementById('tblDailyMiddleTable_' + i).onclick = null;
            document.getElementById('tblDailyMiddleTable_' + i).onmouseover = null;
            document.getElementById('tblDailyMiddleTable_' + i).onmouseout = null;
            document.getElementById('tblDailyRightTable_' + i).onclick = null;
            document.getElementById('tblDailyRightTable_' + i).onmouseover = null;
            document.getElementById('tblDailyRightTable_' + i).onmouseout = null;
        } else {
            document.getElementById('tblDailyLeftTable_' + i).onclick = function() { displayDailyBox(parseInt(this.id.substring(18))); };
            document.getElementById('tblDailyLeftTable_' + i).onmouseover = function() { this.className = skinName + '_table_cell_h'; };
            document.getElementById('tblDailyLeftTable_' + i).onmouseout = function() { this.className = skinName + '_table_cell'; } ;
            document.getElementById('tblDailyMiddleTable_' + i).onclick = function() { displayDailyBox(parseInt(this.id.substring(20))); }
            document.getElementById('tblDailyMiddleTable_' + i).onmouseover = function() { this.className = skinName + '_table_cell_h'; };
            document.getElementById('tblDailyMiddleTable_' + i).onmouseout = function() { this.className = skinName + '_table_cell'; } ;
            document.getElementById('tblDailyRightTable_' + i).onclick = function() { displayDailyBox(parseInt(this.id.substring(19))); }
            document.getElementById('tblDailyRightTable_' + i).onmouseover = function() { this.className = skinName + '_table_cell_h'; };
            document.getElementById('tblDailyRightTable_' + i).onmouseout = function() { this.className = skinName + '_table_cell'; } ;
        }
        document.getElementById('tblDailyLeftTable_' + i).className = className;
        document.getElementById('tblDailyMiddleTable_' + i).className = className;
        document.getElementById('tblDailyRightTable_' + i).className = className;
    }
    var timeout = window.setTimeout('displayDailyBoxFinish()', 500);
}
function displayDailyBoxFinish() {
    document.getElementById('divDailyLeftLoader').style.display = 'none';
    document.getElementById('divDailyMiddleLoader').style.display = 'none';
    document.getElementById('divDailyRightLoader').style.display = 'none';
    for (var i=1; i <= totalDailyBox; i++) {
        if (dailyBoxToShow == i) {
            var display = 'block';
            document.getElementById('tblDailyLeft_' + i).style.display = display;
            document.getElementById('tblDailyMiddle_' + i).style.display = display;
            document.getElementById('tblDailyRight_' + i).style.display = display;
            break;
        }
    }
}
function setFlashSize(newW, newH) {
    var obj = document.getElementById('divMain');
    if (obj != null) {
        obj.style.width = newW + "px";
        obj.style.height = newH + "px";
    }
}
function canResizeFlash(){
    var ua = navigator.userAgent.toLowerCase();
    var opera = ua.indexOf("opera");
    if( document.getElementById ){
        if(opera == -1) return true;
        else if(parseInt(ua.substr(opera+6, 1)) >= 7) return true;
    }
    return false;
}
function mainObj_DoFSCommand(command, args) {
    var arrSize = args.split(',');
	if (command == "setsize") { setFlashSize(arrSize[0], arrSize[1]); }
}
if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) { document.write('<' + 'SCRIPT LANGUAGE=VBScript\> \n'); document.write('on error resume next \n'); document.write('Sub mainObj_FSCommand(ByVal command, ByVal args)\n'); document.write('  call mainObj_DoFSCommand(command, args)\n'); document.write('end sub\n'); document.write('</' + 'SCRIPT> \n'); }
function sliderObj_DoFSCommand(command, args) {
	if (command == "setcalendar") { setCalendar(args); }
}
if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) { document.write('<' + 'SCRIPT LANGUAGE=VBScript\> \n'); document.write('on error resume next \n'); document.write('Sub sliderObj_FSCommand(ByVal command, ByVal args)\n'); document.write('  call sliderObj_DoFSCommand(command, args)\n'); document.write('end sub\n'); document.write('</' + 'SCRIPT> \n'); }

var moz = false;
var ie = false;
function setCalendar(d) {
    document.getElementById('divCalendarContent').innerHTML = '<img src=\'/Files/Image/ajax-loader.gif\' width=\'32\' height=\'32\' alt=\'\' style=\'border: none\' align=\'absmiddle\' />';
    if (document.implementation && document.implementation.createDocument) {
	    moz = true;
	    xmlDoc = document.implementation.createDocument("", "", null);
	    xmlDoc.onload = setCalendarContent;
    } else if (window.ActiveXObject) {
	    ie = true;
	    xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
	    xmlDoc.onreadystatechange = function () {if (xmlDoc.readyState == 4) setCalendarContent()};
    } else {
	    alert('Your browser can\'t handle this script');
	    return;
    }
    xmlDoc.load("/Main.aspx?operation=calendar&d=" + d);
}
function setCalendarContent() {
    var timeout = window.setTimeout('setCalendarContentFinish()', 500);
}
function setCalendarContentFinish() {
    var x = xmlDoc.getElementsByTagName('content');
	if (moz){
	    document.getElementById('divCalendarContent').innerHTML = x[0].childNodes[1].nodeValue;
	} else if(ie && x.length > 0) {
		if (x[0].childNodes[0].text != '')
			document.getElementById('divCalendarContent').innerHTML = x[0].childNodes[0].text;
	}
}
function toggle(obj) {
    var obj = document.getElementById(obj);
    if (obj != null) {
        if (obj.style.display == 'none')
            obj.style.display = 'block';
        else
            obj.style.display = 'none';
    }
}
function toggleMultiple(hide, show) {
    var hides = hide.split(',');
    for (var i=0; i < hides.length; i++) {
        var obj = document.getElementById(hides[i]);
        if (obj != null) obj.style.display = 'none';
    }
    var shows = show.split(',');
    for (var i=0; i < shows.length; i++) {
        var obj = document.getElementById(shows[i]);
        if (obj != null) obj.style.display = 'block';
    }
}
function myVideo() {
window.open('/popup.aspx', 'Video', 'status=0,toolbar=0,menubar=0,resizable=0,scrollbars=0,height=539,width=540')
}
