﻿function OpenWebChat(str){ 
  try{
	 var obj=new ActiveXObject("CNHuamuLooky.CnHumuClient"); 
		 obj.OpenClient(str);
  }catch(e){
	 window.open('/linker/about/');
  }
}

function Show_ProductNameList(classid,FName)
{
	if(document.getElementById("ProductNameList").style.visibility == "hidden")
	{
		document.getElementById("ProductNameList").style.visibility="visible";
	}
	document.getElementById("ProductNameList").style.left=(document.body.scrollLeft + event.x);
	document.getElementById("ProductNameList").style.top=(document.body.scrollTop + event.y+10);
	if(window.document.forms["Form1"].LoadIframe.value != "Yes")
	{
		window.document.frames["PNList"].location='/inc/keywordclass.cfm?classid='+classid+'&FName='+FName;
	}
}
function Close_ProductNameList()
{
	document.getElementById("ProductNameList").style.left=-1000;
	document.getElementById("ProductNameList").style.visibility="hidden";
}



// JavaScript Document
function openint(httid,w,h)
{
	var settop = (window.screen.Height-h)/2;
	var setleft = (window.screen.width-w)/2;
    window.open(httid,'','scrollbars=yes,resizable=no,width=' + w + ',height=' + h + ',menubar=no,top=' + settop + ',left=' + setleft);
}

// JavaScript Document
function CheckDele(){
	if(!confirm('确定删除记录?')){return false;}
}

function Checkdo(megstr){
	if(!confirm(megstr)){return false;}
}

/*对话框*/
function ShowDialog(obj,url,width,height){
	var str=showModalDialog(url,window,"dialogWidth:" + width + "px;dialogHeight:" + height + "px;help:no;scroll:auto;resizable:no;status:no");
	if (str != undefined){
		var arr = obj.split(",");
		var str = str.split("*");
		if(arr.length > 1){
			for(i = 0; i < arr.length; i++){
				eval(arr[i]).value = str[i];
			}
		}else{
			eval(obj).value = str;
		}
	}
}

function resetBtn(fm){
    fm.reset();
    return false;
}

//编辑对话框
function editorShowDialog(obj,url,width,height){
	var str=showModalDialog(url,window,"dialogWidth:" + width + "px;dialogHeight:" + height + "px;help:no;scroll:auto;resizable:no;status:no");
	if (str != undefined){
		var oEditor = FCKeditorAPI.GetInstance(obj) ;
		//document.getElementById("title").value = "值为1";
		if ( oEditor.EditMode == FCK_EDITMODE_WYSIWYG )
		{
			oEditor.InsertHtml(str);
		}
		else
		alert( 'You must be on WYSIWYG mode!' );
	}
}

function SetContents(obj,str)
{
	var oEditor = FCKeditorAPI.GetInstance(obj) ;
	oEditor.SetHTML(str) ;
	return false;
}

function GetLength(obj,minlen,maxlen)
{
	var oEditor = FCKeditorAPI.GetInstance(obj) ;
	var oDOM = oEditor.EditorDocument ;
	var iLength ;
	if ( document.all )		
	{
		iLength = oDOM.body.innerText.length ;
	}
	else					
	{
		var r = oDOM.createRange() ;
		r.selectNodeContents( oDOM.body ) ;
		iLength = r.toString().length ;
	}
	if (iLength < minlen)
	{
		alert('你所输内容少于' + minlen + '字');
		return false;
	}
	if(iLength > maxlen)
	{
		alert('你所输内容超出' + (iLength - maxlen) + '字');
		return false;
	}
}
/**反选*/
function CheckOthers(form)
{
	for (var i=0;i<form.elements.length;i++)
	{
		var e = form.elements[i];

			if (e.checked==false)
			{
				e.checked = true;
			}
			else
			{
				e.checked = false;
			}
	}
}
