// JavaScript Document
var xmlHttp = false;
function CreateXMLHttp() {
try {
	xmlHttp = new XMLHttpRequest();
} catch (trymicrosoft) {
try {
	xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (othermicrosoft) {
try {
	xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (failed) {
	xmlHttp = false;
}
}
}
//if (!xmlHttp)alert("Error initializing XMLHttpRequest!");
}


function HandleRequest(txtDivID) {
	if (xmlHttp.readyState == 4) {
		if (xmlHttp.status == 200) {
			var response = xmlHttp.responseText;
			document.getElementById(txtDivID).innerHTML = response;
			}
		else if(xmlHttp.status == 404) {
			document.getElementById(txtDivID).innerHTML = "Requested URL is not found.";
		}
		else if (xmlHttp.status == 403) {
			document.getElementById(txtDivID).innerHTML = "Access denied.";
		}
		else{
			document.getElementById(txtDivID).innerHTML = "Status is " + xmlHttp.status;
		}
	}
}


function IsDigit(){
	return ((event.keyCode >= 48) && (event.keyCode <= 57));
}

function ReSerarchList()
{
if ((document.getElementById("q").value == "" )||(document.getElementById("q").value == "Product name or keywords" )){
	alert ("Please input a search term.");
	document.getElementById("q").focus();
	return false;
	}
return true;
}



//begin js for proup
var millisec = 250;
var timeoutId;
var visiblePopup = null;

function PopupShowHide(popdivId)
{
	if(document.getElementById)
	{
		var obj = document.getElementById(popdivId);
		if(obj.style.visibility == "hidden" || obj.style.visibility == "")
		{
			obj.style.visibility = "visible";
    		PopupHide();
			visiblePopup=popdivId;
		}
		else
			PopupHide();
	}
	return false;
}

function HideDelay()
{
	PopupClear();
	timeoutId = setTimeout(function(){PopupHide()}, millisec);
}

function PopupHide()
{
	PopupClear();
	if(visiblePopup!=null)
	{
		var o = document.getElementById(visiblePopup);		
		visiblePopup=null;
		o.style.visibility = "hidden";
	}
	return false;
}

function PopupClear()
{
	if(typeof timeoutId != "undefined")
	{
		clearTimeout(timeoutId);
	}
}
//end for popup








function CheckUserLogin(){
	if (document.getElementById("Username").value == "" ){
		alert ("Please input your User ID or E-mail Address! Thanks.");
		document.getElementById("Username").focus();
		return false;
	}
	if (document.getElementById("Password").value == "" ){
		alert ("Please input your Password! Thanks.");
		document.getElementById("Password").focus();
		return false;
	}
	return true;
}


function GotoGetPassword(){
	window.open("app/getPassword.asp");
//	window.location="app/getPassword.asp";
}

function CheckFormGetOrderInfo()
{

var OrderEmail=document.getElementById("OrderEmail");
if (OrderEmail.value == ""){
	alert ("Please input E-Mail (this e-mail is that you submited with the order.). Thanks.");
	OrderEmail.focus();
	return false;
}
if ((OrderEmail.value.charAt(0)==".")||(OrderEmail.value.charAt(0)=="@")||(OrderEmail.value.indexOf('@', 0) == -1)||(OrderEmail.value.indexOf('.', 0) == -1)||(OrderEmail.value.lastIndexOf("@")==OrderEmail.value.length-1)||(OrderEmail.value.lastIndexOf(".")==OrderEmail.value.length-1)||(OrderEmail.length<5)){
	alert ("Please check your E-Mail Address.\nYour email address should look like ab@cd.com.");
	OrderEmail.focus();
	return false;
}

var OrderSN=document.getElementById("OrderSN");
if ((OrderSN.value == "") || (OrderSN.value == "Order Serial No.") )
{
	alert ("Please input Order Serial Number (digital). Thanks.");
	OrderSN.focus();
	return false;
}

return true;

}




function CommonSignIn() {
	CreateXMLHttp();
	var url = "../inc/ajax_inc_signin_home.asp";
	xmlHttp.open("GET", url, false);	
	xmlHttp.onreadystatechange = function(){HandleRequest("areaSignIn")};
	xmlHttp.send(null);
}

function CommonHeaderFunMenu(){
	CreateXMLHttp();
	var url = "../inc/ajax_header_funMenu_home.asp";
	xmlHttp.open("GET", url, true);
	xmlHttp.onreadystatechange = function(){HandleRequest("headerFunMenu")};
	xmlHttp.send(null);
}



function ReSerarchList()
{
if ((document.formSearch.q.value == "" )||(document.formSearch.q.value == "关键字" )){
	alert ("请输入关键字。");
	document.formSearch.q.focus();
	return false;
	}
return true;
}