function showEditWindow(src,wname,w,h,s,st,f)
{
	if (src=="#") return
	else
	{
		w = w ? w : 600; 
		h = h ? h : 500;
		s = s ? s : "yes";
		st = st ? st : "yes";
		f = f ? f : "no";
		wname = wname ? wname : "newWin"+(Math.floor(Math.random()*100000));
		var winl = (screen.width - w) / 2;
		var wint = (screen.height / 2) - h;
		winprops = "Fullscreen="+f+",height="+h+",width="+w+",top="+wint+",left="+winl+
		           "toolbar=no,status="+st+",scrollbars="+s+",location=no,menubar=no,directories=no,resizable";
		window.open(src,wname,winprops);
		
	}
}

var allchecked;

function checkAll( theForm) 
{
  if (allchecked) { allchecked = false; }
    else { allchecked = true; }
  for (var i=0;i<theForm.elements.length;i++)
  {
    var e = theForm.elements[i];
      e.checked = allchecked;
  }

}

function setSc(v)
{
	if (v) document.body.scrollTop=v;
}
function writeSc(frm)
{
	obj=eval("document.forms."+frm);
	if (obj) obj.scroll_value.value=document.body.scrollTop;
}

function showEditWindow(src,wname,w,h,s,st,f)
{
	if (src=="#") return
	else
	{
		w = w ? w : 600; 
		h = h ? h : 500;
		s = s ? s : "yes";
		st = st ? st : "yes";
		f = f ? f : "no";
		wname = wname ? wname : "newWin"+(Math.floor(Math.random()*100000));
		var winl = (screen.width - w) / 2;
		var wint = (screen.height / 2) - h;
		winprops = "Fullscreen="+f+",height="+h+",width="+w+",top="+wint+",left="+winl+
		           "toolbar=no,status="+st+",scrollbars="+s+",location=no,menubar=no,directories=no,resizable";
		window.open(src,wname,winprops);
	}
}

var allchecked;

function checkAll( theForm) {
  if (allchecked) { allchecked = false; }
    else { allchecked = true; }
  for (var i=0;i<theForm.elements.length;i++)
  {
    var e = theForm.elements[i];
      e.checked = allchecked;
  }

}

function setSc(v)
{
	if (v) document.body.scrollTop=v;
}
function writeSc(frm)
{
	obj=eval("document.forms."+frm);
	if (obj) obj.scroll_value.value=document.body.scrollTop;
}
function setFree(obj, string)
{
        if (obj.value == string) obj.value="";
}
function setDef(obj, string)
{
        if (obj.value == "") obj.value=string;
}

// calculate the current window width //
function pageWidth() {
  return window.innerWidth != null ? window.innerWidth : document.documentElement && document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body != null ? document.body.clientWidth : null;
}

// calculate the current window height //
function pageHeight() {
  return window.innerHeight != null? window.innerHeight : document.documentElement && document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body != null? document.body.clientHeight : null;
}

// calculate the current window vertical offset //
function topPosition() {
  return typeof window.pageYOffset != 'undefined' ? window.pageYOffset : document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ? document.body.scrollTop : 0;
}

// calculate the position starting at the left of the window //
function leftPosition() {
  return typeof window.pageXOffset != 'undefined' ? window.pageXOffset : document.documentElement && document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ? document.body.scrollLeft : 0;
}

var TIMER = 5;
var SPEED = 10;

function showPointInfo()
{
    dialog = document.getElementById('pointinformation');
/*    dialogmask = document.getElementById('dialog-mask');*/
/*    dialogmask.style.visibility = "visible";*/
    dialog.style.display = "block";
    dialog.style.opacity = .00;
    dialog.style.filter = 'alpha(opacity=0)';
    dialog.alpha = 0;
    var width = pageWidth();
    var height = pageHeight();
    var left = leftPosition();
    var top = topPosition();
    var dialogwidth = dialog.offsetWidth;
    var dialogheight = dialog.offsetHeight;
    var topposition = top + (height / 3) - (dialogheight / 2);
    var leftposition = left + (width / 2) - (dialogwidth / 2);
    dialog.style.top = topposition + "px";
    dialog.style.left = leftposition + "px";
    dialog.style.visibility = "visible";
    dialog.timer = setInterval("fadeDialog(1)", TIMER);
}

function hidePointInfo()
{
  var dialog = document.getElementById('pointinformation');
  clearInterval(dialog.timer);
  dialog.timer = setInterval("fadeDialog(0)", TIMER);
}

function fadeDialog(flag) {
  if(flag == null) {
    flag = 1;
  }
  var dialog = document.getElementById('pointinformation');
  var value;
  if(flag == 1) {
    value = dialog.alpha + SPEED;
  } else {
    value = dialog.alpha - SPEED;
  }
  dialog.alpha = value;
  dialog.style.opacity = (value / 100);
  dialog.style.filter = 'alpha(opacity=' + value + ')';
  if(value >= 99) {
    clearInterval(dialog.timer);
    dialog.timer = null;
  } else if(value <= 1) {
    dialog.style.display = "none";
/*    document.getElementById('dialog-mask').style.visibility = "hidden";*/
    clearInterval(dialog.timer);
  }
}

