/////////////////////////////////////////////////////////////
//                System Class
/////////////////////////////////////////////////////////////


/////////////////////////////////////////////////////////////
//                Common Function
/////////////////////////////////////////////////////////////
// 根据HTML标签ID获取相应的标签对象
function getObject(objectId) {
    if(document.getElementById && document.getElementById(objectId)) {
		// W3C DOM
		return document.getElementById(objectId);
    } else if (document.all && document.all(objectId)) {
		// MSIE 4 DOM
		return document.all(objectId);
    } else if (document.layers && document.layers[objectId]) {
		// NN 4 DOM.. note: this won't find nested layers
		return document.layers[objectId];
    } else {
		return false;
    }
}

// 获取指定字符串的字节长度：汉字为双字节
function getBytesLength(str) {
    var re=/[\x00-\xff]/g;
    var len=str.length;
    var array=str.match(re);
    
    if (array==null) {
        array="";
    }
    return len*2 - array.length;
}

function checkStrLen(value) {
	var str, Num = 0;
	
	for (var i=0;i < value.length; i++){
		str = value.substring(i, i+1);
		if (str <= "~")  //判断是否双字节
			Num+=1;
		else
			Num+=2;
	}
	
	return Num;
}

function MM_goToURL() { //v3.0
	var i, args=MM_goToURL.arguments;
	document.MM_returnValue = false;

	for (i=0; i<(args.length-1); i+=2) {
		eval(args[i]+".location='"+args[i+1]+"'");
	}
}

function GetRandomNum(Min,Max){
	// 生成随机数
	var Range = Max - Min;
	var Rand = Math.random();
	return(Min + Math.round(Rand * Range));
}

//////////////////////////////////////////////////////////////



function showWindowOpen(url, w, h, t, l, s) {
	window.open(url, "", "width=" + w + ", height=" + h 
		+ ", resizable=0, top=" + t + ", left=" + l 
		+ ", toolbar=no, menubar=no, scrollbars=" + s 
		+ ", resizable=no, location=no, status=no");
}

function OpenWindow(page, size) {
	window.open(page, "newuser", "toolbar=no,location=no,directories=no,status=no,menubar=yes,scrollbars=yes,resizable=no," + size);
}

//////////////////////////////////////////////////////////////

// 标题分页事件
function Title00_onClick(TrId,TdId,MaxTrId){
	for (var i=1;i<=MaxTrId;i++){
		if ( (getObject("Title00_Tr"+TrId+"_"+i+"_"+1).style != null) && (getObject("Title00_Tr"+TrId+"_"+i+"_"+2).style != null) && (getObject("Info00_Tr"+TrId+"_"+i).style != null) ) {
			if (i==TdId){
				getObject("Title00_Tr"+TrId+"_"+i+"_"+1).style.display="";
				getObject("Title00_Tr"+TrId+"_"+i+"_"+2).style.display="none";
				getObject("Info00_Tr"+TrId+"_"+i).style.display="";
			}else{
				getObject("Title00_Tr"+TrId+"_"+i+"_"+1).style.display="none";
				getObject("Title00_Tr"+TrId+"_"+i+"_"+2).style.display="";
				getObject("Info00_Tr"+TrId+"_"+i).style.display="none";
			}
		}
	}
}

function Title_onClick(TrId,TdId,MaxTrId){
	for (var i=1;i<=MaxTrId;i++){
		if ( (getObject("Title_Tr"+TrId+"_"+i+"_"+1).style != null) && (getObject("Title_Tr"+TrId+"_"+i+"_"+2).style != null) && (getObject("Info_Tr"+TrId+"_"+i).style != null) ) {
			if (i==TdId){
				getObject("Title_Tr"+TrId+"_"+i+"_"+1).style.display="";
				getObject("Title_Tr"+TrId+"_"+i+"_"+2).style.display="none";
				getObject("Info_Tr"+TrId+"_"+i).style.display="";
			}else{
				getObject("Title_Tr"+TrId+"_"+i+"_"+1).style.display="none";
				getObject("Title_Tr"+TrId+"_"+i+"_"+2).style.display="";
				getObject("Info_Tr"+TrId+"_"+i).style.display="none";
			}
		}
	}
}

