﻿function login(){if($('mylogin'))$('mylogin').show()}
function loginout(){Http.call("/index.loginout");}
function showinfo(n){
	if($('mylogin'))$('mylogin').hide();
	var o=$("userinfo");
	if(!o)return;
	if(n) o.innerHTML='You are welcome <b>' + n + '</b>. <a onclick="loginout()"><b>Sign Out</b></a>';
	else o.innerHTML='You can buy freely, but <a onclick="login()"><b>Sign In</b></a> allows you more feature.&nbsp; <a href="/account.asp">Create a new account</a> | <a href="/forget.asp">Forgot your password?</a>';
}
function chat(){
	window.open("http://chat10.live800.com/live800/chatClient/chatbox.jsp?companyID=85534&configID=145061&jid=9944639256&enterurl=http%3A%2F%2Fwgolder.com%2F&timestamp=1238120172229","","width=700,height=500");
}
function Login_Before(p){showinfo()};
function Login_After(p){showinfo(p.name)};
function mycoupon(){
	var v=$("coupon").value;
	if(!v) return alert("Please input coupon code first!");
	Http.call("/index.coupon",{code:v},function(p){
		if(!p.success) return;
		$("order_coupon").value=v;
		$("coupon").value="";
		if(typeof(sum)=="function") sum();
	});
}
function payit(){Hint.show("Redirecting Page...");$("payform").submit();}
function myfocus(o){
	if(o.value=="please input order number") o.value="";
	o.style.color="black";
}
function myblur(o){
	if(o.value.trim()==""){
		o.value="please input order number";
		o.style.color="#ccc";
	}
}
function mykey(ev){
	var e=ev?ev:event;
	if(e.keyCode!=13) return;
	mysearch();
}
function mysearch(){
	var v=$("ordersearch").value.replace("please input order number","");
	if(!v) return alert("Please input order number !");
	if(v.charAt(0)=='G') location="/user/gold.asp?no="+encodeURIComponent(v);
	else if(v.charAt(0)=='P') location="/user/level.asp?no="+encodeURIComponent(v);
	else return alert("Please input correct order number !");
}

