//window.onerror = function(){return true}
String.prototype.Trim = function() 
{ 
	return this.replace(/(^\s*)|(\s*$)/g, ""); 
};//这个分号不能少


function get_class_from_html(bh)//文件地址，bh编号
{
	var s=class_str
	s=s.replace(/{bh}t/gi,"</a></li><li id=t><a href=?bh="+bh+"&classID=")
	//alert(s)
	s=s.replace(/{bh}/gi,"</a></li><li id=c><a href=?bh="+bh+"&classID=")//成了如：<a href=?bh=web-003&classID=20
	//alert(s)
//	alert(s.substr(9))
	document.getElementById('product_class_content').innerHTML=s.substr(9)+"</a></li>"
	//document.write(s.replace(/>/g,"ssssss"))//左边是</a></li>不要
}
function check_add(obj)
{
	var form=obj.form;
	var is=form.getElementsByTagName('INPUT')
	for(var i=0;i<is.length;i++)
	{
		if(is[i].type=='text' && is[i].value.Trim().length==0)
		{
			if(is[i].parentElement.innerText.indexOf('*')>-1)//必填字段
			{
				alert("“"+is[i].title+"”不能为空！")
				is[i].focus();
				return false;
			}
		}
	}
	
	var ts=form.getElementsByTagName('TEXTAREA')
	for(var j=0;j<ts.length;j++)
	{
		if(ts[j].value.Trim().length==0)
		{
			if(ts[j].parentElement.innerText.indexOf('*')>-1)//必填字段
			{
				alert("“"+ts[j].title+"”不能为空！")
				ts[j].focus();
				return false;
			}
		}
	}
	form.submit();
	return true;
}

function edit_this(fileName,id)
{
	window.showModalDialog('../../crm/dialog.asp?title=编辑&url=work_tr_exe.asp?dialog=y**action=mod**menu=no**fileName='+fileName+'**id='+id,window,'resizable:yes;dialogWidth:666px;dialogHeight:535px;help:no')
	
}


function show_cur_class(obj_str)//显示上级
{
	var as=document.getElementById(obj_str).getElementsByTagName('A')//obj_str最列表的最外表格
	//alert(obj.id)
	for(var i=0;i<as.length;i++)
	{
		if (as[i].id=='class_list_selected')
		{
			obj=as[i];//当前选中的那个className,A是连接
		}
	}
	
	while (obj.parentElement.tagName!='BODY')
	{
		if (obj.tagName=="DL")
		{
			obj.style.overflow='visible';
			obj.style.backgroundPosition='-1500px 0px';
		}
		obj=obj.parentElement;
	}
}

function menu_bg(obj,str){
	var arr=obj.all//数量
	for (var i=0;i<arr.length;i++)
    {
		if(arr[i].className!=null)//名称不为空
		{
			if (arr[i].className.indexOf("-")>-1 && arr[i].className.indexOf(str)<0)//包含-但不包含str
			{
				var arr2=arr[i].className.split("-")
				arr[i].className=str+"-"+arr2[1]
			}
		}
	}
}

function win_open(u,n,s){window.open(u,n,s)}

function s_h()
{
	obj=document.elementFromPoint(event.x,event.y)
	if (event.offsetY>20 || event.offsetX>30)return;
	if(obj.tagName=="DL")
	{
		if (obj.style.overflow=='hidden'||obj.style.overflow=='')
		{
			obj.style.backgroundPosition='-1500px 0px';
			obj.style.overflow='visible';
		}
		else
		{
			obj.style.backgroundPosition='0px 0px';
			obj.style.overflow='hidden';
		}
	}
}


