// JavaScript Document

var popUpWin=0;
function popup(URLStr, left, top, width, height, scrollflag, toolbar, resize)
{
  if (scrollflag == null) {
	  scrollflag = 'no';
  }
  
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, 'popUpWin', 'toolbar='+toolbar+',location=no,directories=no,status=no,menubar=no,scrollbars='+scrollflag+',resizable='+resize+',copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

function refreshMenu() {
	window.parent.leftFrame.location.reload();
}

function changeLanguage(lang) {
	document.langform.lang.value = lang;
	document.langform.submit();
}

function returnObjById( id )
{
    if (document.getElementById)
        var returnVar = document.getElementById(id);
    else if (document.all)
        var returnVar = document.all[id];
    else if (document.layers)
        var returnVar = document.layers[id];
    return returnVar;
}

function showdiv(name) {
	
	div = returnObjById(name);
	if (div.style.visibility == 'hidden') {
		div.style.visibility = 'visible';
	} else {
		div.style.visibility = 'hidden';
	}
} 

function closediv(e, name) {
	
	div = returnObjById(name);
	
	var element;
	
	if (window.event){
		element = window.event.srcElement;
	}else if (e){
		element = e.target;
	}
	
	if (!e) var e = window.event;
	if (e.target){
		element = e.target;	} else {
		element = window.event.srcElement;
	}
	
	tagtype = element.tagName;
	
	if (div.style.visibility != 'hidden' && tagtype != 'A') {
		div.style.visibility = 'hidden';
	}
	
} 

function submitenter(myfield,e)
{
var keycode;
if (window.event) keycode = window.event.keyCode;
else if (e) keycode = e.which;
else return true;

if (keycode == 13)
   {
   myfield.form.submit();
   return false;
   }
else
   return true;
}

function mouseclicked(myfield,e)
{
if (myfield.value.length > 0)
   {
   myfield.value = "";
   myfield.focus();
   return false;
   }
else
   return true;
}


function setIframeHeight(iframeName) {
  //var iframeWin = window.frames[iframeName];
  var iframeEl = document.getElementById? document.getElementById(iframeName): document.all? document.all[iframeName]: null;
  if (iframeEl) {
  iframeEl.style.height = "auto"; // helps resize (for some) if new doc shorter than previous
  //var docHt = getDocHeight(iframeWin.document);
  // need to add to height to be sure it will all show
  var h = alertSize();
  var new_h = (h-148);
  iframeEl.style.height = new_h + "px";
  //alertSize();
  }
}

function alertSize() {
  var myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
	//Non-IE
	myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	//IE 6+ in 'standards compliant mode'
	myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
	//IE 4 compatible
	myHeight = document.body.clientHeight;
  }
  //window.alert( 'Height = ' + myHeight );
  return myHeight;
}

