getObj = function(id) {
	return document.getElementById(id);
}
function IsElement(id){
	return document.getElementById(id)!=null ? true : false;
}
function $(id) {
	return document.getElementById(id);
}
function isUndefined(variable) {
	return typeof variable == 'undefined' ? true : false;
}
function add(id,htmlvar){
	$(id).innerHTML += htmlvar;
}
function changeh(id,toid){
	$(id).innerHTML = $(toid).innerHTML;
}
function changhtml(id,htmlvar){
	$(id).innerHTML = htmlvar;
}
function changedisplay(openid,offid1,offid2){
	$(openid).style.display="";
	changec(openid+'_menu','s6');
	$(offid1).style.display="none";
	changec(offid1+'_menu','s8');
	if(IsElement(offid2)){
		$(offid2).style.display="none";
		changec(offid2+'_menu','s8');
	}
}
function change(id,htmlvar){
	$('plfl').value=htmlvar;
	if(htmlvar=='0'){
		htmlvar='';
		$('pollinput1').style.display='none';
		$('pollinput2').style.display='none';
		$('biaoti').style.display='none';
	}else{
		if(htmlvar=='1'){
			$('pollinput1').style.display='none';
			$('pollinput2').style.display='none';
			htmlvar='标题必填,内容大于300字';
		}
		if(htmlvar=='2'){
			htmlvar='标题必填';
			$('pollinput1').style.display='inline';
			$('pollinput2').style.display='inline';
			$('polltext').value='投票选项1\n投票选项2\n投票选项3\n投票选项4';
		}
		$('biaoti').style.display='inline';
	}
	$(id).innerHTML = htmlvar;
}
function changewidth(id,changdu){
	$(id).style.width = changdu;
	if(changdu=='0'){$(id+'s').innerHTML='(滑动星星评价)';}
	if(changdu=='30px'){$(id+'s').innerHTML='(6分，较差)';}
	if(changdu=='60px'){$(id+'s').innerHTML='(7分，一般)';}
	if(changdu=='90px'){$(id+'s').innerHTML='(8分，良好)';}
	if(changdu=='120px'){$(id+'s').innerHTML='(9分，优秀)';}
	if(changdu=='150px'){$(id+'s').innerHTML='(10分，神作)';}
}
function changec(id,newclass){
	$(id).className=newclass;	
}
function quren(url,str){
	if(confirm(str)){
		window.location=url;   
		return true;   
	}else{   
		return false;
	}
}
function calclen(value, maxlength, minlength, outmsg){
	var length = cstrlen(value);

	if(length < minlength) {
		$('lengthlimit').innerHTML = '<span style="color: Red;">长度不足 ' + length + ' / ' + minlength + '</span>';
	}else if(length > maxlength) {
		$('lengthlimit').innerHTML = '<span style="color: Red;">内容过长 ' + length + ' / ' + maxlength + '</span>';
	}else{
		if(!outmsg){
			$('lengthlimit').innerHTML = '字数统计 ' + length + ' / ' + maxlength;
		}else{
			$('lengthlimit').innerHTML="";
		}
	}
}
function cstrlen(str){
	var len = 0;
	for(var i = 0; i < str.length; i++) {
		len += str.charCodeAt(i) < 0 || str.charCodeAt(i) > 255 ? 2 : 1;
	}
	return len;
}
function quickpost(event,plobj,id,sutype,robj,touid){
	if(isUndefined(touid))touid=0;
	if((event.ctrlKey && event.keyCode == 13)){
		checkfourm(plobj,id,sutype,robj,touid);
	}
}
function fastpost(event,plobj,id,sutype,robj){
	if((event.ctrlKey && event.keyCode == 13)){
		checkfast(plobj,id,sutype,robj);
	}
}
function checkradio(theRadio){//取得单选按纽的值
    var theRadioLen = theRadio.length;
    var theRadioValue = 0;
    if (theRadioLen == undefined){
        if (theRadio.checked){
            theRadioValue = theRadio.value;
        }
    }else{
        for (theRadioI=0;theRadioI<theRadioLen;theRadioI++){
            if (theRadio[theRadioI].checked){
                theRadioValue = theRadio[theRadioI].value;
                break;
            }
        }
    }
    return theRadioValue;
}
function checkbox(thebox){//取得多选按纽的值，返回一个数组
	var value=new Array();
	for(var i=0;i<thebox.length;i++) 
	{ 
		if(thebox[i].checked) 
		{
			value[i] = thebox[i].value; 
		} 
	}
	return value;
}
function setSelectState(state)//设置select的可见状态
{   
	var objl=document.getElementsByTagName('select');   
	for(var i=0;i<objl.length;i++)   
	{   
		objl[i].style.visibility=state;   
	}   
}
function findPosX(obj){//取得左边坐标
	var curleft = 0;
	if(obj.offsetParent){
		while(obj.offsetParent){
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	} else if(obj.x){
		curleft += obj.x;
	}
	return curleft;
}
function findPosY(obj){//取得顶部坐标
	var curtop = 0;
	if(obj.offsetParent){
		while(obj.offsetParent){
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	} else if(obj.y){
		curtop += obj.y;
	}
	return curtop;
}
/*弹出窗口，背景变暗*/
var isIe=(document.all)?true:false;   
 
function showMessageBox(wTitle,content,posx,posy,wWidth){//弹出方法
	closeWindow();   
	var bWidth=parseInt(document.documentElement.scrollWidth);   
	var bHeight=parseInt(document.documentElement.scrollHeight);   
	if(isIe){   
		setSelectState('hidden');
	}   
	var back=document.createElement("div");   
	back.id="back";   
	var styleStr="top:0px;left:0px;position:absolute;background:#666;width:"+bWidth+"px;height:"+bHeight+"px;";   
	styleStr+=(isIe)?"filter:alpha(opacity=40);":"opacity:0.40;";   
	back.style.cssText=styleStr;   
	document.body.appendChild(back);   
	var mesW=document.createElement("div");   
	mesW.id="mesWindow";   
	mesW.className="mesWindow";   
	mesW.innerHTML="<div class='mesWindowTop'><div class='left line24'>"+wTitle+"</div><div class=right><input type='button' onclick='closeWindow();' title='关闭窗口' class='closes' value='关闭' /></div></div><div class='mesWindowContent' id='mesWindowContent'>"+content+"</div>";   
	styleStr="left:"+(((posx-wWidth)>0)?(posx-wWidth):pos.x)+"px;top:"+posy+"px;position:absolute;width:"+wWidth+"px;";   
	mesW.style.cssText=styleStr;   
	document.body.appendChild(mesW);   
}
function showBackground(obj,endInt){//背景变暗   
	obj.filters.alpha.opacity+=1;   
	if(obj.filters.alpha.opacity<endInt)   
	{   
		setTimeout(function(){showBackground(obj,endInt)},8);   
	}   
}
function closeWindow(){//关闭窗口
	if(document.getElementById('back')!=null){   
		document.getElementById('back').parentNode.removeChild(document.getElementById('back'));   
	}   
	if(document.getElementById('mesWindow')!=null){   
		document.getElementById('mesWindow').parentNode.removeChild(document.getElementById('mesWindow'));   
	}   
	if(isIe){   
		setSelectState('');
	}   
} 
function messagebox(ev,title,content,wwidth){//元素旁弹出  
	var posx = findPosX(ev);
	var posy = findPosY(ev);
	content = $(content).innerHTML;
	showMessageBox(title,content,posx,posy,wwidth);   
} 
function ietruebody(){
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;
}

function require_css(filename){//引用css
	var oCss = document.createElement("link"); 
	oCss.setAttribute("rel", "stylesheet"); 
	oCss.setAttribute("type", "text/css");  
	oCss.setAttribute("href", filename);
	document.getElementsByTagName("head")[0].appendChild(oCss);//绑定
}
/*
function ResumeError() { 
return true; 
} 
window.onerror = ResumeError;
*/
