/*
 * ceno
 */

var ceno = new RegExp("ceno");

ceno_all = function() {
    ceno_datetable();
    ceno_form();
	ceno_menu();
 
    ceno_layout();
	ceno_addEvent();
}

ceno_doClick = function() {
    window.setTimeout('set_Time_out()', 1000);
    set_Time_out = function () {
        var doClick = Ext.getDom(Ext.query('.ceno_doClick'));
        if (doClick[0])
        {
            for (var i = 0; i < doClick.length; i++)
            {
                if (document.createEvent)
                {
                    var evObj = document.createEvent('MouseEvents');
                    evObj.initEvent('click', true, false);
                    doClick[i].dispatchEvent(evObj);
                }
                else if (document.createEventObject)
                {
                    doClick[i].fireEvent('onclick');
                }
            }
        }
    }
}
Ext.onReady(ceno_doClick)

ceno_doClickA = function(a) {
	a=Ext.getDom(a);
    if (document.createEvent)
    {
        var evObj = document.createEvent('MouseEvents');
        evObj.initEvent('click', true, false);
        a.dispatchEvent(evObj);
    }
    else if (document.createEventObject)
    {
        a.fireEvent('onclick');
    }
}

ceno_addEvent=function(){


		var ceno_button_table1=Ext.select('.ceno_button_table1')
	    ceno_button_table1.addClassOnOver('ceno_button_table1_hover');
	    ceno_button_table1.addClassOnClick('ceno_button_table1_down');
		
		var ceno_button_table2=Ext.select('.ceno_button_table2')
		ceno_button_table2.addClassOnOver('ceno_button_table2_hover');
	    ceno_button_table2.addClassOnClick('ceno_button_table2_down');
		
	    Ext.select('.inputTxt').addClassOnFocus('inputTxt_focus');
	
		Ext.select('textarea').addClassOnFocus('focus');	
		
		



		
	    var toolbarButtonDom=Ext.getDom(Ext.query('.ceno_toolbar .btnbg'))
	    if (toolbarButtonDom[0])
	    {
	        for (var i= 0, toolbarButtonDomL=toolbarButtonDom.length; i <toolbarButtonDomL ; i++)
	        {
				var toolbarButtonDomI=toolbarButtonDom[i]
				var toolbarButtonI=Ext.get(toolbarButtonDomI)
	            var dis = new RegExp("disable");
	            if (!dis.test(toolbarButtonDomI.className))
	            {
	                toolbarButtonI.addClassOnOver('over');
	                toolbarButtonI.addClassOnClick('down');
	            }
	        }
	    }
		
		
		
		var subLi=Ext.select('.submenu li');
		subLi.addClassOnOver('over');
		


}
Ext.onReady(ceno_addEvent)




reinitIframe = function (a,miniHeight,Fn)
{	
	var count=0;
	var innerH=0;
	window.setInterval(
		function()
		{
		    try {



				innerH=a.contentWindow.document.body.scrollHeight;
				if(innerH!=count)
				{
					if(innerH<miniHeight)
					{a.height=miniHeight}
					else
					{
						a.height = innerH;
						}					
					if(Fn) Fn();
					count=innerH;
				}
								
		    }
		    catch (ex) {
		    }		
		}
	, 500)
}



ceno_submenu=function(a,menuEl,openAddFn){
	if(openAddFn!=null) openAddFn();
	var This=Ext.get(a);		
	var thisSub=Ext.get(menuEl);			

	thisSub.setStyle('zIndex','9999')
	if(Ext.getDom(thisSub).offsetTop<0)
	{
		This.addClass('down')
		thisSub.setX(This.getX());
		thisSub.setY(This.getY()+This.getHeight());
		ceno_shadow(thisSub);
	}
	else
	{
		This.removeClass('down')
		thisSub.setX(-9999);
		thisSub.setY(-9999);
		ceno_removeShadow();
	}
	
	var thisA=a.getElementsByTagName('a')[0];
	thisA.focus()
	
	thisA.onblur=function(){
		window.setTimeout(function(){
			This.removeClass('down')
			thisSub.setX(-9999);
			thisSub.setY(-9999);
			ceno_removeShadow();					
		}, 300);
	}
}
 
 
 
 
 
 
 


var modeForClose,popCon,popWin,popConDiv,popWinDom,popTit,popWinEmpty

function ceno_msgbox(title, popConEl, w, h,closeAddFn, mode) {
	
	modeForClose=mode 
	
    if (!document.getElementById('popwin')) 
    {
        var popWinHtml = [
                '<div class="popwin" id="popwin">',
                '<div class="pwtitle" id="pwtitle" >',
                '<div class="pwclose" id="pwclose">',
				'<table class="ceno_button_table2" onmouseover=Ext.get(this).addClass("ceno_button_table2_hover")  onmouseout=Ext.get(this).removeClass("ceno_button_table2_hover") onmousedown=Ext.get(this).addClass("ceno_button_table2_down")  onmouseup=Ext.get(this).removeClass("ceno_button_table2_down")><tr class="ceno_button_table2_tr"><td class="l"><div class="ico16 ico_close"></div></td><td class="r"/></tr></table></div>',
				'<span class="pwtitleCon" id="pwtitleCon" ></span>',
                '</div>',
                '<div id="popcont" class="pwcontent">',
                '</div>',
                '</div>'
                ];

        Ext.getBody().insertHtml('beforeEnd', popWinHtml.join(''));
	}
    popWin = Ext.get('popwin');
    popWinDom = Ext.getDom('popwin');
	popConDiv = Ext.get('popcont');
    popTit = Ext.get('pwtitle');
	
	
	 
	var popTitConDom = Ext.getDom('pwtitleCon');	
	popTitConDom.innerHTML=title;


    if (mode == null) 
    {
        popCon = Ext.get(popConEl);
    }

    if (mode == 'iframe') 
    {
        var iframeHtml = '<iframe id="popIframe" class="ceno_auto_height ceno_pHide" frameborder="0" src="about:blank" width="100%" > </iframe>'
        Ext.select('body').insertHtml('beforeEnd', iframeHtml);
        popCon = Ext.get('popIframe');
		
        window.setTimeout(function() {
            Ext.getDom(popCon).src = popConEl;
        }, 500);
		
    }
    if (mode == 'ajax') 
    {
        var ajaxDiv = document.createElement('div');
        ajaxDiv.className = "ceno_auto_height"
        document.body.appendChild(ajaxDiv);
        popCon = Ext.get(ajaxDiv);
		
        window.setTimeout(function() {
            popCon.load({
                url:'ajax.html',
                text: "Loading...",
                callback:ceno_all,
                scripts : true
            })
        }, 500);
    }
		
		
	popCon.appendTo(popConDiv); 


 
    if (w != null) {
        popWin.setWidth(w);
    }
    else {
        popWin.setWidth(400);
    }
	
    if (h!= null) {
        popWin.setHeight(h);
        popConDiv.setHeight(h - popTit.getHeight() - popConDiv.getMargins('tb'));
		popConDiv.setStyle('overflow','auto');
    }
    else {
		popWin.setHeight('auto');
        popConDiv.setHeight(popCon.getHeight() + popCon.getMargins('tb'));
		popConDiv.set({style:'overflow:hidden'});
    }
 	


 
    if (mode == 'iframe')
    {
        ceno_layout();
    }
 

	popWin.set({style:'position:absolute;zIndex:9999;visibility:hidden'});

 	
    popWinEmpty=1  	
    function ceno_msgboxXY() {
		if(popWinEmpty==0) return false
        popWin.center();
        popWinDom.style.left = popWinDom.offsetLeft < 0 ? 0 : popWinDom.offsetLeft + 'px';
        popWinDom.style.top = popWinDom.offsetTop - 30 < 0 ? 0 : popWinDom.offsetTop - 30 + 'px';
    }

    ceno_msgboxXY();
    Ext.EventManager.onWindowResize(ceno_msgboxXY);
 	


    ceno_mask(); 


 
    
	 popWinDisplay = function() {
        popWinDom.style.visibility = 'visible';
        ceno_shadow(popWinDom); 	
        popCon.removeClass('ceno_pHide');
        if(Ext.get('aWin')) {Ext.get('aWin').remove();} 	
    }
	if (!Ext.isIE)
	{
		window.setTimeout('popWinDisplay()', 300);
		flyWin('popwin'); 	
	}
	else
	{
		popWinDisplay();		
	}
	

 	


	Ext.getDom('pwclose').onclick=function(){
		if(closeAddFn!=null) closeAddFn(); 
		msgbox_close();
	}

}

function msgbox_close(){
		ceno_removeShadow();
	    ceno_removeMask();
	    if (modeForClose == null)
	    {
	        popCon.appendTo(Ext.select('body'));
			popCon.addClass('ceno_pHide');
	    }
	    if (modeForClose == 'iframe'||modeForClose == 'ajax')
	    {
	        popCon.remove();
	    }
		popWinDom.style.left='-9999px';
		popWinDom.style.top='-9999px';
		popWinDom.style.visibility='hidden';
		popWinEmpty=0;
}

		

function flyWin(win) {
    var aWin = document.createElement('div');
    aWin.id = 'aWin';
    aWin.style.cssText = "position:absolute;background:#efefef;opacity:0.3;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=30); width:100px; height:100px;  border:1px solid #ccc ";
    document.body.appendChild(aWin);

   
	var win = Ext.getDom(win)
	document.onclick =function (evt){
	    if(!evt) evt = window.event;
	    if(!evt.pageX)evt.pageX = evt.clientX;
	    if(!evt.pageY)evt.pageY = evt.clientY;
		Ext.get(aWin).setX(evt.pageX);
		Ext.get(aWin).setY(evt.pageY);			    
		Ext.get(aWin).moveTo(win.offsetLeft, win.offsetTop, {duration:0.3,easing:'easeOut'});
		Ext.get(aWin).setWidth(win.offsetWidth, {duration:0.3});
		Ext.get(aWin).setHeight(win.offsetHeight, {duration:0.3});			  
		document.onclick=null
		}

    if (!Ext.isIE)
    {
        Ext.get(aWin).setOpacity(1, {duration:0.3});
    }
	else
    {
        Ext.get(aWin).setOpacity(0.5);
    }
}
 
 

function ceno_shadow(obj) {
    var shadowHtml = [
            '<table class="x-shadow" width="100%" height="100%" cellspacing="0" cellpadding="0">',
            '<tr class="xst">',
            '<td class="xstl">&nbsp;</td>',
            '<td class="xstc">&nbsp;</td>',
            '<td class="xstr">&nbsp;</td>',
            '</tr>',
            '<tr class="xsm">',
            '<td class="xsml">&nbsp;</td>',
            '<td class="xsmc">&nbsp;</td>',
            '<td class="xsmr">&nbsp;</td>',
            '</tr>',
            '<tr class="xsb">',
            '<td class="xsbl">&nbsp;</td>',
            '<td class="xsbc">&nbsp;</td>',
            '<td class="xsbr">&nbsp;</td>',
            '</tr>',
            '</table>'
            ];
    var shadowHtmlIE6 = [
            '<table class="x-shadow-ie6" width="100%" height="100%" cellspacing="0" cellpadding="0">',
            '<tr>',
            '<td></td>',
            '</tr>',
            '</table>'
            ];
    var oShadow = document.createElement('div');


    oShadow.id = "ceno_shadow";

    oShadow.style.position = 'absolute';
    oShadow.style.zIndex = '9900';


    obj = Ext.get(obj);
    function ceno_shadowXY() {
        var oH = obj.getHeight();
        var oW = obj.getWidth();
        var oX = obj.getX();
        var oY = obj.getY();
        if (Ext.isIE6)
        {
            oShadow.innerHTML = shadowHtmlIE6.join('');
            oShadow.style.width = oW - 3 + 'px';
            oShadow.style.height = oH - 3 + 'px';
            oShadow.style.left = (oX - 5 < 0 ? 0 : oX - 5) + 'px';
            oShadow.style.top = (oY - 5 < 0 ? 0 : oY - 5) + 'px';
            Ext.get(oShadow).setOpacity(0.5);
        }
        else
        {
            if (Ext.isIE7)
            {
                oShadow.innerHTML = shadowHtml.join('');
                oShadow.style.width = oW + 10 + 'px';
                oShadow.style.height = oH + 10 + 'px';
                Ext.getDom(Ext.get(oShadow).query('.xsmc'))[0].style.height = oH - 10 + 'px';
                oShadow.style.left = (oX - 6 < 0 ? 0 : oX - 6) + 'px';
                oShadow.style.top = (oY - 6 < 0 ? 0 : oY - 6) + 'px';
            }
            else
            {
                oShadow.innerHTML = shadowHtml.join('');
                oShadow.style.width = oW + 10 + 'px';
                oShadow.style.height = oH + 10 + 'px';
                Ext.getDom(Ext.get(oShadow).query('.xsmc'))[0].style.height = oH - 10 + 'px';
                oShadow.style.left = (oX - 4 < 0 ? 0 : oX - 4) + 'px';
                oShadow.style.top = (oY - 4 < 0 ? 0 : oY - 4) + 'px';
            }
        }
    }
    ceno_shadowXY()
    document.body.appendChild(oShadow);
    Ext.EventManager.onWindowResize(ceno_shadowXY);
}
function ceno_removeShadow() {
    if (Ext.get("ceno_shadow"))
    {
        Ext.get("ceno_shadow").remove();
    }
}
 
 

function ceno_mask() {
    var bgw = Ext.lib.Dom.getDocumentWidth();
    var bgh = Ext.lib.Dom.getDocumentHeight();

    var oBg = document.createElement('div');
    oBg.id = 'msgbox_bgDiv';
    oBg.style.cssText = 'width:'+bgw+'px;height:'+bgh+'px; position:absolute;opacity:0;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=30);top:0;left:0;background:#888888;z-index:8998';
	document.body.appendChild(oBg);
	document.body.style.overflowX="hidden";
	if(!Ext.isIE)
	{
		oBg.style.opacity=0;
		window.setTimeout(function() {
        Ext.get(oBg).setOpacity(0.3, {duration:0.3});
    	} , 400);
	}



    Ext.EventManager.onWindowResize(function() {
        bgw = Ext.lib.Dom.getDocumentWidth();
        bgh = Ext.lib.Dom.getDocumentHeight();
        oBg.style.width = bgw + 'px';
        oBg.style.height = bgh + 'px';
    });


 
    window.setTimeout(function() {
            Ext.select('select').set({style:'visibility:hidden'});
			Ext.select('object').set({style:'visibility:hidden'});
			Ext.select('embed').set({style:'visibility:hidden'});
			Ext.select("#popwin select").set({style:'visibility:visible'});
			Ext.select("#popwin object").set({style:'visibility:visible'});
			Ext.select("#popwin embed").set({style:'visibility:visible'});
    } , 2000);

 
	
}

function ceno_removeMask() {
	if(!Ext.isIE)
	{
		Ext.get('msgbox_bgDiv').setOpacity(0, {duration:0.3});
	    window.setTimeout(function() {
			if(Ext.get('msgbox_bgDiv'))
			{
				Ext.get('msgbox_bgDiv').remove();
			}        
	    }, 400);
	}
	else
	{
			if(Ext.get('msgbox_bgDiv'))
			{
				Ext.get('msgbox_bgDiv').remove();
			}
		
	}
	
    

			
 

    window.setTimeout(function() {
	    Ext.select('select').set({style:'visibility:visible'});
	    Ext.select('object').set({style:'visibility:visible'});
	    Ext.select('embed').set({style:'visibility:visible'});
		
		document.body.style.overflowX="auto";
    } , 1000);
 
}

if (Ext.isIE6)
{
    for_png = function ()
    {
        for (var i = 0; i < document.images.length; i++)
        {
            var img = document.images[i];
            var imgName = img.src.toUpperCase();
            if (imgName.substring(imgName.length - 3, imgName.length) == "PNG")
            {
                var imgID = (img.id) ? "id='" + img.id + "' " : "";
                var imgClass = (img.className) ? "class='" + img.className + "' " : "";
                var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' ";
                var imgStyle = "display:inline-block;" + img.style.cssText;
                if (img.align == "left") imgStyle = "float:left;" + imgStyle;
                if (img.align == "right") imgStyle = "float:right;" + imgStyle;
                if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle;
                var strNewHTML = "<span " + imgID + imgClass + imgTitle + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";" + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader (src=\'" + img.src + "\', sizingMethod='scale');\"></span>";
                img.outerHTML = strNewHTML;
                i = i - 1;
            }
        }

    }
    Ext.onReady(for_png);
}
ceno_datetable = function() {


    
    var dataTableDom = Ext.getDom(Ext.query('.ceno_data_table1'));
    
    if (dataTableDom[0])
    {
        var dataTableCls = ".ceno_data_table1";
        var checkboxAll = ".ceno_checkboxAll";
        var tableTitleCls = ".ceno_table_title";
        var tableTitleClsNoPoint = "ceno_table_title";
        var scrollTableTitleCls = ".ceno_scroll_table_title";
        var scrollTableDivCls = ".ceno_scroll_table_div";
        var scrollTableBodyCls = ".ceno_scroll_table_body";
		var scrollTableBodyDivCls = ".ceno_scroll_table_body_div";
        var radioTable = ".ceno_radio_table";
        var tableTipTitleCls = ".ceno_table_tip_title";
        var tableTipTitleHoverCls = "ceno_table_tip_title_hover"
		var tableTipTitleOpenCls = ".ceno_table_tip_title_open";
		var tableTipTitleInputCls = ".ceno_table_tip_title_input"; 


        
        for (var i = 0, dataTableDomL=dataTableDom.length; i <dataTableDomL; i++)
        {

	        
			var dataTableDomI=dataTableDom[i]					
	        var dataTableI = Ext.get(dataTableDomI)
			
			dataTableI.on('keydown', function(e) {
	            var evt = e || window.event || top.event;				
	            if (evt.shiftKey){shiftdown = true};
	        })	
	        dataTableI.on('onkeyup', function(e) {
	            shiftdown = false;
	        })	

            
			var tableInputsDom = Ext.getDom(dataTableI.query('input'));
			if(tableInputsDom[0])
			{
				for (var b = 0,tableInputsDomL=tableInputsDom.length; b < tableInputsDomL; b++)
	            {
	                tableInputsDom[b].checked = false
	            }				
			}

        }
        


        
        tableTipTitleOpenFn = function(a) {
            var This = Ext.get(a);
            var thisNext = This.parent(tableTipTitleCls).next(scrollTableBodyDivCls);
            if (Ext.getDom(thisNext).style.display == 'none')
            {
                thisNext.set({style:'display:'});
                This.parent(tableTipTitleCls).child('.open').replaceClass('b', 'a');
            }
            else
            {
                thisNext.set({style:'display:none'});
                This.parent(tableTipTitleCls).child('.open').replaceClass('a', 'b');
            }
        }

        
        chkall = function (a) {
            
            var This = Ext.get(a);
            

            This.hasClass('select') ? This.removeClass('select') : This.addClass('select')

			if(This.parent(tableTipTitleCls)!=null)
			{
				var thisNext = This.parent(tableTipTitleCls).next(scrollTableBodyDivCls);
				var ochksDom = Ext.getDom(thisNext.query('input'));
			}
			else
			{
				var thisTable=This.parent(dataTableCls);
				var ochksDom = Ext.getDom(thisTable.query('input'));
			}
            for (var i = 0, ochksDomL=ochksDom.length; i <ochksDomL; i++)
            {
                var ochksDomI=ochksDom[i];
				if (ochksDomI.type != "checkbox") continue;
				var ochksI=Ext.get(ochksDomI)
                var otr = ochksI.parent('tr')? ochksI.parent('tr'):ochksI.parent('div');
                if (!This.hasClass('select')) {
                    ochksDomI.checked = false;
                    otr.removeClass('select')
                } else {
                    ochksDomI.checked = true;
                    otr.addClass('select');
                }
            }
        }
        


		

        
        everTrNotTitleFn = function(a, e) {
            var chk = a.getElementsByTagName("input")[0];
			var This=Ext.get(a);
            var thisTable=This.parent(dataTableCls);
            var thisTableDom = Ext.getDom(thisTable);
            if (!chk) return false;
            
            
            chk.checked = chk.checked == true ? false : true;
            if (chk.type == 'checkbox')
            {
                if (chk.checked) {
                    This.addClass('select');
                    if (!curtr) curtr = a;
                    




                    if (shiftdown) {
                        shiftdown = false;
                        if (shiftstart) {
							var oTr=thisTableDom.getElementsByTagName('tr'),shiftstartIndex=0;thisIndex=0;
							for(var t=0,oTrL=oTr.length;t<oTrL;t++)
							{
								if(shiftstart==oTr[t])
								{
									shiftstartIndex=t
								}
								if(a==oTr[t])
								{
									thisIndex=t
								}
							}
                            if (shiftstartIndex > thisIndex) {
                                var start = thisIndex, end = shiftstartIndex;
                            } else {
                                var start = shiftstartIndex, end = thisIndex;
                            }

                            for (var i = start; i <= end; i++) {
                                var r = oTr[i];
                                if (r.className == "clktr") continue;
                                r.getElementsByTagName("input")[0].checked = true;
                                Ext.get(r).addClass('select');
                            }
                            shiftstart = null;
                            if (document.selection) document.selection.clear();
                        } else {
                            shiftstart = a;
                        }
                    } else {
                        shiftstart = a;
                    }
                    
                } else {
                   	This.removeClass('select');
                }
            }

            if (chk.type == 'radio')
            {
                if (chk.checked) {
                    thisTable.select('tr[class!=' + tableTitleClsNoPoint + ']').removeClass('select');
                    This.addClass('select');
                }
                else {
                    thisTable.select('tr[class!=' + tableTitleClsNoPoint + ']').removeClass('select');
                }
            }
        }
		var curtr = null;
        var shiftdown = false;
        var shiftstart = null;


		
		stopPreventEvent = function(evt){
			var e=(evt)?evt:window.event;
			if (window.event) {
			e.cancelBubble=true;
			} else {
			e.stopPropagation();
			}
		}

		 
        everListEditFn = function(a){









			

			





			












		}







































































	




    }


}

Ext.onReady(ceno_datetable)



































ceno_scorllmenu = function() {

    var sMenu = 'ceno_scroll_menu';
	
	var MenuDom=Ext.getDom(Ext.query('.' + sMenu))[0]

    if (MenuDom&&!ceno.test(MenuDom.id))
    {
        MenuDom.id = 'ceno_scrollMenu';
	     
	    var sTitle = 'ceno_scroll_menu_title';
	    var sContent = 'ceno_scroll_menu_content';
	
	    var sContentDiv = 'ceno_scroll_menu_content_div';
	    var sTitleSelect = "ceno_scroll_menu_title_select";
	    var sTitleHover = "ceno_scroll_menu_title_hover";
	     
	



































			var Menu=Ext.get(MenuDom)
            var TitleDom = Ext.getDom(Menu.query('.' + sTitle));
			var Title = Ext.get(TitleDom)

			var ContentDom = Ext.getDom(Menu.query('.' + sContent));
			var Content = Ext.get(ContentDom)
			

            Content.wrap({tag:'div',cls:sContentDiv,style:'height:0px;'});
			var ContentDivDom = Ext.getDom(Menu.query('.' + sContentDiv));
            var ContentDiv = Ext.get(ContentDivDom)	


			
























































             

             
            var ContentDom = Ext.getDom(Menu.query('.' + sContent));
            for (var ConM = 0,ContentDomL=ContentDom.length; ConM < ContentDomL; ConM++)
            {
				var ContentDomI=ContentDom[ConM];
                ContentDomI.style.marginTop = '-' + 100 + 'px'; 
                ContentDomI.style.display = 'none';
            }
             

             


             

            Title.on('click', function() {
                thisMenu(this)
            })
            Title.addClassOnOver(sTitleHover);
        }

        thisMenu = function(a) {
            var This = Ext.get(a);
             














            var thisNext = This.next();
             
		


             
            var titlesHeight = 0;
            for (var i = 0,TitleDomL=TitleDom.length; i <TitleDomL ; i++)
            {
				var TitleDomI=TitleDom[i]
                titlesHeight = TitleDomI.offsetHeight + titlesHeight;
            }
            var contentHeight = Menu.getHeight() - Menu.getFrameWidth('tb') - titlesHeight;
             


             
			var TitleDomL=TitleDom.length,ContentDomL=ContentDom.length;
			if (TitleDomL != ContentDomL) alert(' ');
            for (var i = 0; i < TitleDomL; i++)
            {
				var ContentDivDomI=ContentDivDom[i]
				var TitleDomI=TitleDom[i]
				var ContentDomI=ContentDom[i]
                if (ContentDivDomI.offsetHeight == 0) continue;     

                Ext.get(ContentDivDomI).setHeight(0, {duration:0.5,easing:'easeOutStrong'});
                Ext.get(ContentDivDomI).removeClass('ceno_auto_height');
                ContentDivDomI.style.overflow = 'hidden';
                Ext.get(TitleDomI).removeClass(sTitleSelect);
                 
                ContentDomI.style.marginTop = '-' + ContentDivDomI.offsetHeight + 'px';
                ContentDomI.style.display = 'none';
                 

				var openContentDivDom = ContentDivDom[i]
                window.setTimeout(function() {
                    openContentDivDom.style.display = 'none';
                }, 600);

            }
             

             
            if (thisNext.getHeight() == 0)
            {
				thisNext.setStyle('display','');
				thisNext.setStyle('overflow','auto');
                thisNext.setHeight(contentHeight, {duration:0.5,easing:'easeOutStrong'});
                thisNext.addClass('ceno_auto_height');                
                This.addClass(sTitleSelect);
                 


                 
                var thisContent = thisNext.child('.' + sContent);
                window.setTimeout(function () {
                    thisContent.setStyle('display','');
                    thisContent.anim(
	                    {marginTop:{to: 0}},
	                    {duration:0.5,easing:'easeOutStrong'}
                            );
                }, 300);
                 
            }
        }

}
Ext.onReady(ceno_scorllmenu)



ceno_form = function() {
    var formTableDom = Ext.getDom(Ext.query('.form_table1_div'));
    if (formTableDom[0])
    {
        var formTableDomL = formTableDom.length;
        if (formTableDomL > 1)
        {
			var  formTable=Ext.get(formTableDom);
			formTable.on('click', function() {
			    formTable.removeClass('form_table1_div_hover');
			    Ext.get(this).addClass('form_table1_div_hover');
			})
        }
    }

 
	var noteDom = Ext.getDom(Ext.query('.inner_note'))
    if (noteDom[0])
    {
        for (var i = 0,noteDomL=noteDom.length; i <noteDomL ; i++)
        {
			var noteDomI = noteDom[i];
            if (ceno.test(noteDomI.id)) continue;				
			noteDomI.id = 'ceno_inner_note' + i;			
            
			var noteI=Ext.get(noteDomI);							
			var noteIn=noteI.prev();
			var noteInDom=Ext.getDom(noteIn)

            if (noteInDom.value == '')
            {
                noteDomI.style.display = 'block';
				noteI.setXY(noteIn.getXY());
                noteI.setSize(noteIn.getSize());
            }
            else
            {
                noteDomI.style.display = 'none';
            }
			
            noteIn.on('blur', function() {
                if (Ext.getDom(this).value == '')
                {
					var thisNote=this.next('.inner_note')
                   thisNote.setStyle('display','block');
                   thisNote.setXY(this.getXY());
                }
            })
			noteIn.on('focus', function() {
				var thisNote=this.next('.inner_note')
				thisNote.setStyle('display','none');
            })
	        noteI.on('click', function() {
				var thisNoteIn=this.prev()
				this.setStyle('display','none');
	        	thisNoteIn.focus();
	        })				
        }
		
		Ext.EventManager.onWindowResize(function(){
			for (var i = 0,noteDomL=noteDom.length; i <noteDomL ; i++)
			{
				var noteDomI = noteDom[i];
				var noteI=Ext.get(noteDomI);
				var noteIn=noteI.prev();
				noteI.setXY(noteIn.getXY());
			}
		});
    }
}
Ext.onReady(ceno_form)
ceno_menu = function() {
    var menuC = 'ceno_menu_ul';
    var menu = 'ceno_menu_li';
    var menuHover = 'ceno_menu_li_hover';
    var menuSelect = 'ceno_menu_li_select';
    var allMenu = Ext.select('.' + menu)
    allMenu.addClassOnOver(menuHover);
    allMenu.on('click', function() {
        allMenu.removeClass(menuSelect);
        Ext.get(this).addClass(menuSelect);
    });
}
Ext.onReady(ceno_menu)
ceno_tipmenu = function(a,menuConEl,openAddFn,aspect) {


	if(openAddFn!=null) openAddFn();
	var This = Ext.get(a);
	var thisMenuInnerContent = Ext.get(menuConEl);

    
	var thisX=This.getX();
	var thisY=This.getY();		
	var thisH=This.getHeight();
	var thisW=This.getWidth();	
	var thisMenuInnerContentW=thisMenuInnerContent.getWidth();
	var thisMenuInnerContentH=thisMenuInnerContent.getHeight();
	
	 
	var bgw = Ext.lib.Dom.getViewportWidth();
    var bgh = Ext.lib.Dom.getViewportHeight();
    var thisOffsetBottom = bgh - thisY - thisH;
    var thisOffsetRight = bgw - thisX - thisW;
    var thisMenuHight = thisMenuInnerContentH + 20;
    var thisMenuWidth = thisMenuInnerContentW + 20;
    var bottomOverflow = 0,rightOverflow = 0
    if (thisMenuHight > thisOffsetBottom)
    {
        bottomOverflow = 1;
    }
    if (thisMenuWidth > thisOffsetRight)
    {
        rightOverflow = 1;
    }
     

    var menuTipHtml;
	
    if (aspect=='TR'||aspect=='BR'||aspect=='TL'|| aspect=='BL')
    {
	    if (aspect=='TR')
	    {
	        menuTipHtml =  [
			                '<div class="ceno_menu_tip_div ceno_menu_tip_TR" id="ceno_menu_tip_div">',
			                '<div class="ceno_menu_tip_scroll" id="ceno_menu_tip_scroll">',
			                '<div class="ceno_menu_tip_content" id="ceno_menu_tip_content">',
			                '</div>',
			                '<div class="ceno_menu_tip_arr" id="ceno_menu_tip_arr">',
			                '</div>',
			                '</div>',
			                '</div>'
			                ];
	    }
	    if (aspect=='BR')
	    {
	        menuTipHtml = [
			                '<div class="ceno_menu_tip_div ceno_menu_tip_BR" id="ceno_menu_tip_div">',
			                '<div class="ceno_menu_tip_scroll" id="ceno_menu_tip_scroll">',
			                '<div class="ceno_menu_tip_arr" id="ceno_menu_tip_arr">',
			                '</div>',
			                '<div class="ceno_menu_tip_content" id="ceno_menu_tip_content">',
			                '</div>',
			                '</div>',
			                '</div>'
			                ];
	    }
	    if (aspect=='TL')
	    {
	        menuTipHtml = [
			                '<div class="ceno_menu_tip_div ceno_menu_tip_TL" id="ceno_menu_tip_div">',
			                '<div class="ceno_menu_tip_scroll" id="ceno_menu_tip_scroll">',
			                '<div class="ceno_menu_tip_content" id="ceno_menu_tip_content">',
			                '</div>',
			                '<div class="ceno_menu_tip_arr" id="ceno_menu_tip_arr">',
			                '</div>',
			                '</div>',
			                '</div>'
			                ];
	    }
	    if (aspect=='BL')
	    {
	        menuTipHtml =  [
			                '<div class="ceno_menu_tip_div ceno_menu_tip_BL" id="ceno_menu_tip_div">',
			                '<div class="ceno_menu_tip_scroll" id="ceno_menu_tip_scroll">',
			                '<div class="ceno_menu_tip_arr" id="ceno_menu_tip_arr">',
			                '</div>',
			                '<div class="ceno_menu_tip_content" id="ceno_menu_tip_content">',
			                '</div>',
			                '</div>',
			                '</div>'
			                ];
	    }
    }
    else
    {

	    if (bottomOverflow == 1 && rightOverflow == 1)
	    {
	        menuTipHtml =  [
			                '<div class="ceno_menu_tip_div ceno_menu_tip_TR" id="ceno_menu_tip_div">',
			                '<div class="ceno_menu_tip_scroll" id="ceno_menu_tip_scroll">',
			                '<div class="ceno_menu_tip_content" id="ceno_menu_tip_content">',
			                '</div>',
			                '<div class="ceno_menu_tip_arr" id="ceno_menu_tip_arr">',
			                '</div>',
			                '</div>',
			                '</div>'
			                ];
	    }
	    if (bottomOverflow == 0 && rightOverflow == 1)
	    {
	        menuTipHtml = [
			                '<div class="ceno_menu_tip_div ceno_menu_tip_BR" id="ceno_menu_tip_div">',
			                '<div class="ceno_menu_tip_scroll" id="ceno_menu_tip_scroll">',
			                '<div class="ceno_menu_tip_arr" id="ceno_menu_tip_arr">',
			                '</div>',
			                '<div class="ceno_menu_tip_content" id="ceno_menu_tip_content">',
			                '</div>',
			                '</div>',
			                '</div>'
			                ];
	    }
	    if (bottomOverflow == 1 && rightOverflow == 0)
	    {
	        menuTipHtml = [
			                '<div class="ceno_menu_tip_div ceno_menu_tip_TL" id="ceno_menu_tip_div">',
			                '<div class="ceno_menu_tip_scroll" id="ceno_menu_tip_scroll">',
			                '<div class="ceno_menu_tip_content" id="ceno_menu_tip_content">',
			                '</div>',
			                '<div class="ceno_menu_tip_arr" id="ceno_menu_tip_arr">',
			                '</div>',
			                '</div>',
			                '</div>'
			                ];
	    }
	    if (bottomOverflow == 0 && rightOverflow == 0)
	    {
	        menuTipHtml =  [
			                '<div class="ceno_menu_tip_div ceno_menu_tip_BL" id="ceno_menu_tip_div">',
			                '<div class="ceno_menu_tip_scroll" id="ceno_menu_tip_scroll">',
			                '<div class="ceno_menu_tip_arr" id="ceno_menu_tip_arr">',
			                '</div>',
			                '<div class="ceno_menu_tip_content" id="ceno_menu_tip_content">',
			                '</div>',
			                '</div>',
			                '</div>'
			                ];
	    }

	}
     
    thisMenuInnerContent.insertHtml('afterEnd', menuTipHtml.join(''));
     

     
    var menuTipDiv = Ext.get('ceno_menu_tip_content');
    thisMenuInnerContent.appendTo(menuTipDiv);
     


    var thisMenu = Ext.get('ceno_menu_tip_div');
    var thisMenuDom = Ext.getDom(thisMenu);
    var thisMenuScroll = Ext.get('ceno_menu_tip_scroll');
    var thisMenuContent = Ext.get('ceno_menu_tip_content');
    var thisMenuInnerContentDom = Ext.getDom(thisMenuInnerContent);


    thisMenuInnerContent.removeClass('ceno_pHide')
	
	var thisMenuScrollH=thisMenuScroll.getHeight()			
	var thisMenuH=thisMenu.getHeight();
	var thisMenuW=thisMenuInnerContentW + thisMenuContent.getMargins('lr') + thisMenuContent.getFrameWidth('lr');

			
	thisMenu.setHeight(thisMenuH);
    thisMenu.setWidth(thisMenuW);


	 
    AScroll = function(w) {
		thisMenuScroll.setStyle('marginTop', w + thisMenuScrollH + 'px');






			thisMenuScroll.anim({marginTop:{to: 0}}, {duration:0.3});

    }
	 
	
	 
    T = function() {
        thisMenu.setY(thisY - thisMenuH);
    }
    B = function() {
        thisMenu.setY(thisY + thisH);
    }
    L = function() {
        thisMenu.setX(thisX);
    }
    R = function() {
        thisMenu.setX(thisX - thisMenuW + thisW);
    }
	 
	
    var PN;
    if (aspect=='TR'||aspect=='BR'||aspect=='TL'|| aspect=='BL')
    {
        if (aspect=='TR')
        {
            T();
            R();
            AScroll('+');
            PN = '+';
        }
        if (aspect=='BR')
        {
            B();
            R();
            AScroll('-');
            PN = '-';
        }
        if (aspect=='TL')
        {
            T();
            L();
            AScroll('+');
            PN = '+';
        }
        if (aspect=='BL')
        {
            B();
            L();
            AScroll('-');
            PN = '-';
        }
    }
    else
    {
	    if (bottomOverflow == 1 && rightOverflow == 1)
	    {
	        T();
	        R();
	        AScroll('+');
	        PN = '+';
	    }
	    if (bottomOverflow == 0 && rightOverflow == 1)
	    {
	        B();
	        R();
	        AScroll('-');
	        PN = '-';
	    }
	    if (bottomOverflow == 1 && rightOverflow == 0)
	    {
	        T();
	        L();
	        AScroll('+');
	        PN = '+';
	    }
	    if (bottomOverflow == 0 && rightOverflow == 0)
	    {
	        B();
	        L();
	        AScroll('-');
	        PN = '-';
	    }
	}

     
    var shadowdiplay = window.setTimeout(function() {
        ceno_shadow(thisMenuContent);
    }, 400);
     

     
    var mask = document.createElement('div');
    var btnMask = document.createElement('div');
    mask.style.cssText = 'z-index:1;position:absolute;top:0;left:0; width:' + bgw + 'px; height:' + bgh + 'px;opacity:0;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);background-color:#fff';
    btnMask.style.cssText = 'z-index:9000;position:absolute;opacity:0;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);background-color:#fff';
    document.body.appendChild(btnMask);
    var appendMask = window.setTimeout(function() {
        document.body.appendChild(mask)
    }, 300);

	Ext.get(btnMask).setX(thisX-2);
	Ext.get(btnMask).setY(thisY-2);
    Ext.get(btnMask).setSize(thisW + 4, thisH + 4);
     


     
	thisMenuDom.onclick=menuClose;
	
	function menuClose() {
	
			if(thisMenuScroll) thisMenuScroll.setStyle('marginTop', PN + thisMenuScrollH+'px');
            ceno_removeShadow();
            if(Ext.get(mask)) Ext.get(mask).remove();
            if(Ext.get(btnMask)) Ext.get(btnMask).remove();
            thisMenuInnerContent.addClass('ceno_pHide')
            thisMenuInnerContent.appendTo(Ext.getBody());
            if(thisMenu) thisMenu.remove();
            clearMemory()
    }
	
	
	  
    mask.onmouseover = menuCloseAnim;
	
	function menuCloseAnim() {
        var timer = window.setTimeout('set_Time_out()', 300);
        thisMenu.on('mouseover', function() {
            clearTimeout(timer)
        });
        set_Time_out = function() {
            if(thisMenuScroll) thisMenuScroll.anim({marginTop:{to:PN + thisMenuScrollH}}, {duration:0.3});
            ceno_removeShadow();
            var timer2 = window.setTimeout('set_Time_out2()', 300);
        }
        set_Time_out2 = function() {
            if(Ext.get(mask)) Ext.get(mask).remove();
            if(Ext.get(btnMask)) Ext.get(btnMask).remove();
            thisMenuInnerContent.addClass('ceno_pHide')
            thisMenuInnerContent.appendTo(Ext.getBody());
            if(thisMenu) thisMenu.remove();
            clearMemory()
        }
    }
     
    function clearMemory()
    {
        TR = null;
        BR = null;
        TL = null;
        BL = null;
        appendMask = null
        shadowdiplay = null
        PN = null
        AScroll = null
        T = null
        B = null
        L = null
        R = null

        This = null
        thisMenu = null
        thisMenuDom = null
        thisMenuScroll = null
        thisMenuContent = null
        thisMenuInnerContentDom = null

        mask = null;
        btnMask = null;
    }



}

ceno_layout = function() {

    get_auto_height = function () {

        var auto_height = Ext.getDom(Ext.query('.ceno_auto_height'))[0];
        if (auto_height)
        {
			
			var Form = Ext.getDom(Ext.query('form'));
			if (Form[0])
			{
				for (var i = 0,FormL=Form.length; i < FormL; i++)
	            {
					var FormI=Form[i]
					if(Ext.get(FormI).child('.ceno_auto_height'))
					(Ext.get(Form[i]).addClass('ceno_auto_height'))
				}
			}
			
			
			
			auto_height = Ext.getDom(Ext.query('.ceno_auto_height'));
			
			var cH=Ext.lib.Dom.getViewportHeight()
			var pacl = new RegExp("ceno_auto_height");
            var pacl2 = new RegExp("ceno_pHide");
			

            for (var i = 0, auto_heightL=auto_height.length; i <auto_heightL; i++)
            {
                var auto_heightI=auto_height[i];
				var auto_height_parent = auto_heightI.parentNode;				
                auto_height_parent.style.overflow = 'hidden';
                var auto_height_brothers_height = 0;

                var j = 0;
                
                for (var cn = auto_height_parent.firstChild; cn; cn = cn.nextSibling) {
                    if (cn.nodeType == 1&&!pacl.test(cn.className) && !pacl2.test(cn.className) && cn.style.position != "absolute") {					
                            auto_height_brothers_height = auto_height_brothers_height + cn.offsetHeight + Ext.get(cn).getMargins('tb');
                    }

                }
                var th;
                if (auto_height_parent != document.body)
                {
                    th = auto_height_parent.offsetHeight - Ext.get(auto_height_parent).getFrameWidth('tb') - auto_height_brothers_height;
                }
                else {
                    th = cH - auto_height_brothers_height;
                }
                if (th < 10)
                {
                    th = 10;
                }

                Ext.get(auto_heightI).setHeight(th- Ext.get(auto_heightI).getMargins('tb'));
            }
        }
    }























































    get_auto_height();



}
Ext.onReady(ceno_layout);
Ext.EventManager.onWindowResize(ceno_layout);


