

var GRANULARITY = 2;//粒度大小，表示每级目录最多存100个节点，这个值需要和数据库一?至暂时没用，因为每?100个节点已经够用了..

Comm=function()
{
 
};

Comm.DiaryResDomainPath=null;

Comm.getCurUserFromHref=function(url)
{
    var _User='';
	url=url.replace(/^\s+|\s+$/g,'');//去掉空格
	url=url.toLowerCase();
	url = url.replace(/\w+:\/\//,'');//去掉http://
		
	var re =/((\w+):\/\/)?([^\:|\/]+)(\:\d*)?(.*\/?)([^#|\?|\n]+)?(#.*)?(\?.*)?/;
 
 
	var  matches = url.match(re);
	if (matches) 
	{
	     url = matches[3];
	}

	var urls = url.split('.');
	if (urls.length>=3 ) 
	{   
	    _User=urls[0];
		if(_User =='www')
		{
			_User='ohsroot';
		}
		if(/^[\d]+$/gi.test(_User))
		{
			_User='';
		}
	   
	}else
	{
	    _User='ohsroot';
	}
	//alert(_User);
	return _User;
};

   Comm.CurUser = Comm.getCurUserFromHref(window.location.href);
   Comm.otfilesURL='http://oltag.com:8080/'+Comm.CurUser;
 
   Comm.MyBaseUrl = window.location.href;//'http://www.oltag.com/';
   
   Comm.MyBaseUrl = 'http://'+window.location.host+'/';
   /*

    Comm.MyBaseUrl=Comm.MyBaseUrl.replace(/\W*$/gi,'');//去掉串尾非字符非数字的所有符号
    //处理http://.../xx.aspx这种情况[^\/]+[\/]?
    var  re = /[^\/]+[\/]?/g;    //Create regular expression pattern.
    //如果js中match函数方法没有找到匹配，返回 null。
    //如果找到匹配返回一个数组并且更新全局 RegExp 对象的属性以反映匹配结果。
    //JavaScript中match函数方法返回的数组有三个属性：input、index和lastIndex。
    //Input 属性包含整个的被查找字符串。Index 属性包含了在整个被查找字符串中匹配的子字符串的位置。
    //LastIndex 属性包含了最后一次匹配中最后一个字符的下一个位置。
    //如果没有设置全局标志 (g)，数组的0元素包含整个匹配，而第 1 到 n 元素包含了匹配中曾出现过的任一个子匹配。
    //这相当于没有设置全局标志的 exec 方法。如果设置了全局标志，元素0到n中包含所有匹配。
    var  matches = Comm.MyBaseUrl.match(re);
    
    if (matches) 
    {
        if (matches[0].toLowerCase().indexOf('://')!=-1) 
        {
            if (matches.length>=3) 
            {
               Comm.MyBaseUrl=Comm.MyBaseUrl.replace(matches[2],'');
            }
           
        }else
        {
            //www.xxx.com/xx.xxx
            if (matches.length>=2) 
            {
               Comm.MyBaseUrl=Comm.MyBaseUrl.replace(matches[1],'');
            }
        }
    }
    
    Comm.MyBaseUrl=Comm.MyBaseUrl.replace(/^\s+|\s+$/g,'');//去掉空格
    Comm.MyBaseUrl = Comm.MyBaseUrl.toString();

    if (Comm.MyBaseUrl.charAt(Comm.MyBaseUrl.length-1) != '/') 
    {
        Comm.MyBaseUrl+='/';
    }*/
    	
var ua = navigator.userAgent.toLowerCase();
var isStrict = document.compatMode=="CSS1Compat";

//window.navigator.userAgent.indexOf("MSIE")>=1
Comm.ie = navigator.userAgent.indexOf("MSIE") > 0 && !window.opera;
Comm.ns = navigator.vendor == "Netscape";
//在梅花雪树中也有相关代码

Comm.isOpera = ua.indexOf("opera")>-1;
Comm.isSafari = (/webkit|khtml/).test(ua);
Comm.isIE7 = ua.indexOf("msie 7")>-1;
Comm.isGecko= !Comm.isSafari && ua.indexOf("gecko")>-1;

Comm.isBorderBox=Comm.ie&&!isStrict,
Comm.isWindows=(ua.indexOf("windows")!=-1||ua.indexOf("win32")!=-1),
Comm.isMac=(ua.indexOf("macintosh")!=-1||ua.indexOf("mac os x")!=-1),
Comm.isLinux=(ua.indexOf("linux")!=-1),
Comm.isSecure=window.location.href.toLowerCase().indexOf("https")===0; 


Comm.isAlien=function(a)
{
    return Comm.isObject(a) && typeof a.constructor != 'function';
};



Comm.isArray=function(a)
{
    return Comm.isObject(a) && a.constructor == Array;
};

Comm.isBoolean=function (a)
{
    return typeof a == 'boolean';
};

Comm.isEmpty=function (o)
{
    var i, v;
    if (Comm.isObject(o)) 
    {
        for (i in o) 
        {
            v = o[i];
            if (Comm.isUndefined(v) && Comm.isFunction(v)) 
            {
                return false;
            }
        }
    }
    return true;
};

Comm.isFunction=function (a)
{
    return typeof a == 'function';
};

Comm.isNull=function (a)
{
    return typeof a == 'object' && !a;
};

Comm.isNumber=function (a)
{
    return typeof a == 'number' && isFinite(a);
};

Comm.isNumber2=function(oNum)
{
    if (!oNum) 
	{
        return false;
    }
    var strP = /^\d+(\.\d+)?$/;
    if (!strP.test(oNum)) 
	{
        return false;
    }
	
    try 
	{
        if (parseFloat(oNum) != oNum) 
		{
            return false;
        }
    } 
    catch (ex) 
	{
        return false;
    }
	
    return true;
};//Comm.isNumber=function(oNum)

Comm.isObject=function (a)
{
    return (a && typeof a == 'object') || Comm.isFunction(a);
};

Comm.isString=function(a)
{
    return typeof a == 'string';
};

Comm.isUndefined = function (a)
{
    return typeof a == 'undefined';
};

Comm.badstr = "!&^#|%$)(-+/?<>@`~';:{}[],=\".\\";
Comm.badsql = "!&^|+/?<>`~'=--"; 

////////////////////////////////////▼↓Global System Function↓▼////////////////////////////////////////////////////////////////////////////////


//window.onerror=function(){return true;};

//window.onbeforeunload= function LeaveWin(e){e=e||event;e.returnValue="call,are you make sure close it?";}; 

//var t = Comm.Extends(Object, "Comm");
Function.prototype.Extends = function(SuperClass)
{
    var op = this.prototype, i;
	var p  = this.prototype;
	
	if(op == undefined)
	{
		op = this;
	}
	
	if(p == undefined)
	{
		p = this;
	}
	
//	if(this.prototype !=null )
//	{
//		p= this.prototype=new SuperClass();
//	}else
	{
		p=new SuperClass();
	}

    for (i in p) 
        op[i] = p[i];
		
    return op;
};

Function.prototype.addFunc = function(name, fn) 
{
	this.prototype[name] = fn;
};

if (window.ActiveXObject && (Comm.ie || !window.XMLHttpRequest)) 
{
    window.XMLHttpRequest = function()
    {
        var msxmls = ['MSXML2.XMLHTTP.6.0', 'Msxml2.XMLHTTP.5.0', 'Msxml2.XMLHTTP.4.0', 'Msxml2.XMLHTTP.3.0', 'Msxml2.XMLHTTP.2.6', 'Msxml2.XMLHTTP.1.0', 'Microsoft.XMLHTTP.1', 'Microsoft.XMLHTTP', 'MSXML2.XMLHTTP'], ex;
        for (var i = 0; i < msxmls.length; i++) 
        {
            try 
            {
                return new ActiveXObject(msxmls[i])
            } 
            catch (ex) 
            {
                ;
            }
        }//for
        Comm._xmlHttp = "mz";
        throw new Error(System.NOT_SUPPORTED_XMLHTTP);
    }
};

if(Comm.ns  && netscape.security.PrivilegeManager.enablePrivilege)
{//http://topic.csdn.net/u/20091230/14/66056dda-3134-4a44-9ad0-5677ae5885a1.html
	try
	{
		netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
	}
	catch (e)
	{
		alert("Permission could be denied for cross-browser scripting.");
	}
};

// If Push and pop is not implemented by the browser
if(!Array.prototype.push) 
{
    Array.prototype.push = function array_push()
    {
        for (var i = 0; i < arguments.length; i++) 
            this[this.length] = arguments[i];
        return this.length;
    }
};

if(!Array.prototype.pop) 
{
    Array.prototype.pop = function array_pop()
    {
        lastElement = this[this.length - 1];
        this.length = Math.max(this.length - 1, 0); 
        return lastElement; 
    }
};
Array.prototype.clearfather = function()
{
	for(var i=0;i<this.length;i++)
	{
		for(var j=i+1;j<this.length;j++)
		{
			if(
			this[i].indexOf(this[j])==0
			)
			{
				this.remove(this[j]);
				j--;
			}else if(this[j].indexOf(this[i])==0)
			{
				this.remove(this[i]);
				i--;
				if(i>=this.length ||i<0)
				{
					break;
				}
			}			
		}

	}//for	
	return ;
};//
Array.prototype.clearchilds = function()
{
	for(var i=0;i<this.length;i++)
	{
		for(var j=i+1;j<this.length;j++)
		{
			if(
			this[i].indexOf(this[j])==0
			)
			{
				this.remove(this[i]);
				i--;
				if(i>=this.length ||i<0)
				{
					break;
				}
			}else if(this[j].indexOf(this[i])==0)
			{
				this.remove(this[j]);
				j--;
			}			
		}

	}//for	
	return ;
};//
Array.prototype.existchild = function(val)
{
	for(var i=0,len=this.length;i<len;i++)
	{
		if(
		this[i].indexOf(val)==0
		)
		{
			return i;
		}			
	}//for	
	return -1;	
};//
Array.prototype.existfather = function(val)
{
	for(var i=0,len=this.length;i<len;i++)
	{
		if(
		val.indexOf(this[i])==0
		)
		{
			return i;
		}			
	}//for	
	return -1;	
};//

Array.prototype.isfiliation = function(val)
{
	if(this.existchild(val)==-1 && this.existfather(val)==-1)
	{
		return false;
	}
	return true;
};//

Array.prototype.inArray = function(value)
{
    for (var i = 0, l = this.length; i < l; i++) 
	{
        if (this[i] == value) 
		{
            return true;
        }
    }
    return false;
};//Array.prototype.inArray = function(value) 

Array.prototype.remove = function(val)
{
  var i;
  var j;
  for(i = 0; i < this.length; i++)
  {
	   if(this[i] == val)
	   {
		    for(j = i; j < this.length-1; j++)
		    {
		       this[j] = this[j + 1];
		    }
	        this.length = this.length-1;
	   }
  }//for
};//Array.prototype.remove 

/*
Array.prototype.removeAt =function (index)
{
  var i;
  if(index < this.length)
  {
	for(i = index; i < this.length-1; i++)
	{
	  this[i] = this[i + 1];
	}
	this.length = this.length- 1;
  }//if(index < this.length)
};//Array.prototype.removeAt 
*/

Array.prototype.clear=function()
{
  this.length=0;
}

Array.prototype.insertAt=function(index,obj)
{
  this.splice(index,0,obj);
}

Array.prototype.removeAt=function(index)
{
  this.splice(index,1);
}

//Array.prototype.remove=function(obj)
//{
//  var index=this.indexOf(obj);
//  if (index>=0){
//    this.removeAt(index);
//  }
//}

String.prototype.trim = function String$trim() 
{
    if (arguments.length !== 0) throw Error.parameterCount();
    return this.replace(/^\s+|\s+$/g, '');
};

//清除空格
String.prototype.Trim = function()
{
   return this.replace(/(^\s*)|(\s*$)/g, "");
};

String.prototype.LTrim = function()
{
   return this.replace(/(^\s*)/g, "");
};

String.prototype.RTrim = function()
{
   return this.replace(/(\s*$)/g, "");
};
 
String.prototype.replaceAll  = function(s1,s2){ 
s1 = s1.replace(/([\]\[\.\?\+])/gi,'\\$1');  
return this.replace(new RegExp(s1,"gm"),s2);   
};  

Comm.substr=function(str, len)
{
    if(!str || !len) { return ''; }

    //预期计数：中文2字节，英文1字节
    var a = 0;

    //循环计数
    var i = 0;

    //临时字串
    var temp = '';

    for (i=0;i<str.length;i++)
    {
        if (str.charCodeAt(i)>255)
        {
            //按照预期计数增加2
            a+=2;
        }
        else
        {
             a++;
        }
        //如果增加计数后长度大于限定长度，就直接返回临时字符串
        if(a > len) { return temp; }

        //将当前内容加到临时字符串
        temp += str.charAt(i);
    }
    //如果全部是单字节字符，就直接返回源字符串
    return str;
};//Comm.substr=function(str, len)


//语法甘露?
var object =    //定义小写的object基本类，用于实现最基础的方法等
{
    isA: function(aType)   //一个判断类与类之间以及对象与类之间关系的基础方法
    {
        var self = this;
        while(self)
        {
            if (self == aType)
              return true;
            self = self.Type;
        };
        return false;
    }
};

function Class(aBaseClass, aClassDefine)    //创建类的函数，用于声明类及继承关?
{
    function class_()   //创建类的临时函数?
    {
        this.Type = aBaseClass;    //我们给每一个类约定一个Type属性，引用其继承的?
        for(var member in aClassDefine)
            this[member] = aClassDefine[member];    //复制类的全部定义到当前创建的?
    };
    class_.prototype = aBaseClass;
    return new class_();
};

function New(aClass, aParams)   //创建对象的函数，用于任意类的对象创建
{
    function new_()     //创建对象的临时函数壳
    {
        this.Type = aClass;    //我们也给每一个对象约定一个Type属性，据此可以访问到对象所属的?
        if (aClass.Create)
          aClass.Create.apply(this, aParams);   //我们约定所有类的构造函数都叫Create，这和DELPHI比较相似
    };
    new_.prototype = aClass;
    return new new_();
};
	
////////////////////////////////////▼↓Global COMMON Function↓▼////////////////////////////////////////////////////////////////////////////////
Comm._addStyle = function(sText) 
{
    if (document.createStyleSheet) 
	{
      //IE, create new css
      //!!remember the 31 limit
      var dCss = document.createStyleSheet('');
      dCss.cssText = sText;
    } else 
	{
//      _addEl({
//        tag : 'style',
//        attrs : { textContent : sText }
//      }, 'head');
		var _style = document.createElement('style'); 
		_style.type = 'text/css'; 
		_style.innerHTML=sText; 
		document.getElementsByTagName('HEAD').item(0).appendChild(_style); 
    }
 };// Comm._addStyle



//
// $import('../include/mian.js', 'js');
// $import('../style/style.css', 'css');
//
//path要使用全路径
//在指定位置插入，主要为了日志节点插入脚本用。
Comm.$import2=function(path, type,doc,myid,myClassName)
{

	if(typeof doc=='undefined' || !doc)
	{
		doc= document;
	}
	
	
    var uniqueId = Math.random()*10000 +"";	
    uniqueId=uniqueId.replace('.','');
    
    type=type.toLowerCase();
    
    if (typeof myid=='undefined'||!myid) 
    {
        if (type == "css")  myid   = 'ohsCss_'+uniqueId;
        else myid   = 'ohsJs_'+uniqueId;
    } 
    
 
     var n=path.lastIndexOf('/');
     
      var fn= path.substring(n+1);
      //fn  = fn.split('.')[0];  
 
        
     var o= Comm.$(fn);
     if (!o) {
     return;
     }
     
     

      
      
        var js = doc.createElement('script');
		
		js.setAttribute('type', 'text/javascript');
		js.setAttribute('src', path);
		js.setAttribute('id', fn);
 
			
		js.type='text/javascript';
		js.src= path;
	    js.id =fn;
	    
        if (typeof myClassName!='undefined' && myClassName) 
        {
            js.className=myClassName;
        }
        
     o.parentNode.appendChild(js);
     
};//Comm.$import2
Comm.$import=function(path, type,doc,myid,myClassName,defer)
{
	if(typeof doc=='undefined' || !doc)
	{
		doc= document;
	}
    
    var uniqueId = Math.random()*10000 +"";	
    uniqueId=uniqueId.replace('.','');
    
    type=type.toLowerCase();
    
    if (typeof myid=='undefined'||!myid) 
    {
        if (type == "css")  myid   = 'ohsCss_'+uniqueId;
        else myid   = 'ohsJs_'+uniqueId;
    } 
    

         
	if(doc.getElementById(myid)) return;    
	
    if (type == "css") 
    {

		  if(/\w+\.\w+(\?|$)/.test(path))
		  {
		    var link  = doc.createElement("LINK");
		    link.href = path;
            link.id=myid;
            
            if (typeof myClassName!='undefined'||myClassName) 
            {
                link.className=myClassName;
            }
              
		    
		    link.type = "text/css";
		    link.rel  = "Stylesheet";
		    doc.getElementsByTagName("HEAD")[0].appendChild(link);
		  }
    }
    else 
    {
		
		var oldScripts= doc.getElementsByTagName("script");
		for(var i=0;i<oldScripts.length;++i)
		{
			if(oldScripts[i].src && oldScripts[i].src.toLowerCase() == path.toLowerCase()) return ;
		}
		
		//var script = document.createElement("SCRIPT");
        //script.type = "text/javascript";
        //script.src = path;
        //document.getElementsByTagName("HEAD")[0].appendChild(script);
        
        //var element = document.createElement("script");
        //element.src = "deferredfunctions.js";
        //document.body.appendChild(element);
        
		var _doc = doc.getElementsByTagName('head')[0];
		var js = doc.createElement('script');
		
		js.setAttribute('type', 'text/javascript');
		js.setAttribute('src', path);
		if (defer=='defer') 
		{
		    js.setAttribute('defer', 'defer');
		}
		//
		
		js.type='text/javascript';
		js.src= path;
	    js.id =myid;
	    
            
        if (typeof myClassName!='undefined'||myClassName) 
        {
            js.className=myClassName;
        }
		//js.setAttribute('defer','false');
		//_doc.innerHTML+=js.outerHTML;
		_doc.appendChild(js);
 
		if (!Comm.ie) 
		{ //if not IE
		    //Firefox2 Firefox3 Safari3.1+ Opera9.6+ support js.onload
		    js.onload = function()
			{
		        //alert('Firefox2 Firefox3 Safari3.1+Opera9.6+support js.onload');
		    }
		}
		else 
		{
		    //IE6 IE7 support js.onreadystatechange
		    js.onreadystatechange = function()
			{
		        if (js.readyState == 'loaded' || js.readyState == 'complete') 
				{
		            //alert('IE6 IE7 support js.onreadystatechange');
		        }
		    }
		}
		
		//return false;
		
//        setTimeout(function()
//        {
//            js.parentNode.removeChild(js)
//        }, 99);
		
    }
};//function $import(path, type)

Comm.Include_Js =  function(path, reload)
{
	var scripts = document.getElementsByTagName("script");
	if(!reload)
	{
		for(var i=0;i<scripts.length;i++)
		{
			if (scripts[i].src && scripts[i].src.toLowerCase() == path.toLowerCase()) 
			{
				return;
			}
		}//for
	}//if(!reload)
	
	var sobj=document.createElement('script');
	sobj.type="text/javascript";
	sobj.src=path;
	var headObj = document.getElementsByTagName("head")[0];
	headObj.appendChild(sobj);	
};//Comm.Include_Js =  function(path, reload)


//Comm.$=function(str)
//{
//   return document.getElementById(str);	
//};//

Comm.$=function(element)
{
    if (arguments.length > 1) 
    {
        for (var i = 0, elements = [], length = arguments.length; i < length; i++) 
            elements.push($(arguments[i]));
        return elements;
    }

	element = document.getElementById(element);
    return    element; 

};//function $(element)

//Comm._getElementsByClassName('nodeItemIcon',oParent.parentNode.parentNode,'IMG');
Comm._getElementsByClassName = function(searchClass, node, tag)
{
//    if (document.getElementsByClassName) 
//	{
//        return document.getElementsByClassName(searchClass,node)
//    }
//    else 
	{
        node = node || document;
        tag = tag || "*";
        var classes = searchClass.split(" "), elements = (tag === "*" && node.all) ? node.all : node.getElementsByTagName(tag), patterns = [], returnElements = [], current, match;
        var i = classes.length;
        while (--i >= 0) 
		{
            patterns.push(new RegExp("(^|\\s)" + classes[i] + "(\\s|$)"));
        }
        var j = elements.length;
        while (--j >= 0) 
		{
            current = elements[j];
            match = false;
            for (var k = 0, kl = patterns.length; k < kl; k++) 
			{
                match = patterns[k].test(current.className);
                if (!match) 
                    break;
            }
            if (match) 
                returnElements.push(current);
        }
        return returnElements;
    }
};//Comm.getElementsByClassName = function(searchClass, node, tag)

//Comm.setFireFoxCfg=function(key,value)
//{
//	if(!Comm.ie)
//	{
//        if (window.netscape) 
//        {
//            try 
//            {
//                netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
//            } 
//            catch (e) 
//            {
//                //alert(e.message);
//            }
//        }
//        var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);

//        prefs.setCharPref(key, value);
//	}
//};//Comm.setFireFoxCfg=function(key,value)

Comm.setHomepage=function(strUrl)//strUrl='http://88sky.net'
{

    if (document.all) 
    {
        document.body.style.behavior = 'url(#default#homepage)';
        document.body.setHomePage(strUrl);
        
    }
    else if (window.sidebar) 
    {
        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);
    }
};//function setHomepage(strUrl)

Comm.setHomepage2=function (url)
{
    if (document.all) 
	{
        document.body.style.behavior = 'url(#default#homepage)';
        document.body.setHomePage(url);
    }
    else 
        if (window.sidebar) 
		{
            if (window.netscape) 
			{
                try 
				{
                    netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
                } 
                catch (e) 
				{
                    alert("该操作被浏览器拒绝，如果想启用该功能，请在地址栏内输入 about:config,然后将项 signed.applets.codebase_principal_support 值该为true");
                }
            }
            if (window.confirm("are you make sure make" + url + "is homepage?") == 1) 
			{
                var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
                prefs.setCharPref('browser.startup.homepage', url);
            }
        }
};//Comm.setHomepage2=function (url)

Comm.addBookmark=function(title, url)
{
    if (window.sidebar) 
	{
        window.sidebar.addPanel(title, url, "");
    }
    else 
	{
        if (document.all) 
		{
            window.external.AddFavorite(url, title);
        }
        else 
            if (window.opera && window.print) 
			{
                return true;
            }		
	}
};//Comm.addBookmark=function(title, url)


//兼容ff,ie关闭窗口无提?调用方法setTimeout(closeWindow,3000);
Comm.closeWindow = function()
{
    if (!Comm.ie &&  Comm.ns )
    {
        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.setBoolPref('dom.allow_scripts_to_close_windows', true);
    }//if (System.ns)

	parent.window.open("", "_parent");
	parent.window.close();
	
	if (!Comm.ie &&  Comm.ns)
	{
        prefs.setBoolPref('dom.allow_scripts_to_close_windows', false);	
	}
};//function Comm.closeWindow()

//http://www.codebit.cn/pub/html/javascript/tip/mouse_position/
Comm.mousePosition = function(ev)
{
    var ev = ev||event;
	if (ev.pageX || ev.pageY) 
	{
		return {
			x: ev.pageX,
			y: ev.pageY
		};
	}
	
	return {
		x: ev.clientX + document.body.scrollLeft - document.body.clientLeft,
		y: ev.clientY + document.body.scrollTop - document.body.clientTop
	}
};

//Find top pos of a tree node---OHSTree_dragdrop.js
Comm.getTopPos=function(obj)
{
	var top = obj.offsetTop/1;
	while((obj = obj.offsetParent) != null)
	{
		if(obj.tagName!='HTML')top += obj.offsetTop;
	}			
	if(document.all)top = top/1 + 13; else top = top/1 + 4;		
	return top;
};//Comm.getTopPos=function(obj)
	
		
//Find left pos of a tree node
Comm.getLeftPos=function(obj)
{
	var left = obj.offsetLeft/1 + 1;
	while((obj = obj.offsetParent) != null){
		if(obj.tagName!='HTML')left += obj.offsetLeft;
	}
			
	if(document.all)left = left/1 - 2;
	return left;
};//Comm.getLeftPos=function(obj)


//在firefox下event对象需要以参数的型式传递到函数体内，所以为?
//Comm.GetPosObject(event);
//在ie下则可不传递参数，故为?
//Comm.GetPosObject();
Comm.GetPosObject=function(e)
{
	//
    //e = e || window.event;
	if(Comm.ie)
    {
        e =  window.event;
    }
    return e.srcElement ? e.srcElement : e.explicitOriginalTarget;
//	return document.elementFromPoint ? document.elementFromPoint(
//            e.clientX + document.documentElement.scrollLeft, e.clientY + document.documentElement.scrollTop
//        ) : e.explicitOriginalTarget;
};

 
Comm.getSrcElement= function(e)
{
    var el;
    // Dropped on which element
    if (e.target) 
        el = e.target;
    else 
        if (e.srcElement) 
            el = e.srcElement;
    if (el.nodeType == 3) // defeat Safari bug
        el = el.parentNode;
    return el;
};
//取得控件得绝对位?
Comm.GetObjOffset= function(obj)
{  
    return obj.getBoundingClientRect(); 
};//Comm.GetObjOffset


//获得鼠标所在的位置
Comm.GetMousePos=function(e,posx, posy,oWatchView)
{
     var st, sl, sw, sh; 

    if (document.documentElement && document.documentElement.scrollTop) 
    {         
        st = document.documentElement.scrollTop;         
        sl = document.documentElement.scrollLeft;         
        sw = document.documentElement.scrollWidth;         
        sh = document.documentElement.scrollHeight;
             
    } else if (document.body) 
    {         
        st = document.body.scrollTop;         
        sl = document.body.scrollLeft;         
        sw = document.body.scrollWidth;         
        sh = document.body.scrollHeight; 
            
    }         

		
	if(!e) var e=window.event;

//	if(e.pageX||e.pageY)
//	{
//		posx[0]=e.pageX;
//		posy[0]=e.pageY;
//	}else if(e.clientX||e.clientY)
//	{
//		posx[0]=e.clientX + document.body.scrollLeft +document.documentElement.scrollLeft;
//		posy[0]=e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
//	}
 
    var left  = sl +e.clientX;
    var top   = st +e.clientY;	
	
	if(Comm.ie)
	{
		posx[0]=left;
		posy[0]=top;	
	}else
	{
		posx[0]=left;
		posy[0]=top;		
	}
	
	
	
	var str="";	
	str +="X:"+posx[0]+" ";
	str +="Y:"+posy[0]+" ";
	str+="<br/>";

    if(typeof oWatchView == 'object' )
    {
	    //oWatchView.left='200px';
 	    //oWatchView.top ='30px';
	    oWatchView.innerHTML ="Message:"+ str;
    }//

};//Comm.GetMousePos(e) 

//http://www.iwms.net/n1923c17.aspx
Comm.getElementPos=function(elementId)
{
    var ua = navigator.userAgent.toLowerCase();
    var isOpera = (ua.indexOf('opera') != -1);
    var isIE = (ua.indexOf('msie') != -1 && !isOpera); // not opera spoof 
    var el = document.getElementById(elementId);
    
    if (el.parentNode === null || el.style.display == 'none') 
	{
        return false;
    }
    var parent = null;
    var pos = [];
    var box;
    if (el.getBoundingClientRect) //IE 
    {
        box = el.getBoundingClientRect();
        var scrollTop = Math.max(document.documentElement.scrollTop, document.body.scrollTop);
        var scrollLeft = Math.max(document.documentElement.scrollLeft, document.body.scrollLeft);
        return {x: box.left + scrollLeft,y: box.top + scrollTop};
    }
    else
	{
        if (document.getBoxObjectFor) // gecko    
        {
            box = document.getBoxObjectFor(el);
            var borderLeft = (el.style.borderLeftWidth) ? parseInt(el.style.borderLeftWidth) : 0;
            var borderTop = (el.style.borderTopWidth) ? parseInt(el.style.borderTopWidth) : 0;
            pos = [box.x - borderLeft, box.y - borderTop];
        }
        else // safari & opera 
        {
            pos = [el.offsetLeft, el.offsetTop];
            parent = el.offsetParent;
            if (parent != el) {
                while (parent) {
                    pos[0] += parent.offsetLeft;
                    pos[1] += parent.offsetTop;
                    parent = parent.offsetParent;
                }
            }
            if (ua.indexOf('opera') != -1 || (ua.indexOf('safari') != -1 && el.style.position == 'absolute')) {
                pos[0] -= document.body.offsetLeft;
                pos[1] -= document.body.offsetTop;
            }
        }
		
	} 	
	
    if (el.parentNode) 
	{
        parent = el.parentNode;
    }
    else 
	{
        parent = null;
    }
	
    while (parent && parent.tagName != 'BODY' && parent.tagName != 'HTML') 
	{ // account for any scrolled ancestors
        pos[0] -= parent.scrollLeft;
        pos[1] -= parent.scrollTop;
        if (parent.parentNode) 
		{
            parent = parent.parentNode;
        }
        else 
		{
            parent = null;
        }
    }
	
    return {x: pos[0],y: pos[1]};
};//Comm.getElementPos=function(elementId)

/**
 *
 *  This function adds an event listener to an element on the page.
 *
 *	@param Object whichObject = Reference to HTML element(Which object to assigne the event)
 *	@param String eventType = Which type of event, example "mousemove" or "mouseup"
 *	@param functionName = Name of function to execute.
 *
 * @public
 */
Comm.isAChildOf =function (_parent, _child)
{
   if (_parent === _child) { return false; }
      while (_child && _child !== _parent)
   { _child = _child.parentNode; }

   return _child === _parent;
};
Comm.mouseEnter=function(_fn)
{
   return function(e)
   {
      var relTarget = e.relatedTarget;
      if (this === relTarget|| Comm.isAChildOf(this, relTarget))// 
         { return; }

      _fn.call(this, e);
   }
};


// {{{ removeEvent()
/**
 *H:\SourceCodeStudy\web\javascript\drag-drop-folder-tree.js
 *  This function removes an event listener from an element on the page.
 *
 *	@param Object whichObject = Reference to HTML element(Which object to assigne the event)
 *	@param String eventType = Which type of event, example "mousemove" or "mouseup"
 *	@param functionName = Name of function to execute.
 *
 * @public
 */


Comm.cancelEvent = function(e) 
{
    e = e||window.event
    if (e.preventDefault) 
    {
        e.preventDefault(  );
        e.stopPropagation(  );
    } else 
    {
        e.returnValue = false;
        e.cancelBubble = true;
    }
};//Comm.cancelEvent = function(e) 

Comm.removeEvent =function(obj, eType, fn)
{
    if (obj.detachEvent) 
    {
 	
        obj.detachEvent('on' + eType, obj[eType + fn]);
        obj[eType + fn] = null;
    }
    else if (obj.removeEventListener)
    {
        obj.removeEventListener(eType, fn, false);        
    }else
    {
        delete obj["on" + type];
    }
};//Comm.removeEvent =function(obj, eType, fn)

Comm.addEvent =function(whichObject, eventType, functionName)
{//http://blog.stchur.com/2007/03/15/mouseenter-and-mouseleave-events-for-firefox-and-other-non-ie-browsers/
//
   if(typeof whichObject == 'undefined' || !whichObject)
   {
   	   return null;
   }
   
   if (typeof whichObject.addEventListener != 'undefined')
   {
 
      if (eventType === 'mouseenter')
         { whichObject.addEventListener('mouseover', Comm.mouseEnter(functionName), false); }
      else if (eventType === 'mouseleave')
         { whichObject.addEventListener('mouseout',  Comm.mouseEnter(functionName), false); }
      else
         { whichObject.addEventListener(eventType, functionName, false); }
   }
   else if (typeof whichObject.attachEvent != 'undefined')
   {
        whichObject['e' + eventType + functionName] = functionName;
        whichObject[eventType + functionName] = function()
        {
            whichObject['e' + eventType + functionName](window.event);
        }
        whichObject.attachEvent('on' + eventType, whichObject[eventType + functionName]);
   }
   else
   {
      whichObject['on' + functionName] = functionName;
   }
   
   return functionName;
};//Comm.addEvent =function(whichObject, eventType, functionName) 	
    
//绑定事件,回车即触发提交
//e,'keydown',13,func 
Comm.RedirectEvent = function(e,keyCode,callback)
{
   var e= e||event;
   if(e.keyCode == keyCode) 
   {
        //document.getElementsByName("sub1")[0].click();
        
        callback(e);
 
		//Comm.cancelEvent(e);
		
        return false;
   }
    
   return true;
};//Comm.RedirectEvent = function(e,keyCode,callback)	

//http://www.it86.cc/webdesign/2009/0701/63127.shtml
//changecolor("表格名称","偶数行背景","奇数行背景","鼠标经过背景","点击后背景");
Comm.senfe=function(o, a, b, c, d)
{
    var t = o.getElementsByTagName("tr");
 
    for (var i = 0; i < t.length; i++) 
	{
        t[i].style.backgroundColor = (t[i].sectionRowIndex % 2 == 0) ? a : b;
		if(d)
		{
	        t[i].onclick = function()
			{
	            if (this.x != "1") 
				{
	                this.x = "1";//本来打算直接用背景色判断，FF获取到的背景是RGB值，不好判断
	                this.style.backgroundColor = d;    
	            }
	            else 
				{
	                this.x = "0";
	                this.style.backgroundColor = (this.sectionRowIndex % 2 == 0) ? a : b; 
	            }
	        }			
		}//if(d)

        
        t[i].onmouseover = function()
		{
            if (this.x != "1") 
                this.style.backgroundColor = c;
        }
        
        t[i].onmouseout = function()
		{
            if (this.x != "1") 
                this.style.backgroundColor = (this.sectionRowIndex % 2 == 0) ? a : b;
        }
    }//for (var i = 0; i < t.length; i++) 
};//Comm.senfe=function(o, a, b, c, d)

//http://sandbox.kendsnyder.com/EnterLeave.html?q=sandbox/EnterLeave.html
//$('observation').observe('mouseover',over)
//    .observe('mouseout',out)
//    .observe('mouseenter',enter)
//    .observe('mouseleave',leave);
//
//function detach() {
//    $('observation').stopObserving('mouseover',over)
//        .stopObserving('mouseout',out)
//        .stopObserving('mouseenter',enter)
//        .stopObserving('mouseleave',leave);
//}
/*
//需要prototype.js
if (!Prototype.Browser.IE) 
{
	
    var MouseenterMouseleave = {
        cache: {
            enter: [],
            leave: []
        },
        attach: function(type, element, observer, useCapture){
            var wrapped = function(event){
                if (event.relatedTarget == event.currentTarget || event.relatedTarget.childOf(event.currentTarget)) 
                    return;
                observer();
            };
            element.observe('mouse' + (type == 'enter' ? 'over' : 'out'), wrapped, useCapture);
            this.cache[type].push({
                e: element,
                o: observer,
                w: wrapped
            });
        },
        detach: function(type, element, observer, useCapture){
            var cached = this.cache[type].find(function(obj){
                return obj.e == element && obj.o == observer;
            });
            if (cached) {
                element.stopObserving('mouse' + (type == 'enter' ? 'over' : 'out'), cached.w, useCapture);
                this.cache[type] = this.cache[type].without(cached);
            }
        }
    };
}

Event.observe = function(element, name, observer, useCapture){
    element = $(element);
    useCapture = useCapture || false;
    
    if (name == 'keypress' &&
    (Prototype.Browser.WebKit || element.attachEvent)) 
        name = 'keydown';
    
    if (!Prototype.Browser.IE && (name == 'mouseenter' || name == 'mouseleave')) {
        MouseenterMouseleave.attach(name.substring(5), element, observer, useCapture);
    }
    else {
        Event._observeAndCache(element, name, observer, useCapture);
    }
};

Event.stopObserving = function(element, name, observer, useCapture){
    element = $(element);
    useCapture = useCapture || false;
    
    if (name == 'keypress' &&
    (Prototype.Browser.WebKit || element.attachEvent)) 
        name = 'keydown';
    
    if (!Prototype.Browser.IE && (name == 'mouseenter' || name == 'mouseleave')) {
        MouseenterMouseleave.detach(name.substring(5), element, observer, useCapture);
    }
    else {
        if (element.removeEventListener) {
            element.removeEventListener(name, observer, useCapture);
        }
        else 
            if (element.detachEvent) {
                try {
                    element.detachEvent('on' + name, observer);
                } 
                catch (e) {
                }
            }
    }
};
*/

//mztree....global.js
Comm.searchByTagName =function(e, TAG)
{
  while(e!=null && e.tagName)
  {
  	if(e.tagName==TAG.toUpperCase())
  		return(e); 
	e=e.parentNode; 
  } 
  return null;
};//Comm.searchByTagName =function(e, TAG)

Comm.searchById=function (e, id)
{
  while(e = e.parentNode){if(e.id==id) return(e);} return null;
};//Comm.searchById=function (e, id)



Comm.ReadyDoc = function (fn)
{
    
    if (document.addEventListener)
    {

        document.addEventListener("DOMContentLoaded", function ()
        {
            document.removeEventListener("DOMContentLoaded", arguments.callee, false);
          
            fn();

        }, false);

        //        document.addEventListener(Event.ON_AFTER_READY, function ()
        //        {
        //            document.removeEventListener("DOMContentLoaded", arguments.callee, false);
        //            fn();

        //        }, false);

    }
    else if (document.attachEvent)
    {
        document.attachEvent("onreadystatechange", function ()
        {
            if (document.readyState == 'complete')
            {
                document.detachEvent("onreadystatechange", arguments.callee);
                
                fn();
            }
        });
    }

};  //PolyVi.ReadyDoc

Comm.addLoadEvent = function(fn)
{
    var oldonload = window.onload;
    if (typeof window.onload != 'function') 
	{
        window.onload = fn;
    }
    else 
	{
        window.onload = function()
		{
            oldonload();
            fn();
        }
    }
};//Comm.addLoadEvent = function(fn)
 	  
//DOM只提供了insertBefore，我们很有必要自己实现insertAfter?
//不过我认?insertAdjacentElement是更好的选择?
//现在除了火狐其他浏览器都实现这个方法。下面是Jeremy Keith的版?
//Comm.insertAfter =function(parent, node, referenceNode) 
//{
//	//document.body.insertAdjacentElement(BeforeBegin,s2); 
//	parent.insertBefore(node, referenceNode.nextSibling);
//};//Comm.insertAfter =function(parent, node, referenceNode) 
  
Comm.insertAfter =function(newElement, targetElement)
{
    //newElement是插入的新元??
    //targetElement被插入元素后面的元素
    //获取目标元素的父节点
    var parent = targetElement.parentNode();
	
    //如果目标元素是最后一个元??则新元素紧跟着插入到目标元素的后面
    if (parent.lastChild == targetElement) 
	{
        parent.appendChild(newElement);  
    }
    //如果目标元素不是最后一个元??则新元素插入到目标原书的下一个兄弟元素的前面,即目标元素的后面
    else 
	{
        parent.insertBefore(newElement, targetElement.nextSibling) 
    }
    
};//Comm.insertAfter
Comm._xmlHttp = new XMLHttpRequest();

Comm.checkbadwords = function (str, badwords)
{
    if (typeof(str) != "string" || typeof(badwords) != "string") 
	{
        return (false);
    }
    for (i = 0; i < badwords.length; i++) 
	{
        bad = badwords.charAt(i);
        for (j = 0; j < str.length; j++) 
		{
            if (bad == str.charAt(j)) 
			{
                return false;
                break;
            }
        }//for
    }//for
    return true;
};//Comm.checkbadwords = function (str, badwords)

Comm.objClone= function(obj)
//obj为要克隆的对象，不需要构造方??
{
	result = new Array();
	for (var i in obj)
	result[i] = obj[i]
	return result
};

Comm.createImg = function(pSrc)
{
    var tmp = document.createElement("IMG");
    tmp.align = "absmiddle";
    tmp.src = pSrc;
    tmp.onerror = function(){
						        try 
								{
						            this.parentNode.removeChild(this);
						        } 
						        catch (e) 
								{
						        }
						    }
    return tmp;
};//Comm.createImg = function(pSrc)

// 将newElement元素插入targetElement元素之后
Comm.insertAfter =function(newElement, targetElement) 
{
	var parent = targetElement.parentNode;
	if(parent.lastChild == targetElement) 
	{
	   parent.appendChild(newElement);
	}else 
	{
	   parent.insertBefore(newElement, targetElement.nextSibling);
	}
};//Comm.insertAfter =function(newElement, targetElement) 


Comm.insertAfter2=function (parent, node, referenceNode) 
{
	parent.insertBefore(node, referenceNode.nextSibling);
};//

Comm.getSrcElement= function(e)
{
    var el;
    // Dropped on which element
    if (e.target) 
        el = e.target;
    else 
        if (e.srcElement) 
            el = e.srcElement;
    if (el.nodeType == 3) // defeat Safari bug
        el = el.parentNode;
    return el;
};

Comm.sortBy=function(a,b)
{
	var   c= a;//OHSTree._parseInt(a);
	var   d= b;//OHSTree._parseInt(b);
	
	//
    if(c > d)
	{
		return 1;
	}else if(c<d)
	{
		return -1;
	}else
	{
		return 0;
	}	
};

Comm.getScroll=function()
{
	var t, l, w, h;
	
	if (document.documentElement && document.documentElement.scrollTop) 
	{
		t = document.documentElement.scrollTop;
		l = document.documentElement.scrollLeft;
		w = document.documentElement.scrollWidth;
		h = document.documentElement.scrollHeight;
	} else if (document.body) 
	{
		t = document.body.scrollTop;
		l = document.body.scrollLeft;
		w = document.body.scrollWidth;
		h = document.body.scrollHeight;
	}
	return { t: t, l: l, w: w, h: h };
	
};//Comm.getScroll=function()

//Find top pos of an element
Comm.getTopPos=function(obj)
{
	var top = obj.offsetTop/1;
	while((obj = obj.offsetParent) != null){
		if(obj.tagName!='HTML')top += obj.offsetTop;
	}			
	if(document.all)top = top/1 + 13; else top = top/1 + 4;		
	return top;
};//Comm.getTopPos=function(obj)
	
		
//Find left pos of an element
Comm.getLeftPos=function(obj)
{
	var left = obj.offsetLeft/1 + 1;
	while((obj = obj.offsetParent) != null){
		if(obj.tagName!='HTML')left += obj.offsetLeft;
	}
			
	if(document.all)left = left/1 - 2;
	return left;
};//Comm.getLeftPos=function(obj)

Comm.refreshFrame=function(_id,_url) 
{
   document.getElementById(_id).src = _url;
};//

//<textarea id="status" onkeydown='Comm.countChar("status",140);' onkeyup='Comm.countChar("status",140);'></textarea>
Comm.countChar=function(oTextarea, maxlen)
{  
   var n = maxlen - oTextarea.value.length;
   return n;
   //oTipSpan.innerHTML = '(you can input '+n+' bytes)';//; - oTextarea.value.length
};//Comm.countChar
 

// 替换特殊字符
Comm.HTMLEncode=function (html)
{
if (html=='' || !html || typeof html =='undefined') 
{
    return '';
}

var temp = document.createElement ("div");
(temp.textContent != null) ? (temp.textContent = html) : (temp.innerText = html);
var output = temp.innerHTML;
//output= escape(output);
//output = output.replace(/&/g, "&amp;") ;
//output = output.replace(/"/g, "&quot;") ;
//output = output.replace(/</g, "&lt;") ;
//output = output.replace(/>/g, "&gt;") ;
//output = output.replace(/'/g, "&#146;") ;
//output = output.replace(/\ /g,"&nbsp;");
//output = output.replace(/\n/g,"<br>");
//output = output.replace(/\t/g,"&nbsp;&nbsp;&nbsp;&nbsp;");

temp = null;
return escape(output);
};//Comm.HTMLEncode=function (html)

//窗口居中
Comm.CenterWin=function(oWin)
{
	oWin.style.display='block';	
	//oWin.style.top =document.documentElement.scrollTop.replace('px','') +(document.documentElement.clientHeight-oWin.offsetHeight)/2 +'px';
	//oWin.style.left=document.documentElement.scrollLeft.replace('px','')+(document.documentElement.clientWidth -oWin.offsetWidth )/2 +'px';	

    var dde = document.documentElement;
    if (window.innerWidth)
    {
        var ww = window.innerWidth;
        var wh = window.innerHeight;
        var bgX = window.pageXOffset;
        var bgY = window.pageYOffset;
    }else
    {
        var ww = dde.offsetWidth;
        var wh = dde.offsetHeight;
        var bgX = dde.scrollLeft;
        var bgY = dde.scrollTop;
    }
    oWin.style.top  = (bgY + ((wh - oWin.offsetHeight)/2))+'px';
    oWin.style.left = (bgX + ((ww - oWin.offsetWidth )/2))+'px';
    
};//


Comm.HTMLDecode=function (text)
{
//return unescape(text);
if (text=='' || !text || typeof text =='undefined') 
{
    return '';
}

var temp = document.createElement("div");
temp.innerHTML =  unescape(text);
var output = temp.innerText || temp.textContent;
//output = output.replace( "&amp;",	/&/g ) ;
//output = output.replace( "&quot;",	/"/) ;
//output = output.replace( "&lt;",	/</g) ;
//output = output.replace( "&gt;",	/>/g) ;
//output = output.replace( "&#146;",	/'/g) ;
//output = output.replace( "&nbsp;",	/\ /g);
//output = output.replace( "<br>",	/\n/g);
//output = output.replace( "&nbsp;&nbsp;&nbsp;&nbsp;",	/\t/g);
temp = null;
return (output);
};//Comm.HTMLDecode=function (text)



//Comm.HTMLEncode=function (text)
//{
//	text = text.replace(/&/g, "&amp;") ;
//	text = text.replace(/"/g, "&quot;") ;
//	text = text.replace(/</g, "&lt;") ;
//	text = text.replace(/>/g, "&gt;") ;
//	text = text.replace(/'/g, "&#146;") ;
//	text = text.replace(/\ /g,"&nbsp;");
//	text = text.replace(/\n/g,"<br>");
//	text = text.replace(/\t/g,"&nbsp;&nbsp;&nbsp;&nbsp;");
//	return text;
//};//Comm.HTMLEncode
//
//Comm.HTMLDecode=function (text)
//{
//	text = text.replace( "&amp;",	/&/g ) ;
//	text = text.replace( "&quot;",	/"/) ;
//	text = text.replace( "&lt;",	/</g) ;
//	text = text.replace( "&gt;",	/>/g) ;
//	text = text.replace( "&#146;",	/'/g) ;
//	text = text.replace( "&nbsp;",	/\ /g);
//	text = text.replace( "<br>",	/\n/g);
//	text = text.replace( "&nbsp;&nbsp;&nbsp;&nbsp;",	/\t/g);
//	return text;
//};//

//定义通用的函数交换两个结点的位置  
Comm.swapNode = function (node1,node2)
{  
 //获取父结点  
 var _parent=node1.parentNode;  
 //获取两个结点的相对位置  
 var _t1=node1.nextSibling;  
 var _t2=node2.nextSibling;  
 //将node2插入到原来node1的位置  
 if(_t1)_parent.insertBefore(node2,_t1);  
 else _parent.appendChild(node2);  
 //将node1插入到原来node2的位置  
 if(_t2)_parent.insertBefore(node1,_t2);  
 else _parent.appendChild(node1);  
};//   

Comm.rand = function(num) 
{
   return Math.floor(Math.random()*num)+1;
};//

Comm.fakeReferer=function(url)
{
	if(Comm.ie) 
	{
		var linka = document.createElement('a');
		linka.href=url;
		document.body.appendChild(linka);
		linka.click();
	}else 
	{
		window.location = url;
	}	
};//

//Comm.CreateObject(divId,"clsid:0F2ABF05-6273-47C7-9599-36958DF85D6A",'OhsActiveX','OhsActiveX',"http://oltag.com/ocxTest/OhsActiveX.cab#version=1,0,0,0")
Comm.CreateObject=function(divId,clsId,ocxId,codebase)
{
     var d = document.getElementById(divId);
     try
     {
         d.innerHTML =
           '<object classid="' + clsId + '" id="' + ocxId +'" name="'+ocxId+'"  width="0" height="0" codebase="'+codebase+'"  VIEWASTEXT/>'; 
     }catch(ex)
     {
            var msg ='如果需要使用自动填表功能，请下载并安装控件 <a href="http://oltag.com/ocxTest/O.T自动登录IE控件.rar" ><u>O.T自动登录IE控件.rar</u></a>,(注:自动填表功能目前仅适用于IE内核的浏览器),'+
            '安装完成后重新打开浏览器生效';
           Comm.gMsgBoxWin.oWin.olabel.innerHTML = msg;
           Comm.gMsgBoxWin.oWin.style.display='block';
     }

};//Comm.CreateObject

Comm.EnableDragDrop=function(oAddRowWin)
{
	if(!oAddRowWin || typeof oAddRowWin =='undefined')
	{
		return;
	}
	
    var old_onmousemove = document.documentElement.onmousemove;
	var old_onmouseup   = document.documentElement.onmouseup;
		
    oAddRowWin.onmousedown = function(e)
	{ 
		e = e||event;
		var oE=Comm.getSrcElement(e);
		if (oE != this && typeof oE.value != 'undefined')
		{
		    return;
		}
		var x = e.clientX + document.body.scrollLeft -this.offsetLeft;
		var y = e.clientY + document.body.scrollTop -this.offsetTop;
		s = this.style;


		
		document.documentElement.onmousemove = function(e)
		{
			e = e||event;

			s.left = e.clientX + document.body.scrollLeft - x + "px";
			s.top =  e.clientY + document.body.scrollTop  - y + "px";
		}
		document.documentElement.onmouseup = function()
		{ 
			document.documentElement.onmousemove = old_onmousemove;
			document.documentElement.onmouseup   = old_onmouseup;
						
		}
//		document.documentElement.ondblclick = function()
//		{ 
//			document.documentElement.onmousemove = old_onmousemove;
//			document.documentElement.onmouseup   = old_onmouseup;			
//		}
		
    }
	
};//Comm.EnableDragDrop(oAddRowWin);

////////////////////////////////////prototype.js//////////////////////////////////////////////////////////
  

Comm.extend=function(destination, source) 
{
    for (var property in source)
      destination[property] = source[property];
    return destination;
};

Comm.extend(Object, {
extend:        Comm.extend
});

Object.extend(Function.prototype, (function() {
  var slice = Array.prototype.slice;
  
  function update(array, args) {
    var arrayLength = array.length, length = args.length;
    while (length--) array[arrayLength + length] = args[length];
    return array;
  }

  function merge(array, args) {
    array = slice.call(array, 0);
    return update(array, args);
  }
  
  function bind(context) {
    if (arguments.length < 2 && typeof arguments[0] === "undefined" ) return this;
    var __method = this, args = slice.call(arguments, 1);
    return function() {
      var a = merge(args, arguments);
      return __method.apply(context, a);
    }
  }

  return {
    bind:                bind
  }
})());

Comm.getClass=function(obj) 
{
    return Object.prototype.toString.call(obj).match(/^\[object\s(.*)\]$/)[1];
};
  
Comm.isArray=function(obj)
{
    return Comm.getClass(obj) === "Array";
};//Comm.isArray=function()
        
	            
	            
Comm.GetWebAutoLoginXmlStrCallBack=function(xmlstr)
{   
    xmlstr = xmlstr.value;

    //呼叫activex
    var ocx=document.OhsActiveX;
 
    try
    {

        if(typeof ocx=='undefined' || !ocx)
        {
              Comm.CreateObject('OhsActiveXId',"clsid:0F2ABF05-6273-47C7-9599-36958DF85D6A",'OhsActiveX',"http://oltag.com/ocxTest/OhsActiveX.cab#version=1,0,0,0");
              ocx=document.OhsActiveX;
        }//

        document.OhsActiveX.SendAutoLoginXmlToBHO(xmlstr);
        //alert(document.OhsActiveX.GetVersion());
    }catch(ex)
    {

        //对 COM 组件的调用返回了错误 HRESULT E_FAIL
        if (ex.number==-2147467259) 
        {
             return;
        }
        
        //ex.number==-2146827850 表示没有安装控件
        if (!Comm.ie && ex.number==-2146827850) {
            return;
        }
        
//        var msg ='如果需要使用自动填表功能，请下载并安装控件 <a href="http://oltag.com/ocxTest/O.T自动登录IE控件.rar" ><u>O.T自动登录IE控件.rar</u></a>,(注:自动填表功能目前仅适用于IE内核的浏览器),'+
//        '执行压缩包里的 <b>安装控件.bat</b> ,成功后刷新或重启浏览器生效';
//       Comm.gMsgBoxWin.oWin.olabel.innerHTML = msg;
//       Comm.gMsgBoxWin.oWin.style.display='block';

        //alert('如果需要使用自动填表功能，请下载并安装控件,\r\n自动填表功能目前仅适用于IE内核的浏览器');
    }
    
    
    //var oXml = new OHSXml();
    //oXml.LoadXML(xmlstr);
    
    //oXml=null;
};//Comm.GetWebAutoLoginXmlStrCallBack=function(xmlstr)

Comm.AdjustiframeHeight=function (oframe) {
 
var _doc=null;

if(oframe.contentDocument)
  // Firefox, Opera
  _doc = oframe.contentDocument;
else if(oframe.contentWindow)
  // Internet Explorer
  _doc = oframe.contentWindow.document;	  
else if(oframe.document)
  // Others?
  _doc = oframe.document;	
	  
oframe.style.height=document.documentElement.scrollHeight+ 'px';

};//

function OHSResPos() 
{
    this.strCnt;
    this.nStart;
    this.nEnd;
};

function CResInfo() 
{
    this.OrgFullSrc=new OHSResPos;
    this.OrgSrc=new OHSResPos;
    this.DesSrc=new OHSResPos;
};

Comm.RtnFileName=function (fullpath) 
{
    var fn='';
    var nStart,nEnd,nPos;
    
    nPos = fullpath.lastIndexOf('/');
    if (nPos!=-1) 
    {
       fn= fullpath.substr(nPos+1);
    }else
    {
        fn= fullpath;
    }
    
    if (fn) {
      return fn;
    } 
    return '';
 
};//Comm.RtnFileName=


Comm.GetFullFnFromRelatedFn=function(relatedFn,diaryResDomainPath)
{
//    if (diaryResDomainPath.charAt(diaryResDomainPath.length-1)!='\/') 
//    {
//        //确保目录格式一致,为了提高效率,我这里注释掉了,但是使用该函数一定要注意这个格式是尾部一定要为/
//        diaryResDomainPath+='\/';
//    }
    
    //其实我只需要关注relatedFn中的..个数.
    var s= relatedFn.match(/\.\./gi);
    if (!s) 
    {
        return diaryResDomainPath+relatedFn;
    }
    
    diaryResDomainPath=diaryResDomainPath.replace('http:\/\/','');
    var paths = diaryResDomainPath.split('\/');
    if (paths.length<s.length) 
    {
        return null;
    }
    
    var sTmp='http:\/\/';
    for(var i=0,j=paths.length-s.length-1;i<j;i++)
    {
        sTmp+=paths[i]+'\/';
    }
    relatedFn=relatedFn.replace(/(\.\.?(\\|\/))/ig,'');
    return sTmp+relatedFn;
};//Comm.GetFullFnFromRelatedFn=function(relatedFn,Comm.DiaryResDomainPath);

 

//Comm.ModalDialog('../OhsModelWin.htm');
Comm.ModalDialog=function(url,winArguments)  
{  
    var nwidth='500px';
    var nheight='205px';
    var feature;

    if(document.all) //IE  
    {  
       feature="dialogWidth:"+nwidth+";dialogHeight:"+nheight+";status:no;help:no;titlebar:no;scroll:no;menubar:no;toolbar:no;location :no;resizable:no;dialogHide:yes;unadorned:no;fullscreen:yes;directories:no;";  
       return window.showModalDialog(url,winArguments,feature);  
    }  
    else  
    {  
	       nwidth='576px';
	       nheight='335px';
           //modelessDialog¿ʒԽ«modal»»³Ȥialog=yes  
           var       w=window.screen.width;   
           var       h= window.screen.height;   

           var       win    =  Math.floor((h - parseInt( nwidth.split('px')[0]) )/2);   
           var       winleft=  Math.floor((w - parseInt(nheight.split('px')[0]) )/2);   


           window.myAction=this;

		    feature ="width='"+nwidth+"',height='"+nheight+"',top='"+win+"px',left='"+winleft+"px' ";  
		    //feature+=",menubar=0,scrollbars=0,toolbar=no,location =no,resizable = no, scrollbars=no, status = no,titlebar =no,status=no,modal=yes,dependent=1"; 
    		 
    		 
		    try
		    {
			    return window.showModalDialog(url,winArguments,feature,'replace'); 
		    }catch(ex)
		    {
			    var DialogWin = window.open(url,winArguments,feature);
			    return  window.onclick=function (){DialogWin.focus()}; 
		    } 
    } 
};//Comm.ModalDialog

Comm.DistillPic=function(content,tp,bDisResFromOTWebSite)
{
    var arRtn=new Array();
    var linkHrefTag='',linkTag='';

    var arRtn = [];
    tp=  tp.toLowerCase();
      
    if (tp!='img') 
    {
        return;
    }
    
    if (typeof bDisResFromOTWebSite=='undefined'||!bDisResFromOTWebSite) 
    {
        bDisResFromOTWebSite=false;
    }
        
    //(=\"([\S]*[^"]*((\.gif)|(\.jpg)))\")|(=\'([\S]*[^']*((\.gif)|(\.jpg)))\')|(=([^"][^><"]*((\.gif)|(\.jpg))))|
    //处理无双引号的 (=([^"][^><"]*((\.gif)|(\.jpg))))
    //处理有双引号的 (=\"([\S]*[^"]*((\.gif)|(\.jpg)))\")
    //处理有单引号的 (=\'([\S]*[^']*((\.gif)|(\.jpg)))\')
    var pattern = new RegExp('(=\"([\\S]*[^\"]*((\\.gif)|(\\.jpg)))\")|(=\'([\\S]*[^\']*((\\.gif)|(\.jpg)))\')|(=([^\"][^><\"]*((\\.gif)|(\\.jpg))))','gi'); 
    var token = pattern.exec(content);//get the first match
    var re;
    //group 2,7,12为我所需要的图片的src
    var sTmpSrc='';
    var arSrc=new Array();
    var arCnt=new Array();
    var fn='';
    var nStart,nEnd,nPos;
    
    while (token != null)
    {
         // if we have a match, print information about it
         
         if (token[2]) 
         {
            sTmpSrc=token[2];
            
         }else if (token[7]) 
         {
            sTmpSrc=token[7];
            
         }else if (token[12]) 
         {
            sTmpSrc=token[12];
            
         }
         sTmpSrc = sTmpSrc.toLowerCase();
 
         if (!bDisResFromOTWebSite && sTmpSrc.indexOf('oltag.com')!=-1) 
         {
              token = pattern.exec(content);
              continue;
         }
 
         var picInfo= new CResInfo;
         fn= sTmpSrc.Trim().toLowerCase();  
         
         picInfo.OrgSrc.strCnt=fn;            
         //检查是否有重复项
         for(var i=0,j=arSrc.length;i<j;i++)
         {
            //都是小写
            if(arSrc[i].OrgSrc.strCnt==picInfo.OrgSrc.strCnt) 
            {
                bHaveExist=true;
                break;
            }
            
         }//for
         
         if (bHaveExist) 
         {
             picInfo=null;
             break;
         }   
               
         if (fn.indexOf('http:')!=0 ) 
         {
         
             if (!Comm.DiaryResDomainPath) 
             {
                 //存在相对路径，弹出提示框
                 var cParams={'curRelatedPath':fn};
                 var rtnOldUrlStr=Comm.ModalDialog('../OhsModelWin.htm'+'?'+Math.random()*10000, cParams);
                 
                 if (rtnOldUrlStr==''||rtnOldUrlStr.indexOf('http:\/\/')!=0) 
                 {
                     //用户放弃对该相对路径资源的抽取
                     token = pattern.exec(content);
                     continue;
                 }
                 
                 //从模式对话框中返回的字符可能是路径,也可能是文件全名,所以我需要处理
                 Comm.DiaryResDomainPath = rtnOldUrlStr.substr(0,rtnOldUrlStr.length-Comm.RtnFileName(rtnOldUrlStr));
                 if (Comm.DiaryResDomainPath.charAt(Comm.DiaryResDomainPath.length-1)!='\/')
                 {
                    Comm.DiaryResDomainPath +='\/';
                 }             
             }
 
             //相对路径出现的情形为:./xxxx  ../xxxxx   xxxx/xxx 
             //每篇日志对应一个 Comm.DiaryResDomainPath,所以Comm.DiaryResDomainPath在diary.js中清0
             fn=Comm.GetFullFnFromRelatedFn(fn,Comm.DiaryResDomainPath);
             
         }    

         picInfo.OrgFullSrc.strCnt=fn;    
           
         picInfo.OrgSrc.nStart = token.index;
         picInfo.OrgSrc.nEnd   = token.lastIndex;
         picInfo.DesSrc.strCnt=Comm.RtnFileName(sTmpSrc);
         
         arSrc.push(picInfo);
 
         token = pattern.exec(content);    // get the next match
    }//while (token != null)
         
    return {'src':arSrc, 'des':arCnt }; 
          
};//Comm.DistillPic=function(content)


//是否是网址，还是本地路径
Comm.IsLocalPath=function (urlPath, outPath) 
{
    var bUrl =false,bLocalPath=false;

    urlPath =unescape(urlPath);
    
    if(urlPath.indexOf('://')!=-1) bUrl =true;
    if(urlPath.indexOf('file://')!=-1) bLocalPath =true;	
    
	//alert(o._url);
	var openUrl = urlPath;//encodeURI  
	              		
	if(!bUrl&&!bLocalPath)
	{
	    //使用正则判断它是否是本地路径
	    if(/^(file:\/\/\/)?[\w]:[\/\\]?([\s\S]+[\/\\]?)*/i.test(urlPath))
	    {
	         //本地文件
	         //openUrl = 'file:///'+openUrl;
	         bLocalPath=true;
	    }else
	    {
	         //网址
	         openUrl = 'http://'+openUrl;
	         bUrl =true;
	    }
	}
	
    if (openUrl.charAt(openUrl.length-1)!='/' && openUrl.charAt(openUrl.length-1)!='\\') 
    {
        if (bLocalPath) 
        {
         openUrl+='\\';
        }else
        {
         openUrl+='/';
        }
    }	
    
	var npos= openUrl.lastIndexOf('\\');
	if (npos==-1) 
	{
	    npos =openUrl.lastIndexOf('/');
	}
	
	if (npos==-1) 
	{
	    return bLocalPath;
	}
	
	if (typeof outPath !='undefined' && outPath) 
	{
 
	    outPath.push(openUrl.substring(0,npos+1));//substring(start, end)	
	}

    
    return bLocalPath;
    
};//Comm.IsLocalPath=function (strPath) 

Comm.DistillRes=function(content,tp,bDisResFromOTWebSite)
{
    var pattern;
    var linkHrefTag='',linkTag='';
    var re ='';//new RegExp('\W','gi');
    
    tp=tp.toLowerCase();
    
    if (tp =='js') 
    {
        linkTag='script';
        //pattern = /<script([^>]*)>/gi;        //<script([^>]*)[>]([.\S\r\n]*)<\/script> recognizes words; global
        linkHrefTag='src';

    }else if(tp=='css')
    {
        linkTag='link';
        //pattern = /<link([^>]*)>/gi;        // recognizes words; global
        linkHrefTag='href';
    }else if (tp=='img') 
    {
        linkTag='img';
        linkHrefTag='src';
 
    }
    
    if (typeof bDisResFromOTWebSite=='undefined'||!bDisResFromOTWebSite) 
    {
        bDisResFromOTWebSite=false;
    }
    
    pattern = new RegExp('<'+linkTag+'([^>]*)>','gi'); 
    var token = pattern.exec(content);//get the first match
                
    if (token) 
    {
        token.lastIndex =0;
    }
 
    var sTmpSrc='';
    var arSrc=new Array();
    var arCnt=new Array();
    var fn='';
    
    
    while (token != null)
    {
         var picInfo= new CResInfo;
         
         // if we have a match, print information about it
//         if (!bDisResFromOTWebSite && token[1].toLowerCase().indexOf('oltag.com')!=-1) 
//         {
//              token = pattern.exec(content);
//              continue;
//         }
         
         if (token[1] && token[1].toLowerCase().indexOf(linkHrefTag)!=-1) 
         {
              //提取js中的src  \s+src=\s*(([^\s]*)|\"([^\"]*)|\'([^\']*))
              re = new RegExp('\\s+'+linkHrefTag+'=\\s*(\"([^\"]*)|\'([^\']*)|([^\\s]*))','gi'); 
              //re = new RegExp('\s+'+linkHrefTag+'=\s*(\"([^\"]*)|\'([^\']*)|([^\s]*))','gi'); 
              sTmpSrc = re.exec(token[1]);///src="(.*)"/gi.exec(token[1]);
             
              if (sTmpSrc) 
              {
                 sTmpSrc.lastIndex =0;
              }
              var bHaveExist=false;
              var picInfo=null;
             
              for(var m=2;m<=4;m++)
              {
                  if (sTmpSrc[m]) 
                  {
                     if (!bDisResFromOTWebSite && sTmpSrc[m].toLowerCase().indexOf('oltag.com')!=-1) 
                     {
                          //token = pattern.exec(content);
                          break;
                     }
                     
                     picInfo= new CResInfo;
                     
                     fn= sTmpSrc[m].Trim().toLowerCase();  
                     picInfo.OrgSrc.strCnt=fn;  
                                       
                     //检查是否有重复项
                     for(var i=0,j=arSrc.length;i<j;i++)
                     {
                        //都是小写
                        if(arSrc[i].OrgSrc.strCnt==picInfo.OrgSrc.strCnt) 
                        {
                            bHaveExist=true;
                            break;
                        }
                        
                     }//for
                     
                     if (bHaveExist) 
                     {
                         picInfo=null;
                         break;
                     }
                     
                     picInfo.OrgSrc.nStart = token.index ;
                     picInfo.OrgSrc.nEnd   = token.lastIndex ; 
                     var rtnDomainPath=null;
                     
                     //只有当bDisResFromOTWebSite==false时，才是提取资源到服务器，否则就是用来插入资源到head
                     if (!bDisResFromOTWebSite&&sTmpSrc[m].indexOf('.')==0 ) 
                     {
                         //存在相对路径，弹出提示框
                         var cParams={'curRelatedPath':sTmpSrc[m]};
                         rtnDomainPath=Comm.ModalDialog('../OhsModelWin.htm'+'?'+Math.random()*10000, cParams);
                          
                     }   
  
                     if (!bDisResFromOTWebSite&&fn.indexOf('http:')!=0 ) 
                     {
                         if (!Comm.DiaryResDomainPath) 
                         {
                             //存在相对路径，弹出提示框
                             var cParams={'curRelatedPath':fn};
                             var rtnOldUrlStr=Comm.ModalDialog('../OhsModelWin.htm'+'?'+Math.random()*10000, cParams);
                             
                             var rtnPath=[];
 
                             //我在此判断是本地文件夹目录，还是远程web url.
                             if (Comm.IsLocalPath(rtnOldUrlStr,rtnPath)) 
                             {
                                 break;
                             } 
                             
                             rtnOldUrlStr = rtnPath[0];
                             
                             if (rtnOldUrlStr==''||rtnOldUrlStr.indexOf('http:\/\/')!=0) 
                             {
                                 //用户放弃对该相对路径资源的抽取
                                 token = pattern.exec(content);
                                 continue;
                             }
                             
                             //从模式对话框中返回的字符可能是路径,也可能是文件全名,所以我需要处理
                             Comm.DiaryResDomainPath = rtnOldUrlStr.substr(0,rtnOldUrlStr.length-Comm.RtnFileName(rtnOldUrlStr));
                             if (Comm.DiaryResDomainPath.charAt(Comm.DiaryResDomainPath.length-1)!='\/')
                             {
                                Comm.DiaryResDomainPath +='\/';
                             }             
                         }
             
                         //相对路径出现的情形为:./xxxx  ../xxxxx   xxxx/xxx 
                         //每篇日志对应一个 Comm.DiaryResDomainPath,所以Comm.DiaryResDomainPath在diary.js中清0
                         fn=Comm.GetFullFnFromRelatedFn(fn,Comm.DiaryResDomainPath);
                         
                     }    

                     picInfo.OrgFullSrc.strCnt=fn;  
                                               
                     picInfo.DesSrc.strCnt=Comm.RtnFileName(sTmpSrc[m]);
                     
                     arSrc.push(picInfo);
                     break;             
                  }//if (sTmpSrc[m])  
              }//for
         }// if (token[1] && token[1].toLowerCase().indexOf(linkHrefTag)!=-1) 
         
         token = pattern.exec(content);    // get the next match
    }//while (token != null)
 
    //pattern = /([.\r\n\S ]*)<\/SCRIPT>/gi;
    if (tp=='js') 
    {
        linkTag='script';
    }else if(tp=='css')
    {
        linkTag='style';
    }else if (tp=='img') 
    {
        linkTag='img';
        return {'src':arSrc, 'cnt':arCnt };
    }
    
    pattern = new RegExp('<'+linkTag+'([^>]*)>','gi'); 
    var ars = content.split(pattern);//get the first match 
 
    pattern = new RegExp('([\\s\\S]*)<\\/'+linkTag+'>','i'); 
    //new RegExp('([.\\r\\n\\S ]*)<\/'+linkTag+'>','gi');     
    re = new RegExp('<\/'+linkTag+'>','gi');     
 
    for(var i=0,j=ars.length;i<j;i++)
    {
        //先split,然后再match,抽取网页中的js代码段
        var cntInfo= new OHSResPos;
        //if (!/<\/script>/gi.test(ars[i])) 
        if(!re.test(ars[i]))
        {
            continue;
        }
        
        token = pattern.exec(ars[i]); 
        if (token &&token.length>1) 
        {
            //如果非空
            if(!/^\s*$/g.test(token[1]))
            {
                cntInfo.strCnt=token[1];
                cntInfo.nStart = token.index;
                cntInfo.nEnd   = token.lastIndex;                
                arCnt.push(cntInfo);
            }
        }
        
        if (token) 
        {
            token.lastIndex =0;
        }         
        
    }//for
    
    return {'src':arSrc, 'cnt':arCnt };       
};//Comm.DistillRes(content,tp)r

Comm.GenericOhsRandomResFn=function (fn) {
    var nStart,nEnd;
    nStart = fn.lastIndexOf('.');
    var sSuffixfn= fn.substr(0,nStart);
    var randm= Math.random();

    var uniqueId = Math.random()*10000 +"";
    uniqueId=uniqueId.replace('.', '');
    
    //有些文件后面带有尾巴，如.js?v=45641...,所以这里要去掉。
    var sTail = fn.substr(nStart);

    var   token = sTail.match(/([.\w]+)/i); 

    if (token &&token.length>1) 
    {
        //如果非空
        if(!/^\s*$/g.test(token[1]))
        {
            sTail = token[1];
        }
    }
    
    return sSuffixfn+'_OhsTree'+uniqueId+sTail;
};//Comm.GenericOhsRandomResFn=function ()


Comm.removeAllChild=function (oParent)
{
//    if (oParent.children.length==0) {
//    return;
//    }
    //删除this.oTbl窗口中的所有元素
    var preo = null;
    var o = oParent.childNodes[0];//preo.nextSibling;
    while (o) 
    {
        preo=o;
        o= o.nextSibling;
        preo.parentNode.removeChild(preo);
    }
};//Comm.removeAllChild=function (oParent)

Comm.Sleep=function(ms)
{
	if(!Comm.isSafari)
	{
		  var start = new Date().getTime(); 

		  while(new Date().getTime()-start<ms)
		  {
		    try
			{
				var strfile=Comm.MyBaseUrl+"xx.html/mz="+ Math.random();
				var  ajax = new OHSAjax(strfile);
				ajax.method = "GET";
				ajax.async=true;
				ajax.runAJAX('');
				ajax =null;
		    }catch(ex)
			{
				return;
			}
		  }		
	}else
	{
		 var start=new Date().getTime(); //for opera only
		 while(true) if(new Date().getTime()-start>n) break;
	}
};//Comm.Sleep=function(ms)
//Comm.ocxIsInsalled =function(oID)
//{
//    with(event.srcElement)
//    {
//        //给事件发生的对象添加clientCaps默认行为
//        addBehavior('#default#clientcaps');
//        //根据控件的ID检测是否已经安装，是的话继续检测控件版本，否则提示"未安装"
//        isComponentInstalled(oID,"componentid")?alert('已安装，版本：'+getComponentVersion(oID,"componentid")):alert("未安装");
//    }
//};//

 

//load cookie manager lib
//Comm.$import("CookieManager.js", "js");
//Comm.Include_Js('..\OHS_UI\UIbase.js');



