
var KMAXHEIGHT = 100;
var KOPENNING = 2;
var KCLOSING = 1;
var KNONE = 0;
var iStatus=0;
var KTIMEOUT = 1;
var KCHANGINGHEIGHT = 2;

function OpenTab(id){

iCloseTabChecker=1;
if(iStatus==KCLOSING)
	return;

     var strUrl = "";
     var strDivId;
 
 switch(id){
    case 1:
     //objContainer.style.backgroundColor="#ff0000";
     strUrl  = "/getlocalblock.aspx?app=documents&page=document&docParId=0&docId=11593";
     strDivId = "divMainScrolling";
     document.getElementById("divMainScrolling2").style.display = "none";
     break;
    case 2:
     //objContainer.style.backgroundColor="#00ff00";
     strUrl  = "/getlocalblock.aspx?app=documents&page=document&docParId=0&docId=11592";
     strDivId = "divMainScrolling";
     document.getElementById("divMainScrolling2").style.display = "none";
     break;
    case 3:
     //objContainer.style.backgroundColor="#0000ff";
     strUrl  = "/getlocalblock.aspx?app=documents&page=document&docParId=0&docId=11591";
     strDivId = "divMainScrolling";
     document.getElementById("divMainScrolling2").style.display = "none";
     break;
    case 4:
     //objContainer.style.backgroundColor="#333333";
     strUrl  = "/getlocalblock.aspx?app=documents&page=document&docParId=0&docId=11596";
     strDivId = "divMainScrolling2";
     document.getElementById("divMainScrolling").style.display = "none";
     break;
    case 5:
     //objContainer.style.backgroundColor="#000000";
     strUrl  = "/getlocalblock.aspx?app=documents&page=document&docParId=0&docId=11595";
     strDivId = "divMainScrolling2";
     document.getElementById("divMainScrolling").style.display = "none";
     break;
    case 6:
     //objContainer.style.backgroundColor="#efefef";
     strUrl  = "/getlocalblock.aspx?app=documents&page=document&docParId=0&docId=11594";
     strDivId = "divMainScrolling2";
     document.getElementById("divMainScrolling").style.display = "none";
     break;
  }

     document.getElementById(strDivId).style.display = "block";
     CheckIsTabOpened(strDivId);
     LoadPage(strUrl,strDivId);
}

function CloseTab(){
    if(iStatus==KNONE){
	var objContainer = document.getElementById("divMainScrolling");
	TapCloserAPI(objContainer.id);

	var objContainer2 = document.getElementById("divMainScrolling2");
	TapCloserAPI(objContainer2.id);
    }
}

function CheckIsTabOpened(divId){
    var objContainer = document.getElementById(divId);
    if(iStatus==KNONE && objContainer.style.display!="block"){
	TapOpenerAPI(divId);
    }
}

var iFade=100;
function TapCloserAPI(divId){
  var objContainer = document.getElementById(divId);

   var iCurrentHeight = objContainer.style.height.replace("px","") - 0;
   objContainer.innerHTML = "";
   if(iCurrentHeight > 0){
	objContainer.style.height = iCurrentHeight - KCHANGINGHEIGHT;
	if(iCurrentHeight==KCHANGINGHEIGHT){
	    objContainer.style.display = "none";
	}
	iStatus = KCLOSING;
	setTimeout("TapCloserAPI('"+divId+"')",KTIMEOUT);
   }else{
	iStatus = KNONE;
   }
}

function TapOpenerAPI(divId){
   var objContainer = document.getElementById(divId);

   var iCurrentHeight = objContainer.style.height.replace("px","") - 0;
   if(iCurrentHeight < KMAXHEIGHT){
	objContainer.style.height = iCurrentHeight + KCHANGINGHEIGHT;
	KCHANGINGHEIGHT++;
	objContainer.style.display = "block";
	iStatus = KOPENNING;
	setTimeout("TapOpenerAPI('"+divId+"')",KTIMEOUT);
   }else{
	KCHANGINGHEIGHT = 1;
	iStatus = KNONE;
   }
}

var iCloseTabChecker=1;
function LogOutTab(){
	if(iCloseTabChecker==0){
		CloseTab();
		iCloseTabChecker = 1;
	}
	setTimeout("LogOutTab()",2000);
}
LogOutTab();

function SwitchClickableTab(tabId){
	document.getElementById("tabClickable1").className = "tab-headerdown";
	document.getElementById("tabClickable2").className = "tab-headerdown";
	document.getElementById("tabClickable3").className = "tab-headerdown";
	document.getElementById("tabClickable4").className = "tab-headerdown";

	document.getElementById("tabClickable"+tabId).className = "tab-headerup";

	var strUrl = "";
 	switch(tabId){
  	  case 1:
  	   strUrl = "/getlocalblock.aspx?app=documents&page=document&docParId=0&docId=11587";
  	   break;
  	  case 2:
  	   strUrl = "/getlocalblock.aspx?app=documents&page=document&docParId=0&docId=11588";
  	   break;
  	  case 3:
  	   strUrl = "/getlocalblock.aspx?app=documents&page=document&docParId=0&docId=11589";
  	   break;
  	  case 4:
   	   strUrl = "/getlocalblock.aspx?app=documents&page=document&docParId=0&docId=11590";
   	   break;
  	}
	LoadPage(strUrl,"divTabClickingContent");
} 


function OnLoadInits(){
	SwitchClickableTab(1);

}

