// 窗口操作函数
// ======================================================================
function $alert(msg){window.alert(msg);}
function $href(loc){window.location.href=loc;}
function $windowTop(){return (window.top)?window.top:window;}
function $widnowOpener(){var w=window.opener?window.opener:window;return w;}
function $windowOpen(url,width,height,scrollbar,status,resize){var left=(screen.width-width)/2;var top=(screen.height-height)/2-100;return window.open(url,"_blank","width="+width+",height="+height+",top="+top+",left="+left+",scrollbars="+(scrollbar?"1":"0")+",resizable="+(resize?"1":"0")+",status="+(status?"1":"0"));}
function $windowOpenFull(url,scrollbar,status,resize){return $windowOpen(url,screen.width,screen.height,scrollbar,status,resize);}
function $windowDialog(url,width,height,argument){if(window.showModelessDialog){return window.showModelessDialog(url,argument,"dialogHeight="+height+"px;dialogWidth="+width+"px;center=1;help=no;status=no;");}else{return $windowOpen(url,width,height,false,false,false);}}
function $windowDialogBox(url,width,height,argument){if(window.showModalDialog){return window.showModalDialog(url,argument,"dialogHeight="+height+"px;dialogWidth="+width+"px;center=1;help=no;status=no;");}else{return $windowOpen(url,width,height,false,false,false);}}
function $windowClose(obj){obj?obj.close():window.close();}
function $iframeWindow(iframeId){return $(iframeId).contentWindow;}
function $parameter(s){var ret="";var h=window.location.search;if (h&&h.length>1){h=h.substr(1);var ps=h.split("&");for(var i=0;i<ps.length;i++){var p=ps[i].split("=");if(p.length==2&&p[0]==s){ret=p[1];break;}}}return ret;}

var ringPath = "";

//<!-- 登陆验证 -->
function logincheck(){
		var cityCode = document.getElementById("cityCode").value;
		var userNumber = document.getElementById("phoneNumber");
		var userPassword = document.getElementById("pwd");
		var checkNumber = document.getElementById("checkNumber");
		if(userNumber.value == null || userNumber.value == ''){
			alert("请输入用户小灵通号码!");
			return false;
		}else{
			if(isNaN(userNumber.value)){
				alert("输入的小灵通号码必须为数字格式，请重新输入小灵通号码!");
				return false;
			}
		}
		if(userPassword.value == null || userPassword.value == ''){
			alert("请输入用户登陆密码!");
			return false;
		}else{
			if(userPassword.value.length < 6){
				alert("输入的密码长度不足六位，请重新输入登陆密码!");
				return false;
			}
			if(isNaN(userPassword.value)){
				alert("输入的密码必须为数字格式，请重新输入登陆密码!");
				return false;
			}
		}
		if(checkNumber.value == null || checkNumber.value == ''){
			alert("请输入用户登陆验证码!");
			return false;
		}else{
			if(isNaN(checkNumber.value)){
				alert("输入的验证码必须为数字格式，请重新输入登陆验证码!");
				return false;
			}
		}
		/*
		if(cityCode == '0662' || cityCode == '0663' || cityCode == '0668' || cityCode == '0750'
				 || cityCode == '0752' || cityCode == '0753' || cityCode == '0754' || cityCode == '0756' 
				 || cityCode == '0757' || cityCode == '0758' || cityCode == '0759' || cityCode == '0760' 
				 || cityCode == '0762' || cityCode == '0763' || cityCode == '0766' 
				 || cityCode == '0768' || cityCode == '0769' ){
			return true;
		}else{
				//if(confirm("尊敬的七彩铃音用户，您好！\n由于彩铃平台升级，目前新平台只支持完成升级的地市，未完成割接的地市用户登录/订购时会重定向到旧版系统\n由于您当前登录/订购的用户为未完成割接的地市用户，请问是否跳转至旧版系统执行登录/订购操作？")){
				window.open('http://gd.118100.cn/index.jsp','_blank');
				return false;
			//}
			//return false;
		}
		*/
		return true;
}
function doLogin(){
		var p = loginForm.phoneNumber.value;
		var v = loginForm.checkNumber.value;
		
		var w = loginForm.crbtPwd.value;
		var userType = $getEle("userType").value;
		
		if(userType=="xlt" || userType=="gh" || userType=="cdma"){
			if(p=="" || p.length==0 || p=="固话/小灵通请加区号"){			
				alert('请输入你的电话号码!');
				loginForm.phoneNumber.value = "";
				loginForm.phoneNumber.focus();
				return false;
			}
			if(userType=="cdma"){
				if(p.length!=11 || p.substr(0,1)!=1){
					alert("你输入的电话号码不合法！");
					loginForm.phoneNumber.focus();
					return false;
				}
			}
			if(userType=="xlt" || userType=="gh"){
				if(p.length<10 || p.length>12 || p.substr(0,1)!=0){
					alert("你输入的电话号码不合法！");
					loginForm.phoneNumber.focus();
					return false;
				}
			}
			if(userType=="xlt" || userType=="gh" || userType=="cdma"){
				var regu = /\D/g;
				var re = new RegExp(regu);
				if(re.test(p)){
					alert("你输入的电话号码有非法字符！");
					loginForm.phoneNumber.focus();
					return false;
				}
			}
			if(w=="" || w.length==0){			
				alert('彩铃密码不能为空!');
				loginForm.crbtPwd.focus();
				return false;
			}	
		}
		if(v=="" || v.length==0){
			alert('网页验证码不能为空!');
			loginForm.checkNumber.focus();
			return false;
		}
		if(isNaN(v)){
			alert("你输入的网页验证码必须是数字格式,请重新输入网页验证码!");
			loginForm.checkNumber.focus();
			return false;
		}
		return true;
	}

//<!-- 注册类型选择 -->
function chooseregtype(){
	var str;
	var regType = document.getElementsByName("regType");
	for (i=0;i<regType.length;i++){//遍历Radio
		if(regType[i].checked){
			str = regType[i].value;
		}
	}
	if(str == 'Y'){
		location.href = "register_xlt.jsp";
	}else{
		location.href = "guhua.jsp";
	}
}
	
//<!-- 修改密码验证 -->
function checkChangepw(){
	var userPassword = document.getElementById("oldPwd").value;
	var userNewPassword = document.getElementById("newPwd").value;
	var reuserNewPassword = document.getElementById("rePwd").value;
	if(userPassword == null || userPassword == ''){
		alert("请输入旧密码!");
		return false;
	}else{
			/*
			if(userPassword.length < 1 || userPassword.length > 8){
				alert("输入的密码的可用长度为1-8位，请重新输入原始密码!");
				return false;
			}
			if(isNaN(userPassword)){
				alert("输入的密码必须为数字格式，请重新输入原始密码!");
				return false;
			}
			*/
	}
	if(userNewPassword == null || userNewPassword == ''){
		alert("请输入新密码!");
		return false;
	}
	else{
		if(userNewPassword.length < 4 || userNewPassword.length > 8){
			alert("新密码的可用长度为4-8位的字符，请重新输入新密码!");
			return false;
		}
		/*
		if(isNaN(userNewPassword)){
			alert("输入的密码必须为数字格式，请重新输入新密码!");
			return false;
		}
		*/
	}
	if(reuserNewPassword == null || reuserNewPassword == ''){
		alert("请重复输入新密码!");
		return false;
	}
	else{
		/*
		if(reuserNewPassword.length < 6){
			alert("输入的密码长度不足六位，请重新输入新密码!");
			return false;
		}
		if(isNaN(reuserNewPassword)){
			alert("输入的密码必须为数字格式，请重新输入新密码!");
			return false;
		}
		*/
	}
	if(userNewPassword != reuserNewPassword){
		alert("两次输入的新密码不一致，请重新输入新密码!");
		return false;
	}
	return true;
}

//取回密码操作验证
function getpassCheck(){
	var userNumber = document.getElementById("phoneNumber");
	var checkNumber = document.getElementById("checkNumber");
	if(userNumber.value == null || userNumber.value == ''){
		alert("请输入用户小灵通号码!");
		return false;
	}else{
		if(isNaN(userNumber.value)){
			alert("输入的小灵通号码必须为数字格式，请重新输入小灵通号码!");
			return false;
		}
	}
	if(checkNumber.value == null || checkNumber.value == ''){
		alert("请输入验证码!");
		return false;
	}else{
		if(isNaN(checkNumber.value)){
			alert("输入的验证码必须为数字格式，请重新输入验证码!");
			return false;
		}
	}
	return true;
}

//定购，赠送非登陆用户验证
function userCheck(){
	var userNumber = document.getElementById("userNumber");
	var userPassword = document.getElementById("userPassword");
	if(userNumber.value == null || userNumber.value == ''){
		alert("请输入用户小灵通号码!");
		return false;
	}
	if(userPassword.value == null || userPassword.value == ''){
		alert("请输入用户登陆密码!");
		return false;
	}
	return true;
}

//铃音接受者号码输入框验证
function presentCheck(){
	var userNumber = document.getElementById("userNumber");
	if(userNumber.value == null || userNumber.value == ''){
		alert("请输入接受赠送者小灵通号码!");
		return false;
	}
	return true;
}
	
//检查密码框是否为空
function checkpw(){
	var userPassword = document.getElementById("userPassword").value;
	if(userPassword == null || userPassword == ''){
		alert("请输入原始密码!");
		return false;
	}
	return true;
}
	
//value 长度大于len， 就截断 加...
function addPoint(value, len) {
	var result = value;
	if (value.length > len) {
		result = value.substring(0, len) + "...";
	}
	document.write(result);
}

function subStr(value, len) {
	var result = value;
	if (value.length > len) {
		result = value.substring(0, len) + "..";
	}
	return result;
}

//运算，保留小数点后2位
function keepFit(num) {
    document.write((num/100).toFixed(2));
}

//运算，保留小数点后2位
function keepFitRet(num) {
   	return ((num/100).toFixed(2));
}

//截取铃音代码
function subringcode(value){
	var str1;
	var str2;
	var str3;
	var result;
	result = value;
	if(value != null && value != ''){
		if(value.length == 12 ){
			str1 = value.substring(2,4);
			str2 = value.substring(6,value.length);
			str3 = str1 + str2;
			result = str3;
		}
	}
	document.write(result);
}

//打开窗口
function winopen(url,width,height,arg){
	$windowDialog(url,width,height,arg);
}

//定购，试听铃音
function ordering(ringId,operatorType,operId,ringType,ringFare,ringLabel,ringSource,singerName){
	var url;
	ringFare = (ringFare/100).toFixed(2) + '元';
	if((ringId == null || ringId == '') || (operatorType == null || operatorType == '') || 
		(operId == null || operId == '') || (ringType == null || ringType == '')){
			alert("该铃音状态异常，为了保障您的权益，暂时无法提供定购/试听操作!");
			return false;
	}else{
		if(operId == '1'){
			if(operatorType == '1'){
				if(ringType == '1'){
					if(confirm("您确定要定购该铃音？铃音信息如下\n铃音名称："+ringLabel+"\n价格："+ringFare+"\n歌手："+singerName+"\n提供商："+ringSource+"")){
						url = '../operation/operation.shtml?method=order&ringId='+ringId+'&ringType='+ringType+'&operatorType='+operatorType+'&operId='+operId;
						window.open(url,'ORDERING','width=655,height=490');
					}
				}else if(ringType == '2'){
					if(confirm("您确定要定购该铃音盒？铃音盒信息如下\n铃音盒名称："+ringLabel+"\n价格："+ringFare+"\n提供商："+ringSource+"")){
						url = '../operation/operation.shtml?method=order&ringId='+ringId+'&ringType='+ringType+'&operatorType='+operatorType+'&operId='+operId;
						window.open(url,'ORDERING','status=no,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,width=655,height=490');
					}
				}
				return false;
			}else if(operatorType == '2'){
				url = '../operation/operation.shtml?method=order&ringId='+ringId+'&ringType='+ringType+'&operatorType='+operatorType+'&operId='+operId;
				window.open(url,'LISTENRING','status=no,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,width=655,height=490');
			}
		}else if(operId == '2'){
			if(confirm("您确定要删除该铃音？铃音信息如下\n铃音名称："+ringLabel+"\n价格："+ringFare+"\n歌手："+singerName+"\n提供商："+ringSource+"")){
				url = '../myring/removering.shtml?method=removering&ringId='+ringId+'&ringType='+ringType+'&operatorType='+operatorType+'&operId='+operId;
				//window.open(url,'ORDERING','width=800,height=600');
				location.href=url;
			}
		}else{
		}
	}
	return false;
}

//首页定购，试听铃音
function orderingformIndex(ringId,operatorType,operId,ringType,ringFare,ringLabel,ringSource,singerName){
	var url;
	ringFare = (ringFare/100).toFixed(2) + '元';
	if((ringId == null || ringId == '') || (operatorType == null || operatorType == '') || 
		(operId == null || operId == '') || (ringType == null || ringType == '')){
			alert("该铃音状态异常，为了保障您的权益，暂时无法提供定购/试听操作!");
			return false;
	}else{
		if(operId == '1'){
			if(operatorType == '1'){
				if(ringType == '1'){
					if(confirm("您确定要定购该铃音？铃音信息如下\n铃音名称："+ringLabel+"\n价格："+ringFare+"\n歌手："+singerName+"\n提供商："+ringSource+"")){
						url = 'operation/operation.shtml?method=order&ringId='+ringId+'&ringType='+ringType+'&operatorType='+operatorType+'&operId='+operId;
						window.open(url,'ORDERING','width=655,height=490');
					}
				}else if(ringType == '2'){
					if(confirm("您确定要定购该铃音盒？铃音盒信息如下\n铃音盒名称："+ringLabel+"\n价格："+ringFare+"\n提供商："+ringSource+"")){
						url = 'operation/operation.shtml?method=order&ringId='+ringId+'&ringType='+ringType+'&operatorType='+operatorType+'&operId='+operId;
						window.open(url,'ORDERING','status=no,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,width=655,height=490');
					}
				}
				return false;
			}else if(operatorType == '2'){
				url = 'operation/operation.shtml?method=order&ringId='+ringId+'&ringType='+ringType+'&operatorType='+operatorType+'&operId='+operId;
				window.open(url,'LISTENRING','width=655,height=490');
			}
		}else if(operId == '2'){
			if(confirm("您确定要删除该铃音？铃音信息如下\n铃音名称："+ringLabel+"\n价格："+ringFare+"\n歌手："+singerName+"\n提供商："+ringSource+"")){
				url = 'myring/removering.shtml?method=removering&ringId='+ringId+'&ringType='+ringType+'&operatorType='+operatorType+'&operId='+operId;
				//window.open(url,'ORDERING','width=800,height=600');
				location.href=url;
			}
		}else{	
		}
	}
	return false;
}

//定购，试听铃音
function order(ringId,operatorType,operId,ringType,ringFare,ringLabel,ringSource,singerName){
	var url;
	ringFare = (ringFare/100).toFixed(2) + '元';
	if((ringId == null || ringId == '') || (operatorType == null || operatorType == '') || 
		(operId == null || operId == '') || (ringType == null || ringType == '')){
			alert("该铃音状态异常，为了保障您的权益，暂时无法提供定购/试听操作!");
			return false;
	}else{
		if(operatorType == '1'){
			if(confirm(" 您确定要定购该铃音？铃音信息如下\n铃音名称："+ringLabel+"\n价格："+ringFare+"\n歌手："+singerName+"\n提供商："+ringSource+"")){
				url = '../operation/operation.shtml?method=order&ringId='+ringId+'&ringType='+ringType+'&operatorType='+operatorType+'&operId='+operId;
				location.href = url;
			}
			return false;
		}
	}
	return false;
}


//赠送彩铃
function presentring(ringId){
	var url;
	if(ringId == null || ringId == ''){
		alert("该铃音状态异常，为了保障您的权益，暂时无法提供定购/试听操作!");
		return false;
	}else{
		url = '../operation/present.shtml?method=checkpresent&ringId='+ringId;
		window.open(url,'PRESENTRING','width=650,height=485');
	}
	return false;
}

// 设置默认铃音
function defaultring(ringId,ringType){
	var url;
	var str;
	if(ringType == '1'){
		str = '铃音';
	}else if(ringType == '2'){
		str = '铃音组';
	}else if(ringType == '3'){
		str = '铃音盒';
	}
	if((ringId == null || ringId == '') ||(ringType == null || ringType == '')){
		alert("该铃音状态异常，为了保障您的权益，暂时无法将该"+str+"设置为默认"+str+"操作!");
		return false;
	}else{
		url = '../myring/defaultring.shtml?method=defaultring&ringId='+ringId+'&ringType='+ringType;
		location.href = url;
	}
}

function listenring(ringid){
	var url = '../operation/operation.shtml?method=order&ringId='+ringid+'&ringType=1&operatorType=2&operId=1';
	window.open(url,'LISTENRING','status=no,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,width=655,height=490');
}

//关闭弹出的窗口
function winclose(){
	window.close();
}

//搜索列表的全选/全不选按钮
function isSelect() 
{ 
	var checkbox = document.getElementsByName("_selectItem");
	var length = checkbox.length;
	for(var i=0;i<length;i++) 
	{ 
		if(checkbox[i].checked) 
		{ 
			checkbox[i].checked = false; 
		} 
		else
		{ 
			checkbox[i].checked = true; 
		} 
	} 
} 

// 手工编辑搜索项连接
//参数定义：selectitem：搜索类别；content：搜索内容；pageno：定位到当前搜索内容的页数
function searchByEdit(selectitem,content,pageno){
	document.getElementById("_select").value = selectitem;
	document.getElementById("_content").value = content;
	document.getElementById("page_No").value = pageno;
	search();
}

// 提示
function createclew(str){
	alert(str);
	return false;
}

//列表全选 xzt
function CheckAll(form)
{
  for (var i=0;i<form.elements.length;i++)
  {
    var e = form.elements[i];
	if(!e.disabled)
    	e.checked = true;
  }
}
//列表重置 xzt
function unCheckAll(form)
{
  for (var i=0;i<form.elements.length;i++)
  {
    var e = form.elements[i];
	if(!e.disabled)
    	e.checked = false;
  }
}
//列表反选 xzt
function reCheckAll(form)
{
  for (var i=0;i<form.elements.length;i++)
  {
    var e = form.elements[i];
	if(!e.disabled){
		if(e.checked) e.checked = false;
		else e.checked = true;
	}
  }
}

//******************************华为版本
//-- 异常流转控制
function err_ajax_handle(message,ex){
	var code = ex.code;
	var msg = ex.msg;
	loadCompleted();
	switch(code){
		case "1": err_aj_laterondoit(msg);
				break;
		case "2": err_aj_userlogin(msg);
				break;
		case "3": err_aj_userloginclonce(msg);
				break;
		case "99": err_aj_sysexce(msg);
				break;
		default: err_aj_unknowmsg();
	}
}
function err_plus_handle(message,ex){
	var code = ex.code;
	var msg = ex.msg;
	document.getElementById("loadImg").style.display = "none";
	document.getElementById("btnListen").disabled = false;
	document.getElementById("btnSet").disabled = false;
	alert("出现未知错误或系统繁忙，请稍候重试!");
}

//--系统通讯异常，稍后执行操作
function err_aj_laterondoit(message) { //错误函数
	alert(message+"请稍后再执行本操作!");
}

//-- 登录超时，跳转到登录页
function err_aj_userlogin(message) { //错误函数
	alert(message+"请重新执行登录操作!");
	location.href="../index.html";
}

//-- 登录超时，打开登录页，并且关闭当前窗口
function err_aj_userloginclonce(message){
	alert(message+"请重新执行登录操作!");
	window.open("../index.html");
	window.close();
}

//--系统繁忙，稍后执行操作
function err_aj_sysexce(message) { //错误函数
	alert(message+"请稍后再执行本操作!");
}


function err_aj_unknowmsg(){
	//alert("出现未知错误或用户浏览器安全级别设置过高.\n您可以重试或重新设置浏览器安全级别.\n系统将自动返回首页.");
	//location.href="../index.html";
	alert("DWR调用未知错误 -_-|||");
}
	
// 手工编辑搜索项连接
//参数定义：selectitem：搜索类别；content：搜索内容；pageno：定位到当前搜索内容的页数
function searchBySinger(selectitem,content,pageno){
	document.getElementById("_select").value = selectitem;
	document.getElementById("_content").value = content;
	document.getElementById("page_No").value = pageno;
	search();
}

function $getEle(str){
	return document.getElementById(str);
}

function $getFE(form, str){
	return eval("document." + form + "." + str);
}

function $getEleValue(str){
	return document.getElementById(str).value;
}

function tingTone(toneID){
	var url = '';
	url = '../operation/ting.shtml?method=ting&toneID='+toneID;
	window.open(url,'ting','width=398,height=308');
}
function tingToneV2(toneID){
	var url = '';
	url = '../operation/ting.shtml?method=v2ting&toneID='+toneID;
	window.open(url,'ting','width=398,height=308');
}

function orderTone(tonecode,tonetype,ordertype){
	/*
	var url = '';
	url = '../operation/order.shtml?method=loadorder&tonecode='+tonecode+'&tonetype='+tonetype+'&ordertype='+ordertype;
	window.open(url,'ORDERING','width=655,height=490');
	*/
	orderToneV2(tonecode,tonetype,ordertype);
}

//--珠江啤酒活动的的js调用
function orderTone_beer(tonecode,tonetype,ordertype){
	
	orderToneV2_beer(tonecode,tonetype,ordertype);
}

function orderToneV2(tonecode,tonetype,ordertype){
	var url = '';
	var h = 530;
	var w = 750;
	//if(tonetype == "2" || tonetype == 2) h = 510;
	if(tonetype == "2" || tonetype == 2){
	    h = 560;
	    w = 735;                                                                                                                                                            
	    url = '/boxplayer.shtml?r='+Math.round(Math.random()*100000)+'&tid=' + tonecode;
	    window.open(url,'GDIMUSIC_BOXPLAYER','width='+w+',height='+h); 
	}
	else{
	    url = '../operation/v2order.shtml?method=v2loadorder&tonecode='+tonecode+'&tonetype='+tonetype+'&ordertype='+ordertype;
	    window.open(url,'ORDERINGV2','width='+w+',height='+h); 
	}
}

function orderToneUp(tonecode,tonetype,ordertype){
	var url = '';
	var h = 530;
	var w = 750;
	//if(tonetype == "2" || tonetype == 2) h = 510;
	if(tonetype == "2" || tonetype == 2){
	    h = 560;
	    w = 735;                                                                                                                                                            
	    url = '/boxplayer.shtml?r='+Math.round(Math.random()*100000)+'&tid=' + tonecode + '&flag=up';
	    window.open(url,'GDIMUSIC_BOXPLAYER','width='+w+',height='+h); 
	}
	else{
	}
}

function orderToneFm(tonecode,tonetype,ordertype,fm){
	var url = '';
	var h = 530;
	var w = 750;
	//if(tonetype == "2" || tonetype == 2) h = 510;
	if(tonetype == "2" || tonetype == 2){
	    h = 560;
	    w = 735;                                                                                                                                                            
	    url = '/boxplayer.shtml?r='+Math.round(Math.random()*100000)+'&tid=' + tonecode + '&fm=' + fm;
	    window.open(url,'GDIMUSIC_BOXPLAYER','width='+w+',height='+h); 
	}
	else{
	}
}

function orderToneHdFm(tonecode,tonetype,ordertype,fm,hd){
	var url = '';
	var h = 530;
	var w = 750;
	//if(tonetype == "2" || tonetype == 2) h = 510;
	if(tonetype == "2" || tonetype == 2){
	    h = 560;
	    w = 735;                                                                                                                                                            
	    url = '/boxplayer.shtml?r='+Math.round(Math.random()*100000)+'&tid=' + tonecode;
		if(fm != "") url += '&fm=' + fm;
		if(hd != "") url += '&hd=' + hd;
	    window.open(url,'GDIMUSIC_BOXPLAYER','width='+w+',height='+h); 
	}
	else{
	}
}

//--珠江啤酒活动的js调用
function orderToneV2_beer(tonecode,tonetype,ordertype){
	var url = '';
	var h = 530;
	var w = 750;
	if(tonetype == "2") h = 510;
	url = '/operation/v2order.shtml?method=beerloadorder&tonecode='+tonecode+'&tonetype='+tonetype+'&ordertype='+ordertype;
	window.open(url,'ORDERINGV2','width='+w+',height='+h);  
}

//-- 打开彩铃卡订购页面
function orderToneV2ForRingCard(tonecode,tonetype,ordertype){
	var url = '';
	var h = 530;
	var w = 750;
	if(tonetype == "2") h = 510;
	url = '../operation/v2order.shtml?method=v2loadorder&tonecode='+tonecode+'&tonetype='+tonetype+'&ordertype='+ordertype+'&isRingCard=1';
	window.open(url,'ORDERINGV2','width='+w+',height='+h);  
}

function _orderToneV2(tonecode,tonetype,ordertype){
	var url = '';
	var url = '';
	var h = 530;
	var w = 750;
	if(tonetype == "2") h = 510;
	url = '../operation/v2order.shtml?method=v2loadorder&tonecode='+tonecode+'&tonetype='+tonetype+'&ordertype='+ordertype+((typeof(_f) == "undefined" || _f == "") ? "" : "&f="+_f);
	window.open(url,'_ORDERINGV2','width='+w+',height='+h);  
}

function orderToneIndex(tonecode,tonetype,ordertype){
	var url = '';
	url = 'operation/order.shtml?method=loadorder&tonecode='+tonecode+'&tonetype='+tonetype+'&ordertype='+ordertype;
	window.open(url,'ORDERING','width=655,height=490');  
}

function orderToneIndexV2(tonecode,tonetype,ordertype){
	var url = '';
	var h = 530;
	var w = 750;
	if(tonetype == "2") h = 510;
	url = 'operation/v2order.shtml?method=v2loadorder&tonecode='+tonecode+'&tonetype='+tonetype+'&ordertype='+ordertype;
	window.open(url,'ORDERINGV2','width='+w+',height='+h);  
}

/*
function orderToneHD(tonecode,tonetype,ordertype){
	orderToneHDV2(tonecode,tonetype,ordertype);
}
*/

function orderToneHDV2(tonecode,tonetype,ordertype){
	var url = '';
	var h = 530;
	var w = 750;
	if(tonetype == "2") h = 510;
	url = 'http://gd.118100.cn/operation/v2order.shtml?method=v2loadorder&tonecode='+tonecode+'&tonetype='+tonetype+'&ordertype='+ordertype+((typeof(_f) == "undefined" || _f == "") ? "" : "&f="+_f);
	window.open(url,'ORDERINGV2','width='+w+',height='+h);  
}

function orderToneHD2(tonecode,tonetype,ordertype){
	var url = '';
	url = '../../../operation/order.shtml?method=loadorder&tonecode='+tonecode+'&tonetype='+tonetype+'&ordertype='+ordertype;
	window.open(url,'ORDERING','width=655,height=490');
}
function copyTone(tonecode,tonetype,ordertype,copyphonenumber){
	/*
	var url = '';
	url = 'copy.shtml?method=loadcopytone&tonecode='+tonecode+'&tonetype='+tonetype+'&ordertype='+ordertype+'&copyphonenumber='+copyphonenumber;
	window.open(url,'ORDERING','width=655,height=490');
	*/
	var url = '';   
	var h = 530;
	var w = 750;
	if(tonetype == "2") h = 510;
	url = 'copy.shtml?method=loadcopytone&tonecode='+tonecode+'&tonetype='+tonetype+'&ordertype='+ordertype+'&copyphonenumber='+copyphonenumber;
	window.open(url,'ORDERINGV2','width='+w+',height='+h); 
}

function hw_encodeuri(str){
	document.write(encodeURI(str));
}

function switchTag(tag,content)
{
    for(i=1; i <3; i++)
    {
        if ("tag"+i==tag)
        {
            document.getElementById(tag).getElementsByTagName("a")[0].className="selectli"+i;
            document.getElementById(tag).getElementsByTagName("a")[0].getElementsByTagName("span")[0].className="selectspan"+i;
        }else{
            document.getElementById("tag"+i).getElementsByTagName("a")[0].className="";
            document.getElementById("tag"+i).getElementsByTagName("a")[0].getElementsByTagName("span")[0].className="";
        }
        if ("content"+i==content)
        {
            document.getElementById(content).className="";
        }else{
            document.getElementById("content"+i).className="hidecontent";
        }
        document.getElementById("content").className=content;
    }
}

function getObject(idname) {
	if (document.getElementById){
		return document.getElementById(idname);
	}else if (document.all){
		return document.all[idname];
	}else if (document.layers){
		return document.layers[idname];
	}else{
		return null;
	}
}

function Common(){
	this.openpop = function(obj, url, w, h) {
		if(typeof w== undefined){w=510;}
		if(typeof h == undefined){h=220;}
		var t,l;
		if(obj){
			obj.onclick = function(e){
				var tempx = window.screen.availWidth;
				var tempy = window.screen.availHeight
				t = (tempy-h)/2;
				l = (tempx-w)/2;
				window.open(url,'',"width=" + w + ",height=" + h + ",top=" + t + ",left=" + l + ",scrollbars=0,resizable=1,scrollbars=yes");
			}
		}else{
			if(typeof t == undefined){t=200;}
			if(typeof l == undefined){l=100;}
			window.open(url,'',"width=" + w + ",height=" + h + ",top=" + t + ",left=" + l + ",scrollbars=0,resizable=1,scrollbars=yes");
		}
		return false;
	}

	this.create = function(txt,w,h){
		var o = document.createElement(txt,w,h);
		if(w){o.style.width = w+"px";}
		if(h){o.style.height = h+"px";}
		return o;
	};

	this.getCookie = function(name){
		  var cookieValue = "";
		  var search = name + "=";
		  if(document.cookie.length > 0) { 
			offset = document.cookie.indexOf(search);
			if (offset != -1){ 
			  offset += search.length;
			  end = document.cookie.indexOf(";", offset);
			  if (end == -1) end = document.cookie.length;
			  cookieValue = unescape(document.cookie.substring(offset, end));
			}
		  }
		  return cookieValue;
	};

	this.setCookie = function(name, value, hours){
		var expire = "";
		if(hours != null){
			expire = new Date((new Date()).getTime() + hours * 3600000);
			expire = "; expires=" + expire.toGMTString();
		}
		document.cookie = name + "=" + escape(value)+ ";path=/" + expire;
	};

	this.o = function(obj){
		return getObject(obj);
	};

	this.t = function(obj,flag){
		return getTags(obj,flag);
	};

	this.h = function(o){
		if(getObject(o).style.display!="block"){
			getObject(o).style.display = "block";
		}else{
			getObject(o).style.display = "none";
		}
	};
	
	this.p = function(name,bea,val){
		if(bea){
			if(val){this.o(name).value=val;}
			this.o(name).disabled=true;
		}else{
			if(val){this.o(name).value=val;}
			this.o(name).disabled=false;
		}
		return ;
	};

	this.cf = function(txt,url){
		var pass = confirm(txt);
		if(pass){
			location.assign(url);
		}
	};

	this.clk = function(act,id){
		var v = "";
		var o;
		var a = this.t(this.o(id),"input");
		for(var i=0; i<a.length; i++){
			o = a[i];
			if(act=="all"){
				o.checked = true;	
			}else if(act=="un"){
				if(o.checked){
					o.checked = false;
				}else{
					o.checked = true;
				}
			}else{
				var n = a[i].value;
				if(n>0 && a[i].checked){
					v = v + a[i].value + "_";
				}
			}
		}
	};

	this.getHtml = function(id){
		if(this.o(id)){
			return this.o(id).innerHTML;
		}
	};

	this.setObjHtml = function(obj,str){
		if(obj){
			obj.innerHTML=str;
		}
	};

	this.setHtml = function(id,str){
		if(this.o(id)){
			this.o(id).innerHTML=str;
		}
	};

	this.getValue = function(id){
		if(this.o(id)){
			return this.o(id).value;
		}
	};

	this.setValue = function(id,str){
		if(this.o(id)){
			this.o(id).value=str;
		}
	};

	this.getUrl = function(){
		var s = self.location + "";
		return s;
	};

	this.remove = function(obj){
		obj.parentNode.removeChild(obj);
	};

	this.removeById = function(id){
		var obj = this.o(id);
		if(obj)	obj.parentNode.removeChild(obj);
	};

	this.loading = function(flag,ap,top,left){
		/*
		qwLoading("loadingDiv", flag, ap); 
		qwLoading(div, flag, ap, top, left);
		*/
		var obj = this.o("loadingDiv");
		if(top!=undefined){
			obj.style.top = top+"px";
		}
		if(left!=undefined){
			obj.style.left = left+"px";
		}else{
			obj.style.left="40%";
		}
		obj.style.visibility = (flag) ? 'visible':'hidden'
		if(ap){
			this.floatbg(flag);
		}
	};
	this.floatbg = function(i){
		var o = this.o("divZoom");
		if(i==1){
			o.style.visibility = 'visible';
			o.style.height = document.documentElement.scrollHeight+"px";
			o.ondblclick = function(e){
				o.style.visibility = 'hidden';
			};
		}else{
			o.style.visibility = 'hidden';
		}
	};
	this.hint = function(text, dis){
		if(dis==undefined||dis){
			this.o("hint").style.display = "block";
			this.o("hintmsg").innerHTML = text;
		}else{
			this.o("hintmsg").innerHTML = text;
			this.o("hint").style.display = "none";
		}
	};
}

/*
 * 图片按比例缩放
 */
function AutoDrawImage(ImgD,iw,ih){
var image=new Image();
var iwidth = iw; //定义允许图片宽度
var iheight = ih; //定义允许图片高度
image.src=ImgD.src;

if(image.width>0 && image.height>0){
	flag=true;
	if(image.width/image.height>= iwidth/iheight){
		if(image.width>iwidth){ 
		ImgD.width=iwidth;
		ImgD.height=(image.height*iwidth)/image.width;
		}else{
		ImgD.width=image.width; 
		ImgD.height=image.height;
		}
	    //ImgD.alt=image.width+"×"+image.height;
	}
	else{
		if(image.height>iheight){ 
		ImgD.height=iheight;
		ImgD.width=(image.width*iheight)/image.height; 
		}else{
		ImgD.width=image.width; 
		ImgD.height=image.height;
		}
		//ImgD.alt=image.width+"×"+image.height;
	}
}
}

//-- 数据加载提示
function loadingdata() {
	var disabledZone = $getEle('disabledZone');
	var messageZone = $getEle('messageZone');
	var loadingMessage = "数据加载中，请稍候......";
	var t_height;
	//alert(document.body.scrollHeight +","+window.screen.availHeight);
	if (document.body.scrollHeight>window.screen.availHeight)
	{
		t_height = document.body.scrollHeight;
	}else{ 
		t_height = window.screen.availHeight;
	}
	if (!disabledZone) {
		disabledZone = document.createElement('div'); 
		disabledZone.setAttribute('id', 'disabledZone'); 
		disabledZone.style.position = "absolute"; 
		disabledZone.style.zIndex = "1";
		//disabledZone.style.marginRight = "auto";
		//disabledZone.style.lineheight = "auto";
		disabledZone.style.top = "0";
		disabledZone.style.right = "0";
		disabledZone.style.bottom = "0";
		disabledZone.style.left = "0";
		disabledZone.style.zIndex = "60000000"; 
		disabledZone.style.width = "100%"; 
		disabledZone.style.height = t_height;
		disabledZone.style.background="#c0c0c0";
		disabledZone.style.filter = "alpha(opacity=50)";
		disabledZone.style.opacity = "0.5";
		//disabledZone.style.opacity= "0.41";
		//disabledZone.style.textAlign = "center";
		//disabledZone.style.verticalalign = "middle";
		//disabledZone.style.background='url(http://www.google.com/intl/en/images/logo.gif)';
		//var text = document.createTextNode(loadingMessage);
		//disabledZone.appendChild(text);
		document.body.appendChild(disabledZone); 
		messageZone = document.createElement('div'); 
		messageZone.setAttribute('id', 'messageZone'); 
		messageZone.style.position = "absolute";
		messageZone.style.zIndex = "70000000";  
		messageZone.style.top = "50%"; 
		messageZone.style.left = "40%";
		messageZone.style.background = "#000"; 
		messageZone.style.color = "white"; 
		messageZone.style.fontFamily = "Arial,Helvetica,sans-serif"; 
		messageZone.style.padding = "4px"; 
		messageZone.style.textAlign = "center";
		document.body.appendChild(messageZone); 
		var img = document.createElement("img");
		var br = document.createElement("br");
		img.src = "../images/message/loader.gif";
		var text = document.createTextNode(loadingMessage);
		var _div = document.createElement("div"); 
    	_div.innerHTML = "[<span onclick='loadCompleted();return false;' style='cursor:pointer'>取消</span>]";
		messageZone.appendChild(text);
		messageZone.appendChild(_div);
		//messageZone.appendChild(br);
		messageZone.appendChild(img);
		
	}else {
		//messageZone.innerHTML = loadingMessage; 
		disabledZone.style.visibility = 'visible'; 
		messageZone.style.visibility = 'visible'; 
	}
}

//-- 隐藏数据加载提示
function loadCompleted() {
	try{
		$getEle('disabledZone').style.visibility = 'hidden';
		$getEle('messageZone').style.visibility = 'hidden';
	}
	catch(e){
	}
}

function resizeFrame(content){
    try{
        var frames=parent.document.documentElement.getElementsByTagName("iframe");
        for(var i=0;i<frames.length;i++)
        {
            if(frames[i].getAttribute("name")==content)
            {
                frames[i].style.height=document.body.scrollHeight + "px";
                break;
            }
        }
    }catch(e){
       alert(e);
    }
}
var ITEMS_CHAR = "_gd.118100.cn_";
var LISTEM_HIS = "listen_history";
function addHistory(tongname,tonecode,tonetype){
try{
	linkname = tongname;
	address = tonecode + "+" + tonetype + ITEMS_CHAR; 
	wlink = linkname + "+" + address;     
	old_info = getCookie(LISTEM_HIS);
	
	var insert = true;                                      
	if(old_info == null){ 
		insert=true; 
	} 
	else{     
		var old_link = old_info.split(ITEMS_CHAR);
		for(var j=0; j<3; j++){
			if(old_link[j] == null)
				break; 
			if(old_link[j].indexOf(tonecode) != -1)
				insert = false; 
		} 
	}
	if(insert){
		if(getCookie(LISTEM_HIS) != null){
			wlink += getCookie(LISTEM_HIS); 
		}
		setCookie(LISTEM_HIS,wlink);
		//listen_history_show(); 
	}
}catch(e){} 
}
//cookie的相关函数 
//读取cookie中指定的内容 
function getCookieVal(offset){  
    var endstr = document.cookie.indexOf (";", offset);  
    if (endstr == -1) endstr = document.cookie.length;  
    return unescape(document.cookie.substring(offset, endstr));  
}   
function getCookie(name){ 
    var arg = name + "=";  
    var alen = arg.length;  
    var clen = document.cookie.length;  
    var i = 0;  
    while (i < clen){  
        var j = i + alen;  
        if (document.cookie.substring(i, j) == arg) return getCookieVal (j);  
             i = document.cookie.indexOf(" ", i) + 1;  
             if (i == 0) break;  
        }  
    return null;  
}  
//写入cookie 
function setCookie(name, value){  
    var exp = new Date();  
    exp.setTime(exp.getTime() + 336*3600000);
    document.cookie = name + "=" + escape(value) + "; path=/; expires=" + exp.toGMTString();  
}
function listen_history_show(){   
try{
    var history_info = getCookie(LISTEM_HIS);
    var content = "";
    if(history_info != null){ 
		history_arg = history_info.split(ITEMS_CHAR); 
		var i; 
		if(history_arg[0] != null){
			var wlink=history_arg[0].split("+");
			content = "<ul>欢迎！您试听过：<a href=\"javascript:void(orderToneIndex('"+wlink[1]+"','"+wlink[2]+"','1'));\">"+wlink[0]+"</a></ul>";
		}
		if(history_arg[1] != null){
			var wlink = history_arg[1].split("+");
			if(history_arg[2] != null){
				var wlink2 = history_arg[2].split("+");
				content += "<ul><a href=\"javascript:void(orderToneIndex('"+wlink[1]+"','"+wlink[2]+"','1'));\">"+wlink[0]+"</a> <a href=\"javascript:void(orderToneIndex('"+wlink2[1]+"','"+wlink2[2]+"','1'));\">"+wlink2[0]+"</a></ul>";
			}
			else{
				content += "<ul><a href=\"javascript:void(orderToneIndex('"+wlink[1]+"','"+wlink[2]+"','1'));\">"+wlink[0]+"</a></ul>";
			}
		}
		document.getElementById("listenHistory").innerHTML = content;
	} 
	else{
		document.getElementById("listenHistory").innerHTML = "<ul>欢迎！您还没有试听铃音。</ul><ul>赶快去试听吧！</ul>";
	} 
}catch(e){} 
}

function listen_history_show_v2(){   
try{
    var history_info = getCookie(LISTEM_HIS);
	
    var content = "<div class=\"history_info_head\"></div>";
    if(history_info != null){ 
		history_arg = history_info.split(ITEMS_CHAR); 
		var i; 
		for(i=0;i<history_arg.length;i++){
			var wlink=history_arg[i].split("+");
			if(wlink[0] != ""){
				if(i < 5){
					content += "<div id=\"b04_c03_1\"><img src=\"_imgs/index/icon_01.gif\" /></div><div id=\"b04_c03_2\" class=\"font_d\"><a href=\"javascript:void(orderToneIndexV2('"+wlink[1]+"','"+wlink[2]+"','1'));\">"+subStr(wlink[0],12)+"</a></div>";
				}
			}
		}
		document.getElementById("b04_c03").innerHTML = content;
	} 
	else{
		document.getElementById("b04_c03").innerHTML = content;
	} 
}catch(e){
	} 
}

//-- 单击选中则删除相应输入框中的值
function clearInput(inp){
	var input = document.getElementById(inp);
	if(input.value != null && input.value != ""){
		if(input.value == "无须区号"){
			input.value = '';
		}
	}
}
function clearInputV2(inp){
	var input = document.getElementById(inp);
	if(input.value != null && input.value != ""){
		if(input.value == "固话/小灵通请加区号"){
			input.value = '';
		}
	}
}
function clearOrderInput(inp){
	try{
	var input = document.getElementById(inp);
	if(input.value != null && input.value != ""){
		if(input.value == "请输入区号加电话号码"){
			input.value = '';
		}
	}
	}catch(e){} 
}

function loadorderopen(form){
	var w = window.open("about:blank",'ORDERING','width=655,height=490');
	w.focus();
	form.submit();
}
function loadordergather(form){
	var isSel = false;
  	for (var i=0;i<form.elements.length;i++){
		var e = form.elements[i];
		if(e.checked){ 
		   	isSel=true;
			break;
		}
  	}
  	if(isSel){
		loadorderopen(form);
	}
	else{
   		alert("请选择您要试听的铃音!");
		return false;
  	}
	return false;
}
function loadorderopenV2(form){
	var w = window.open("about:blank",'ORDERINGV2','width=750,height=430');
	w.focus();
	form.submit();
}
function loadordergatherV2(form){
	var isSel = false;
  	for (var i=0;i<form.elements.length;i++){
		var e = form.elements[i];
		if(e.checked){ 
		   	isSel=true;
			break;
		}
  	}
  	if(isSel){
		loadorderopenV2(form);
	}
	else{
   		alert("请选择您要试听的铃音!");
		return false;
  	}
	return false;
}

function v2loadorderopen(form){
	var w = window.open("about:blank",'ORDERINGV2','width=750,height=430');
	w.focus();
	form.submit();
}
function v2loadordergather(form){
	var isSel = false;
  	for (var i=0;i<form.elements.length;i++){
		var e = form.elements[i];
		if(e.checked){ 
		   	isSel=true;
			break;
		}
  	}
  	if(isSel){
		v2loadorderopen(form);
	}
	else{
   		alert("请选择您要试听的铃音!");
		return false;
  	}
	return false;
}

function mainloadorderopen(form, action, oldaction, oldmethod){
	var w = window.open("about:blank",'ORDERING','width=655,height=490');
	w.focus();
	form.method.value = "loadordergather";
	form.action = action;
	form.target = "ORDERING";
	form.submit();
	form.action = oldaction;
	form.method.value = oldmethod;
	form.target = "_self";
}
function mainloadordergather(form, action, oldaction, oldmethod){
	var isSel = false;
  	for (var i=0;i<form.elements.length;i++){
		var e = form.elements[i];
		if(e.checked){ 
		   	isSel=true;
			break;
		}
  	}
  	if(isSel){
		//mainloadorderopen(form, action, oldaction, oldmethod);
		mainloadorderopenV2(form, action, oldaction, oldmethod);
	}
	else{
   		alert("请选择您要试听的铃音!");
		return false;
  	}
	return false;
}

function mainloadorderopenV2(form, action, oldaction, oldmethod){
	var w = window.open("about:blank",'ORDERINGV2','width=750,height=430');
	w.focus();
	form.method.value = "v2loadordergather";
	form.action = action;
	form.target = "ORDERINGV2";
	form.submit();
	form.action = oldaction;
	form.method.value = oldmethod;
	form.target = "_self";
}
function mainloadordergatherV2(form, action, oldaction, oldmethod){
	var isSel = false;
  	for (var i=0;i<form.elements.length;i++){
		var e = form.elements[i];
		if(e.checked){ 
		   	isSel=true;
			break;
		}
  	}
  	if(isSel){
		mainloadorderopenV2(form, action, oldaction, oldmethod);
	}
	else{
   		alert("请选择您要试听的铃音!");
		return false;
  	}
	return false;
}

//value 长度大于len，就截断加..
function subStr(value, len) {
	var result = value;
	if (value.length > len) {
		result = value.substring(0, len) + "..";
	}
	return result;
}

//value 长度大于len，就截断
function subDate(value, len, str) {
	var result = value;
	if (value.length > len) {
		result = value.substring(0, len) + str;
	}
	return result;
}

function alertmsg(){
	alert("test测试一下");
}

function isDigit(c)
{
	return ((c >= "0") && (c <= "9"));
}


function myTrim(str)
{
	var end = false;
	var ch;

	while(!end)
	{
		if (str.length == 0) break;
		ch = str.charAt(0);

		if (ch == ' ')
		{
			str = str.substring(1,str.length);
		}
		else
		{
			end = true;
		}
	}

	end = false;

	while(!end)
	{
		if (str.length == 0)
		{
			break;
		}

		ch = str.charAt(str.length-1);

		if (ch == ' ')
		{
			str = str.substring(0,str.length-1);
		}
		else
		{
			end = true;
		}
	}

	return str;
}

function isNumbers(field)
{
	field = myTrim(field);

	var i;

	for (i = 0; i < field.length; i++)
	{
		var c = field.charAt(i);

		if (!isDigit(c) )
		{
			return false;
		}
	}

	return true;
}

/**
 * 计算文本域中的中英文符的总长度
 * @param field 输入的中英文混合字符串
 * @return 文本域中的中英文符的总长度
 */
function calculatebytesize(field)
{
	field = myTrim(field);

	var i;
	var size=0;

	for (i = 0; i < field.length; i++)
	{
		var c = field.charAt(i);

		if ((c >= "!") && (c <= "\u20AC") )
		{
			size=size+1;
		}
		else
		{
			size=size+2;
		}
	}

	return size;
}
function containInvalidChar(field)
{
	for (i = 0; i < field.length; i++)
	{
		var c = field.charAt(i);

		if( c == '&' || c == '<' || c == ';' || c == '*' || c == '(' || c == ')'
		   || c == '>' || c == '"'
		   || c == '@' || c == '#'|| c == '\\'|| c == "'" || c == '?'
		   || c == '$' || c == '^' || c == '\/' || c == '~' || c == '%' || c == '!' || c == '=')
		{
			return true;
		}
	}

	return false;
}

/**
 * 判断提供的字符串是否为空
 * @param field 输入字符串
 * @return true/false
 */
function isEmpty(field)
{
	return ((field == null) || (field.length == 0) || myTrim(field)=="");
}

function getTags(parentobj, tag){
	if (parentobj == null){
		return new Array();
	}else if (typeof parentobj.getElementsByTagName != 'undefined'){
		return parentobj.getElementsByTagName(tag);
	}else if (parentobj.all && parentobj.all.tags){
		return parentobj.all.tags(tag);
	}else{		
		return new Array();
	}
}

function getObject(idname) {
	if (document.getElementById){
		return document.getElementById(idname);
	}else if (document.all){
		return document.all[idname];
	}else if (document.layers){
		return document.layers[idname];
	}else{
		return null;
	}
}
function myring_content(obj)
{
    var arr1 = new Array();
	arr1[1] = document.getElementById("myring_content1");
	arr1[2] = document.getElementById("myring_content2");	
	arr1[3] = document.getElementById("myring_content3");	
	for(var i=1;i<=3;i++)
	{
		if(i==obj)
		 {
			 arr1[i].style.display="";
			 document.getElementById("myring_content_img"+obj).src= '../_imgs/main/myring_icon_0'+obj+'k.gif';
			 //document.getElementById("content_img2").src= '_imgs/index/b02_btn02k.gif';
		 }
		 else
         { 
			 arr1[i].style.display="none";
			 document.getElementById("myring_content_img"+i).src= '../_imgs/main/myring_icon_0'+i+'.gif';
			 //document.getElementById("content_img2").src= '_imgs/index/b02_btn02k.gif';
		 }
		
	}
}
function setContent(s){
	document.getElementById("myring_content1").style.display = "none";
	document.getElementById("myring_content2").style.display = "none";
	document.getElementById("myring_content3").style.display = "none";
	document.getElementById("myring_content_img1").src = "../_imgs/main/myring_icon_01.gif";
	document.getElementById("myring_content_img2").src = "../_imgs/main/myring_icon_02.gif";
	document.getElementById("myring_content_img3").src = "../_imgs/main/myring_icon_03.gif";
	
	document.getElementById("myring_content" + s).style.display = "block";
	document.getElementById("myring_content_img" + s).src = "../_imgs/main/myring_icon_0" + s + "k.gif";
}

//demo:openwin('http://gd.118100.cn','','550','435','200','140')
function openwin( url , name , width , height , left , top ){
	window.open( url , name ,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width="+width+",height="+height+",left="+left+",top="+top );
}

//demo:openwinscroll('http://gd.118100.cn','','550','435','200','140')
function openwinscroll( url , name , width , height , left , top ){
	window.open( url , name ,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width="+width+",height="+height+",left="+left+",top="+top );
}
var path = "";
function main_turn(_i){
	$getEle("c_qtab02_img1").src = "../_imgs/main/myring_t01.gif";
	$getEle("c_qtab02_img2").src = "../_imgs/main/myring_t02.gif";
	$getEle("c_qtab02_img" + _i).src = "../_imgs/main/myring_t0"+ _i +"k.gif";
	
	$getEle("myring_g_content21").style.display = "none";
	$getEle("myring_g_content22").style.display = "none";
	$getEle("myring_g_content2" + _i).style.display = "block";
	
	switch(_i){
		case 1:
			top.location.href = path + "/myring/ringmanage.shtml";
			break;
		case 2:
			top.location.href = path + "/myring/plustone.shtml?method=queryInboxPlus";
			break;
	}
	
}


function hiddenVerify(isImme){
	if(!verifyCounter[0])
		return;
	if(!isImme)
		verifyCounter[0].timeout=setTimeout(function(){verifyCounter[0].killMe()},500);
	else
		verifyCounter[0].killMe();
}
	
VerifyImage.prototype.change=function(){
	var o=$getEle(this.eleID);
	this.seed=Math.random();
	o.src = ringPath + "/verifycode.jpg?n="+this.seed;
}

var verifyCounter=[];
function VerifyImage(eleID,x,y){
	var c=verifyCounter.length;
	this.timeout=null;
	this.ipt = null;
	if(!eleID)
		this.eleID=eleID="verifyIMG_"+c;
	this.od=document.getElementById("_rndImageDIV");
	with(this.od){
		style.position="absolute";
		style.backgroundColor="#E8FBFF";
		style.border="solid 1px #545454";
		style.padding="3px";
		id=eleID+"_anchor";
		style.zIndex = 3000;
	}
	this.templete=('<img id="'+eleID+'" onclick="getVerify(\''+eleID+'\','+c+')" style="cursor:pointer;margin-bottom:5px" src="'+ ringPath +'/verifycode.jpg?n={{_random_}}" alt="获取中..." title="点击更换" width="130" height="50" /><br /><span onclick="getVerify(\''+eleID+'\','+c+')" style="color:black;cursor:pointer">看不清楚?换一个</span>');
	this.seed=Math.random();
	this.appended=false;
	verifyCounter[c]=this;
}

VerifyImage.prototype.killMe=function(){
	this.od.style.display="none";
}

function getVerify(s,n){
	clearTimeout(verifyCounter[n].timeout);
	verifyCounter[n].change();
	if(verifyCounter[n].ipt){
		verifyCounter[n].ipt.value="";
		verifyCounter[n].ipt.focus();
	}
}

function focusGetVerify(o){
    if(o==undefined){
    	return;
    }
	var pos=getPosition(o);
	var e=(verifyCounter.length>0)?(verifyCounter[0]):(new VerifyImage());
	e.ipt = o;
	e.showMe(pos.left,pos.top);
	o.value="";
}

function getPosition(obj){   
    var top=105;   
    var left=obj.offsetWidth;   
    var width=obj.offsetWidth;   
    var height=obj.offsetHeight;   
    while(obj.offsetParent){   
        top += obj.offsetTop;   
        left += obj.offsetLeft;   
        obj = obj.offsetParent;   
    }   
    return {"top":top,"left":left,"width":width,"height":height};   
}
    
VerifyImage.prototype.showMe=function(x,y){
	with(this.od){
		style.top=(y-85)+"px";
		style.left=(x+1)+"px";
	}
	if(!this.appended){
		 this.od.innerHTML=this.templete.replace(/\{\{_random_\}\}/g,this.seed); 
		 this.appended=true;
	}
	this.od.style.display="";
}
//设置class
function shover(o,className)
	{
	if(!o) return;
	o.className = className;		
	}
//添加class
function addClass(o,className)
	{
	if(!o) return;
	o.className = className+" " + o.className;		
	}
//删除class
function repalceClass(o,className)
	{
	if(!o) return;
	//o.className = className+" " + o.className;		
	SunRise.Dom.removeClass(o,className);
	}

//--七彩铃音卡模块新增JS内容	作者：陈凌冰	日期：2009-09-26
//彩铃卡登陆验证
function musicCardLogCheck(){
	var musicCardPassword = document.getElementById("musicCardPassword");
	var checkNumber = document.getElementById("checkNumber");
	if(musicCardPassword.value == null || musicCardPassword.value == ''){
		alert("请输入彩铃卡密码!");
		return false;
	}
	if(checkNumber.value == null || checkNumber.value == ''){
		alert("请输入验证码!");
		return false;
	}
	return true;
}
