function add1(){
	for(i=0;i<document.getElementById('select2').options.length;i++){
		if(document.getElementById('select2').options[i].value=='nolimit'){
			alert('已经选择了所有地区！如需重新选择，务必将其移除');
			return;
		}
	}
    var opt=document.getElementById('selectfrom').options;    
    len=opt.length;   
    var allopt=1;
    for(i=len-1;i>-1;i--){   
        if(opt[i].selected){
        	if(opt[i].value=='nolimit'){	//所有
        		allopt = opt[i];
				delAll();
			}
        }   
    }
	if(allopt!=1){
		document.getElementById('select2').appendChild(allopt); 
	}else{
		for(i=len-1;i>-1;i--){   
	    	if(opt[i].selected)
				document.getElementById('select2').appendChild(opt[i]); 	
	    }  		
	}
}   
function delAll(){   
    var opt=document.getElementById('select2').options;   
    len=opt.length;   
    for(i=len-1;i>-1;i--){   
        document.getElementById('selectfrom').appendChild(opt[i]);   
    }   
}  
function checkHead(){
	var a = document.getElementById('key').value;
	var len = document.getElementById('select2').options.length;
	if(len<1){
		alert('请选择地区');
		return false;
	}else if(a!=''){
		return true;
	}else{
		alert('请输入内容');
		return false;	
	}
}
function del1(){   
    var opt=document.getElementById('select2').options;   
    len=opt.length;   
    for(i=len-1;i>-1;i--){   
        if(opt[i].selected){   
            document.getElementById('selectfrom').appendChild(opt[i]);   
        }   
    }   
}   
function setFavorite(strURL, strTitle){
    try{
        window.external.addFavorite(strURL, strTitle);
    }catch (e){
        try{
            window.sidebar.addPanel(strTitle, strURL, "");
        }catch (e){
            alert("加入收藏失败，请使用Ctrl+D进行添加");
        }
    }
}
function setHome(obj,strURL){
	try{
		obj.style.behavior='url(#default#homepage)';
		obj.setHomePage(strURL);
	}catch(e){
		if(window.netscape) {
				try {
					netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");  
				}catch (e)  { 
					alert("此操作被浏览器拒绝！请在浏览器地址栏输入“about:config”并回车然后将[signed.applets.codebase_principal_support]设置为'true'");  
				}
				var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
				prefs.setCharPref('browser.startup.homepage',strURL);
		 }
	}
}
