var currentFocus = "";
var counter = 0;

function isVisible(name) {
    document.poppedLayer =  eval('document.getElementById(name)');
     
    return ( document.poppedLayer.style.display != "none");
    
}

function showIfNotVisible(item, constraint)
{
if (!isVisible(constraint))
    show2(item);
}

function isSelected(constraint) 
{
    return ( currentFocus == constraint);
}

function setCurrentFocus(item)
{
    currentFocus = item;
}

function hideIfNotSelected(item, constraint)
{
if (!isSelected(constraint))
    hide2(item);
}

function showIfNotSelected(item, constraint)
{
if (!isSelected(constraint))
    show2(item);
}

function showIfNotSelected(item, constraint1, constraint2)
{

if (!isSelected(constraint1) && !isSelected(constraint2))
    show2(item);
}


function ifTextShowClear(textbox, clearbutton)
{
     document.poppedLayer = 
        eval('document.getElementById(textbox)');
        
 if (document.poppedLayer != null)
 {
    if (document.poppedLayer.value.length != 0)
         show2(clearbutton);
         }
}

function hide2(name) {
  document.poppedLayer = 
        eval('document.getElementById(name)');
   
   if (document.poppedLayer != null)
        document.poppedLayer.style.display = "none";
}

function show2(name) {
     document.poppedLayer = 
        eval('document.getElementById(name)');
      
      if (document.poppedLayer != null)
        document.poppedLayer.style.display = "inline";
}


function FocusOnInserterItem(name)
{
 

 document.poppedLayer = eval('document.getElementById(name)');
  
 if (document.poppedLayer != null)
 {
    document.poppedLayer.focus();
    window.scrollBy(0,150);
 }
}

