/**************************************************/
/*                Html在线编辑器                    */
/**************************************************/
//得到Html编辑器的值
function GetContent()
{
	frmEditer = window.frames("editer").frames("Composition")
	content = document.all("content")
	if ( frmEditer !=null && content !=null )
	{
		content.value=frmEditer.document.body.innerHTML;
	}	
	//wt = setTimeout("GetContent()",1000)
}
//赋值给Html编辑器的值
function WriteContent()
{
	frmEditer = window.frames("editer").frames("Composition")
	content = document.all("content")
	if ( frmEditer !=null && content !=null )
	{
		frmEditer.document.body.innerHTML = content.value;
	}
}

//增加字符串 Trim 属性
String.prototype.trim = function()
{
   return this.replace(/(^\s+)|\s+$/g,"");
 }
 
 

//全选反选操作
function Check()
{
	chkAll = document.all("chkAll").checked
	var coll = document.all("checkbox");
	
	if (coll != null)
	{
		for(j=0; j < coll.length; j++)
		{
			coll[j].checked = 	chkAll		
		}
	}

	//alert(document.all("chkAll").checked)
}


//提交操作
function SubmitAction(theform,action)
{
	//alert (theform)
	theform.method ="post"
	theform.action="?action=" + action;
}

//提交操作
function SubmitAction1(theform,action)
{
	//alert (theform)
	theform.method ="post"
	theform.action="?action1=" + action;
}

//删除提示
function Delete()
{
	if(confirm("你确定要删除吗？"))
	{
		return true;
	}	
	else
	{
		return false;
	}
}


var ie = document.all?1:0 
function CA(frm){
var trk=0;
isOnload = 0;

for (var i=0;i<frm.elements.length;i++)
{
var e = frm.elements[i];
if ((e.name != 'allbox') && (e.type=='checkbox'))
{

if (isOnload != 1)
{
trk++;
e.checked = frm.allbox.checked;
if (frm.allbox.checked)
{
	if (e.checked)
	{
		hL(e);
	}
	else
	{
		dL(e);
	}
}
else
{
	if (e.checked)
	{
		hL(e);
	}
	else
	{
		dL(e);
	}
}
}
}
}
}


function CCA(CB){
var frm = CB.form
if (CB.checked)
hL(CB);
else
dL(CB);
var TB=TO=0;
for (var i=0;i<frm.elements.length;i++)
{
var e = frm.elements[i];
if ((e.name != 'allbox') && (e.type=='checkbox'))
{
TB++;
if (e.checked)
TO++;
}
}

if (TO==TB)
frm.allbox.checked=true;
else
frm.allbox.checked=false;
}
function hL(E){
if (ie)
{
while (E.tagName!="TR")
{E=E.parentElement;}
}
else
{
while (E.tagName!="TR")
{E=E.parentNode;}
}
E.className = "H";
}
function dL(E){
if (ie)
{
while (E.tagName!="TR")
{E=E.parentElement;}
}
else
{
while (E.tagName!="TR")
{E=E.parentNode;}
}
E.className = "";
}

//选择图片
function SelectedImg(ImgPath,thisImg)
{
	//ImgPath = "../image/Club/Product/"
	ImgName =opener.document.all("ImgName");
	txtImgName = opener.document.all("txtImgName");
	if (ImgName != null)
	{
		ImgName.src = ImgPath + thisImg;
	}

	if (txtImgName != null)
	{
		txtImgName.value = thisImg
	}
	window.close();
}

//打开新窗口
function openWindow(theURL,winName,features) { 
  window.open(theURL,winName,features);
}


//根据ID查看商业机会
function ViewTradeLead(ID){
	window.open("/OfferShow/OfferDocoment.asp?id=" +ID ,"TradeSubWin"+ID,"location=yes,menubar=yes,scrollbars=yes,resizable=yes,width=680,height=580,left=0,top=0");
}

//根据ID查看产品
function ViewProductLead(ID){
	window.open("/ProductShow/ProductDocoment.asp?id=" +ID ,"ProductSubWin"+ID,"location=yes,menubar=yes,scrollbars=yes,resizable=yes,width=680,height=580,left=0,top=0");
}


//根据ID直接对商业机会询盘
function InquiryTradeLead(ID){
	window.open("/Inquire.asp?Type=2&id=" +ID ,"InquirySubWin"+ID,"location=yes,menubar=yes,scrollbars=yes,resizable=yes,width=680,height=600,left=0,top=0");
}

//根据ID查直接对产品询盘
function InquiryProductLeads(ID){
	window.open("/Inquire.asp?Type=1&id=" +ID ,"InquirySubWin"+ID,"location=yes,menubar=yes,scrollbars=yes,resizable=yes,width=680,height=600,left=0,top=0");
}


//根据ID查直接对企业询盘
function InquiryCompanyLeads(ID){
	window.open("/Inquire.asp?Type=3&id=" +ID ,"InquirySubWin"+ID,"location=yes,menubar=yes,scrollbars=yes,resizable=yes,width=680,height=600,left=0,top=0");
}



//根据Url直接发送询盘
function SendInquiry(Url){
	window.open(Url ,"","location=yes,menubar=yes,scrollbars=yes,resizable=yes,width=700,height=500,left=0,top=0");
}


//跳转网址
function Jump(value)
{
	location.href=value
}

//选中列表项
function SelectedItem(listName, value)
{
	objList = document.all(listName)
	if (objList != null)
	{
		len = objList.length;
		if (len != 0 )
		{
		for(i=0;i<len;i++)
		{
			if (objList.options[i].value ==value)
			objList.options[i].selected = true;

		}
	}
	}
}

//梆定原因
function GetCause(value)
{
	var existing=false
	cause = document.all("lstCause");
	
	if (cause != null)
	{
		len = cause.length;
		if (len != 0 )
		{
		for(i=0;i<len;i++)
		{
			if (cause.options[i].value ==value)
			{			
				cause.options[i].selected = true;
				existing = true
			}

		}
		
		if (!existing)
		{
			txtCause = document.all("txtCause")
			if (txtCause != null)
			{
				txtCause.value = value;
				txtCause.style.display = "block";
				cause.options[len-1].selected = true;
			}

		}
	}
	}
}

//搜索
function Search()
{
	searchType = document.all("lstSearchType");	
	objKeywords= document.all("txtKeywords");
	var keywords = ""

	if (searchType != null)
	{
		search = searchType.options[searchType.selectedIndex].value;
		if (search == "no")
		{
			alert("请选择搜索类型！");
			searchType.focus();
		}
		else
		{
			if (objKeywords !=null)
			{
				keywords = objKeywords.value
			}
			window.open(search  +  "?keywords=" + keywords );
		}
		
	}
}

function SearchClub(id)
{
	searchType = document.all("lstSearchType");	
	objKeywords= document.all("txtKeywords");
	var keywords = ""

	if (searchType != null)
	{
		search = searchType.options[searchType.selectedIndex].value;
		if (search == "no")
		{
			alert("请选择搜索类型！")
		}
		else
		{
			if (objKeywords !=null)
			{
				keywords = objKeywords.value
			}
			window.open(search +"?id=" + id + "&keywords=" + keywords);
		}
		
	}
}

//得到焦点时置空

function SetEmptyValue( the, initValue)
{
	if(the.value==initValue)
	{
	  the.value="";
	}	
}
//得到原来文字提示
function GetOriTip( the, oriTip)
{
	if(the.value=="")
	{
	  the.value=oriTip;
	}	
}


 
 //验证是否输入了关键词
function CheckKeywords(formKey, elementName,tip)
{
	var result = true;
	//var keywordsColl = document.all(theElement);
	var keywordsColl=document.forms[formKey].elements[elementName];

	var strKeywords="";
	if(keywordsColl != null)
	{
		for(var i=0; i < keywordsColl.length; i++ )
		{
			strKeywords += keywordsColl[i].value.trim();			
		}
		
		if(strKeywords =="")
		{
			alert("请输入" + tip +"！");
			keywordsColl[0].focus();
			result = false;
		}
	}
	return result;
}

//- 验证是否选择单选框
function CheckRadioList(formKey, elementName, tip)
{
	len=document.forms[formKey].elements[elementName].length;
	var blnNone=true;
	for(i=0;i<len;i++){
		if(document.forms[formKey].elements[elementName][i].checked){
			blnNone=false;
			break;
		}		
	}
	
	if(blnNone){
		alert("请选择" + tip +"！");
		document.forms[formKey].elements[elementName][0].focus();		
		return false;
	}
	return true;
}
//- 对象不能为空
function mustNotBlank( formKey,elementName,tip )
{
	var element=document.forms[formKey].elements[elementName];
	if(element.value.trim() == "")
	{
		alert("请输入" + tip +"！");
		element.focus();		
		return false;
	}
	return true;
}

//- 改变字体大小
function doZoom(size){
document.getElementById('zoom').style.fontSize=size+'px'
}

//- 改变图片大小
function bbimg(o){
	var zoom=parseInt(o.style.zoom, 10)||100;
	zoom+=event.wheelDelta/12;
	if (zoom>0) o.style.zoom=zoom+'%';
	return false;
}
