function popupWin(theURL,winName,winW,winH,status,resizable,scrollbars) {
	try{
		if(status=="" || status==null){
			status="yes";
		}
		if(resizable=="" || resizable==null){
			resizable="yes";
		}
		if(scrollbars=="" | scrollbars==null){
			scrollbars="yes";
		}
		var x_coord = (screen.width - winW) / 2;
		var y_coord = (screen.height - winH) / 2;
		var winProps = "height="+winH+",width="+winW+",scrollbars=" + scrollbars + ",resizable=" + resizable + ",status=" + status;
		Win = window.open(theURL,winName,winProps);
		Win.window.moveTo(x_coord, y_coord);
	}catch(error){
		//alert(error);
	}
	try{
		//alert('focus');
		Win.window.focus(); 
	}catch(error){
		//alert(error);
	}
}

function MM_jumpMenu(selObj,restore){ //v3.0
  eval("window.location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function rowCol(theBox,theID,rowStyle) {
	//alert(theBox + theID  + rowStyle);
	row = document.getElementById(theID);
	
	if(theBox.checked == true) {
		row.className = rowStyle+'press';
	} else {
		row.className = rowStyle;
	}
	
}

function lightrowCol(theID,rowStyle) {
	//alert(theID  + rowStyle);
	row = document.getElementById(theID);
	row.className = rowStyle+'press';

}

function rolloverMainLinks(theId,theImg) {

	var navbar = document.getElementById(theId);
	
	if(navbar.style.display == "none") {
		navbar.style.display = "";
		document[theImg].src = "images/arrow_down.gif";
	} else {
		navbar.style.display = "none";
		document[theImg].src = "images/arrow_right.gif";
	}
}

function rolloverSubLinks(theId,theImg,theAction) {

	var navbar = document.getElementById(theId);
	
	if(navbar.style.display == "none") {
		navbar.style.display = "";
		if(theAction == 'end') {
			document[theImg].src = "images/tree_node_minus_end.gif";
		} else {
			document[theImg].src = "images/tree_node_minus.gif";
		}
	} else {
		navbar.style.display = "none";
		if(theAction == 'end') {
			document[theImg].src = "images/tree_node_plus_end.gif";
		} else {
			document[theImg].src = "images/tree_node_plus.gif";
		}
	}
}
function navHeight() {
	winHeight = document.all?document.body.clientHeight:window.innerHeight;
	newWinHeight = winHeight - 55;
	navCell = document.getElementById('navHeight');
	navCell.height = newWinHeight;
	//alert(winHeight);
}

function editCheck(rowName,checkBox,rowStyle) {

	row = document.getElementById(rowName);
	rowCheckBox = document.getElementById(checkBox);
	
	row.className = rowStyle+'press';
	rowCheckBox.checked = true;
	
}

function highlightCol(theBox,theID,rowStyle) {
	row = document.getElementById(theID);
	row.className = rowStyle+'press';
}

function checkAnyChecked(checkBox,ids) {
	vids = ids.split(',');
	for(i=0;i<vids.length;i++){
		if(vids[i]!=""){
			checkBox2 = checkBox + "[" + vids[i] + "]";
			//alert(checkBox2);
			oCheckBox = document.getElementById(checkBox2);
			if(oCheckBox.checked==true){
				//alert ("any checked!");
				return true;
			}
		}
	}
	alert ("There are not selected items!");
	return false;
}


//usage example: <a class="blackLink" href="#javascript" onClick="checkAll('modify_probe','<? echo $ids;?>','row_probe_',2);">[x]</a>
var checkAllStatus = new Array();
var rowStyle = 'col';
function checkAll(checkBox,ids,rowname,id) {
	if(checkAllStatus[id]==false || checkAllStatus[id]==undefined){
		checkAllStatus[id] = true;
	}else{
		checkAllStatus[id] = false;
	}
	//alert(checkAllStatus[id]);
	vids = ids.split(',');

	for(i=0;i<vids.length;i++){
		if(vids[i]!=""){
			checkBox2 = checkBox + "[" + vids[i] + "]";
			oCheckBox = document.getElementById(checkBox2);
			
			if(checkAllStatus[id]==true){
				if(rowname!="" && oCheckBox.checked == false){
					rowname2 = rowname + vids[i];
					row = document.getElementById(rowname2);
					if(rowStyle=='nocol'){
						rowStyle = 'col';
					}else{
						rowStyle = 'nocol';
					}
					row.className = rowStyle+'press';
				}
				oCheckBox.checked=true;
			}else{
				if(rowname!="" && oCheckBox.checked == true){
					rowname2 = rowname + vids[i];
					row = document.getElementById(rowname2);
					if(rowStyle=='nocol'){
						rowStyle = 'col';
					}else{
						rowStyle = 'nocol';
					}
					row.className = rowStyle;
				}
				oCheckBox.checked=false;
			}
			
		}
	}
}


function decision(message, url){
	if(confirm(message)) location.href = url;
}

function decision2(message){
	if(confirm(message)) return true;
}

function doClear(theText) {
	if (theText.value == theText.defaultValue) {
		theText.value = "";
	}
}
function confirmAction(buttonVal) {
	var check = confirm("Are you sure you want to "+buttonVal.value+"?");
	if(check == true) {
		return true;
	} else {
		return false;
	}
}
function confirmActionWithText(text) {
	var check = confirm("Are you sure you want to "+text+"?");
	if(check == true) {
		return true;
	} else {
		return false;
	}
}

///////////////////////////////////////////////////////////////net.js , CONTENT LOADER FOR AJAX

///////////////////////////////////////////////////////////////FUNCTIONS FOR SHOWING / HIDING SCROLLBARS
var scrollbars = false;

function noScrollIE(){
	document.body.scroll="no";
	scrollbars=false;
}

function scrollIE(){
	document.body.scroll="yes";
	scrollbars=true;
}

function noScrollNS(){
	edivmainbody=document.getElementById("divmainbody");
	edivmainbody.style.overflow="hidden";
	scrollbars=false;
}

function scrollNS(){
	edivmainbody=document.getElementById("divmainbody");
	edivmainbody.style.overflow="";
	scrollbars=true;
}

function removeScrollBars(){
	var browser;
	var browser2=navigator.appName;
	
	if (browser2=="Microsoft Internet Explorer"){
		//alert(1111);
		noScrollIE();
	}else{ //NO IE
		//alert(2222);
		noScrollNS();
	}

}
///////////////////////////////////////////////////////////////END - FUNCTIONS FOR SHOWING / HIDING SCROLLBARS



/* namespacing object */
var net=new Object();

net.READY_STATE_UNINITIALIZED=0;
net.READY_STATE_LOADING=1;
net.READY_STATE_LOADED=2;
net.READY_STATE_INTERACTIVE=3;
net.READY_STATE_COMPLETE=4;


/*--- content loader object for cross-browser requests ---*/
net.ContentLoader=function(url,onload,onerror,method,params,contentType){
  this.req=null;
  this.onload=onload;
  this.onerror=(onerror) ? onerror : this.defaultError;
  this.loadXMLDoc(url,method,params,contentType);
}

net.ContentLoader.prototype.loadXMLDoc=function(url,method,params,contentType){
  if (!method){
    method="GET";
  }
  if (!contentType && method=="POST"){
    contentType='application/x-www-form-urlencoded';
  }
  if (window.XMLHttpRequest){
    this.req=new XMLHttpRequest();
  } else if (window.ActiveXObject){
    this.req=new ActiveXObject("Microsoft.XMLHTTP");
  }
  if (this.req){
    try{
      var loader=this;
      this.req.onreadystatechange=function(){
        net.ContentLoader.onReadyState.call(loader);
      }
      this.req.open(method,url,true);
      if (contentType){
        this.req.setRequestHeader('Content-Type', contentType);
      }
      this.req.send(params);
    }catch (err){
      this.onerror.call(this);
    }
  }
}


net.ContentLoader.onReadyState=function(){
  var req=this.req;
  var ready=req.readyState;
  if (ready==net.READY_STATE_COMPLETE){
    var httpStatus=req.status;
    if (httpStatus==200 || httpStatus==0){
      this.onload.call(this);
    }else{
      this.onerror.call(this);
    }
  }
}

net.ContentLoader.prototype.defaultError=function(){
  alert("error fetching data!"
    +"\n\nreadyState:"+this.req.readyState
    +"\nstatus: "+this.req.status
    +"\nheaders: "+this.req.getAllResponseHeaders());
}
///////////////////////////////////////////////////////////////END net.js , CONTENT LOADER FOR AJAX
function login2() {
    login_done_called  = false;
    login_hosts_count = 0;
    for(i=0; i<login_hosts.length; i++) {
        //f2=top.loginframe2;
        //framename="loginframe_" + login_hosts[i];
        f2 = top.frames[i];
        //f2=document.getElementById(framename);
        form2=f2.document.getElementById("loginForm");
        u=f2.document.getElementById("username");
        p=f2.document.getElementById("password");
        u.value = document.getElementById("username").value;
        p.value = document.getElementById("password").value;
        form2.submit();
        //alert("submitted host " + login_hosts[i]);
    }
    timerID  = setTimeout("loginTimeout()", 5000);
    return false;
}
function isDefined(variable) {
    return (!(!( variable||false )))
}
function GetCookie(sName)
{
  // cookies are separated by semicolons
  var aCookie = document.cookie.split("; ");
  for (var i=0; i < aCookie.length; i++)
  {
    // a name/value pair (a crumb) is separated by an equal sign
    var aCrumb = aCookie[i].split("=");
    if (sName == aCrumb[0]) 
        return unescape(aCrumb[1]);
    }
  // a cookie with the requested name does not exist
  return null;
}
