﻿function OnlyInputNumber(inAddition)
	{
		var objSrc=event.srcElement;
		var k=event.keyCode;
		var charKey=String.fromCharCode(k);	
		if(inAddition)
		{
			if(inAddition.indexOf(charKey)!=-1) return;
		}
		if(k>57||k<48)
			{
				event.keyCode=null;
				return;
			}
	}

function checkNull(objName,message) {
	var i = 0;
	var objLen = 0;
	var strTemp = objName.value;
	if (strTemp.length == 0) {
		window.alert(message + "不能为空");
		name.focus();
		return true;
	} else {
		for (i = 0; i < strTemp.length; i++) {
			if (strTemp.charAt(i) != " ")
				objLen++;
		}
		if (objLen == 0) {
			window.alert(message + "不能为空");
			name.focus();
			return true;
		} else
			return false;
	}
}

function IsNull(objName) {
	var i = 0;
	var objLen = 0;
	var strTemp = objName.value;
	if (strTemp.length == 0) {
		return true;
	} else {
		for (i = 0; i < strTemp.length; i++) {
			if (strTemp.charAt(i) != " ")
				objLen++;
		}
		if (objLen == 0) {
			return true;
		} else
			return false;
	}
}

function checkNumn(strObjName) {
	var objName = document.all(strObjName);
	if (objName.value != "") {
		if (isNaN(objName.value)) {
			return false;
		}
	}
	return true;
}

function IsEmpty(strObjName) {
	var i = 0;
	var objLen = 0;
	var objName = document.all(strObjName);
	var strTemp = objName.value;
	if (strTemp.length == 0) {
		return true;
	} else {
		for (i = 0; i < strTemp.length; i++) {
			if (strTemp.charAt(i) != " ")
				objLen++;
		}
		if (objLen == 0) {
			return true;
		} else
			return false;
	}
}

function SetSelValue(inSelName, inData) {
	var objSel = document.all(inSelName), i;
	for (i = 0; i < objSel.options.length; i++) {
		objSel.options[i].selected = false;
		if (objSel.options[i].value == inData)
			objSel.options[i].selected = true;
	}
}

function getSelValues(objSelName){
	var objSel = document.all(objSelName);
	var selValues = "";
	for(i=0;i<objSel.length;i++){
		selValues += objSel.options[i].value+",";		
	}	
	selValues = selValues.substring(0,selValues.length-1);
	return selValues;
}
    

function ClearAllChk() {
	var aryChk = document.all.tags("INPUT"), i;
	for (i = 0; i < aryChk.length; i++)
		if (aryChk[i].type == "checkbox")
			aryChk[i].checked = false;
}




function GetPeriod(inObjName) {
	var strURL = AbsPath + "/widget/calendar/period.html";
	var strStyle = "dialogWidth=190pt;dialogHeight=187pt;status=off;help=off;scrollbars=off";
	var AryDate = window.showModalDialog(strURL, 'unlimitday', strStyle);
	if (AryDate != "")
		document.all(inObjName).value = AryDate;
}


function GetDate(inObjName) {
	var strURL = AbsPath + "/widget/calendar/date.html";
	var strStyle = "dialogWidth=185pt;dialogHeight=168pt;status=off;help=off;scrollbars=off";
	var AryDate = window.showModalDialog(strURL, '', strStyle);
	if (AryDate.length == 4)
		document.all(inObjName).value = AryDate[0];
}


function selItemMove(fromSelectID,toSelectID){
   var from = document.getElementById(fromSelectID);
   var to = document.getElementById(toSelectID);
            
   for(var i=0;i<from.options.length;i++){
      if(from.options[i].selected){
          to.appendChild(from.options[i]);
                    i = i - 1;
       }
   }
   for(var i=0;i<to.options.length;i++){
  	 to.options[i].selected = false;
   }
}    
function selItemUp(selectID){   
    var sel = document.getElementById(selectID);
    for(var i=1; i < sel.length; i++){
   
      if(sel.options[i].selected){
         if(!sel.options.item(i-1).selected){
         
              var selText = sel.options[i].text;
              var selValue = sel.options[i].value;
                          
              sel.options[i].text = sel.options[i-1].text;
              sel.options[i].value = sel.options[i-1].value;
              sel.options[i].selected = false;
                          
              sel.options[i-1].text = selText;
              sel.options[i-1].value = selValue;
              sel.options[i-1].selected=true;
         }
     }
   }
}

function selItemDown(selectID){ 
    var sel = document.getElementById(selectID);
    for(var i=sel.length -2; i >= 0; i--){
 
     if(sel.options.item(i).selected){
         if(!sel.options.item(i+1).selected){
          
              var selText = sel.options[i].text;
              var selValue = sel.options[i].value;
                          
              sel.options[i].text = sel.options[i+1].text;
              sel.options[i].value = sel.options[i+1].value;
              sel.options[i].selected = false;
                          
              sel.options[i+1].text = selText;
              sel.options[i+1].value = selValue;
              sel.options[i+1].selected=true;
         }
     }
   }
}

function  getIndexByValue(obj,value)
   {
    //alert("value== "+value);
    var len=obj.options.length;
    //alert(len);
    for(var i=0;i<len;i++)
    {
      var a=parseInt(obj.options[i].value);
      var b=parseInt(value);
     if(a==b)
     { //alert("i=="+i);
       return i;
     }
    
    }
    return 0;
    
   }
 function focusByValue(obj,value)
   {
     var i=getIndexByValue(obj,value);
     //alert("select = "+i);
     obj.options[i].selected=true;
    
   }
   
function viewWebmanDetail(webmanId) {
		   var iWidth=800; 
           var iHeight=700;	
           var iTop=(window.screen.height-iHeight)/2;
           var iLeft=(window.screen.width-iWidth)/2;
		   window.open("WebManAction.do?action=webmen&webManId="+webmanId, "站长资料", "height="+iHeight+", width="+iWidth+", top="+iTop+", left="+iLeft+
			", toolbar=no, menubar=no, resizable=yes,scrollbars=yes,location=no, status=no");
		}
//跳转到【网盟】日业绩明细
function goUnionDaylyCp(queryTime,webMan_Account,webMan_ID,real_name){
	var iWidth=800; 
	var iHeight=700;	
	var iTop=(window.screen.height-iHeight)/2;
	var iLeft=(window.screen.width-iWidth)/2;
	window.open("AchieveManage.do?action=queryDaylyCp&queryTime="
									+queryTime+"&webMan_ID="+webMan_ID+"&real_name="+real_name+"&webMan_Account="+webMan_Account+"&first=no&zero=0",
									"业绩明细统计", "height="+iHeight+", width="+iWidth+", top="+iTop+", left="+iLeft+
			", toolbar=no, menubar=no, resizable=yes,scrollbars=yes,location=no, status=no");
}
//跳转到【网盟】日充值明细
function goUnionCharge(queryTime,webMan_Account,webMan_ID,game_ID){
	var iWidth=860; 
	var iHeight=700;	
	var iTop=(window.screen.height-iHeight)/2;
	var iLeft=(window.screen.width-iWidth)/2;
	window.open("AchieveManage.do?action=queryCharge&queryTime="
									+queryTime+"&game_ID="+game_ID+"&webMan_ID="+webMan_ID+"&webMan_Account="+webMan_Account+"&first=no&zero=0",
									"业绩明细统计", "height="+iHeight+", width="+iWidth+", top="+iTop+", left="+iLeft+
			", toolbar=no, menubar=no, resizable=yes,scrollbars=yes,location=no, status=no");
}

//跳转到【公会】日业绩明细
function goGuildDaylyCp(s_Time,e_time,webMan_Account,webMan_ID){
	var iWidth=860; 
	var iHeight=700;	
	var iTop=(window.screen.height-iHeight)/2;
	var iLeft=(window.screen.width-iWidth)/2;
	var queryTime;
	if(s_Time != ''&& e_time != ''){
		queryTime = s_Time+":"+e_time;
	}
	window.open("AchieveManage.do?action=guild_Daylycp&queryTime="
									+queryTime+"&webMan_ID="+webMan_ID+"&webMan_Account="+webMan_Account+"&first=no&zero=0",
									"日业绩明细", "height="+iHeight+", width="+iWidth+", top="+iTop+", left="+iLeft+
			", toolbar=no, menubar=no, resizable=yes,scrollbars=yes,location=no, status=no");	
}
//跳转到【公会】日业绩明细 new
function goGuildDaylyCpNew(queryTime,webMan_Account,webMan_ID,real_name){
	var iWidth=860; 
	var iHeight=700;	
	var iTop=(window.screen.height-iHeight)/2;
	var iLeft=(window.screen.width-iWidth)/2;
	
	window.open("AchieveManage.do?action=guild_Daylycp&queryTime="
									+queryTime+"&webMan_ID="+webMan_ID+"&real_name="+real_name+"&webMan_Account="+webMan_Account+"&first=no&zero=0",
									"日业绩明细", "height="+iHeight+", width="+iWidth+", top="+iTop+", left="+iLeft+
			", toolbar=no, menubar=no, resizable=yes,scrollbars=yes,location=no, status=no");	
}

//跳转到【媒体】日业绩明细
function goMediaDaylyCp(s_Time,e_time,webMan_Account,webMan_ID){	
	var iWidth=860; 
	var iHeight=700;	
	var iTop=(window.screen.height-iHeight)/2;
	var iLeft=(window.screen.width-iWidth)/2;
	var queryTime;
	if(s_Time != ''&& e_time != ''){
		queryTime = s_Time+":"+e_time;
	}
	window.open("AchieveManage.do?action=media_Daylycp&queryTime="
									+queryTime+"&webMan_ID="+webMan_ID+"&webMan_Account="+webMan_Account+"&first=no&zero=0",
									"日业绩明细", "height="+iHeight+", width="+iWidth+", top="+iTop+", left="+iLeft+
			", toolbar=no, menubar=no, resizable=yes,scrollbars=yes,location=no, status=no");
}
//跳转到【媒体】日业绩明细 新方法
function goMediaDaylyCpNew(queryTime,webMan_Account,webMan_ID){	
	var iWidth=860; 
	var iHeight=700;	
	var iTop=(window.screen.height-iHeight)/2;
	var iLeft=(window.screen.width-iWidth)/2;
	window.open("AchieveManage.do?action=media_Daylycp&queryTime="
									+queryTime+"&webMan_ID="+webMan_ID+"&webMan_Account="+webMan_Account+"&first=no&zero=0",
									"日业绩明细", "height="+iHeight+", width="+iWidth+", top="+iTop+", left="+iLeft+
			", toolbar=no, menubar=no, resizable=yes,scrollbars=yes,location=no, status=no");
}
//跳转到按游戏充值统计画面
function goChargeByGame(CpType,s_Time,e_time,webMan_ID,type,webman_Account){
	var iWidth=800; 
	
	var iHeight=500;	
	var iTop=(window.screen.height-iHeight)/2;
	var iLeft=(window.screen.width-iWidth)/2;
	var queryTime;
    var flag="AchieveManage.do?action=chargeByGame";  
    if(s_Time != ''&& e_time != ''){
	queryTime = s_Time+":"+e_time;}
    if(CpType==1){
        flag="CpaAchieveManage.do?action=queryCpaDaylyDetail"; }
	window.open(flag+"&queryTime="+queryTime+"&webMan_ID="+webMan_ID+"&type="+type+"&_webman_Account="+webman_Account,
	                          	"游戏统计", "height="+iHeight+", width="+iWidth+", top="+iTop+", left="+iLeft+
			", toolbar=no, menubar=no, resizable=yes,scrollbars=yes,location=no, status=no");
}
	
