﻿// JavaScript Document

function getPDF(theURL) {
	theURL = "../doc/" + theURL;
	location = theURL;
}

function viewProduct(theURL, className){
var i;
	if(className == "无齿轮系列：GTW-GTS") { i = "1" }
	if(className == "无齿轮系列：ER-VM") { i = "2" }
	if(className == "无齿轮系列：GTN") { i = "3" }
	if(className == "无齿轮系列：家用梯") { i = "4" }
	if(className == "混合动力PMG系列") { i = "5" }
	if(className == "扶梯FJ系列") { i = "6" }
	if(className == "有齿轮系列") { i = "0" }
	  

	if(className == "Gearless Traction Machine: GTW GTS Series") { i = "1" }
	if(className == "Gearless Traction Machine: ER VM Series") { i = "2" }
	if(className == "Gearless Traction Machine: GTN Series") { i = "3" }
	if(className == "Gearless Traction Machine: For Home Lift") { i = "4" }
	if(className == "PMG Series") { i = "5" }
	if(className == "FJ Series") { i = "6" }
	if(className == "Geared Traction Machine") { i = "0" }
	theURL = "products_viewer_" + i + ".htm?" + escape(theURL);
	location = theURL;
}

// Example:
// simplePreload( '01.gif', '02.gif' ); 
function simplePreload()
{ 
  var args = simplePreload.arguments;
  document.imageArray = new Array(args.length);
  for(var i=0; i<args.length; i++)
  {
    document.imageArray[i] = new Image;
    document.imageArray[i].src = args[i];
  }
}

function LoadFlash(url,wmode,width,height) { 
//Flash Transparent
//<PARAM NAME="wmode" VALUE="transparent">
	var htmstr ='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" ';
	htmstr += 'width="' + width + '" height="' + height + '">';
	htmstr += '<param name="movie" value="' + url + '" />';
	htmstr += '<param name="quality" value="high" />';
	//htmstr += '<param name="wmode" value="' + wmode + '" />';
	htmstr += '<param value="opaque" name="wmode"/>';
	htmstr += '<embed src="' + url + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" ';
	htmstr += 'wmode="' + wmode + '" width="' + width + '" height="' + height + '"></embed></object>';
	document.write(htmstr);
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


function isFilled(obj){
	if(obj.value == "" || obj.value == null){return false}
	return true;
}

function doPrint(id){ //执行打印
	MM_openBrWindow('OpenPrint.asp?id='+id,'printWin','status=yes,scrollbars=yes,resizable=yes,toolbar=no,menubar=yes,width=650,height=550')
}


function setCookie(name, value, hours)
{
  var expire = "";
  if(hours != null)
  {
    expire = new Date((new Date()).getTime() + hours * 3600000);
    expire = "; expires=" + expire.toGMTString();
  }
  document.cookie = name + "=" + escape(value) + expire;
}

function getCookieData(labelName){
  var labelLen = labelName.length;
  var cookieData = document.cookie;
  var cLen = cookieData.length;
  var i = 0;
  var cEnd = null;
  while(i<cLen){
    var j = i + labelLen;
	if(cookieData.substring(i,j) == labelName){
	  cEnd = cookieData.indexOf(";",j);
	  if(cEnd == -1)
	    cEnd = cookieData.length;
	  return unescape(cookieData.substring(j+1, cEnd));
	}
	i++;
  }//end of while
  return "";
}

function deleteCookie(name, path, domain){
  if(getCookieData(name)!=''){
	document.cookie = name + '=' +
					(";expires= Thu, 01-jan-70 00:00:01 GMT") +
					((path)?"; path="+ path: "")+
					(domain)?"; domain="+ domain: "";
  }
}

function wEmail(user){	
	var emailHtml = "<a href=\"mailto:";
	if(user.indexOf("*")>-1){			
			var s;
			s = user.replace("*","@");
			emailHtml += s + "\">" + s + "</a>";
		}else{
			emailHtml += user + "@tracton.cn\">" + user + "@traction.cn</a>";
		}
	document.write(emailHtml);	
	}
	
function showSb(tag){
		var divObj = document.getElementById(tag);
		var icount = 7;	//共有分菜单数量
		for(var i=1; i<icount+1; i++){
			var div = document.getElementById("sb"+i);
			div.className = "hide";
			}
		if(divObj){
			if (divObj.className == "hide") {
				divObj.className = "show";
			} else {
				divObj.className = "hide";
			}
		}
}
