﻿var cart={},order={},str;
var cart_game=Cookie.get("cart_game"),cart_type=Cookie.get("cart_type");
var cart_key=Cookie.get("cart_key"),cart_server=Cookie.get("cart_server");
try{if(str=Cookie.get("cart")) eval("cart="+str);}catch(e){Cookie.set("cart","")}
try{if(str=Cookie.get("order")) eval("order="+str);}catch(e){Cookie.set("order","")}
function save(){
	Cookie.set("cart",tocookie(cart));
	Cookie.set("cart_game",cart_game);
	Cookie.set("cart_type",cart_type);
	Cookie.set("cart_key",cart_key);
	Cookie.set("cart_server",cart_server);
}
function Login_Before(){F.tran("login_info","login_tbl")};
function Login_After(){
	if(!$("carter")) return location="/user/";
	show_user();
};
function show_user(b){
	if(Cookie.get("user_name")=="")F.tran("login_info","login_tbl");
	else{
		F.tran("login_tbl","login_info");
		var o=document.getElementById("user_name");
		if(o) o.innerHTML=Cookie.get("user_name");
	}
}
function loginout(){F.call("/index.loginout","",function(){F.tran("login_info","login_tbl");});}
function carthide(){F.unpop(); Select_Before()}
function clr(a){
	a.blur();
	F.tran('divpwd','pwdtbl');
	Control.pwd.reset();F.pop(null,"Find Password:");
	return false
}
function chat(){
	window.open("http://chat.live800.com/live800/chatClient/chatbox.jsp?jid=6954509703&companyID=31193&configID=23970&enterurl=http%3A%2F%2Fwww%2EOOFYY%2Ecom%2Fbuy%2Easpx","","width=540,height=400");
}
function cls(o){o.style.backgroundImage='none'}
function showpwd(v){
	var o=$("mypassword"); if(!o) return;
	o.innerHTML=v;
	F.tran("pwdtbl","divpwd");
}
function search(){
	var v=$("key").value;
	location=F.urlhead()+".htm"+(v?"?key="+escape(v):"");
}
function myTip(e){showTip(this,e);}
function showTip(source,e){
	var o=document.getElementById("popLayer"); if(!o)return;
	var t=source.getAttribute("tip");if(!t) return;
	o.innerHTML=t;
	var x=e?e.clientX:event.clientX,y=e?e.clientY:event.clientY,w=o.offsetWidth,h=o.offsetHeight;
	var left=x+12+w>document.body.clientWidth?x-w-24:x+12,top=y+12+h>document.body.clientHeight?y-h-24:y+12;
	o.style.left=((document.documentElement.scrollLeft||document.body.scrollLeft)+left)+"px";
	o.style.top=((document.documentElement.scrollTop||document.body.scrollTop)+top)+"px";
	if(F.ie)o.filters.Alpha.opacity=0; else o.style.MozOpacity=0;
	fadeOut();
}
var fadeOutTime=null;
function fadeOut(){
	var o=document.getElementById("popLayer");if(!o)return;
	if(fadeOutTime)clearTimeout(fadeOutTime);
	if(o.style.display!="block"){
		if(F.ie)o.filters.Alpha.opacity=0; else o.style.MozOpacity=0;
		o.style.display="block";
	}
	if(F.ie){ if(o.filters.Alpha.opacity>=100) return; o.filters.Alpha.opacity+=5; }
	else{ if(o.style.MozOpacity>=1) return; o.style.MozOpacity=1; }
	fadeOutTime=setTimeout("fadeOut()",5);
}
function fadeIn(){
	var o=document.getElementById("popLayer"); if(!o)return;
	if(F.ie)o.filters.Alpha.opacity=0; else o.style.MozOpacity=0;
	o.style.display="none";
}
var myname=Cookie.get("user_name");
document.write("<div id='login'><div style='width:1003px'><table control='login' query='none' style='margin-left:20px'><tr><td><table id='login_tbl' "+(myname==""?"":"style='display:none' ")+"cellpadding='0' cellspacing='0'><tr><td>E-mail:</td><td width=5></td><td><input type='text' name='user_acc' need='Please Input User Email!' style='background-image:url(/pic/input1.gif)' onfocus='cls(this)' class='text'></td><td width=5></td><td>Password:</td><td width=5></td><td><input type='password' name='user_pwd' need='Please Input Password!' style='background-image:url(/pic/input2.gif)' onfocus='cls(this)' class='text'></td><td width=5></td><td><input type='button' id='submit' act='submit' cmd='/index.login' value='Login'></td></tr></table><table id='login_info' "+(myname==""?"style='display:none' ":"")+"cellpadding='0' cellspacing='0'><tr><td style='color:white;font-weight:bold'><span id='user_name'>"+(myname==""?"":myname)+"</span> , You are Welcome</td><td width=10></td><td><input type='button' onclick='loginout()' value='Sign Out'></td></tr></table></td><td nowrap><a href='/signup.htm'>Sign Up</a> |<a href='#' onclick='return clr(this)'>Forgot password?</a> |<a id='cartlink' href='/cart.htm'>Shopping cart</a></td><td><img src='/pic/flag/en2.gif' onclick='location.href=\"http://oofay.com\"' /><img src='/pic/flag/de.gif' onclick='location.href=\"http://de.oofay.com\"' /><img src='/pic/flag/fr.gif' onclick='location.href=\"http://fr.oofay.com\"' /></td></tr></table></div></div><div id='mask'></div><div id='pop' style='width:375px'><div id='pop_bar'><span id='pop_title'></span><img id=close src='/pic/close.gif'/></div><div id='pop_text'><table id='pwdtbl' control='pwd' query='none' cellpadding='0' cellspacing='5'><tr><td><b>User Email:</b><input type='hidden' name='login_id'></td><td><input type='text' name='user_acc' label='Email' kind='email' need='Your Email is Needed' size='39' class='input' /></td></tr><tr><td colspan='3' class='dot'></td></tr><tr><td><b>Question:</b></td><td><select name='user_question' style='width:250px'><option value='1'>What street did you grow up on?</option><option value='2'>What is your mother's maiden name?</option><option value='3'>What is the name of your first school?</option><option value='4'>What is your pet's name?</option><option value='5'>What is your father's middle name?</option><option value='6'>What is your school's mascot?</option></select></td></tr><tr><td><b>Answer:</b></td><td><input type='text' name='user_answer' label='RealName' need='Please Input Your Answer' size='39' class='input' /></td></tr><tr><td colspan='3' class='dot'></td></tr><tr><td></td><td height='30'><input id='submit' act='submit' type='button' cmd='/index.getpwd' value='Get My Password' class='btn' style='width:160px;height:24px'></td><td></td></tr></table><div id=divpwd style='display:none;text-align:center;line-height:25px'><b>Your Password is : </b><b id=mypassword style='color:#00f'></b></div></div></div><div id='popLayer'></div><div id='hotrect'></div>");
init($("login"));init($("pwdtbl"));