<!-- //

function showhide(id){
if (document.getElementById){
obj = document.getElementById(id);
if (obj.style.display == "none"){
obj.style.display = "";
} else {
obj.style.display = "none";
}
}
}

function tagsStatus(who){
var objValue
objValue=who.textContent;
if (objValue=="Show Tags")
   {who.textContent="Hide Tags";}
   else
   {who.textContent="Show Tags";};
   };

// Change Item of Menu
function menuswitch(who,button_state)
   {
   classvalue = 'menuButton';
   if (button_state) 
     {
       classvalue = 'menuButtonOver';
     };
     who.className = classvalue;
   };   


/// On Menu Click
function menuClick(who)
{
  var aObj = who.firstChild;
  if (aObj.click)
  {
    aObj.click();
  }
  else 
  {
    document.location.href = aObj.href;
  };
};
   
function imgRollOver(who,img_src) {
who.firstChild.src=img_src;
}
   
   
//  -->

var n;

var menu_obj = null;
var menu_sub_obj = null;

var objTop;
var objLeft;
var objWidth;
var objHeight;

var subObjWidth = 0;
var subObjHeight = 0;

function getLeft(el){
xPos = el.offsetLeft;
tempEl = el.offsetParent;
while (tempEl != null) {
xPos += tempEl.offsetLeft;
tempEl = tempEl.offsetParent;
}
return xPos;
}

function getTop(el){
yPos = el.offsetTop;
tempEl = el.offsetParent;
while (tempEl != null) {
yPos += tempEl.offsetTop;
tempEl = tempEl.offsetParent;
}

return yPos;
}

/// On Menu Over
function mOver(obj, msId)
{
  if (!(menu_obj === obj))
  {
    MenuSwitchOff();
  };
  menu_obj = obj;

  var cn = obj.className;
  ////if (!((cn == 'mItemThis')||(cn == 'mItemThisUp'))) {obj.className = 'mItemUp';}  else {obj.className = 'mItemThisUp';};

  ///Size
  objTop = getTop(obj);
  //objTop2 = objTop-ScrollTop;
  objLeft = getLeft(obj);
  objWidth = obj.offsetWidth;
  objHeight = obj.offsetHeight;

  ShowSubMenu(obj, msId);
}


function ShowSubMenu(obj, msId)
{
  var cObj = obj.childNodes.item(0);

  if (msId == undefined) return;
  var objSub = document.getElementById(msId);
  if (!objSub) return;
  
  objSub.style.display = 'block';///inline
  objSub.style.top = objTop;
  objSub.style.left = objLeft ; ///+ objWidth
  //alert(objLeft);
  
  menu_sub_obj = objSub; 
  subObjWidth = objSub.offsetWidth;
  subObjHeight = objSub.offsetHeight+35;
  
}


/// Check Mouse Cursor Position -> Hide Menu
function CheckMouse(ev)
{
var ScrollTop = document.body.scrollTop;
if (ScrollTop == 0)
{
    if (window.pageYOffset)
        ScrollTop = window.pageYOffset;
    else
        ScrollTop = (document.body.parentElement) ? document.body.parentElement.scrollTop : 0;
}

  if (menu_obj == null) return;
  var x = ev.clientX;
  var y = ev.clientY + ScrollTop;

  //Display Exit coordiantes
  //self.status = "X= "+ x + "  Y= " + y;

/*

A1______A2
|_______|_____
AB      A4   |B2
|            |
|            |
B3___________B4

*/

  var A1y = objTop;
  var A1x = objLeft; 

  var A2x = objLeft + objWidth;
  
  var ABx = objLeft;
  var ABy = objTop + objHeight;  
  
  var A4x = A2x;
  var B3y = objTop + subObjHeight;
  var B2x = objLeft + subObjWidth;
  var B4x = B2x;
  
  var objRight = objLeft + objWidth;
  var objBottom = objTop + objHeight;  
  
  var subObjTop = objBottom;
  var subObjBottom = objTop + subObjHeight;
  var subObjRight = objLeft + subObjWidth;
  var subObjLeft = objLeft;


  /// In main button
  //var inMainButton = ((x>objLeft)&&(x<objRight))&&((y>objTop)&&(y<objBottom)); 
  
  //if (((x>subObjLeft)&&(x<subObjRight))&&((y>subObjTop)&&(y<subObjBottom)) == false) var inSubMenu=false;
  
   //if ((inSubMenu==false) && (inMainButton==false))  MenuSwitchOff();


  /// Y-check
  var yOut = false;
  if ((y<objTop)||(y>subObjBottom)) yOut = true;

  /// X-Check
  var xOut = false;
  if (yOut == false)
  {
  if (x<subObjLeft) xOut=true; 
 
  if (((x>objRight)&&(y<objBottom))||((y>subObjTop)&&(x>subObjRight))) xOut = true;
  }
  
  if ((yOut)||(xOut)) MenuSwitchOff();  
}

function MenuSwitchOff()
{
  if (menu_obj == null) return;
  var cn = menu_obj.className;

  var cObj = menu_obj.childNodes.item(0);
  menu_obj = null;
  
  if (menu_sub_obj == null) return;
  menu_sub_obj.style.display = 'none';
  subObjWidth = 0;
  subObjHeight = 0;
  menu_sub_obj = null;

}


