
function openWin(url) {
    window.open(url, '', 'width=400px, height=220px, resizable=yes, scrollbars=no, left=' + (screen.availWidth-620)/2 + ',top=' + (screen.availHeight-470)/2);
}

function openWin1(url, name) 
{	
    var myWin = window.open(url, name, 'width=400px, height=220px, resizable=yes, scrollbars=no, left=' + (screen.availWidth)/4 + ',top=' + (screen.availHeight)/4);
    myWin.focus();
}

function openWin2(url) 
{	
    var myWin = window.open(url, 'userStatusTree', 'width=400px, height=220px, resizable=yes, scrollbars=no, left=' + (screen.availWidth)/4 + ',top=' + (screen.availHeight)/4);
    myWin.focus();
}

function openWin3(url) 
{	
    var myWin = window.open(url, '', 'width=400px, height=400px, resizable=yes, scrollbars=yes, left=' + (screen.availWidth)/4 + ',top=' + (screen.availHeight)/4);
    myWin.focus();
}

function openWin4(url) 
{	
    var myWin = window.open(url, '', 'width=400px, height=400px, resizable=yes, scrollbars=no, left=' + (screen.availWidth)/4 + ',top=' + (screen.availHeight)/4);
    myWin.focus();
}

function openWin5(url) 
{	
    var myWin = window.open(url, '', 'width=400px, height=500px, resizable=yes, scrollbars=no, left=' + (screen.availWidth + 800)/4 + ',top=' + (screen.availHeight)/4);
    myWin.focus();
}

function openWin6(url) 
{	
    var myWin = window.open(url, '', 'width=600px, height=350px, resizable=yes, scrollbars=no, left=' + (screen.availWidth)/4 + ',top=' + (screen.availHeight)/4);
    myWin.focus();
}

function openWin9(url) 
{	
    var myWin = window.open(url, '', 'width=1002px, height=600px, resizable=yes, scrollbars=yes,status=no,left=10,top=10');
    myWin.focus();
}
function openWin7(url) 
{	
    var myWin = window.open(url);
    myWin.focus();
}
function openWin8(url) 
{	
    var myWin = window.open(url, '', 'width=620px, height=350px, resizable=no, scrollbars=yes,status=no,left=' + (screen.availWidth)/4 + ',top=' + (screen.availHeight)/4);
    myWin.focus();
}


function selectAll(form, isCheck) {
	for(var i = 0; i < form.length; i++) {
		var e = form[i];
		if(e.type == "checkbox") {
			e.checked = isCheck;
		}
	}
}

function getChecked(form) {
	for(var i = 0; i < form.length; i++) {
		var e = form[i];
		if(e.type == "checkbox" && e.checked && e.name == "ids") {
			return e.value;			
		}
	}
	return "";
}

function getChecks(form) {
	var ids = "";
	for(var i = 0; i < form.length; i++) {
		var e = form[i];
		if(e.type == "checkbox" && e.checked && e.name == "ids") {
			if(ids != "") {
				ids += ",";
			}
			ids += e.value;			
		}
	}
	return ids;
}

function getRadioChecked(form) {
	for(var i = 0; i < form.length; i++) {
		var e = form[i];
		if(e.type == "radio" && e.checked && e.name == "id") {
			return e.value;			
		}
	}
	return "";
}

function getChecksNum(form){
	var k = 0 ;
	for(var i = 0; i < form.length; i++) {
		var e = form[i];
		if(e.type == "checkbox" && e.checked && e.name == "ids") {
			k += 1 ;
		}
	}
	return k;
}

//友情连接跳转
function gotoUrl(url){
	if (url){
		window.open(url) ;
	}
}

function searchSubmit(form){
  if(form.keyword.value == "") {
	  alert("请填写搜索条件！");
	  form.keyword.focus();
	  return false;
  }
  form.method.value = "find" ;
  form.submit();
}

function replacehtml()   
{   
    var str="";//注入字段   
  
    function setStr()   
    {   
        this.str=arguments[0];   
    }   
    function getStr()   
    {   
        return this.str;   
    }   
       
    //自定义html替换   
    function replace()   
    {   
        if(arguments.length>0)   
        {   
            this.str=arguments[0];   
        }   
        this.str=this.str.replace(/<font.*?<\/font>/g,"");//font标签   
        this.str=this.str.replace(/<script .*?<\/script>/ig,""); //script标签   
        this.str=this.str.replace(/<(a|img)/ig, "@@@$1"); //img标签   
        this.str=this.str.replace(/<[^>a]*>/ig, ""); //a标签   
        this.str=this.str.replace(/@@@(a|img)/ig, "<$1"); //a|img   
        this.str=this.str.replace(/<br>/ig,"");//换行   
        return this.str;   
    }   
       
    //替换所有html标签   
    function replaceAll()   
    {   
        if(arguments.length>0)   
        {   
            this.str=arguments[0];   
        }   
        this.str=this.str.replace(/<[^>]*>/g, "");   
        this.str=this.str.replace(/\r\n/g, "<br/>");   
        return this.str;   
    }   
       
    var o={};   
    o.setStr=setStr;   
    o.getStr=getStr;   
    o.replace=replace;   
    o.replaceAll=replaceAll;   
    return o;   
}   

function clearHTML(str){
	var ret="";
	if(str==null){
		str="";
	}
	if(str!=""){
		var clearObj=new replacehtml();//实例化   
		clearObj.setStr(str);   
		clearObj.replaceAll();   
		ret=clearObj.getStr();
	}
	return ret;
}
