function change_cz(key){
	if(key==1){
		document.getElementById("bt_left_1").className="bt_over_l";
		document.getElementById("bt_bg_1").className="bt_over_bg";
		document.getElementById("bt_right_1").className="bt_over_r";
		document.getElementById("bt_left_2").className="bt_out_l";
		document.getElementById("bt_bg_2").className="bt_out_bg";
		document.getElementById("bt_right_2").className="bt_out_r";
		document.getElementById("bt_left_3").className="bt_out_l";
		document.getElementById("bt_bg_3").className="bt_out_bg";
		document.getElementById("bt_right_3").className="bt_out_r";
		$("#cz_mobile").css("display","");
		$("#cz_game").css("display","none");
		$("#cz_gold").css("display","none");
	}
	if(key==2){
		document.getElementById("bt_left_1").className="bt_over_l_1";
		document.getElementById("bt_bg_1").className="bt_out_bg";
		document.getElementById("bt_right_1").className="bt_out_r_1";
		document.getElementById("bt_left_2").className="bt_over_l_2";
		document.getElementById("bt_bg_2").className="bt_over_bg";
		document.getElementById("bt_right_2").className="bt_over_r"	;
		document.getElementById("bt_left_3").className="bt_out_l";
		document.getElementById("bt_bg_3").className="bt_out_bg";
		document.getElementById("bt_right_3").className="bt_out_r";
		$("#cz_mobile").css("display","none");
		$("#cz_game").css("display","");
		$("#cz_gold").css("display","none");
	}
	if(key==3){
		document.getElementById("bt_left_1").className="bt_over_l_1";
		document.getElementById("bt_bg_1").className="bt_out_bg";
		document.getElementById("bt_right_1").className="bt_out_r_1";
		document.getElementById("bt_left_2").className="bt_out_l";
		document.getElementById("bt_bg_2").className="bt_out_bg";
		document.getElementById("bt_right_2").className="bt_out_r_1";
		document.getElementById("bt_left_3").className="bt_over_l_2";
		document.getElementById("bt_bg_3").className="bt_over_bg";
		document.getElementById("bt_right_3").className="bt_over_r";
		$("#cz_mobile").css("display","none");
		$("#cz_game").css("display","none");
		$("#cz_gold").css("display","");
	}
}

function ecode(value){
	return encodeURI(encodeURI(value));
}

function skip(cardid){
	var nickname = $("#username").val();
//	var chainname = "";
//	var queryString = "nickName=" + nickname;
//	var url ="http://www.ofcard.com/getChainDomains.do?" + queryString + "&random="+(new Date()).getTime();
//	$.ajaxSettings.async = false;
//	$.getJSON(url + "&callback=?",function(json) {
//	        $.each(json, function(i, item) {
//	        	chainname = item.chainname;	        	
//	        });
//	        document.getElementById("frm1").action = "http://" + chainname +  "/temptx.jsp?cardid=" + cardid;
//			document.getElementById("frm1").submit();
//	});
	document.getElementById("frm1").action = "http://" + "www.ofcard.com" +  "/temptx.jsp?cardid=" + cardid;
	document.getElementById("frm1").submit();
}

function initname(){
	var AgencyName = $("#AgencyName").html();
	if(AgencyName==""){
		alert("无法取到经销商登陆名,请根据要求嵌入相应！");
		return false;
	}
	document.getElementById("username").value=AgencyName;
//	var Days = 1; //此 cookie 将被保存 1天
//  var exp  = new Date();    //new Date("December 31, 9998");
//  exp.setTime(exp.getTime() + Days*24*60*60*1000);
//  document.cookie = "ofusername" + "="+ escape (AgencyName) + ";expires=" + exp.toGMTString() + ";domain=" + ".ofcard.com" + ";path" + "/";
//	var arr = document.cookie.match(new RegExp("(^| )"+"ofusername"+"=([^;]*)(;|$)"));
}

//话费
function setChargeNote(){
	var chargeMobileType = $("#chargeMobileType").val();
	var chargeZone = $("#chargeZone").val();
	var chargePrix = $("#chargePrix").val();
	if(chargeMobileType==""||chargeZone==""||chargePrix==""){
		return;
	}
	var queryString = "mobileType="+ecode(chargeMobileType)+"&zone="+ecode(chargeZone)+"&prix="+ecode(chargePrix);
	var url ="http://www.ofcard.com/getCardBox.do?" + queryString + "&random="+(new Date()).getTime();
	$.getJSON(url + "&callback=?",function(json) {
	        $.each(json, function(i, item) {
	               var msg = item.card;
	               if(msg==""){
						$("#mblist").html("<span class='t_red'>暂未开通</span>");
					}else{
						var content = "";
						var list = "";
						var lists = msg.split("&");
						for(var i=0;i<lists.length;i++){
							list = lists[i].split(",");
							if(list[2]=="") continue;
							if(list[2]=="3"){
								content += "充 值 卡：<span class='t_red2'>￥"+list[1]+"</span>元&nbsp;<a href='#' onclick=skip('"+list[0]+"') class='cz'>点此买卡</a><br />";
							}else if(list[2]=="4"){
								content += "即时快充：<span class='t_red2'>￥"+list[1]+"</span>元&nbsp;<a href='#' onclick=skip('"+list[0]+"') class='cz'>点此充值</a><br />";
							}else if(list[2]=="5"){
								content += "优惠慢充：<span class='t_red2'>￥"+list[1]+"</span>元&nbsp;<a href='#' onclick=skip('"+list[0]+"') class='cz'>点此充值</a><br />";
							}
						}
						$("#mblist").html(content);
					}
	        });
	});
}

//游戏
function setChargeGame(){
	var chargeGame = $("#chargeGame").val();
	if(chargeGame==""){
		return;
	}
	var content = "";
	var temp = "";
	eval("var productArr=Arr"+chargeGame+";");
	for (var i=0;i<productArr.length;i++){	
		temp = productArr[i][0].replace(" 只售:", "");
		if(temp.length<6){
			content +="面值 " + temp+"：<span class='t_red'>￥"+productArr[i][2]+"</span>元&nbsp;<a href='#' onclick=skip('"+productArr[i][1]+"') class='cz'>充值</a><br />";	
		}else{
			content += temp+"：<span class='t_red'>￥"+productArr[i][2]+"</span>元&nbsp;<a href='#' onclick=skip('"+productArr[i][1]+"') class='cz'>充值</a><br />";	
		}	
	}
	$("#gmlist").html(content);
}

function showGameList(){
	
	var chargeGame = document.getElementById("chargeGame");
	var temp = "";
	
	if(chargeGame.options.length==0){
		for (i=0; i<vendorArr.length; i++){
			if(vendorArr[i][2]=="22"){
				temp = vendorArr[i][0].replace("直充", "");
				temp = temp.replace("直冲", "");
				temp = temp.replace("在线直冲", "");
				temp = temp.replace("在线直充", "");
				temp = temp.replace("在线充", "");
				temp = temp.replace("在线冲", "");
				temp = temp.replace("按元随意", "");
				chargeGame.options.add(new Option(temp, vendorArr[i][1]));
			}
		}
	}
}


document.writeln("<%@ page contentType=\"text\/html; charset=GBK\" %>");
document.writeln("<!DOCTYPE html PUBLIC \"-\/\/W3C\/\/DTD XHTML 1.0 Transitional\/\/EN\" \"http:\/\/www.w3.org\/TR\/xhtml1\/DTD\/xhtml1-transitional.dtd\">");
document.writeln("<html xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">");
document.writeln("<style type=\"text\/css\">");
document.writeln("<!--");
document.writeln(".t_red2{ font-size:12px; font-family:Verdana, Arial, Helvetica, sans-serif; font-weight:bold; color:#FF6600;}");
document.writeln(".t_red{ font-size:12px; font-weight:bold; color:#FF0000; font-family:Arial, Helvetica, sans-serif;}");
document.writeln(".cz_top_bg{height:32px; background-image:url(\http://www.ofcard.com/mem\/images\/box\/cz_top_bg.gif); background-repeat:repeat-x;}");
document.writeln(".cz_bottom_bg{height:9px; background-image:url(\http://www.ofcard.com/mem\/images\/box\/cz_bottom_bg.gif); background-repeat:repeat-x;}");
document.writeln(".float_l{float:left;}");
document.writeln(".float_r{float:right;}");
document.writeln(".bt_over_l{width:4px; height:32px; float:left; background-image:url(\http://www.ofcard.com/mem\/images\/box\/cz_bt_over_left.gif);}");
document.writeln(".bt_over_l_2{width:4px; height:32px;_height:30px; float:left; background-image:url(\http://www.ofcard.com/mem\/images\/box\/cz_bt_over_left_1.gif);}");
document.writeln(".bt_over_l_1{width:4px; height:32px; float:left; background-image:url(\http://www.ofcard.com/mem\/images\/box\/cz_top_left.gif);}");
document.writeln(".bt_over_bg{background-image:url(\http://www.ofcard.com/mem\/images\/box\/cz_bt_over_bg.gif);background-position:top; background-repeat:repeat-x;  height:32px;float:left; font-size:14px; font-weight:bold; line-height:32px;color:red;padding:0 5px; width:70px; cursor:hand;}");
document.writeln(".bt_over_r{width:4px; height:32px; float:left; background-image:url(\http://www.ofcard.com/mem\/images\/box\/cz_bt_over_right.gif);}");
document.writeln(".bt_out_l{width:4px; height:32px; float:left;}");
document.writeln(".bt_out_bg{ height:32px;float:left; font-size:12px; line-height:32px;color:#333333;padding:0 5px; width:60px; cursor:hand;}");
document.writeln(".bt_out_r{width:4px; height:32px; float:left; background-image:url(\http://www.ofcard.com/mem\/images\/box\/cz_line.gif);}");
document.writeln(".bt_out_r_1{width:4px; height:32px; float:left;}");
document.writeln(".mid_border{ border-style:double; border-color:#F8A73E; border-width:0 1px;}");
document.writeln("a.cz:link {");
document.writeln("	font-size: 12px;");
document.writeln("	color: #0000FF;");
document.writeln("	text-decoration: underline;");
document.writeln("}");
document.writeln("a.cz:visited {");
document.writeln("	font-size: 12px;");
document.writeln("	color: #0000FF;");
document.writeln("	text-decoration: underline;");
document.writeln("}");
document.writeln("a.cz:hover {");
document.writeln("	font-size: 12px;");
document.writeln("	color: #FF0000;");
document.writeln("	text-decoration: none;");
document.writeln("}");
document.writeln("-->");
document.writeln("<\/style>");
document.write('<form name="frm1" method="post" action="http://www.ofcard.com/temptx.jsp" target="_blank" onSubmit="return OnChange1();">');
document.write('<input type="hidden" name="username" id="username" value="">');
document.writeln("<div class=\"cz_top_bg\">");
document.writeln("	<span class=\"float_l\">");
document.writeln("		<span id=\"bt_left_1\" class=\"bt_over_l\"><img src=\"\http://www.ofcard.com/mem\/images\/box\/spacer.gif\" height=\"32\" width=\"4\"\/><\/span>");
document.writeln("		<span id=\"bt_bg_1\" class=\"bt_over_bg\" onclick=\"change_cz(1)\">话费充值<\/span>");
document.writeln("		<span id=\"bt_right_1\" class=\"bt_over_r\"><img src=\"\http://www.ofcard.com/mem\/images\/box\/spacer.gif\" height=\"32\" width=\"4\"\/><\/span>");
document.writeln("	<\/span>");
document.writeln("	<span class=\"float_l\">");
document.writeln("		<span id=\"bt_left_2\" class=\"bt_out_l\"><img src=\"\http://www.ofcard.com/mem\/images\/box\/spacer.gif\" height=\"32\" width=\"4\"\/><\/span>");
document.writeln("		<span id=\"bt_bg_2\" class=\"bt_out_bg\" onclick=\"change_cz(2)\">游戏充值<\/span>");
document.writeln("		<span id=\"bt_right_2\" class=\"bt_out_r\"><img src=\"\http://www.ofcard.com/mem\/images\/box\/spacer.gif\" height=\"32\" width=\"4\"\/><\/span>");
document.writeln("	<\/span>");
document.writeln("    <span class=\"float_l\">");
document.writeln("		<span id=\"bt_left_3\" class=\"bt_out_l\"><img src=\"\/http://www.ofcard.commem\/images\/box\/spacer.gif\" height=\"32\" width=\"4\"\/><\/span>");
document.writeln("		<span id=\"bt_bg_3\" class=\"bt_out_bg\" onclick=\"change_cz(3)\">游戏金币<\/span>");
document.writeln("		<span id=\"bt_right_3\" class=\"bt_out_r\"><img src=\"\http://www.ofcard.com/mem\/images\/box\/spacer.gif\" height=\"32\" width=\"4\"\/><\/span>");
document.writeln("	<\/span>	");
document.writeln("	<span class=\"float_r\"><img src=\"\http://www.ofcard.com/mem\/images\/box\/cz_top_right.gif\" \/><\/span>");
document.writeln("<\/div>");
document.writeln("<div class=\"mid_border\">");
document.writeln("");
document.writeln("");
document.writeln("	<div align=\"left\" id=\"cz_mobile\" style=\"padding-left:15px;\">");
document.writeln("		<ul  style=\"padding:0px; margin:0px; list-style-type:none; font-size:12px;\">");
document.writeln("			<li style=\"height:30px;\">运营商：");
document.writeln("			  <select name=\"chargeMobileType\" id=\"chargeMobileType\" style=\"vertical-align:middle;\" onchange=\"setChargeNote()\">");
document.writeln("			    <option value=\"移动\" selected=\"selected\">移动<\/option>");
document.writeln("			    <option value=\"联通\">联通<\/option>");
document.writeln("			    <option value=\"电信\">电信<\/option>");
document.writeln("			  <\/select>");
document.writeln("			<\/li>");
document.writeln("			<li style=\"height:30px;\">地　区：");
document.writeln("			  <select name=\"chargeZone\" id=\"chargeZone\" style=\"vertical-align:middle; width:100px;\" onchange=\"setChargeNote()\">");
document.writeln("                  <option value=\"广东\" selected=\"selected\">广东<\/option>");
document.writeln("                  <option value=\"北京\">北京<\/option>");
document.writeln("                  <option value=\"上海\">上海<\/option>");
document.writeln("                  <option value=\"浙江\">浙江<\/option>");
document.writeln("                  <option value=\"江苏\">江苏<\/option>");
document.writeln("                  <option value=\"山东\">山东<\/option>");
document.writeln("                  <option value=\"山西\">山西<\/option>");
document.writeln("                  <option value=\"福建\">福建<\/option>");
document.writeln("                  <option value=\"辽宁\">辽宁<\/option>");
document.writeln("                  <option value=\"河南\">河南<\/option>");
document.writeln("                  <option value=\"四川\">四川<\/option>");
document.writeln("                  <option value=\"湖北\">湖北<\/option>");
document.writeln("                  <option value=\"天津\">天津<\/option>");
document.writeln("                  <option value=\"湖南\">湖南<\/option>");
document.writeln("                  <option value=\"河北\">河北<\/option>");
document.writeln("                  <option value=\"重庆\">重庆<\/option>");
document.writeln("                  <option value=\"云南\">云南<\/option>");
document.writeln("                  <option value=\"新疆\">新疆<\/option>");
document.writeln("                  <option value=\"西藏\">西藏<\/option>");
document.writeln("                  <option value=\"青海\">青海<\/option>");
document.writeln("                  <option value=\"宁夏\">宁夏<\/option>");
document.writeln("                  <option value=\"江西\">江西<\/option>");
document.writeln("                  <option value=\"吉林\">吉林<\/option>");
document.writeln("                  <option value=\"海南\">海南<\/option>");
document.writeln("                  <option value=\"贵州\">贵州<\/option>");
document.writeln("                  <option value=\"广西\">广西<\/option>");
document.writeln("                  <option value=\"甘肃\">甘肃<\/option>");
document.writeln("                  <option value=\"安徽\">安徽<\/option>");
document.writeln("                  <option value=\"陕西\">陕西<\/option>");
document.writeln("                  <option value=\"黑龙江\">黑龙江<\/option>");
document.writeln("                  <option value=\"内蒙古\">内蒙古<\/option>");
document.writeln("			  <\/select>");
document.writeln("			<\/li>");
document.writeln("			<li style=\"height:30px;\">面　值：");
document.writeln("			  <select name=\"chargePrix\" id=\"chargePrix\" style=\"vertical-align:middle; width:100px;\" onchange=\"setChargeNote()\">");
document.writeln("                <option value=\"30元\">30元<\/option>");
document.writeln("                <option value=\"50元\" selected=\"selected\">50元<\/option>");
document.writeln("                <option value=\"100元\">100元<\/option>");
document.writeln("                <option value=\"300元\">300元<\/option>");
document.writeln("			  <\/select>");
document.writeln("			<\/li>");
document.writeln("			<li style=\"background-color:#FDF4DB; border-style:double;border-width:1px; border-color:#FBE3A6;height:80px; width:96%; overflow-y:auto;padding:5px; \">");
document.writeln("				<div id=\"mblist\"><\/div>");
document.writeln("            <\/li>");
document.writeln("		<\/ul>");
document.writeln("	<\/div>");
document.writeln("    ");
document.writeln("    ");
document.writeln("	<div id=\"cz_game\" style=\"padding:5px;display:none;\">");
document.writeln("		<ul style=\"padding:0px; margin:0px; list-style-type:none; font-size:12px;\">");
document.writeln("			<li style=\"height:30px;*margin-bottom:12px;\">游戏：");
document.writeln("			  <select name=\"chargeGame\" id=\"chargeGame\" style=\"vertical-align:middle;\" onchange=\"setChargeGame()\">");
document.writeln("			  <\/select>");
document.writeln("			<\/li>");
document.writeln("			<li style=\"background-color:#FDF4DB; border-style:double;border-width:1px; border-color:#FBE3A6; padding:5px;height:120px; overflow-y:auto;line-height:20px;\">");
document.writeln("				<div id=\"gmlist\"><\/div>");
document.writeln("            <\/li>");
document.writeln("		<\/ul>");
document.writeln("	<\/div>");
document.writeln("    ");
document.writeln("    ");
document.writeln("    <div align=\"left\" id=\"cz_gold\" style=\"padding:5px;display:none;\">");
document.writeln("		<ul style=\"padding:0px; margin:0px; list-style-type:none; font-size:12px;\">");
document.writeln("			<li style=\"background-color:#FDF4DB; border-style:double;border-width:1px; border-color:#FBE3A6; padding:5px;height:160px; overflow-y:auto;line-height:20px;\">");
document.writeln("				<div style=\"padding-left:20px\">");
document.writeln("				魔兽世界金币：&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"#\" onclick=\"skip('280101')\" class=\"cz\">购买<\/a><br \/>");
document.writeln("                地下城与勇士金币：<a href=\"#\" onclick=\"skip('280201')\" class=\"cz\">购买<\/a><br \/>");
document.writeln("			    天龙八部金币：&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"#\" onclick=\"skip('280301')\" class=\"cz\">购买<\/a><br \/>");
document.writeln("			    台服魔兽世界金币：<a href=\"#\" onclick=\"skip('280401')\" class=\"cz\">购买<\/a><br \/>");
document.writeln("			    永恒之塔金币：&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"#\" onclick=\"skip('280501')\" class=\"cz\">购买<\/a><br \/>");
document.writeln("			    完美国际金币：&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"#\" onclick=\"skip('280601')\" class=\"cz\">购买<\/a><br \/>");
document.writeln("			    诛仙金币：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"#\" onclick=\"skip('280701')\" class=\"cz\">购买<\/a>");
document.writeln("			    <\/div>");
document.writeln("			<\/li>");
document.writeln("		<\/ul>");
document.writeln("	<\/div>");
document.writeln("    ");
document.writeln("");
document.writeln("<\/div>");
document.writeln("<div  class=\"cz_bottom_bg\"><span class=\"float_l\"><img src=\"\http://www.ofcard.com/mem\/images\/box\/cz_bottom_left.gif\" \/><\/span><span class=\"float_r\"><img src=\"\http://www.ofcard.com/mem\/images\/box\/cz_bottom_right.gif\" \/><\/span><\/div>");
document.write('</form>');
document.writeln("<script language=\"javascript\">");
document.writeln("setChargeNote();");
document.writeln("showGameList();");
document.writeln("setChargeGame();");
document.writeln("initname();");
document.writeln("<\/script>");
document.writeln("<\/html>")
