var theshowerrormsgopacity = 0;	// 透明度
// 使用方法：标题，内容，宽度，高度，回调函数（如果没有的话传null）
// exp1:msgwindow.showmsg('testtitle','bhjbjhb',320,200,null);
// exp2:msgwindow.showmsg('testtitle','bhjbjhb',320,200,tf);
// exp3:$debug('test');
var msgwindow=function(){
	this.theshowerrormsgopacity=0;
	this.callback=null;
};
// 创建显示div
msgwindow.showmsg=function(title, content, width, height, callback) {
	if($('theshowerrormsg')){
	}else{
	hidehandle();
	if (!width) {
		width = 320;
	}
	if (!height) {
		height = 200;
	}
	var eldiv = document.createElement("div");
	eldiv.id = "theshowerrormsg";
	eldiv.style.backgroundColor = "#000000";
	eldiv.style.top = 0;
	eldiv.style.left = 0;
	var wwidth=document.documentElement.scrollWidth;
	var hheight=document.documentElement.scrollHeight;
	try{
		if(document.documentElement.clientWidth>=wwidth){
			wwidth=document.documentElement.clientWidth;
		}
		if(document.documentElement.clientHeight>=hheight){
			hheight=document.documentElement.clientHeight;
		}
	}catch(e){};
	eldiv.style.width = wwidth+"px";
	eldiv.style.height = hheight+"px";
	eldiv.style.position = "absolute";
	eldiv.style.display = "";
	eldiv.style.zIndex = "65534";
	var str = "";
	if (callback) {
		str = "<button onclick=\"msgwindow.removeerrormsg(true)\">确定</button>";
		msgwindow.callback=callback;
	}
	var errorstr = "<div onmouseup='upDrag()' class='dragAble' onmousedown='initDrag(event)' style=\"background-color:#ffffff;width:" + width + "px;height:" + height + "px;top:" + (height/2 +150+document.documentElement.scrollTop) + "px;left:" + ((document.documentElement.scrollWidth - width) / 2) + "px;z-index:65535;border:solid 1px #63f7fb;position:absolute\"><div style=\"cursor: move;font-weight:bolder;color:#FFCC00;height:18px;padding:2px;font-size:14px;margin-bottom:3px;padding-left:5px;word-break: break-all;background-color:#11478d;\">" + title + "</div><div style=\"margin:10px;word-break: break-all;\">" + content + "</div><div align=\"center\" style=\"height:20px;vertical-align: bottom;margin:5px;\">" + str + "<button style=\"border:1px #000 solid;background-color:#11478d;color:#fc0;\" onclick=\"msgwindow.removeerrormsg(false)\">";
	if (callback){
		errorstr+="取消";
	}else{
		errorstr+="确定";
	}
	errorstr+="</button></div></div>";
	eldiv.innerHTML = errorstr;
	eldiv.style.filter = "alpha(Opacity=0)";
	eldiv.style.opacity = "0";
	document.body.appendChild(eldiv);
	eldiv.timer = window.setInterval(this.displaytheshowerrormsg, 150);
	}
}
// 隐藏所有select
function hidehandle(){
	var els=document.getElementsByTagName("select");
	for(var i=0;i<els.length; i+=1){
		var objTemp = els[i];
		objTemp.style.display="none";
	}
}
// 显示所有select
function showhandle(){
	var els=document.getElementsByTagName("select");
	for(var i=0;i<els.length; i+=1){
		var objTemp = els[i];
		objTemp.style.display="";
	}
}
// 移除
msgwindow.removeerrormsg=function(temp) {
	var el = $("theshowerrormsg");
	if (temp) {
		this.callback.call();
	}
	el.timer = window.setInterval(this.disappeartheshowerrormsg, 150);
}
// 渐显
msgwindow.displaytheshowerrormsg=function() {
	var eldiv = $("theshowerrormsg");
	this.theshowerrormsgopacity += 25;
	if (this.theshowerrormsgopacity >= 85) {
		window.clearInterval(eldiv.timer);
	} else {
		eldiv.style.opacity = "0." + this.theshowerrormsgopacity;
		eldiv.style.filter = "alpha(Opacity=" + this.theshowerrormsgopacity + ")";
	}
}
// 渐隐
msgwindow.disappeartheshowerrormsg=function() {
	var eldiv = $("theshowerrormsg");
	this.theshowerrormsgopacity -= 45;
	if (this.theshowerrormsgopacity <= 0) {
		window.clearInterval(eldiv.timer);
		document.body.removeChild(eldiv);
		showhandle();
	} else {
		eldiv.style.opacity = "0." + this.theshowerrormsgopacity;
		eldiv.style.filter = "alpha(Opacity=" + this.theshowerrormsgopacity + ")";
	}
}
// pic
// distype 1:60*60;2:280*200
msgwindow.showpic=function(str ,distype){
	var imgstr="";
	if(distype){
		if(distype==1){
			imgstr="<img src=\""+str+"\"/ height='60' width='60'>";
			msgwindow.showmsg('show thepic',imgstr,120,80,null);
		}	
	}else{
		imgstr="<img src=\""+str+"\"/ height='200' width='280'>";
		msgwindow.showmsg('show thepic',imgstr,305,260,null);
	}
}
// getElementById();
function $(element) {
	if (typeof element == "string") {
		element = document.getElementById(element);
	}
	return element;
}
// debug
// type可以为div、input和不写，不写的话直接输出（对象也可以、但对象信息应该显示不全），input输出value，div输出innerHTML
function $debug(str,type) {
	var debugstr="";
	var awidth="80%";
	var aheight="100%";
	if(!type){
		debugstr=str;
		try{
			if(typeof str != "string"){
				debugstr="<textarea cols='70' rows='30'>";
				for(var i in str){
					var property=str[i];
					debugstr+=i+" = "+property+"\n";
				}
			}
			debugstr+="</textarea>";
			awidth=640;
			aheight=480;
		}catch(ex){}
	}else if(type=="div"){
		debugstr=str.innerHTML;
	}else if(type=="input"){
		debugstr=str.value;
	}
	msgwindow.showmsg("debug", debugstr, awidth, aheight, null);
}
// 得到元素left值
function getLeft(el) {
	return !el ? 0 : (el.offsetLeft + getLeft(el.offsetParent));
}   
// 得到元素top值
function getTop(el) {
	return !el ? 0 : (el.offsetTop + getTop(el.offsetParent));
}
// 鼠标拖动
var nn6=document.getElementById&&!document.all;
var isdrag=false;
var y,x;
var oDragObj;
var oZindex;
function myMoveMouse(evt) {
	if (isdrag) {
		evt = evt || window.event;
		oDragObj.style.top  =  (nTY + evt.clientY - y)+"px";
		oDragObj.style.left  =  (nTX + evt.clientX - x)+"px";
		return false;
	} 
} 
function initDrag(evt) {
 	var oDragHandle = nn6 ? evt.target : event.srcElement;
	while (oDragHandle.tagName != "HTML" && oDragHandle.className != "dragAble") {
		oDragHandle = nn6 ? oDragHandle.parentNode : oDragHandle.parentElement;
	} 
	if (oDragHandle.className=="dragAble") {
		isdrag = true;
		if(!oDragObj){
			oZindex = oDragHandle.style.zIndex;
			oDragHandle.style.zIndex = 100;
		}
		if (oDragObj && oDragHandle!=oDragObj){
			oDragObj.style.zIndex = oZindex;
			oZindex = oDragHandle.style.zIndex;
			oDragHandle.style.zIndex = 100;
		}
		nTY = parseInt(oDragHandle.style.top+0);
		y = nn6 ? evt.clientY : event.clientY;
		nTX = parseInt(oDragHandle.style.left+0);
		x = nn6 ? evt.clientX : event.clientX;
		oDragObj = oDragHandle;
		document.onmousemove=myMoveMouse;
		return false;
	}
} 
function upDrag(){
	isdrag=false;
}
// 用,来分隔数字
function outputComma(number) {
    number = '' + number
    if (number.length > 3) {
        var mod = number.length%3;
        var output = (mod > 0 ? (number.substring(0,mod)) : '');
        for (i=0 ; i < Math.floor(number.length/3) ; i+=1) {
            if ((mod ==0) && (i ==0))
                output+= number.substring(mod+3*i,mod+3*i+3);
            else
                output+= ',' + number.substring(mod+3*i,mod+3*i+3);
        }
        return (output);
    }
    else return number;
}
//单开页预览type 0:str;1:pic
function previewpage(str,type){
	var xx=window.open('', '预览', 'menubar=null,width=600,height=300,resizable=yes');
	if(type==1){
		str="<img src='"+str+"'/>";
	}
	xx.document.writeln(str);
}
// 左上箭头提示
// example:<input type="text" id="ttttttt" onmouseover="left_up_tip(this,-100,30,'fsdfsdfsdfsdfds',200)" onmouseout="close_tip()"/>
function left_up_tip(tsrc,tleft,ttop,tstr,twidth){
	if($('the_up_tip')){
	}else{
		var eldiv = document.createElement("div");
		if (!twidth) {
			twidth = 320;
		}
		eldiv.id = "the_up_tip";
		eldiv.style.top = getTop(tsrc)+ttop+"px";
		eldiv.style.left = getLeft(tsrc)+tleft+"px";
		eldiv.style.width = twidth+"px";
		eldiv.style.position = "absolute";
		eldiv.style.zIndex = "65535";
		eldiv.style.marginLeft="200px";
		eldiv.style.fontSize="12px";
		eldiv.style.lineHeight="18px"; 
		tstr="<div style=\"width:"+twidth+"px; position: relative; top:1px;\"><img src=\"/fscn/web/images/tips/tip1.png\" style=\"display:block;\" /></div><div style=\"border:1px solid #999; background:#f7fae3; width:"+(twidth-10)+"px; font-size:12px; padding:8px;\">"+tstr+"</div>";
		eldiv.innerHTML=tstr;
		document.body.appendChild(eldiv);
	}
}
// 左下箭头提示
// example:<input type="text" id="ttttttt" onmouseover="left_down_tip(this,-200,-58,'fsdfsdfsdfsdfds',200)" onmouseout="close_tip()"/>
function left_down_tip(tsrc,tleft,ttop,tstr,twidth){
	if($('the_up_tip')){
	}else{
		var eldiv = document.createElement("div");
		if (!twidth) {
			twidth = 320;
		}
		eldiv.id = "the_up_tip";
		eldiv.style.top = getTop(tsrc)+ttop+"px";
		eldiv.style.left = getLeft(tsrc)+tleft+"px";
		eldiv.style.width = twidth+"px";
		eldiv.style.position = "absolute";
		eldiv.style.zIndex = "65535";
		eldiv.style.marginLeft="200px";
		eldiv.style.fontSize="12px";
		eldiv.style.lineHeight="18px"; 
		tstr="<div style=\"border:1px solid #999; background:#f7fae3; width:"+(twidth-10)+"px; font-size:12px; padding:8px;\">"+tstr+"</div><div style=\"width:"+twidth+"px; position: relative; top:-1px\"><img src=\"/fscn/web/images/tips/tip2.png\" style=\"display:block;\" /></div>";
		eldiv.innerHTML=tstr;
		document.body.appendChild(eldiv);
	}
}
// 关闭提示
function close_tip(){
	try{
		if (document.readyState == "complete"){
			document.body.removeChild($('the_up_tip'));
		}
	}catch(e){}
}
// 单开新页显示图片
function openPic() {window.open(this.src, "", "");}
//通用图片处理大小，按宽度等比例缩小,type：不写是按宽度，高度；1：宽度；2：高度
function pic_resizer(picname,picwidth,picheight,type){
	var pic_name=picname;
	var pic_width=picwidth;
	var pic_height=picheight;
	var vtype=null;
	if(type){
		vtype=type;
	}
	var elpics=null;
	if(pic_name){
		elpics=document.getElementsByName(pic_name);
	}else{
		elpics=document.getElementsByTagName("img");
	}
	for(var i=0;i<elpics.length;i++){
		elpics[i].onload=function (){
			if(vtype){
				if(vtype==1 && this.width>pic_width){
					this.height=this.height*pic_width/this.width;
					this.width=pic_width;
					this.style.cursor='pointer';
					this.onclick=openPic;
						this.style.display="block";
				}
				if(vtype==2 && this.height>pic_height){
					this.width=this.width*pic_height/this.height;
					this.height=pic_height;
					this.style.cursor='pointer';
					this.onclick=openPic;
						this.style.display="block";
				}
			}else{
				if(this.width>pic_width || this.height>pic_height){
					var rate1=this.width/pic_width;
					var rate2=this.height/pic_height;
					if(rate1>rate2){
						this.height=this.height*pic_width/this.width;
						this.width=pic_width;
						this.style.cursor='pointer';
						this.onclick=openPic;
						this.style.display="block";
					}else{
						this.width=this.width*pic_height/this.height;
						this.height=pic_height;
						this.style.cursor='pointer';
						this.onclick=openPic;
						this.style.display="block";
					}
				}
			}
		};
	}
}
function bookmark(){
	var title=document.title
	var url=document.location.href
	if (window.sidebar) window.sidebar.addPanel(title, url,"");
	else if( window.opera && window.print ){
	var mbm = document.createElement('a');
	mbm.setAttribute('rel','sidebar');
	mbm.setAttribute('href',url);
	mbm.setAttribute('title',title);
	mbm.click();}
	else if( document.all ) window.external.AddFavorite( url, title);
}
// blog 左侧开关
function blog_o_c_l(el){
	if(el.src.indexOf("/fscn/web/images/blog/one/left_2.jpg")!=-1){
		$('div_'+el.id).style.display="none";
		el.src="/fscn/web/images/blog/one/left_1.jpg";
	}else{
		$('div_'+el.id).style.display="";
		el.src="/fscn/web/images/blog/one/left_2.jpg";
	}
}
//剪贴板
function copytoclip(str){
	window.clipboardData.setData("Text",str);
}
// 跳转页面
function goto_page(str,value){window.location=str+value;}
// blog 评论开关
function blog_o_c_r(el){
	if(el.src.indexOf("/fscn/web/images/blog/one/blog_pl_1.jpg")!=-1){
		$('div_'+el.id).style.display="none";
		el.src="/fscn/web/images/blog/one/blog_pl_2.jpg";
	}else{
		$('div_'+el.id).style.display="";
		el.src="/fscn/web/images/blog/one/blog_pl_1.jpg";
	}
}
function checkclick(msg){if(confirm(msg)){try{event.returnValue=true;}catch(e){return true;}}else{try{event.returnValue=false;}catch(e){return false;}}}
function shw_reputation(num){
	$("re_div_"+num).style.display="";
}
function dis_reputation(num){
	$("re_div_"+num).style.display="none";
}
function open_indexpic(srce){
	try{
		if (document.readyState == "complete" || !document.readyState){
			var src=srce.src;
			if(srce==null || src=='' || src.indexOf("fserror")!=-1){
				
			}else{
				var temp=0;
				if($('the_up_tip')){
					temp=$('the_up_tip').ex;
					document.body.removeChild($('the_up_tip'));
				}
				if(temp==0 || temp!=src){
					var eldiv = document.createElement("div");
					eldiv.id = "the_up_tip";
					eldiv.ex=src;
					eldiv.onclick=close_tip;
					eldiv.style.top = getTop(srce)+"px";
					eldiv.style.left = getLeft(srce)+170+"px";
					eldiv.style.position = "absolute";
					eldiv.style.zIndex = "65535";
					eldiv.innerHTML="<img style='border:5px solid #ccc;cursor:pointer;' src='"+src+"' name='c_index_fs_ss' onload=\"pic_resizer('c_index_fs_ss',64,48);\" id=\"imggggg_50fs\" alt='"+srce.alt+"'/>";
					document.body.appendChild(eldiv);
				}
			}
		}
	}catch(e){}
}
function copyurltoclip(atitle){
var clipBoardContent="";clipBoardContent+="推荐给你一篇不错的文章";clipBoardContent+="\n";clipBoardContent+=atitle;clipBoardContent+="\n";clipBoardContent+=document.location;window.clipboardData.setData("Text",clipBoardContent);alert("复制成功，已经把该网址复制到剪贴板，可以打开QQ或者MSN的对话框，然后使用（Ctrl+V或鼠标右键）粘贴功能给你的好友");
}
function dignews(newsid){var url = '/fscn/news/dignews.action?id='+newsid;var loader1=new net.ContentLoader(url,dignewsb,onerrors,"POST","");}
function dignewsb(){var strText = this.req.responseText;$('the_newsdignum').innerHTML=strText;}