var agt=navigator.userAgent.toLowerCase();
var is_ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));

function menuShow(nodeID, show) {
  var arrow=document.getElementById("arrow"+nodeID);
  var node=document.getElementById("node"+nodeID);
  var subnode=document.getElementById("sub"+nodeID);
  var pos = findPosition( node );
  var left=258,top=0;

  if(subnode)
  {
    subnode.style.left=pos[0]+left;
    subnode.style.top=pos[1]-top;
    if(show) {
      arrow.style.display="";
      MM_showHideLayers('sub'+nodeID,'','show');
    }
    else {
      arrow.style.display="none";
      MM_showHideLayers('sub'+nodeID,'','inherit');
    }
  }
  else {
    if(show)
      arrow.style.display="";
    else
      arrow.style.display="none";
  }
}

function menuShow_1(nodeID, show) {
  var node=document.getElementById("node"+nodeID);
  var subnode=document.getElementById("sub"+nodeID);
  var pos = findPosition( node );
  var left=250,top=0;

  if(subnode)
  {
    subnode.style.left=pos[0]+left;
    subnode.style.top=pos[1]-top;
    if(show)
      MM_showHideLayers('sub'+nodeID,'','show');
    else
      MM_showHideLayers('sub'+nodeID,'','inherit');
  }
}

function submenuShow(parentID, nodeID, show) {
  var arrow=document.getElementById("arrow"+nodeID);
  var node=document.getElementById("node"+nodeID);
  var subnode=document.getElementById("sub"+nodeID);
  var subnode1=document.getElementById("sub"+parentID);
  var pos = findPosition( node );
  var left=206,top=8;

  if(subnode)
  {
    subnode.style.left=pos[0]+left;
    subnode.style.top=pos[1]-top;
    if(show) {
      arrow.style.display="";
      MM_showHideLayers('sub'+parentID,'','show');
      MM_showHideLayers('sub'+nodeID,'','show');
    }
    else {
      arrow.style.display="none";
      MM_showHideLayers('sub'+parentID,'','inherit');
      MM_showHideLayers('sub'+nodeID,'','inherit');
    }
  }
  else {
    if(show) {
      arrow.style.display="";
      MM_showHideLayers('sub'+parentID,'','show');
    }
    else {
      arrow.style.display="none";
      MM_showHideLayers('sub'+parentID,'','inherit');
    }
  }
}

function setArrow(grandParentID, parentID, nodeID, show) {
  var arrow1=document.getElementById("arrow"+grandParentID);
  var arrow2=document.getElementById("arrow"+parentID);
  var arrow3=document.getElementById("arrow"+nodeID);

  arrow1.style.display="";
  arrow2.style.display="";

  if(show)
    arrow3.style.display="";
  else
    arrow3.style.display="none";
}

function thrmenuShow(parentID, nodeID, show) {
  if(show) {
    MM_showHideLayers('sub'+parentID,'','show');
    MM_showHideLayers('sub'+nodeID,'','show');
  }
  else {
    MM_showHideLayers('sub'+parentID,'','inherit');
    MM_showHideLayers('sub'+nodeID,'','inherit');
  }
}

function setMenuHeight(nodeID, num) {
  var layer=document.getElementById("sub"+nodeID);
  layer.style.height=23*num;
}

function productThumb(imagefile) {
  var show=document.getElementById("middleshow");

  var kids=show.childNodes;
  for (j=0; j < kids.length; j++) {
    show.removeChild(kids[j]);
  }

  var img=new Image(225, 225);
  img.src="template/images/Products/"+imagefile;

  show.appendChild(img);
}

function newproductThumb3(imagefile1,imagefile2,imagefile3,imagefile4) {
  var show=document.getElementById("middleshow1");
  var kids=show.childNodes;
  for (j=0; j < kids.length; j++) {
    show.removeChild(kids[j]);
  }
  var img=new Image(200, 200);
  img.src="template/images/newProduct/"+imagefile1;
  show.appendChild(img);
  
  var show=document.getElementById("middleshow2");
  var kids=show.childNodes;
  for (j=0; j < kids.length; j++) {
    show.removeChild(kids[j]);
  }
  var img=new Image(200, 200);
  img.src="template/images/newProduct/"+imagefile2;
  show.appendChild(img);
  
  var show=document.getElementById("middleshow3");
  var kids=show.childNodes;
  for (j=0; j < kids.length; j++) {
    show.removeChild(kids[j]);
  }
  var img=new Image(200, 200);
  img.src="template/images/newProduct/"+imagefile3;
  show.appendChild(img);
  
  var show=document.getElementById("middleshow4");
  show.style.visibility="hidden";
  
  var show=document.getElementById("middleshow5");
  show.style.visibility="hidden";
}

function newproductThumb4(imagefile1,imagefile2,imagefile3,imagefile4) {
  var show=document.getElementById("middleshow1");
  var kids=show.childNodes;
  for (j=0; j < kids.length; j++) {
    show.removeChild(kids[j]);
  }
  var img=new Image(200, 200);
  img.src="template/images/newProduct/"+imagefile1;
  show.appendChild(img);
  
  var show=document.getElementById("middleshow2");
  var kids=show.childNodes;
  for (j=0; j < kids.length; j++) {
    show.removeChild(kids[j]);
  }
  var img=new Image(200, 200);
  img.src="template/images/newProduct/"+imagefile2;
  show.appendChild(img);
  
  var show=document.getElementById("middleshow3");
  var kids=show.childNodes;
  for (j=0; j < kids.length; j++) {
    show.removeChild(kids[j]);
  }
  var img=new Image(200, 200);
  img.src="template/images/newProduct/"+imagefile3;
  show.appendChild(img);
  
  var show=document.getElementById("middleshow4");
  show.style.visibility="hidden";
  var kids=show.childNodes;
  for (j=0; j < kids.length; j++) {
    show.removeChild(kids[j]);
  }
  var img=new Image(200, 200);
  img.src="template/images/newProduct/"+imagefile4;
  show.appendChild(img);
  
  var show=document.getElementById("middleshow5");
  show.style.visibility="hidden";
}

function newproductThumb5(imagefile1,imagefile2,imagefile3,imagefile4,imagefile5) {
  var show=document.getElementById("middleshow1");
  var kids=show.childNodes;
  for (j=0; j < kids.length; j++) {
    show.removeChild(kids[j]);
  }
  var img=new Image(200, 200);
  img.src="template/images/newProduct/"+imagefile1;
  show.appendChild(img);
  
  var show=document.getElementById("middleshow2");
  var kids=show.childNodes;
  for (j=0; j < kids.length; j++) {
    show.removeChild(kids[j]);
  }
  var img=new Image(200, 200);
  img.src="template/images/newProduct/"+imagefile2;
  show.appendChild(img);
  
  var show=document.getElementById("middleshow3");
  var kids=show.childNodes;
  for (j=0; j < kids.length; j++) {
    show.removeChild(kids[j]);
  }
  var img=new Image(200, 200);
  img.src="template/images/newProduct/"+imagefile3;
  show.appendChild(img);
  
  var show=document.getElementById("middleshow4");
  show.style.visibility="visible";
  var kids=show.childNodes;
  for (j=0; j < kids.length; j++) {
    show.removeChild(kids[j]);
  }
  var img=new Image(200, 200);
  img.src="template/images/newProduct/"+imagefile4;
  show.appendChild(img);
    
  var show=document.getElementById("middleshow5");
      show.style.visibility="visible";
  var kids=show.childNodes;
  for (j=0; j < kids.length; j++) {
    show.removeChild(kids[j]);
  }
  var img=new Image(200, 200);
  img.src="template/images/newProduct/"+imagefile5;
  show.appendChild(img);
}

function newproductThumb(imagefile) {
  var show=document.getElementById("middleshow");

  var kids=show.childNodes;
  for (j=0; j < kids.length; j++) {
    show.removeChild(kids[j]);
  }

  var img=new Image(225, 225);
  img.src="template/images/newProduct/"+imagefile;

  show.appendChild(img);
}

function interiorThumb(ID,imagefile) {
  var show=document.getElementById("middleshow"+ID);

  var kids=show.childNodes;
  for (j=0; j < kids.length; j++) {
    show.removeChild(kids[j]);
  }

  var img=new Image(108,225 );
  img.src="template/images/newproduct/3/"+imagefile;

  show.appendChild(img);
}
function leftThumb(ID,imagefile,width,height) {
  var show=document.getElementById("leftshow"+ID);

  var kids=show.childNodes;
  for (j=0; j < kids.length; j++) {
    show.removeChild(kids[j]);
  }

  var img=new Image(width,height);
  img.src="template/images/newproduct/3/"+imagefile;

  show.appendChild(img);
}
function productDetail(productID, show) {
  var product=document.getElementById("product"+productID);
  if(show)
    product.style.visibility="visible";
  else
    product.style.visibility="hidden";
}

function findPosition( oLink ) {
  if( oLink.offsetParent ) {
    for( var posX = 0, posY = 0; oLink.offsetParent; oLink = oLink.offsetParent ) {
      posX += oLink.offsetLeft;
      posY += oLink.offsetTop;
    }
    return [ posX, posY ];
  } else {
    return [ oLink.x, oLink.y ];
  }
}

function popupImage(image) {
  var thdm=image.src;
  var path=thdm.split(/\//g);
  var file=path[path.length-1];
  var bigImage=file.substring(3, file.length);
  path[path.length-1]=bigImage;
  bigPath=thdm.replace(file, bigImage);

  var bigImageObject=document.createElement("IMG");
  bigImageObject.src=bigPath;
  bigImageObject.onreadystatechange=function() {
    if(bigImageObject.readyState=="complete") {
      openImageWindow(bigPath, bigImageObject.width, bigImageObject.height);
    }
  }

  if(bigImageObject.readyState=="complete") {
    openImageWindow(bigPath, bigImageObject.width, bigImageObject.height);
  }
}

function openImageWindow(src, width, height) {
  windowstyle="width="+width+",height="+height+", toolbar=no, menubar=no, resizable=no,location=no, status=no";
  window.open("image.php?image="+src, "", windowstyle);
}

//屏蔽浏览器右键菜单  方法一
function click() { if (event.button==2) 
{alert('Site Url:www.grottodesigncreations.com'); } } document.onmousedown=click // --> 


//屏蔽浏览器右键菜单  方法二
    if (window.Event) 
    document.captureEvents(Event.MOUSEUP); 
    function nocontextmenu(){ 
     event.cancelBubble = true 
     event.returnValue = false; 
     return false; 
    } 
    function norightclick(e){ 
     if (window.Event){ 
      if (e.which == 2 || e.which == 3) 
      return false; 
     } 
     else 
      if (event.button == 2 || event.button == 3){ 
       event.cancelBubble = true 
       event.returnValue = false; 
       return false; 
      } 
    } 
    document.oncontextmenu = nocontextmenu; // for IE5+ 
    document.onmousedown = norightclick; // for all others 
