
/* nieyong wrote to insert the question into cookie*/
/*get html tag*/
String.prototype.trim = function () {
	return this.replace(/^\s*|\s*$/g, "");
};
function v(id) {
	return document.getElementById(id);
}
function prv(id) {
	return window.parent.document.getElementById(id);
}
function vi(id) {
	return v(id).innerHTML.replace(/(^\s*)|(\s*$)/g, "");
}
function vv(id) {
	return v(id).value.replace(/(^\s*)|(\s*$)/g, "");
}
/*cookie handle*/
//设置cookies值
function setcookie(name, value) {
	document.cookie = name + "=" + value;
}
function setcookie2(name, value) {
	document.cookie = name + "=" + escape(value) + ";";
}
//取得cookies值
function getcookie(name) {
	var strArg = name + "=";
	var nArgLen = strArg.length;
	  //获取cookie的长度
	var nCookieLen = document.cookie.length;
	var nEnd;
	var i = 0;
	var j;
	while (i < nCookieLen) {
		j = i + nArgLen;
		if (document.cookie.substring(i, j) == strArg) {
			nEnd = document.cookie.indexOf(";", j);
			if (nEnd == -1) {
				nEnd = document.cookie.length;
			}
			return document.cookie.substring(j, nEnd);
		}
		i = document.cookie.indexOf(" ", i) + 1;
		if (i == 0) {
			break;
		}
	}
	return "";
}
function BASEisNotNum(theNum) {
//判断是否为数字
	if (BASEtrim(theNum) == "") {
		return true;
	}
	for (var i = 0; i < theNum.length; i++) {
		oneNum = theNum.substring(i, i + 1);
		if (oneNum < "0" || oneNum > "9") {
			return true;
		}
	}
	return false;
}
function BASEisNotInt(theInt) {
//判断是否为整数
	theInt = BASEtrim(theInt);
	if ((theInt.length > 1 && theInt.substring(0, 1) == "0") || BASEisNotNum(theInt)) {
		return true;
	}
	return false;
}
function BASEisNotFloat(theFloat) {
//判断是否为浮点数
	len = theFloat.length;
	dotNum = 0;
	if (len == 0) {
		return true;
	}
	for (var i = 0; i < len; i++) {
		oneNum = theFloat.substring(i, i + 1);
		if (oneNum == ".") {
			dotNum++;
		}
		if (((oneNum < "0" || oneNum > "9") && oneNum != ".") || dotNum > 1) {
			return true;
		}
	}
	if (len > 1 && theFloat.substring(0, 1) == "0") {
		if (theFloat.substring(1, 2) != ".") {
			return true;
		}
	}
	return false;
}
/*检测是否是数字*/
function isdigit(s) {
	var r, re;
	re = /\d*/i; //d表示数字,*表示匹配多个数字
	r = s.match(re);
	return (r == s) ? 1 : 0;
}


	//隐藏  显示  模块
function overMouse(id) {
	v(id).style.display = "";
}
function outMouse(id) {
	v(id).style.display = "none";
}
function isView(id){
		document.getElementById('breadnav').focus();//获取焦点
		$.alert("隐藏内容模块 你可以从  ==>首页 ==>设置首页内容 中调用此模块呈现在首页，原模块内容不会发生改变。");
			var hide = v(id).innerHTML;
	        if(hide == '隐藏'){
				v(id).innerHTML = '显示';
				v(id+'DIV').style.display = 'none';
			}
			
			if(hide == '显示'){
				v(id+'DIV').style.display = '';
				v(id).innerHTML = '隐藏';
			}
			 $.ajax({   
	                 url:'/myinfo/updateModule.do',   
	                data:{module:id},   
	                error:function(){   
	               	  alert("提交失败,请检测操作是否有误");   
	                },   
	                 success:function(data){  
	                 	
	                 	if(data == 0){
	                		alert('设置失败,请检测操作是否有误!');
	                	}else{
	                		setTimeout("window.parent.location.reload()",2000);
	                		
	                	}
	                 }   
	             });
	}

function block() {
	var path = "/myinfo/viewModule.do";
	$.funkyUI({url:path, OKEvent:okEvent, css:{width:"400", height:"300"}});
}

function format(sidebar,content) {
	var path = "/myinfo/setFormat.jsp?sidebar="+sidebar+"&content="+content;
	$.funkyUI({url:path, OKEvent:okEvent, css:{width:"500", height:"200"}});
}

function okEvent() {
	alert(window.parent.document.getElementById("moduleForm"));
}
function saveModule(){
		 $.ajax({   
                 url:'/myinfo/updateAllModule.do',   
                 data:{files:$("[name='files'][checked]").val(),experience:$("[name='experience'][checked]").val(),statistics:$("[name='statistics'][checked]").val(),cost:$("[name='cost'][checked]").val(),
                    	fellow:$("[name='fellow'][checked]").val(),leave:$("[name='leave'][checked]").val(),hot:$("[name='hot'][checked]").val()},   
                 error:function(){   
               	 alert("提交失败,请检测操作是否有误");   
                },   
                 success:function(data){   
                	if(data == 1){
                		alert('设置成功');
					  //否则仅关闭窗口
						$.unfunkyUI();
						window.parent.location.reload();
                		
                	}else{
                		alert('设置失败,请检测操作是否有误!');
                		window.close();
                	}
                }   
             });
	}


 function closeDIV(){
  	  	  	var viewDIV =  document.getElementById('success');
  	   		 viewDIV.style.display = 'none';
}

//关闭模态窗口
function closeModal(){
		//否则仅关闭窗口
		$.unfunkyUI();
		window.parent.location.reload();
	}
	
  
  
  	 
  	    //iframe 显示错误 DIV
  	    function iframeCloseDIV(){
  	  	  	var viewDIV =  document.getElementById('success');
  	   		 viewDIV.style.display = 'none';
  	   		 parent.frameResize();
  	    }
  	    
  	    
  	    
  	    //关闭浏览器  不提示
	function close_win()    {   
		    window.opener=null;      
		    //window.opener=top;      
		    window.open("","_self");      
		    window.close();        
    }   