function showNav() {
  var navigator = document.getElementById("navigator");
  var navigator1 = document.getElementById("navigator1");
  navigator.style.left = findPosition(navigator1)[0] - 290 + "px";
  navigator.style.top = navigator1.offsetTop + navigator1.offsetHeight + 5 + "px";
  document.getElementById("navigator-img").src= ctx + "/images/tb2.jpg";
  jQuery("#navigator").slideDown("fast");
}
function hideNav() {
	document.getElementById("navigator-img").src= ctx + "/images/tb1.jpg";
	jQuery("#navigator").slideUp("fast");
}
function findPosition( oElement )
{
  var x2 = 0;
  var y2 = 0;
  var width = oElement.offsetWidth;
  var height = oElement.offsetHeight;
  //alert(width + "=" + height);
  if( typeof( oElement.offsetParent ) != 'undefined' )
  {
    for( var posX = 0, posY = 0; oElement; oElement = oElement.offsetParent )
    {
      posX += oElement.offsetLeft;
      posY += oElement.offsetTop;     
    }
    x2 = posX + width;
    y2 = posY + height;
    return [ posX, posY ,x2, y2];
   
    } else{
      x2 = oElement.x + width;
      y2 = oElement.y + height;
      return [ oElement.x, oElement.y, x2, y2];
  }
}
document.onclick = function() {
	hideNav();
};
function bookmarkit() {
    window.external.addFavorite('http://www.foode.cn/','中国食品交易网');
}
function addBookmark(title,url) {
	if ((typeof window.sidebar == 'object') && (typeof window.sidebar.addPanel == 'function'))//Gecko
    {
        window.sidebar.addPanel(title,url,"");
    }
    else//IE
    {
        window.external.AddFavorite(url,title);
    }
}
function enterMemberOffice() {
	window.open(ctx + '/successedLogin.xhtml');
}
function doLogin() {
	window.open(ctx + '/customer/login.xhtml');
}
function doRegister() {
	window.open(ctx + '/customer/register/register.xhtml');
}
