﻿/*------------------------------------------------------------------------------
//  Warning : This computer program is protected by copying law and international treaties.
//  unauthorized reproduction program or any portion of it will be prosecuted to the maximum extent possible under law .
//  Forbidding : Redistribution of this code, whole or in part, as source code  or in binary form, alone or 
//  as part of a larger distribution or product, is forbidden for any commercial or for-profit or Non-commercial
//  use without the author's explicit written permission.
//  Author : email:ruihade@hotmail.com , ruihade@gmail.com ,location: taiwan, cellphone:0919910435
//  date:2007/11/27
//<script language="javascript" src="..\App_Js\masterint.js"></script>
-----------------------------------------------------------------------------*/
var tabstrips = "RedhotTab"
var tabheads = "RedTabStrip"
function InitializeTabstrip(id_name, index, obj) {
    try {
        var i = 1;
        var na = document.getElementById(id_name + '_' + i);
        while (na != null) {
            na.style.display = 'none';
            i++;
            na = document.getElementById(id_name + '_' + i);
        }
        ApplyStyles();
        na = document.getElementById(id_name + '_' + index);
        if (index != undefined && na != null) {
            na.style.display = 'block';
            na = document.getElementById(id_name + 'State');
            if (na != null) na.value = index;
        }
        if (obj != null) {
            obj.parentElement.className = "SelectedTab";
        }
    }
    catch (e) {
        alert('RedhotSoft: ' + e.message);
    }
}
function LoadTabsDef() {
    InitializeTabstrip(tabstrips, 1);
    SelectTab(1, 1);
}
function Clear() {
    var na = document.getElementById('maintab1');
    if (na) {
        na.style.display = 'block';
        na.visible = true;
        for (index = 2; index < 4; index++) {
            na = document.getElementById('RedhotTab_' + index);
            if (na != null) {
                na.style.display = 'none';
                na.visible = false;
            }
        }
    } 
}
function LoadTabstrip() {
    try {

        var tabstrips_Arr = tabstrips.split(",");
        var na;
        for (index = 0; index < tabstrips_Arr.length; index++) {
            na = document.getElementById(tabstrips_Arr[index] + 'State')
            if (na != null) {
                var position = na.value;
                if (position != "") {
                    InitializeTabstrip(tabstrips_Arr[index], parseInt(position));
                    SelectTab(index, parseInt(position));
                }
                else
                    InitializeTabstrip(tabstrips_Arr[index]);
            }
        }
    }
    catch (e) { alert('RedhotSoft: ' + e.message); }
}


function ApplyStyles() {
try{
    var tabheads_Arr = tabheads.split(",")
    for (index = 0; index < tabheads_Arr.length; index++) {
      var tbl = document.getElementById(tabheads_Arr[index]);
      if (tbl)
      {
        tbl.className = "Tabs";
        for (rowno = 0; rowno < tbl.rows.length; rowno++) {
            for (colno = 0; colno < tbl.rows[rowno].cells.length; colno++) {
                tbl.rows[rowno].cells[colno].className = "Tab";
            }
        }
      }
    }
    }
 catch (e) { alert('RedhotSoft: ' + e.message); }  
}

function SelectTab(tblno, colno) {
try{
    tblno--;
    colno--;
    var tabheads_Arr = tabheads.split(",");
    var tbl = document.getElementById(tabheads_Arr[tblno]);
    if (tbl) tbl.rows[0].cells[colno].className = "SelectedTab";
    }
    catch (e) { alert('RedhotSoft: ' + e.message); }
}
function Restore(querystring) {
    try {
        var tabstrips_Arr = querystring.split(",");
        for (index = 0; index < tabstrips_Arr.length; index++) {
            var ctl = tabstrips_Arr[index].split(":")

            if (ctl.length == 1)
                InitializeTabstrip(ctl[0]);
            else {
                InitializeTabstrip(ctl[0], parseInt(ctl[1]));
                SelectTab(index, parseInt(ctl[1]));
            }
        }
    }
    catch (e) { alert('RedhotSoft: ' + e.message); }
}    