var cm=null;
//document.onclick = new Function("show(null)")
var t;

//var store_sel=new Image();
//var store_img=new Image();
var store_className;

function initialise(){
}
function Deselect(Element){
	if(!selectedID)return;
	if(Element==selectedID)return;
	Element.className=store_className;
	
	switch(Element.id){
		case 'td8':
		case 'td9':
			break;
		case 'td4':
			if(selectedID.id.substring(0, 3)=='td4')return;
		default:
			var re=/_over\.gif/;
			var imageName=document.images[Element.id+'img'].src;
			imageName=imageName.replace(re, '.gif');
			//document.images[Element.id+'img'].src=store_sel.src;
			document.images[Element.id+'img'].src=imageName;
	}
}
function Select(Element){
	//if(Element==selectedID)return;
	if(!selectedID)return;
	store_className=Element.className;
	Element.className='over';
	switch(Element.id){
		case 'td8':
		case 'td9':
			break;
		case 'td4':
		default:
			//store_sel.src=document.images[Element.id+'img'].src;
			var re=/_over\.gif/;
			//var imageName=store_sel.src;
			var imageName=document.images[Element.id+'img'].src;
			imageName=imageName.replace(re, '.gif');
			re=/\.gif/;
			imageName=imageName.replace(re, '_over.gif');
			document.images[Element.id+'img'].src=imageName;
	}
}

function initialise(){
}
function isEmail(string){
	return (string.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1);
}
function isTelephone(element) {
    if(element=='') return false;
	return true;
	
    var ValidChars = "0123456789()- +";
    var ReturnThis = true;
    var i 

    for (i=0; i < element.length; i++) {
		if (ValidChars.indexOf(element.charAt(i)) == -1) {
	       ReturnThis = false;
        }
    }
    if (ReturnThis == false) {
        alert("Please enter a valid Telephone Number.");
    }
    return ReturnThis;
}

function show(m,el,x,y) 
{
	document.title='menu '+el;
	var oElement = document.getElementById(m);
	if (oElement) 
	{
		document.title+=', FOUND';
		oElement.style.display='block';
		clearTimeout(t);
		document.title+=', Finding '+el;
		oElement.style.left = getPos(document.getElementById(el),"Left") + x + 'px';
		oElement.style.top = getPos(document.getElementById(el),"Top") + y + 'px';
	}
	else document.title+=', NOT FOUND';
	if ((oElement!=cm) && (cm)) cm.style.display='none'
	cm=oElement
}

function getPos(el,sProp) 
{
	var iPos = 0
	if(el)document.title+=', Found '+el.tagName;
	while (el!=null) 
	{
		iPos+=el["offset" + sProp]
		el = el.offsetParent
	//document.title+=', '+sProp+'='+iPos;
	}
	return iPos
}

function hideMain()
{
  //document.title='';
  t = setTimeout("show()", 200)  
}   

function hide(num)
{
	var oElement = document.getElementById(num);
	if(oElement)
	{
		oElement.style.display = 'none';
	}
	//document.title='';
}
function DL_GetElementLeft(eElement)
{
   if (!eElement && this)                    // if argument is invalid
   {                                         // (not specified, is null or is 0)
      eElement = this;                       // and function is a method
   }                                         // identify the element as the method owner

   var DL_bIE = document.all ? true : false; // initialize var to identify IE

   var nLeftPos = eElement.offsetLeft;       // initialize var to store calculations
   var eParElement = eElement.offsetParent;  // identify first offset parent element

   while (eParElement != null)
   {                                         // move up through element hierarchy

      if(DL_bIE)                             // if browser is IE, then...
      {
         if( (eParElement.tagName != "TABLE") && (eParElement.tagName != "BODY") )
         {                                   // if parent is not a table or the body, then...
            nLeftPos += eParElement.clientLeft; // append cell border width to calcs
         }
      }
      else                                   // if browser is Gecko, then...
      {
         if(eParElement.tagName == "TABLE")  // if parent is a table, then...
         {                                   // get its border as a number
            var nParBorder = parseInt(eParElement.border);
            if(isNaN(nParBorder))            // if no valid border attribute, then...
            {                                // check the table's frame attribute
               var nParFrame = eParElement.getAttribute('frame');
               if(nParFrame != null)         // if frame has ANY value, then...
               {
                  nLeftPos += 1;             // append one pixel to counter
               }
            }
            else if(nParBorder > 0)          // if a border width is specified, then...
            {
               nLeftPos += nParBorder;       // append the border width to counter
            }
         }
      }
      nLeftPos += eParElement.offsetLeft;    // append left offset of parent
      eParElement = eParElement.offsetParent; // and move up the element hierarchy
   }                                         // until no more offset parents exist
   return nLeftPos;                          // return the number calculated
}

function DL_GetElementTop(eElement)
{
   if (!eElement && this)                    // if argument is invalid
   {                                         // (not specified, is null or is 0)
      eElement = this;                       // and function is a method
   }                                         // identify the element as the method owner

   var DL_bIE = document.all ? true : false; // initialize var to identify IE

   var nTopPos = eElement.offsetTop;         // initialize var to store calculations
   var eParElement = eElement.offsetParent;  // identify first offset parent element

   while (eParElement != null)
   {                                         // move up through element hierarchy
      if(DL_bIE)                             // if browser is IE, then...
      {
         if( (eParElement.tagName != "TABLE") && (eParElement.tagName != "BODY") )
         {                                   // if parent a table cell, then...
            nTopPos += eParElement.clientTop; // append cell border width to calcs
         }
      }
      else                                   // if browser is Gecko, then...
      {
         if(eParElement.tagName == "TABLE")  // if parent is a table, then...
         {                                   // get its border as a number
            var nParBorder = parseInt(eParElement.border);
            if(isNaN(nParBorder))            // if no valid border attribute, then...
            {                                // check the table's frame attribute
               var nParFrame = eParElement.getAttribute('frame');
               if(nParFrame != null)         // if frame has ANY value, then...
               {
                  nTopPos += 1;              // append one pixel to counter
               }
            }
            else if(nParBorder > 0)          // if a border width is specified, then...
            {
               nTopPos += nParBorder;        // append the border width to counter
            }
         }
      }

      nTopPos += eParElement.offsetTop;      // append top offset of parent
      eParElement = eParElement.offsetParent; // and move up the element hierarchy
   }                                         // until no more offset parents exist
   return nTopPos;                           // return the number calculated
}

