var _$ = function(id,form){return "string" == typeof id ? (form ? eval("document.getElementById('"+form+"')."+id) : document.getElementById(id)) : id} //Firefoxidֵ
var _$gname = function(name){return document.getElementsByName(name)}
var _$tag = function(name){return document.getElementsByTagName(name)}
var _$gtag = function(name,tagName){return name ? _$(name).getElementsByTagName(tagName) : _$tag(tagName)}
var _$ihtml = function(id,s){_$(id).innerHTML = s}
var _$itext = function(id,s){_$(id).innerText = s}
var _$ivalue = function(id,s){_$(id).value = s}
var _$gclass = function(name){return getElementsByClassName(name)}
var _$db = function(id,form){form ? eval("_$('"+id+"','"+form+"').disabled = true") : _$(id).disabled = true}
String.prototype.trim = function(){return this.replace(/(^\s*)|(\s*$)/g,"")}
//======================= AJAX
function XHR(){ //XMLHttpRequest
var XHR = false;
try{XHR = new ActiveXObject("Msxml2.XMLHTTP");
}catch(e){
    try{XHR = new ActiveXObject("Microsoft.XMLHTTP");
    }catch(e){XHR = false;}
}
if(!XHR && typeof XMLHttpRequest != "undefined"){XHR = new XMLHttpRequest();}
return XHR;
}

function getEvaluate(ID,agreeID,disagreeID){
var xhr = XHR();
xhr.open("GET", "Eva.asp?ID="+ID, false);
xhr.send(null);
var msgs = xhr.responseText.split(",");
_$(agreeID).innerHTML = msgs[0];
_$(disagreeID).innerHTML = msgs[1];
}

function checksearch(){
if(_$("keyword").value==""){
alert("請輸入關鍵詞");
_$("keyword").focus();
return false;
}
}

function checkclasssearch(){
if(_$("classid").value==""){
alert("請選擇類別");
_$("classid").focus();
return false;
}
}

function   do_submit(cmd) 
{ 
	cartform.action='car.asp'; 
	cartform.submit(cartform); 
} 

function checkLeftLoginTop(){
if(_$("LUserName").value==""){
alert("請輸入賬號");
_$("LUserName").focus();
return false;
}
if(_$("LUserName").value.indexOf('@')<0){
alert("請正確輸入賬號");
_$("LUserName").select();
return false;
}
if(_$("LUserName").value.indexOf('.')<0){
alert("請正確輸入賬號");
_$("LUserName").select();
return false;
}
if(_$("LPassword").value==""){
alert("請輸入密碼");
_$("LPassword").focus();
return false;
}
if(_$("Code").value==""){
alert("Please enter the Code");
_$("Code").focus();
return false;
}
}

function checkregister(){	
if(_$("RegEmail").value==""){
alert("請輸入賬號");
_$("RegEmail").focus();
return false;
}
if(_$("RegEmail").value.indexOf('@')<0){
alert("請正確輸入賬號");
_$("RegEmail").select();
return false;
}
if(_$("RegEmail").value.indexOf('.')<0){
alert("請正確輸入賬號");
_$("RegEmail").select();
return false;
}
if(_$("Password").value==""){
alert("請輸入密碼");
_$("Password").focus();
return false;
}
if(_$("Password").value.length<6||_$("Password").value.length>16){
alert("請正確輸入密碼");
_$("Password").select();
return false;
}
if(_$("Password2").value==""){
alert("請再次輸入密碼");
_$("Password2").focus();
return false;
}
if(_$("Password").value!=_$("Password2").value){
alert("請確保密碼與確認密碼相同");
_$("Password2").focus();
return false;
}
if(_$("ma").value==""){
alert("請輸入驗證碼");
_$("ma").focus();
return false;
}
}

function checkmail(){
if(_$("dingyetwo").value==""){
alert("請輸入郵箱");
_$("dingyetwo").focus();
return false;
}
if(_$("dingyetwo").value.indexOf('@')<0){
alert("請正確輸入郵箱");
_$("dingyetwo").select();
return false;
}
if(_$("dingyetwo").value.indexOf('.')<0){
alert("請正確輸入郵箱");
_$("dingyetwo").select();
return false;
}
}

function checkmyinmation(){
if(_$("userName").value==""){
alert("請輸入Email地址");
_$("userName").focus();
return false;
}
if(_$("userName").value.indexOf('@')<0){
alert("請正確輸入Email地址");
_$("userName").select();
return false;
}
if(_$("userName").value.indexOf('.')<0){
alert("請正確輸入Email地址");
_$("userName").select();
return false;
}
if(_$("First_Name").value==""){
alert("請輸入姓名");
_$("First_Name").focus();
return false;
}
if(_$("Telephone").value==""){
alert("請輸入手機號");
_$("Telephone").focus();
return false;
}
if(_$("Telephone").value.length<6){
alert("請正確輸入手機號");
_$("Telephone").select();
return false;
}
if(_$("Telephone").value.length>11){
alert("請正確輸入手機號");
_$("Telephone").select();
return false;
}
}

function checkupdatepass(){
	
if(_$("Password").value==""){
alert("請輸入原始密碼");
_$("Password").select();
return false;
}
if(_$("NewPassword").value==""){
alert("請輸入新密碼");
_$("NewPassword").select();
return false;
}
if(_$("NewPassword").value.length<6||_$("NewPassword").value.length>16){
alert("請正確輸入新密碼");
_$("NewPassword").select();
return false;
}
if(_$("NewPassword2").value==""){
alert("再次輸入新密碼");
_$("NewPassword").select();
return false;
}

}

function checkmyorder(){

if(_$("First_Name").value==""){
alert("請輸入收貨人");
_$("First_Name").focus();
return false;
}

if(_$("Telephone").value==""){
alert("請輸入手機號");
_$("Telephone").focus();
return false;
}

if(_$("Telephone").value.length<8){
alert("請正確輸入手機號");
_$("Telephone").select();
return false;
}

if(_$("Telephone").value.length>11){
alert("請正確輸入手機號");
_$("Telephone").select();
return false;
}

if(_$("Street_Addres").value==""){
alert("請輸入收貨人地址");
_$("Street_Addres").focus();
return false;
}
}

function checknumfu(){
if(_$("hao").value==""){
alert("請輸入產品貨號");
_$("hao").focus();
return false;
}
}

