function ShowPopup(hoveritem){
hp = document.getElementById("hoverpopup");

// Set position of hover-over popup
  var coors = findPos(hoveritem);

  hp.style.top = coors[1] + 18 + 'px';
  hp.style.left = coors[0] + 20 + 'px';

//hp.style.top = hoveritem.offsetTop + 18;
//hp.style.left = hoveritem.offsetLeft + 20;

// Set popup to visible
hp.style.visibility = "Visible";
}

function HidePopup(){
hp = document.getElementById("hoverpopup");
hp.style.visibility = "Hidden";
document.getElementById("txtHint").innerHTML="";
}

function findPos(obj) {
  var curleft = curtop = 0;
  if (obj.offsetParent) {
    curleft = obj.offsetLeft
    curtop = obj.offsetTop
    while (obj = obj.offsetParent) {
      curleft += obj.offsetLeft
      curtop += obj.offsetTop
    }
  }
  return [curleft,curtop];
}

var xmlHttp

function ShowHelp(str)
{ 
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="help.php";
url=url+"?q="+str;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function stateChanged() 
{ 
if (xmlHttp.readyState==4)
{ 
document.getElementById("txtHint").innerHTML=xmlHttp.responseText;
}
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}

function tesforuniqueness(str)
{ 
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="help_testslugs.php";
url=url+"?u="+str;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChanged2;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function stateChanged2()
{ 
if (xmlHttp.readyState==4)
{ 
    if(xmlHttp.responseText!=="0")
    {
    var message;
    message=xmlHttp.responseText;
        alert(message+"\n\n");
        create_channel.channel_slug.focus();
        return false;
    }
    return true;
}
}