﻿function $(o){return document.getElementById(o.toString());}
function Juge1(theForm)
{
  if (theForm.text_name.value == "")
  {
    alert("please fill your Contact person!");
    theForm.text_name.focus();
    return (false);
  }
	if (theForm.company.value == "")
  {
    alert("please fill your Company name!");
    theForm.company.focus();
    return (false);
  }
	
  if (theForm.email.value == "")
	{
		alert("Email null!");
		theForm.email.focus();
		return (false);
	}

	var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_@.";
	var checkStr = theForm.email.value;
	var allValid = true;
	for (i = 0;  i < checkStr.length;  i++)
	{
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOK.length;  j++)
		if (ch == checkOK.charAt(j))
			break;
		if (j == checkOK.length)
		{
			allValid = false;
			break;
		}
	}

	if (theForm.email.value.length < 6)
	{
			allValid = false;
	}

	if (!allValid)
	{
		alert("Email fail!");
		theForm.email.focus();
		return (false);
	}

	address=theForm.email.value;
    if(address.length>0)
	{
        i=address.indexOf("@");
        if(i==-1)
		{
			window.alert("Sorry!Email fail!")
			theForm.email.focus();
			return false
        }
       ii=address.indexOf(".")
        if(ii==-1)
		{
			window.alert("Sorry!Email fail!")
			theForm.email.focus();
			return false
        }

    }
	
}

function gotoPartNumber(o,oLanuage)
{
	var partNum = $(o);
	if(partNum.value.length == 0)
	{
		switch(oLanuage.toString().toUpperCase())
		{
			case "CN":
				alert("请输入要查询的零件号码.");
				break;
			case "EN":
				alert("Please Enter Part Number.");
				break;
			default:
				alert(oLanuage.toString());
				break;
		}
		partNum.focus()
		return false;
	}
	else
	{
		$("ShowContent").style.display="none";
		fGoto.document.location.href="fGoto.asp?part=" +partNum.value;
		$("partDiv").style.display="block";
	}
}
function ct(o,o2)
{
	document.location.href=o+"_Server.asp?p="+o2;
}

function omov(o)
{
	o.style.background = "#eeeeee";
}
function omou(o)
{
	o.style.background = "";
}

function ShowDisplay()
{
	var s = arguments.length;
	if(s==0)return;
	var t = arguments[0];
	for(var i=1;i<s;i++)
	{
		$(t+arguments[i].toString()).style.display="";
	}
}
function cd(o)
{
	$(o).style.display="block";
}
function co(o)
{
	$(o).style.display="none";
}