﻿// JScript File
var objectIDPrefix;
objectIDPrefix = "";



function fnProcessContent(objTDid,processType,ATabColor,CTabColor)
{
    objectIDPrefix = fnGetLatestID(objTDid);
   
    CallBackPage = objectIDPrefix.replace("_",":")
    CallBackPage = CallBackPage.replace("_",":")
    if(CallBackPage.indexOf("_") != -1)
    {
        CallBackPage = CallBackPage.substring(0,CallBackPage.indexOf("_"));
    }

    WebForm_DoCallback(CallBackPage,processType,fnResult,null,fnError,true);
    
    fnSetTabStyles(objTDid,ATabColor,CTabColor);    
}

function fnSetTabStyles(objTDid,ATabColor,CTabColor)
{
    if(objectIDPrefix == "")
    {
       objectIDPrefix = fnGetLatestID(objTDid)
    }
    totalTDs = document.getElementById(objectIDPrefix+"_trTextHTMLMenu").cells.length;
    var StartTabIndex = 0;
    while(StartTabIndex < (totalTDs - 1))
    {
        
        var CellId;
        CellId = "";
        CellId = eval('document.getElementById("'+objectIDPrefix+'_trTextHTMLMenu").cells['+StartTabIndex+'].id');
        document.getElementById(CellId).style.fontFamily = "Arial";
        document.getElementById(CellId).style.fontSize = "11px";
        document.getElementById(CellId).style.cursor = "pointer";
        if(objTDid == CellId)
        {
             document.getElementById(CellId).style.backgroundColor = ATabColor;
             document.getElementById(CellId).style.borderColor = "#ae0000";
        }
        else
        {
            document.getElementById(CellId).style.backgroundColor = CTabColor;
        }
        StartTabIndex = StartTabIndex + 1;
    }
}

function fnStartScript(ModulePrefix,Acolor,Ccolor)
{
	
    objectIDPrefix = ModulePrefix;
}


function fnGetLatestID(sCtlId)
{
    
	strId = new String(sCtlId);
	
	lstInd = strId.lastIndexOf("_");
	
	strId = strId.substring(0,lstInd);
	
	return strId;
}
		

function fnResult(result)
{
    
    try
    {
   
        document.getElementById(objectIDPrefix + "_lblContent").style.display = "block";
        
        document.getElementById(objectIDPrefix + "_lblContent").innerHTML =  result;
    
     }
     catch(ex)
     {
        
     }
     
}


function fnError(result)
{
    alert(result);
}



