var postSubmited = false;
function ctlent(obj) {
	if(postSubmited == false && (event.ctrlKey && window.event.keyCode == 13) || (event.altKey && window.event.keyCode == 83)) {
			if(this.document.input.topicsubmit) this.document.input.topicsubmit.disabled = true;
			if(this.document.input.replysubmit) this.document.input.replysubmit.disabled = true;
			if(this.document.input.editsubmit) this.document.input.editsubmit.disabled = true;
			postSubmited = true;
			this.document.input.submit();
	}
}

var flag=false; 
function DrawImage(ImgD){ 
	var image=new Image(); 
	image.src=ImgD.src; 
	if(image.width>0 && image.height>0){ 
		flag=true; 
		if(image.width>=518){ 
			ImgD.width=518; 
			ImgD.height=(image.height*518)/image.width; 
		}else{ 
			ImgD.width=image.width; 
			ImgD.height=image.height; 
		}  
	} 
} 

function showIntro(objID)
{
	if (document.getElementById(objID).style.display == "none") {
		document.getElementById(objID).style.display = "";
	}else{
		document.getElementById(objID).style.display = "none";
	}
}

function winconfirm(confirmMSG,confirmURL){
	question = confirm(confirmMSG);
	if (question != "0"){
		window.location=confirmURL;
	}
}

function CopyText(obj) {
	ie = (document.all)? true:false
	if (ie){
		var rng = document.body.createTextRange();
		rng.moveToElementText(obj);
		rng.scrollIntoView();
		rng.select();
		rng.execCommand("Copy");
		rng.collapse(false);
	}
}

function emThis(){var et="mailto:?subject="+document.title + "("+location.href+")";location.href=et;}
function blogCheck(){if((navigator.userAgent.indexOf("MSIE")>0)&&(navigator.userAgent.indexOf("Win")>0)){document.all.blogThis.style.display="";}}
function blogThis(u){if(u.charAt(0)=="/"){u="http://"+window.location.host+u}else{u=window.location.href}var sel=document.selection.createRange();sel.expand("word");window.open("http://spaces.msn.com/BlogIt.aspx?Title="+escape(document.title)+"&SourceURL="+escape(u)+"&description="+escape(sel.text));}
function IMThis(docId){
	try	{
		obj=new ActiveXObject("MSNMessenger.P4QuickLaunch");
	}catch(e)
	{
		obj=null;
	};
	if(obj!=null){
		obj.LaunchApp("","");
		//SetCookie('MSGRSTORYID',docId);
	}else{
		alert("Sorry, your configuration doesn't support this feature. The minimum requirements are MSN Messenger 6.0 or higher and Internet Explorer 5.5 or higher.");
	}
}
/*
function SetCookie(sName,sValue){document.cookie=sName+"="+escape(sValue)+";expires="+new Date(2021,10,4).toGMTString()+";path=/"+
((location.host.toLowerCase().indexOf("517sou.net")>=0)?";domain=517sou.net":"2mysite.net");}
*/
function StorePage()
{
        d=document;
        t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:''):(d.getSelection?d.getSelection():'');
        void(keyit=window.open('http://www.365key.com/storeit.aspx?t='+escape(d.title)+'&u='+escape(d.location.href)+'&c='+escape(t),'keyit','scrollbars=no,width=475,height=575,left=75,top=20,status=no,resizable=yes'));
        keyit.focus();
}

function Jtrim(str)  //去空隔函数
{

	var i = 0;
	var len = str.length;
	if ( str == "" ) return( str );
	j = len -1;
	flagbegin = true;
	flagend = true;
	while ( flagbegin == true && i< len)
	{
		if ( str.charAt(i) == " " )
		{
			i=i+1;
			flagbegin=true;
		}
		else
		{
			flagbegin=false;
		}
	}

	while  (flagend== true && j>=0)
	{
		if (str.charAt(j)==" ")
		{
			j=j-1;
			flagend=true;
		}
		else
		{
			flagend=false;
		}
	}

	if ( i > j ) return ("")

	trimstr = str.substring(i,j+1);
	return trimstr;
}


function isemail(s)//验证E-MAIL格式函数
	{
		        
		if (s.length > 100)
		{
			window.alert("email地址长度不能超过100位!");
			return false;
		}

		var regu = "^(([0-9a-zA-Z]+)|([0-9a-zA-Z]+[_.0-9a-zA-Z-]*[0-9a-zA-Z]+))@([a-zA-Z0-9-]+[.])+([a-zA-Z]{2}|net|NET|com|COM|gov|GOV|mil|MIL|org|ORG|edu|EDU|int|INT)$";
		var re = new RegExp(regu);
		if (s.search(re) != -1) {
			return true;
		} else {
		//		window.alert("请输入有效合法的E-mail地址 ！");
			return false;
		}
}
