// JavaScript Document
	function jumpto(info_id){
		var url  = "code_info.php?id="+info_id;
		window.open(url,'_blank');
	}
//弹窗show_msg
	function msg(msg){
		$.weeboxs.open(msg, {title: '提示',type:'alert'});
	}
//弹框jquery.weebox
	function redir(msg,url){
		$.weeboxs.open(msg, {title: '提示',type:'alert',onclose:function(){location.href=url;}});
	}

	//关闭弹窗
	function closeBox(){
		$.weeboxs.getTopBox().close();
	}
//弹窗后退
	function goback(msg){
		$.weeboxs.open(msg, {title: '提示',type:'alert', onclose:function(){history.back(-1);}});
	}
  

//领号
function open_dialog(gid,is_login,is_need){
	var ref  = location.href;
	var url  = "/ling_code.php?gid="+gid+"&ref="+ref;
	if(uid>0)
	$.weeboxs.open(url, {title:'领号' , type:'msg',contentType:'ajax',width:550});
	else{
	$.weeboxs.open('<div style="width:247px; background-color:#f9f9f9; border:2px solid #cfcfcf; padding:10px;"><iframe frameborder="0" width="247px" height="110px" allowtransparency="true" src="http://u.ufojoy.com/passport/smart_login.php?u=http://ka.ufojoy.com/pages/success.html" scrolling="no"></iframe></div>', {
					   title: '投票领号（快速登录入口）',
					   width:295,
					   height:135,
					   okBtnName:'关闭',
					   type:'alert'
					});
	$('.weedialog .dialog-ok').hide();
	}
	/*if(is_need == 1 && is_login == 0){
	 	$.weeboxs.open('<iframe src="http://www.baidu.com"></iframe>', {title:'用户登陆' ,type:'msg',contentType:'ajax',width:400,height:500});
	}else{}*/
}

//淘号
function open_taocode(gid,is_login,is_need){
	var ref  = location.href;
	var url = "/tao_code.php?gid="+gid+"&ref="+ref;
	
	if(uid>0)
	$.weeboxs.open(url,{title:'淘号',type:'msg',contentType:'ajax',width:550});
	else{
	$.weeboxs.open('<div style="width:247px; background-color:#f9f9f9; border:2px solid #cfcfcf; padding:10px;"><iframe frameborder="0" width="247px" height="110px" allowtransparency="true" src="http://u.ufojoy.com/passport/smart_login.php?u=http://ka.ufojoy.com/pages/success.html" scrolling="no"></iframe></div>', {
					   title: '投票领号（快速登录入口）',
					   width:295,
					   height:135,
					   okBtnName:'关闭',
					   type:'alert'
					});
	$('.weedialog .dialog-ok').hide();
	}
	/*if(is_need == 1 && is_login == 0){	 
		$.weeboxs.open('#register',{title:'用户注册',type:'msg',contentType:'ajax',width:400});
	}else{}*/
}

//打开
function showCodeDetail(id){
	var url = "/code_detail.php?id="+id;
	$.weeboxs.open(url,{title:'号码详情',type:'alert',contentType:'ajax',width:550});
}


//复制到剪贴板
  function copyToClipboard(txt) {   
         if(window.clipboardData) {   
               //window.clipboardData.clearData();   
               window.clipboardData.setData("Text", txt);  
			   alert("复制成功！");
         } else if(navigator.userAgent.indexOf("Opera") != -1) {   
              window.location = txt;   
			  alert("复制成功！");
         } else if (window.netscape) {   
              try {   
                   netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");   
             } catch (e) {   
                  alert("被浏览器拒绝！\n请在浏览器地址栏输入'about:config'并回车\n然后将 'signed.applets.codebase_principal_support'设置为'true'");   
             }
             var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);   
             if (!clip)   
                  return;   
             var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);   
             if (!trans)   
                  return;   
             trans.addDataFlavor('text/unicode');   
             var str = new Object();   
             var len = new Object();   
             var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);   
             var copytext = txt;   
             str.data = copytext;   
             trans.setTransferData("text/unicode",str,copytext.length*2);   
             var clipid = Components.interfaces.nsIClipboard;   
            if (!clip)   
                  return false;   
             clip.setData(trans,null,clipid.kGlobalClipboard);   
             alert("复制成功！")   
        }   
  } 
  
//打开存卡箱
function openAccount(islogin){
	if(!islogin){
		msg('请先登录！');
	}else{
		location.href = "ka_store.php";
	}
}

//赋值到剪切板
	function setClip()
	{
		var acode = $('#acode').text();
		copyToClipboard(acode);
	}

