var	doubleclickord=Math.random()*1000000000;
var imageServer="http://image.eet-china.com/";
var forumServer="http://forum.eet-cn.com/";
var serverName="http://www.eet-china.com/";
function s_chg(model)
{
	if (IsHomePage){
		document.getElementById('lc').innerHTML = '<span class="element1"><INPUT id=keyword name=keyword type=text size="50"></span>';
	}else{
		document.getElementById('lc').innerHTML = '<span class="element1"><b>分类：</b></span><span class="element1" id=dropdownsearch></span>'+
												  '<span class="element1"><b>关键词：</b></span>'+ 	 										  	  
	 										      '<span class="element1"><INPUT id=keyword type=text name=keyword ></span>';		
	}
	document.getElementById('btn1').innerHTML = '<span class="element1"><input name="image" type="image" src="'+imageServer+'search.gif" align="absmiddle"></span>'+	  
	  											'<span class="element1"><a id=searchhref href="'+imageServer+'advanced-search!default.jspa">高级搜索</a>|<a id=helphref href="'+forumServer+'STATIC/SITE/KEYWHELP.HTM" >帮助</a></span>';
	var tmpS=document.getElementById('dropdownsearch');
	if (tmpS){
		tmpS.innerHTML=WriteCustomDropdownList(selectTypeArray,'select',selectVal);
	}
}
function selectCategory(forumID) {
	window.location.replace('FORUM_LIST_'+forumID+'_0.HTM');
}
function forwardDownloadPage(alink, downloadTimes, icon, fileName, subject,thisPageUrl) {
    var downloadForm = document.getElementById("downloadForm");
    var href = alink.href;
    if(href.indexOf("pageUserId=-1") > -1) { 
    //var domain = href.substring(0, href.indexOf("/", 7)).replace("forum", "www");
    //window.location = domain + "/login.do?fromWhere="+thisPageUrl;
    login(thisPageUrl);
    return false;
    } else {
        downloadForm.href.value = href;
        downloadForm.downloadTimes.value = downloadTimes;
        downloadForm.icon.value = icon;
        downloadForm.fileName.value = fileName;
        downloadForm.subject.value = subject;
        downloadForm.submit();
    }
    return false;
}	
function popWin(newURL,wth,hgh)
{
	window.open(newURL,'','width='+wth+',height='+hgh+',left=70,top=130,scrollbars=yes');
}
<!--
function NewWin(newURL,wth,hgh)
{
	window.open(newURL,'','width='+wth+',height='+hgh+',left=70,top=130,scrollbars=yes');
}
function checkns4() {
	if (document.layers) {
		document.write("<style>");	
		document.write("BODY { margin-left: 2px }");
		document.write("</style>");
	}
}
checkns4();
NS4 = (document.layers);
IE4 = (document.all);
ver4 = (IE4);  
isMac = (navigator.appVersion.indexOf("Mac") != -1);
isMenu = (IE4 && !isMac); 
function popUp(){return};
function popDown(){return};
function startIt(){return};
if (!ver4) event=null;
//-->
var selectTypeArray =new  Array();
selectTypeArray.push('技术文章+WENKU');
selectTypeArray.push('新品+XINZHI');
selectTypeArray.push('新闻+XINWEN');
selectTypeArray.push('实例+SHILI');
selectTypeArray.push('小组+XIAOZU');
selectTypeArray.push('专题论坛+ZHUANTI');
selectTypeArray.push('自由论坛+LUNTAN');
selectTypeArray.push('博客+BOKE');
selectTypeArray.push('研讨会+YANTAOHUI');
selectTypeArray.push('辞典+CIDIAN');
var IsHomePage=false;
var searchModel = 'globalsources';
var selectVal = 'LUNTAN';

var pollTypePost=400;
var blog=31;
function vote(pollForm,option,pollId,objectId)
{
	var action = "/ajaxVote.jspa";
	var pars ="pollId="+pollId+"&option="+option+"&objectId="+objectId;		
	var myAjax = new Ajax.Request(action,{method: 'post', parameters: pars, onComplete: updatePage} );
}
function updatePage(xmlHttp) 
{
	if (xmlHttp.readyState == 4) 
	{
	  	if (xmlHttp.status == 200) 
	  	{	
	  		var xmlobj = xmlHttp.responseXML;
	  		var status = xmlobj.getElementsByTagName("result")[0].getElementsByTagName("status")[0].firstChild.data;
			var objectType= xmlobj.getElementsByTagName("result")[0].getElementsByTagName("objectType")[0].firstChild.data;
			var objectId = xmlobj.getElementsByTagName("result")[0].getElementsByTagName("objectId")[0].firstChild.data;
			var optionCount = xmlobj.getElementsByTagName("result")[0].getElementsByTagName("count")[0].getElementsByTagName("optionCount")[0].firstChild.data;
			var totalCount = xmlobj.getElementsByTagName("result")[0].getElementsByTagName("count")[0].getElementsByTagName("totalCount")[0].firstChild.data;
			if(status == "alreadyVoted")
			{
				alert('您已经进行了投票。');
				return;
			}
			else if(status =="succVoted")
			{
				alert('您的投票已记录，谢谢您的参与');
			}
			else if(status=="postOwner")
			{
				alert('您不能对自己发表的帖子进行投票');
				return;
			}
			else if(status=="blogOwner")
			{
				alert('您不能对自己发表的文章进行投票');
				return;
			}
			else 
			{
				alert('系统发生错误。请联系系统管理员。');
				return;
			}
			if(objectType==pollTypePost)
			{			
				for(var i=0;i<optionCount;i++)
				{
					var count = xmlobj.getElementsByTagName("result")[0].getElementsByTagName("count")[0].getElementsByTagName("voteCount"+i)[0].firstChild.data;
					document.getElementById(objectId+"_"+i).innerHTML = count;
				}
			}else if(objectType==blog){
				var count = xmlobj.getElementsByTagName("result")[0].getElementsByTagName("count")[0].getElementsByTagName("voteCount0")[0].firstChild.data;
				document.getElementById("cnt").innerHTML = count;
			}
		}
  	}
}	 
function saveProperty(threadId) {
	var styleClass=document.getElementById('titleColor').value
	var  bold="";
	if(document.getElementById("boldfaced").checked == true)
	{
		bold="Y";
	}
	window.location.href="EditStyle.jspa?styleContent="+styleClass+"&threadId="+threadId+"&bold="+bold;
}
function operate(newURL,wth,hgh)
{
	if(window.opener==null)
	{
		window.open(newURL,'','width='+wth+',height='+hgh+',left=70,top=130,scrollbars=yes');
	}
	else
	{
		window.location.href=newURL;	
	}
}
function gotoDownLoad(newURL,wth,hgh)
{
	if(window.opener==null)
	{
		window.open(newURL,'','width='+wth+',height='+hgh+',left=70,top=130,scrollbars=yes');
	}
	else
	{
		window.location.href=newURL;	
	}
}
function onQuickReplySubmit(action){			
	//document.getElementById("doQuickReplyButton").onclick = "javascript:quickreplied()";
	document.postform.action.value=action;
	//document.postform.content.value = editor.getHTML();
	document.postform.submit();
}		
function quickreplied(){
	return;
}
function delEntry(entry_id){
		if (window.confirm("是否确定删除文章？"))
		{
			window.location.href="del_entry.jspa?entry_id="+entry_id;
		}
}
function approveEntry(entry_id){
		if (window.confirm("是否确定批准文章？"))
		{
			window.location.href="auth_blogContent.jspa?entryId="+entry_id;
		}
}
function delAttach(attach_id,blog_id,attach_desc){
		if (window.confirm("是否确定删除文档"+attach_desc+"？"))
		{
			window.location.href="del_attach.jspa?attachment_id="+attach_id+"&blog_id="+blog_id;
		}
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
function delComment(comment_id){
	if (window.confirm("是否确定删除评论？")){
		//	alert("Testing");
		window.location.href="del_comment.jspa?comment_id="+comment_id;
	}
}

function apprComment(comment_id,entry_id){
	if (window.confirm("是否批准此评论？")){
		window.location.href="approve_comment.jspa?comment_id="+comment_id+"&entry_id="+entry_id;
	}
}
function doSubmit(val){
	document.threadflatform.approve.value = val;
	document.threadflatform.submit();
}
var on1 = false;
function isEnglish(name){
	if(name.length == 0){
		return false;
	}
	for(i = 0; i < name.length; i++) {
		if(name.charCodeAt(i) > 128)
		return false;
	}
	return true;
}
function isMail(name){ 
	if(!isEnglish(name)){
		return false;
	}
	i = name.indexOf("@");
	j = name.lastIndexOf("@");
	if(i == -1){
		return false;
	}
	if(i != j){
		return false;
	}
	if(i == name.length){
		return false;
	}
	return true;
}
function doEmail(frm){
	if(! isMail(frm.toEmail.value)) {
		alert("您的电子邮件不合法！");
		frm.toEmail.focus();
		return false;
	}
	if(frm.toUser.value.lehgth == 0||frm.toUser.value == null){
		alert("请输入收件人名称!");
		frm.toUser.focus();
		return false;
	}
	frm.action=forumServer+"topicPK!email.jspa";
	frm.submit();
}

function sendSubmit(formName)
{
	var url ="POLL_VOTE_"+formName.pollID.value+"_"+formName.option.value+".HTM";
	OpenWin(url,500,400);
	return false;
}
function doLogin(){
	document.invite1.action=serverName+"login.do";
	document.invite1.submit();	 
}

function checkForm(frm) {
	if (frm.body.value.length>500){
		alert("输入文字大于500!");
		frm.body.focus();
		return false;
	}else if(frm.body.value.length == 0){
		alert("请输入内容!");
		frm.body.focus();
		return false;
	}
	return true;			
}

function doPost(frm){	
	if(!checkForm(frm)){
		frm.body.focus();
		return false;
	}
	frm.action=forumServer+"topicPK!post.jspa";
	frm.submit();		
}


function doScript(url) {
    window.location = url;
    return;
}
