<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_checkPlugin(plgIn, theURL, altURL, autoGo) { //v4.0
  var ok=false; document.MM_returnValue = false;
  with (navigator) if (appName.indexOf('Microsoft')==-1 || (plugins && plugins.length)) {
    ok=(plugins && plugins[plgIn]);
  } else if (appVersion.indexOf('3.1')==-1) { //not Netscape or Win3.1
    if (plgIn.indexOf("Flash")!=-1 && window.MM_flash!=null) ok=window.MM_flash;
    else if (plgIn.indexOf("Director")!=-1 && window.MM_dir!=null) ok=window.MM_dir;
    else ok=autoGo; }
  if (!ok) theURL=altURL; if (theURL) window.location=theURL;
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_displayStatusMsg(msgStr) { //v1.0
  status=msgStr;
  document.MM_returnValue = true;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  if (features === undefined) features = 'resizable=yes';   	
  window.open(theURL,winName,features);
}

function fullScreen(theURL) {
window.open(theURL, '', 'fullscreen=yes,scrollbars=yes,resizable=yes');
}
function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}

function OpenWin(pTarget) 
{
//	var w = window.open( pTarget,"_blank","top=0,left=0,scrollbars=1,width="+(window.screen.availWidth+5000)/2+",height="+window.screen.availHeight/2 );
//	w.moveTo( -1,-1 );
	var w = window.open( pTarget,"_blank","top=0,left=0,scrollbars=1,width=600,height=300" );
//	w.resizeTo( window.screen.availWidth/2, window.screen.availHeight/2 );
}


function GetProdType(vTypeNo) {
  var txt=vTypeNo;
  if (txt!="") {
    document.formSearch.ProdType.value=txt;
  }
}

function ValidatePT() {
//  if (document.formSearch.typeno.value=="") {
  if (document.formSearch.ProdType.value=="") {
    alert('Please input the Product Type / Part Name');
    return false;
  } else {
    return true;
  }
}


function ChLang()
{
  var loc = location.href;
  
  if (loc.indexOf("#") != -1) {
    loc = loc.substr(0,loc.indexOf("#"));
  }
  
  if (loc.indexOf("/ja") != -1) {
    window.location =loc.replace("/ja","/en");
  } else {
    window.location =loc.replace("/en","/ja");
  }  
}




function jsTrim(s) {
	if(s==null || s=="") return s;
	var i = 0;
	var len = s.length;
	while(s.charAt(i)==" " && i<len) i++;
	if(i<len) {
		s = s.substr(i,s.length - i);
		len = s.length;
		i = len - 1;
		while(s.charAt(i)==" " && i>=0) i--;
		if(i>=0) s = s.substr(0,i+1);
	}else s = "";
	return s;
}

function jsIsEmpty(s) {
	s = jsTrim(s);
	if(s==null||s=="") return true;
	return false;
}

function jsIsEmail(s) {
		s = jsTrim(s);
		var p1 = s.indexOf("@");
		var p2 = s.lastIndexOf(".");
		if( (p1<=0) || (p1!=s.lastIndexOf("@")) || (p2<0) || ((p2+1)==s.length) || (p1>=p2) || ((p2-p1)==1) ) {
			return false;
		}
		return true;
}

function jsIsNumber(s) {
	s = jsTrim(s);
	if(s==""||s==null) return false;
	var n = new Number(s); // why not use parseint? cause parseint("12ab")=12, i don't want it.
	if(isNaN(n)) return false;
	return true;
}

function jsIsDate(s) { // yyyy-mm-dd
	s = jsTrim(s);
	if(s==""||s==null) return false;
	var sepchar = "-";
	var p1 = s.indexOf(sepchar,0)
	if(p1<0) return false;
	var year = new Number(s.substr(0,p1));
	 // why not use parseint? cause parseint("12ab")=12, i don't want it.
	if (isNaN(year) || year<1 ) return false;
	p2 = s.indexOf(sepchar,p1+1);
	if(p2<0) return false;
	var month = new Number(s.substr(p1+1,p2-p1-1));
	if(isNaN(month) || month<1 || month>12) return false;
	var maxdays=30;
	if(month==1 || month==3 || month==5 || month==7 || month==8 || month==10 || month==12 ) 
		maxdays = 31;
	else if(month==2) maxdays = ((year % 4) == 0) ? 29 : 28;
	var days = new Number(s.substr(p2+1,s.length-p2));
	if(isNaN(days) || days<1 || days>maxdays) return false;
	return true;
}

function goPageNo_onkeypress() {
	if(window.event.keyCode==13)
		return btnList_onclick();
}

function text_onkeypress() {
	if(window.event.keyCode==13) {
		var f = document.forms["frmMain"];
		f.forceSubmit.value=1;
	}
}

function btnList_onclick(pageNo) {
	var f = document.forms["frmMain"];
	f.goPageNo.value = pageNo;
	var v = pageNo;	
	if(v==null||v==""||v=="undefined"||isNaN(parseInt(v))) {
			//document.all("searchInfo").innerHTML = "<b><font color=red>Please enter page no.</font></b>";
			//alert("Please enter page no.");
			f.goPageNo.focus();
			f.goPageNo.select();
			return false;
	}
	f.scrollAction.value = "L";
	f.submit();
}

function btnPrevious_onclick() {
	var f = document.forms["frmMain"];
	f.scrollAction.value = "P";
	f.submit();
}
function btnNext_onclick() {	
	var f = document.forms["frmMain"];
	f.scrollAction.value = "N";
	f.submit();
}

function detailsmousemove() {
	window.status = window.event.srcElement.title;
}

function detailsmouseout() {
	window.status = "";
}

function detailsonclick(pos) {
	var f = document.forms["frmMain"];
	f.pos.value = pos;
	f.scrollAction.value = "";
}

function frmLoginCheck(btn,addon) {
	//var m = document.forms["frmOrder"];
	var f = document.forms["frmMain"];
	var v,o;
	switch(btn) {
	case "login":
		if(jsIsEmpty(f.loginname.value)) {
			alert("Please input User Name.");
			f.loginname.focus();
			return false;
		}		
		if(jsIsEmpty(f.password.value)) {
			alert("Please input Password.");
			f.password.focus();
			return false;
		}
		//f.action = m.action;
		f.btnLogin.value = 1;
		//f.loginname.value = m.loginname.value;
		//f.password.value = m.password.value;
		f.submit();
		break;
	default:
	}
	return false;
}

function frmQuote2(prodid, partsno,quan,saApp,saMounting,saProdType,saDiameter,saHeight,saLength,saWidth) {	
	//var m = document.forms["frmOrder"];
/*	if(m.custlogin.value!=1) {
		alert("Please login first.");
		return;
	}
*/
	var f = document.forms["frmMain"];
 
	//f.action = m.action;
	 
	f.quote_prodid.value = prodid;
	//f.quote_catid.value = catid;
	f.quote_partsno.value = partsno;
	f.quote_quan.value = quan;
    f.saApp.value = saApp;
    f.saProdType.value = saProdType;
    f.saMounting.value = saMounting;	
    f.saDiameter.value = saDiameter;		
    f.saHeight.value = saHeight;							 
    f.saLength.value = saLength;							 
    f.saWidth.value = saWidth;							 		
	f.submit();
	
}
function frmQuote3(prodid, partsno,quan,saApp,saProdType,saMounting,saDiameter,saWattage,saVoltage,saHeight,saLength,saWidth) {	
	//var m = document.forms["frmOrder"];
/*	if(m.custlogin.value!=1) {
		alert("Please login first.");
		return;
	}
*/
	var f = document.forms["frmMain"];
 
	//f.action = m.action;
	 
	f.quote_prodid.value = prodid;
	//f.quote_catid.value = catid;
	f.quote_partsno.value = partsno;
	f.quote_quan.value = quan;
    f.saApp.value = saApp;
    f.saProdType.value = saProdType;
    f.saDiameter.value = saDiameter;		
    f.saWattage.value = saWattage;		
    f.saVoltage.value = saVoltage;		
    f.saHeight.value = saHeight;							 
    f.saLength.value = saLength;							 
    f.saWidth.value = saWidth;			
    f.saMounting.value = saMounting;								 		
	f.submit();
	
}

function frmQuote4(prodid, partsno,quan,saApp,saProdType,saMounting,saInductance,saInduct,saDCR,saRelCurrent,saRel,saDiameter,saHeight,saLength,saWidth) {	
	//var m = document.forms["frmOrder"];
/*	if(m.custlogin.value!=1) {
		alert("Please login first.");
		return;
	}
*/
	var f = document.forms["frmMain"];
 
	//f.action = m.action;
	 
	f.quote_prodid.value = prodid;
	//f.quote_catid.value = catid;
	f.quote_partsno.value = partsno;
	f.quote_quan.value = quan;
    f.saApp.value = saApp;
    f.saProdType.value = saProdType;
    f.saMounting.value = saMounting;		
    f.saInductance.value = saInductance;		
    f.saInduct.value = saInduct;		
    f.saDCR.value = saDCR;		
    f.saRelCurrent.value = saRelCurrent;		
    f.saRel.value = saRel;		
    f.saDiameter.value = saDiameter;		

    f.saHeight.value = saHeight;							 
    f.saLength.value = saLength;							 
    f.saWidth.value = saWidth;							 		
	f.submit();
	
}

function frmQuote5(prodid, partsno,quan,saApp,saProdType,saMounting,saInductance,saInduct,saDCR,saRelCurrent,saRel,saDiameter,saWattage,saVoltage,saHeight,saLength,saWidth) {	
	//var m = document.forms["frmOrder"];
/*	if(m.custlogin.value!=1) {
		alert("Please login first.");
		return;
	}
*/
	var f = document.forms["frmMain"];
 
	//f.action = m.action;
	 
	f.quote_prodid.value = prodid;
	//f.quote_catid.value = catid;
	f.quote_partsno.value = partsno;
	f.quote_quan.value = quan;
    f.saApp.value = saApp;
    f.saProdType.value = saProdType;
    f.saMounting.value = saMounting;		
    f.saInductance.value = saInductance;		
    f.saInduct.value = saInduct;		
    f.saDCR.value = saDCR;		
    f.saRelCurrent.value = saRelCurrent;		
    f.saRel.value = saRel;		
    f.saDiameter.value = saDiameter;		
    f.saWattage.value = saWattage;		
    f.saVoltage.value = saVoltage;		
    f.saHeight.value = saHeight;							 
    f.saLength.value = saLength;							 
    f.saWidth.value = saWidth;							 		
	f.submit();
	
}

function frmQuote1(prodid, partsno, quan, typeno) {	
	//var m = document.forms["frmOrder"];
/*	if(m.custlogin.value!=1) {
		alert("Please login first.");
		return;
	}
*/
	var f = document.forms["frmMain"];
 
	//f.action = m.action;
	 
	f.quote_prodid.value = prodid;
	//f.quote_catid.value = catid;
	f.quote_partsno.value = partsno;
	f.quote_quan.value = quan;
	f.textfield.value = typeno;
	 
	f.submit();
	
}
function frmQuote(prodid, partsno, quan, quote_type) {	
	//var m = document.forms["frmOrder"];
/*	if(m.custlogin.value!=1) {
		alert("Please login first.");
		return;
	}
*/
	var f = document.forms["frmMain"];
 
	//f.action = m.action;
	 
	f.quote_prodid.value = prodid;
	//f.quote_catid.value = catid;
	f.quote_partsno.value = partsno;
	f.quote_quan.value = quan;
	f.quote_type.value = quote_type;   
	f.submit();
	
}

function frmQuote1(prodid, partsno, quan, typeno) {	
	//var m = document.forms["frmOrder"];
/*	if(m.custlogin.value!=1) {
		alert("Please login first.");
		return;
	}
*/
	var f = document.forms["frmMain"];
 
	//f.action = m.action;
	 
	f.quote_prodid.value = prodid;
	//f.quote_catid.value = catid;
	f.quote_partsno.value = partsno;
	f.quote_quan.value = quan;
	f.textfield.value = textfield;	 
	f.submit();
	
}

function frmQuoteModify(prodid, partsno,quan,oldquan,obj, quote_type) 
{
	var m = document.forms["frmMain"];
	if((quan==0)&&(m.custwarningflag.value==0)) {
		//m.custwarningflag.value = 1;
		if(!window.confirm("Really remove this item?")) {
			if(quan!=oldquan) obj.value = oldquan;
			return;
		}
	}
	//var f = document.forms["frmMain"];
	//f.action = m.action;
	m.quote_prodid.value = prodid;
	//f.quote_catid.value = catid;
	m.quote_partsno.value = partsno;
	m.quote_quan.value = quan;
	m.quote_type.value = quote_type;   
	m.submit();
}

function frmQuoteSend() {
	var m = document.forms["frmMain"];
	if(m.custlogin.value!=1) {
		alert("Please login first.");
		m.loginname.focus();
		return;
	}
	if(!window.confirm("Request your quotes?")) {
	    this.focus();
		return;
	}
	var f = document.forms["frmMain"];
	//f.action = m.action;
	f.quote_send.value = 1;
	f.submit();
}

function txtCond_onkeypress() {
	if((window.event.keyCode==13)) {
		search_Go_onclick();
	}
	return true;
}

function search_Go_onclick() {
	var m = document.forms["frmProd"];
	window.navigate("list.php?prodSubmit=1&txtCond="+(m.txtCond.value)+"&selCat="+(m.selCat.value));
	return false;
}

function set(){
    for(var i=0,hash={};i<arguments.length;i++) hash[arguments[i]]=1
    return hash
}

function Wa_SetImgAutoSize(img) 
{ 
//var img=document.all.img1;//获取图片 
var MaxWidth=50;//设置图片宽度界限 
var MaxHeight=35;//设置图片高度界限 
var HeightWidth=img.offsetHeight/img.offsetWidth;//设置高宽比 
var WidthHeight=img.offsetWidth/img.offsetHeight;//设置宽高比 
//alert("test"+img.offsetHeight+img.fileSize);
//if(img.offsetHeight>1) alert(img.offsetHeight);
if(img.readyState!="complete"){
 return false;//确保图片完全加载
}
if(img.offsetWidth>MaxWidth){ 
img.width=MaxWidth; 
img.height=MaxWidth*HeightWidth; 
} 
if(img.offsetHeight>MaxHeight){ 
img.height=MaxHeight; 
img.width=MaxHeight*WidthHeight; 
} 
} 

// Script Source: CodeLifter.com
// Copyright 2003
// Do not remove this notice.

// SETUPS:
// ===============================

// Set the horizontal and vertical position for the popup

PositionX = 10;
PositionY = 10;

// Set these value approximately 20 pixels greater than the
// size of the largest image to be used (needed for Netscape)

defaultWidth  = 500;
defaultHeight = 500;

// Set autoclose true to have the window close automatically
// Set autoclose false to allow multiple popup windows

var AutoClose = true;

// Do not edit below this line...
// ================================
if (parseInt(navigator.appVersion.charAt(0))>=4){
var isNN=(navigator.appName=="Netscape")?1:0;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
var optIE='scrollbars=no,width=150,height=100,left='+PositionX+',top='+PositionY;
function popImage(imageURL,imageTitle){
if (isNN){imgWin=window.open('about:blank','',optNN);}
if (isIE){imgWin=window.open('about:blank','',optIE);}
with (imgWin.document){
writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');writeln('<sc'+'ript>');
writeln('var isNN,isIE;');writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
writeln('isNN=(navigator.appName=="Netscape")?1:0;');writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
writeln('function reSizeToImage(){');writeln('if (isIE){');writeln('window.resizeTo(100,100);');
writeln('width=120-(document.body.clientWidth-document.images[0].width);');
writeln('height=100-(document.body.clientHeight-document.images[0].height);');
writeln('window.resizeTo(width,height);}');writeln('if (isNN){');       
writeln('window.innerWidth=document.images["George"].width;');writeln('window.innerHeight=document.images["George"].height;}}');
writeln('function doTitle(){document.title="'+imageTitle+'";}');writeln('</sc'+'ript>');
if (!AutoClose) writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
else writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
writeln('<img name="George" src='+imageURL+' style="display:block"></body></html>');
close();		
}}

//-->
