tabCount = 16;

function activateTab(h,i) {
    document.getElementById( "tab-body:"+h+":"+ i).style.display='block';
    document.getElementById( "tab-header-on:"+h+":"+ i).style.display='block';
    document.getElementById( "tab-header-off:"+h+":"+ i).style.display='none';
    
}

function deactivateTab(h,i) {
    document.getElementById( "tab-body:"+h+":"+ i).style.display='none';
    document.getElementById( "tab-header-off:"+h+":"+ i).style.display='block';
    document.getElementById( "tab-header-on:"+h+":"+ i).style.display='none';
}



function changeActiveTab(h,i) {
   for( j=0; j < tabCount; ++j ) {
        if( j==i ) {
            activateTab(h,j);
        } else {
            deactivateTab(h,j);
        }
    }
}

tabTopCount = 3;

function submitForm(formname) {
	document.forms[formname].submit();
}

function resetForm(formname) {
	document.forms[formname].reset();
}

function activateEditTab() {
    document.getElementById( "tab-top-body:edit").style.display='block';
    document.getElementById( "tab-top-body:view").style.display='none';
    document.getElementById( "tab-top-body:editicons").style.display='block';
    document.getElementById( "tab-top-body:viewicons").style.display='none';

}

function activateViewTab() {
    document.getElementById( "tab-top-body:edit").style.display='none';
    document.getElementById( "tab-top-body:view").style.display='block';
    document.getElementById( "tab-top-body:editicons").style.display='none';
    document.getElementById( "tab-top-body:viewicons").style.display='block';
}


function submitEditDetail(){
    document.editdetailform.submit();
}

function resetEditDetail(){
    document.editdetailform.reset();
}

function submitAccrual() {
    document.accrualfrm.submit();
}

function submitLinkDetail(){
    document.linkform.submit();
}

function resetLinkDetail(){
    document.linkform.reset();
}


/**
* basic picklist popup
* we always take away the header
*
*/
function  historyWindow(mylink) {
  document.body.style.cursor ="auto";
  window.open(mylink+'+popup=yes+header=no', 'history', 'width=600,height=700,dependent=yes,scrollbars=yes');
  return false;
}



/**
* basic edit popup control
*/
function createPopUp(mywindow, mylink) {
  document.body.style.cursor ="auto";
  window.open(mylink, mywindow,"width=900, height=500, resizable=yes, menu=no,dependent=yes,scrollbars=yes");
  
}

function confirmSubmit()
{
var agree=confirm("Are you sure you wish to continue?");
  if (agree) {
    return true ; 
  } else {
    return false;
  }
}


function setupWindow(){
  Tooltip.init();
}

function popupEditMessages() {

    var i = document.URL.indexOf("EDIT.ERROR");
    if (i > -1) {
        var newWin = window.open(document.URL.substring(0,i), "subWindow","height=500,width=700,resizable=yes,scrollbars=yes");
    }
}

function goBack() {
   window.back();
}

function closeWindow() {
   window.close ();
}
