<!--// 06/09/2003 O++ add function for set and add cookie for shopping cart.// 05/11/2001 Tik,comment out form1.log_ops.// 02/20/2001 Noi add login options Fast/Secure// 12/07/2000 05:04:PM Pot, add checkkey functionvar log_in;function testSite(){	if (document.form1.the_site.value.length < 1 ){		validatePrompt (document.form1.the_site, "Please enter an organization name.")		return (false);	} else	return (true);}function testMail(){	if (document.form1.the_mail.value.length < 1 ){		validatePrompt (document.form1.the_mail, "Please enter a valid email address to login.")		return (false);	} else	return (true);}function testPW(){	if (document.form1.the_pass.value.length < 1 ){		validatePrompt (document.form1.the_pass, "Please enter a valid password.")		return (false);	} else	return (true);}function testNewName(){	if (document.form1.user_name.value.length < 1 ){		validatePrompt (document.form1.user_name, "Please enter a new username.")		return (false);	} else	return (true);}function testNewPW(){	if (document.form1.new_pass.value.length < 1 ){		validatePrompt (document.form1.new_pass, "Please enter a valid new password.")		return (false);	} else	return (true);}function testNewPW2(){	if (document.form1.new_pass2.value.length < 1 ){		validatePrompt (document.form1.new_pass2, "Please re-enter the new password.")		return (false);	} else	return (true);}function submitit () {	if (!testMail()) return;	if (!testPW()) return;	Ctrl = document.form1.fromlogin;	if (Ctrl.value.length<1){		if (!testNewPW()) return;		if (!testNewPW2()) return;	}	log_in=1;	Login();	return;}function ok(e) {	if(e.which==13){		document.form1.submit();	}}if (navigator.userAgent.indexOf("Mozilla/3.0") == -1) {	if(navigator.appName == 'Netscape'){		window.captureEvents(Event.KEYPRESS);		window.onkeypress=ok;	}}function validatePrompt(Ctrl,PromptStr){	alert (PromptStr)	Ctrl.focus();	return;}function Set() {	var Then = new Date()	Then.setTime(Then.getTime() + 24 * 365 * 60 * 60 * 60 * 1000);	document.cookie = "SCKCookie="+document.form1.the_mail.value+"; expires=" + Then.toGMTString();}function Login(){	Set();	document.form1.submit();}function Get(fromfile){	if (fromfile==2){	}	if (!showhint){		if (fromfile<2){		document.form1.the_pass.value = "";		}		document.form1.user_name.value = getCookie("SCKCookie");		if(!fromfile){			document.form1.new_name.value = getCookie("SOLCookie2");		}		if(document.form1.user_name.value)			if (fromfile<2){				this.document.form1.the_pass.focus();			}		else			this.document.form1.user_name.focus();	}}function Get2(){	document.form1.the_pass.value = "";	if(document.form1.user_name.value)		this.document.form1.the_pass.focus();	else		this.document.form1.user_name.focus();}function getCookie(name) {	var dc = document.cookie;	var prefix = name + "=";	var begin = dc.indexOf("; " + prefix);	if (begin == -1) {		begin = dc.indexOf(prefix);		if (begin != 0) return "";	} else		begin += 2;	var end = document.cookie.indexOf(";", begin);	if (end == -1)		end = dc.length;		return unescape(dc.substring(begin + prefix.length, end));}function Unsetlogout(){	log_in=1;	return;}function noback(){	if(log_in==1){		return;	}	if(log_out){		window.location = SOL_URL+'/login.html?logout=1';	}	return;}function checkkey (event) {	var AsciiCode = 0;	if(window.event)		AsciiCode = window.event.keyCode;	else		AsciiCode = event.which;	if (AsciiCode == 13)		submitit();}function focus(){	var x;	if(document.form1){		x=document.form1.the_mail.value;		if(!x)			document.form1.the_mail.focus();		else			document.form1.the_pass.focus();				document.form1.the_mail.value = getCookie('SCKCookie');	}}function addCookie(){	document.forms[0].shopcart_arr.value = getCookie('CMCookie1');	//alert('addCookie function == '+document.forms[0].shopcart_arr.value);}function SetCurCookie() {	var form = document.forms[0];	var empty_val = " ";	document.cookie = "CMCookie1="+form.shopcart_arr.value+";";}function delCurCookie(){ 	var form = document.forms[0];	var empty_val = " ";	var Then = new Date();	document.cookie = "CMCookie1="+empty_val+";";	//alert('this del cookie '+document.cookie);}function add2cart(goods_id,quan,avail){	var form = document.forms[0];	var p_id_ = form.p_id.value;	var team_id_ = form.team_id.value;	var quan_sel = eval('document.forms[0].quanlity_'+goods_id);	var size_sel = eval('document.forms[0].size_'+goods_id);	var color_sel = eval('document.forms[0].color_'+goods_id);	quan = quan_sel.options[quan_sel.selectedIndex].value;	if(size_sel){		size = size_sel.options[size_sel.selectedIndex].value;		size_arr = size.split(' - ');		if(size_arr[0] != " --- ")		t_size = size_arr[0];		else			t_size = ' ';	}else{		t_size = ' ';	}	if(color_sel){		color_ = color_sel.options[color_sel.selectedIndex].value;		color_arr = color_.split(' >>> ');		color = color_arr[2];	}else		color = '';			var can_sell=1;//	if(avail<quan) can_sell=0;	if(quan_sel.options[0].value == 0) can_sell = 0;	if(can_sell==1){		var old_goods = getCookie('CMCookie1');		var now_cart_arr = '';		var ins_cart = '';		if(color) t_size = t_size+">"+color+"<";		if(old_goods!='') now_cart_arr=old_goods;		if(now_cart_arr=='')			now_cart_arr = goods_id+"|"+t_size+"|"+quan;		else			now_cart_arr = now_cart_arr+','+goods_id+"|"+t_size+"|"+quan;		form.shopcart_arr.value = now_cart_arr;		SetCurCookie();		form.shopcart_arr.value = getCookie('CMCookie1');		openNewWindow2(w_path_home3+'cm/shoppingcart_list.php?p_id='+p_id_+'&team_id='+team_id_,'ShoppingCartList',700,540);	}else //if(avail>0 && can_sell==0) alert('The amount of product less than your ordering. Please try to choose new amount.');		  /*else*/                       alert('This product does not available.');	}function clear_cart(){	var conf_val;	conf_val = confirm ('All items in your shopping cart will be delete , ok?');	if(conf_val){		delCurCookie();	}}//-->