function trim_1(sString){while(sString.substring(0,1)==' '){sString=sString.substring(1,sString.length);}
while(sString.substring(sString.length-1,sString.length)==' '){sString=sString.substring(0,sString.length-1);}
return sString;}
function checkblank_1(str){if(trim_1(str)=='')return true;else return false;}
function validateForm_1(){username=document.getElementById('username').value;password=document.getElementById('password').value;if(checkblank_1(username)||username=='Tên đăng nhập'){alert('Tên đăng nhập của bạn ?');document.getElementById('username').style.border='solid 1px #FF0000';document.getElementById('username').focus();return false;}else{document.getElementById('username').style.border='solid 1px #00FF00';}
if(checkblank_1(password)||password=='Mật khẩu'){alert('Mật khẩu đăng nhập của bạn?');document.getElementById('password').style.border='solid 1px #FF0000';document.getElementById('password').focus();return false;}else{document.getElementById('password').style.border='solid 1px #00FF00';}
document.register.submit();}
function subSearch(){keyword=document.getElementById('keyword').value;if(checkblank_1(keyword)){alert('Xin bạn nhập từ khóa cần tìm.');document.getElementById('keyword').style.border='solid 1px #FF0000';document.getElementById('keyword').focus();return false;}
window.location.href='/Tim-kiem.html?keyword='+keyword;}
function quotes_up(){Quantity=document.getElementById('nQuantity').value;Quantity=parseInt(Quantity)+1;document.getElementById('nQuantity').value=Quantity;}
function quotes_down(){Quantity=document.getElementById('nQuantity').value;Quantity=parseInt(Quantity)-1;if(Quantity>0){document.getElementById('nQuantity').value=Quantity;}}
function checkout_method(){var act_select=0;for(i=0;i<document.payment_method.act_select.length;i++){if(document.payment_method.act_select[i].checked==true){act_select=document.payment_method.act_select[i].value;}}
act_select=parseInt(act_select);switch(act_select){case 1:window.location.href='/Dang-nhap.html';break;case 2:window.location.href='/Dang-ky.html';break;default:window.location.href='/Gio-hang.html?action=payment&pass=1';}
return false;}
function mouseout(id,count){showtime=setInterval(function(){changtab(id,count,1)},6000);}
showtime=0;function changtab(id,count,clear){for(i=1;i<=count;i++){document.getElementById('tab_'+i).className='tab_nomal';}
document.getElementById('tab_'+id).className='tab_select';valueHtml=document.getElementById('content_'+id).innerHTML;document.getElementById('tab_content').innerHTML=valueHtml;if(clear==1)clearInterval(showtime);}
function isemail_1(email){var re=/^(\w|[^_]\.[^_]|[\-])+(([^_])(\@){1}([^_]))(([a-z]|[\d]|[_]|[\-])+|([^_]\.[^_])*)+\.[a-z]{2,3}$/i
return re.test(email);}
function checkFormForgot(){if(checkblank_1(document.getElementById("email_user").value)){alert("Bạn vui lòng nhập địa chỉ email.");document.getElementById("email_user").focus();return false;}
if(!isemail_1(document.getElementById("email_user").value)){alert("Email không đúng định dạng");document.getElementById("email_user").focus();return false;}
document.forgotPass.submit();}
