
var _w = null;
var _nw;

function createNew() {
  _w = window.open();
  _w.document.open();
  _w.document.write('<html><head><title>New Window</title></head><body>');
  _w.document.write('<a href="javascript:window.close()">Close Window!</a>');
  _w.document.write('</body></html>');
  _w.document.close();
}


/* Function: popWindow
 * -------------------
 * Generic popup window function, can be called from pretty much anywhere.
 * opens a popup window with passed in url, height, width, and name.  The
 * popup window should open centered on the computer screen.
 *
 */

function popWindow(url, name, width, height) {
	var x = (screen.width - width)/2;
	var y = (screen.height - height)/2;
	var opts = 'height=' + height + ',width=' + width + ",screenX=" + x + ",left=" + x + ",screenY=" + y + ",top=" + y + ',location=no,scrollbars=yes,menubar=no,resizable=no,status=no,toolbar=no';
	//var opts = "height=" + height + ",width=" + width + ",scrollbars=yes,menubar=no,resizable=yes,status=no,toolbar=no";
	_nw = window.open(url, name, opts);
	_nw.focus();

}

//popWindow for graphs

function graphWindow(url) {
 popWindow(url, null, screen.width-200, screen.height-200);
}




//confim before deleting

function confirmSubmit(data, msg)
{
var agree=confirm("Are you sure you want to delete " + data + " ?\n " + msg);
if (agree)
	return true ;
else
	return false ;
}


function confirmMsg(msg)
{
var agree=confirm(msg);
if (agree)
	return true ;
else
	return false ;
}


//------------------------
//change colors of TAB
//------------------------
function changeTabColor(tabNo, tabColor) {

	  //document.write('tabNo=' + tabNo);
	  //document.write('tabColor=' + tabColor);
    var tab = document.getElementById('tab_'+ tabNo);
    //var vLink = document.getElementById('tabLink_'+ tabNo);
    tab.style.bgcolor = tabColor;
    //tab.style.background-color = tabColor;
    //tab.style.display='none';
    return true;
}



//------------------------
//change colors of TAB
//------------------------
function showTab(tabNo) {

	  //document.write('tabNo=' + tabNo);
    var tabNormal = document.getElementById('tab_'+ tabNo + '_normal');
    var tabSelected = document.getElementById('tab_'+ tabNo + '_selected');

    tabNormal.style.display='none';
    tabSelected.style.display='';
    return true;
}


function hideTab(tabNo) {

	  //document.write('tabNo=' + tabNo);
    var tabNormal = document.getElementById('tab_'+ tabNo + '_normal');
    var tabSelected = document.getElementById('tab_'+ tabNo + '_selected');

    tabSelected.style.display='none';
    tabNormal.style.display='';
    return true;
}


//hide a div
function hideDiv(id) {
    var divSelected = document.getElementById(id);
    divSelected.style.display='none';
    divSelected.style.zindex=3000;
    //return false;
}


//show a div
function showDiv(id) {
    var divSelected = document.getElementById(id);
    divSelected.style.display='';
    //return false;
}


//toggle a div
function toggleDiv(id) {
    var divSelected = document.getElementById(id);
    
    if( divSelected.style.display == '') {  //hide it
	    divSelected.style.display='none';
	    divSelected.style.zindex=3000;
    }
    else {  //show it
        divSelected.style.display='';  
    }
    
    //return false;
}



function toggleTabDiv(tabNo) {

	  //document.write('tabNo=' + tabNo);
    var tabNormal = document.getElementById('tab_'+ tabNo + '_normal');
    var tabSelected = document.getElementById('tab_'+ tabNo + '_selected');

    tabNormal.style.display='none';
    tabSelected.style.display='';
    return true;
}


function showMessage1(rev) {
    if (r) {
        r.style.display='none'
    }
    //document.write('rev=' + rev);
    r = document.getElementById('rev_'+rev)
    r.style.display=''
    return true
}


function hideMessage() {
    if (r) {
        r.style.display='none'
        return true
    }
    return false
}



var tabNames = new Array(3);
var tabIds = new Array(3);

tabNames[0]='tab0';
tabNames[1]='tab1';
tabNames[2]='tab2';
tabIds[0]='0';
tabIds[1]='1';
tabIds[2]='2';


function fnTabClick( nTab )
{ 
  var oTab;

  //unselect all tabs 
  for (var i = 0; i < tabIds.length; i++) {
    eval("oTab = tabs"+tabIds[i]);
    oTab.className = "clsTab";
  }

  eval("tabs"+nTab+".className = 'clsTabSelected'");
	return true;
}




function fnTabClick1( nTab )
{ 

	//document.write('nTab = ' + nTab);
  nTab = parseInt(nTab);
  var oTab;

  //unselect all tabs 
  for (var i = 0; i < tabIds.length; i++) {
    eval("oTab = tabs"+tabIds[i]);
    oTab.className = "clsTab";
    //oTab.style.borderLeftStyle = "";
    //oTab.style.borderRightStyle = "";
  }


  //document.search.selected_tab.value = nTab;
  //eval("searchContent_"+nTab+".style.display = 'block'");
  eval("tabs"+nTab+".className = 'clsTabSelected'");
	

	return true;
}

