function findObj(theObj, theDoc)
{
  var p, i, foundObj;
  if(!theDoc) theDoc = document;
  if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)
  {
    theDoc = parent.frames[theObj.substring(p+1)].document;
    theObj = theObj.substring(0,p);
  }
  if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
  for (i=0; !foundObj && i < theDoc.forms.length; i++) 
    foundObj = theDoc.forms[i][theObj];
  for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
    foundObj = findObj(theObj,theDoc.layers[i].document);
  if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
  return foundObj;
}


function preloadImages()
{
  if(document.images)
  {
    if(!document.imageArray) document.imageArray = new Array();
    var i,j = document.imageArray.length, args = preloadImages.arguments;
    for(i=0; i<args.length; i++)
    {
      if (args[i].indexOf("#")!=0)
      {
        document.imageArray[j] = new Image;
        document.imageArray[j++].src = args[i];
      }
    }
  }
}




function showHideLayers()
{ 
  var i, visStr, obj, args = showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3)
  {
    if ((obj = findObj(args[i])) != null)
    {
      visStr = args[i+2];
      if (obj.style)
      {
        obj = obj.style;
        if(visStr == 'show') visStr = 'visible';
        else if(visStr == 'hide') visStr = 'hidden';
      }
      obj.visibility = visStr;
    }
  }
}



function showHide(targetName) {
   if( document.getElementById ) { // NS6+
       target = document.getElementById(targetName);
   } else if( document.all ) { // IE4+
       target = document.all[targetName];
   }
   if( target ) {
     if( target.style.display == "none" ) {
        target.style.display = "inline";
     } else {
        target.style.display = "none";
     }
   }
}

var win=null;
function MyWindow(mypage,myname,w,h,scroll,pos){
var rndURL = (1000*Math.random());
if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes';
win=window.open(mypage+'&rndURL='+rndURL,myname,settings);
if(win.focus){win.focus();}}
function DoSearch(){
var mbool = "AND";
var mcase = "Insensitive";
if(!document.CANDOSearch.terms.value){
 alert("Error. Please enter something to search for");
 return false;
 }
else{
  var URL = "http://www.v-belt.com.cn/cgi-bin/CANDOSearch.cgi?command=query&terms="+escape(document.CANDOSearch.terms.value)+"&mbool="+mbool+"&mcase="+mcase;
  MyWindow(URL,'query',600,400,'yes','center');
  return false;
  }
}



function large_page(pURL){
		var tname=(new Date()).getTime();
		var tfeatures='width=720,height=610,scrollbars=yes,toolbars=no,resizable=yes';
		var ppURL='http://www.v-belt.com.cn/pvc_conveyor_belt.cfm?image=' + pURL;
		new_window = window.open(ppURL,tname,tfeatures);
		new_window.focus();
}


function large_wheel(wURL){
		var wname=(new Date()).getTime();
		var wfeatures='width=720,height=610,scrollbars=yes,toolbars=no,resizable=yes';
		var wpURL='http://www.v-belt.com.cn/wheel.cfm?image=' + wURL;
		new_window = window.open(wpURL,wname,wfeatures);
		new_window.focus();
}

function navRoll(obj, new_style) {
obj.className = new_style;
}
