
/*
	"Hemi" JavaScript Framework
	Engine for Web Applications 3.1
	Composite file "hemi.comp.js" release: 3.1.1
	Copyright 2002 - 2010. All Rights Reserved.
	Author: Stephen W. Cote
	Email: sw.cote@gmail.com
	Project: http://www.whitefrost.com/Hemi/
	BSD License: http://www.whitefrost.com/Hemi.license.txt
*/
(function(){H.include("hemi.event");H.include("hemi.util");H.namespace("monitor",H,{service:null,serviceImpl:
function(){var t=this;t.t="MonitorService";t.v="3.1.1";t.i="monitor_service_1";t.r=0;t.o={monitors:[],context_object:0};t.cookies={};t.p={ci:0,delay:1000,session_name:"MSESS_ID",document_rendered:0,hashed_cookies:0,window_interval:0,can_interval:1,window_state:0,application_id:0,dataset_id:0,last_image_index:0};t.getContextObject=function(){return t.o.context_object;};t.getDatasetId=function(){return t.p.dataset_id;};t.getDocumentRendered=function(){return t.p.document_rendered;};t.getWindowState=function(){return t.p.window_state;};t.getSessionId=function(){return t.cookies[t.p.session_name];};t.getApplicationId=function(){return t.p.application_id;};t.getContextId=function(){return t.p.ci;};t.hashCookie=function(n,b,s){var c=t.p,k=t.cookies;if(!c.hashed_cookies++||s)t.hashValue(document.cookie,";","=",k);if(b&&D.TS(k[n]))t.hashValue(k[n],"&",":",k);};t.hashValue=function(c,d,s,k){if(c){var j=0,l,a=c.split(d),f=eval("/\\s*([^\\s"+s+"]+)"+s+"(.+)\\s*/");for(;a&&j<a.length;){l=a[j++].match(f);if(l)k[l[1]]=l[2].match(/^\d+$/)?parseInt(l[2]):l[2];}}};t.G=function(n){return t.o.context_object.getElementsByTagName(n);};t.doInterval=function(){var m=t.o.monitors,c=t.p,i=0,l,o,z;l=m.length;for(;i<l;){o=m[i++];if(!o)continue;z=o.p;if(D.TF(o.doInterval)&&z.can_interval){if(z.interval_offset<=0)z.interval_offset=1;z.interval_offset--;if(z.interval_offset<=0)o.doInterval();}}c.window_interval=window.setTimeout(t.handle_window_interval,c.delay);return 1;};t.handle_window_interval=function(){var c=t.p;if(c.window_state>3){window.clearTimeout(c.window_interval);c.window_interval=0;return;}if(!c.can_interval)return;if(c.can_interval)if(!t.doInterval()){window.clearTimeout(c.window_interval);c.window_interval=0;c.can_interval=0;}};t.handle_document_stop=function(e){t.DE("document_stop",e);};t.handle_window_load=function(e){var c=t.p;if(c.window_state>=3)return;t.BE();c.window_state=3;c.document_rendered=1;t.DE("window_load",e);};t.handle_window_beforeunload=function(e){t.DE("window_beforeunload",e);t.p.window_state=4;};t.handle_window_unload=function(e,bPub){var c=t.p;if(!Hemi||typeof Hemi.include!="function")return;if(t.r==4){t.r=4.5;c.window_state=5;t.DE("window_unload",e);c.document_rendered=0;t.BE(1);t.bindObjects(1);t.ImageProbe(1);}t.r=5;};t.destroy=function(bPub){this.handle_window_unload(0,1);};t.DE=function(s,e,p2,p3){var m=t.o.monitors,i=0,l,o,n;n="handle_"+s;l=m.length;for(;i<l;){o=m[i++];if(o&&typeof o[n]=="function")o[n](e,p2,p3);}};t.initializeMonitorService=function(){if(t.r)return 0;var	d=document,w=window,c=t.p,o=t.cookies,p=t.o;t.r=2;c.application_id=(typeof APPLICATION_ID!=D.U)?APPLICATION_ID:"Global";c.dataset_id=(typeof DATASET_ID!=D.U?DATASET_ID:"public");p.context_object=(typeof CONTEXT_OBJECT!=D.U?CONTEXT_OBJECT:document);t.hashCookie();c.ci=H.guid();if(!o[c.session_name]){o[c.session_name]=c.ci;d.cookie=c.session_name+"="+o[c.session_name]+";";}t.bindObjects();t.ImageProbe();t.r=4;t.doInterval();};t.handle_context_menu=function(e){t.DE("context_menu",e);};t.handle_window_error=function(m,u,l){t.DE("window_error",m,u,l);if(typeof window.ph_error==D.F)return window.ph_error.apply(window,arguments);};t.handle_mouse_click=function(e){t.DE("mouse_click",e);};t.handle_mouse_move=function(e){t.DE("mouse_move",e);};t.handle_document_scroll=function(e){t.DE("document_scroll",e);};t.handle_window_focus=function(e){t.DE("window_focus",e);};t.handle_window_blur=function(e){t.DE("window_blur",e);};t.handle_input_focus=function(e){t.DE("input_focus",e);};t.handle_input_blur=function(e){t.DE("input_blur",e);};t.handle_window_keydown=function(e){t.DE("window_keydown",e);};t.handle_window_resize=function(e){t.DE("window_resize",e);};t.handle_form_submit=function(e){t.DE("form_submit",e);var oF=H.event.getEventSource(e);if(oF&&oF.nodeType==1&&typeof oF.ph_submit==D.F)return oF.ph_submit.apply(oF,arguments);};t.handle_form_reset=function(e){t.DE("form_reset",e);var oF=H.event.getEventSource(e);if(oF&&oF.nodeType==1&&typeof oF.ph_reset==D.F)return oF.ph_reset.apply(oF,arguments);};t.handle_select_change=function(e){t.DE("select_change",e);};t.bindObjects=function(b){var _a=(b?H.event.removeEventListener:H.event.addEventListener),d=document,w=window,f=false,o,p=t.o;_a(d,"stop",t.handle_document_stop,f);_a(w,"load",t.handle_window_load,f);_a(w,"unload",t.handle_window_unload,f);_a(w,"beforeunload",t.handle_window_beforeunload,f);o=p.context_object;if(o==d)o=d.documentElement;_a(o,"contextmenu",t.handle_context_menu,f);_a(o,"mousemove",t.handle_mouse_move,f);_a(o,"click",t.handle_mouse_click,f);_a(o,"scroll",t.handle_document_scroll,f);_a(w,"focus",t.handle_window_focus,f);_a(w,"blur",t.handle_window_blur,f);_a(w,"keydown",t.handle_window_keydown,f);_a(w,"resize",t.handle_window_resize,f);if(!b){if(w.onerror)w.ph_error=w.onerror;w.onerror=t.handle_window_error;}else{if(w.ph_error)w.onerror=w.ph_error;}};t.BE=function(b){var a=[],i,o,f=(b?H.event.removeEventListener:H.event.addEventListener),mc=t.handle_mouse_click,hs=t.handle_form_submit,hr=t.handle_form_reset,hc=t.handle_select_change,uf=t.handle_input_focus,ub=t.handle_input_blur;H.util.absorb(t.G("form"),a);H.util.absorb(t.G("a"),a);H.util.absorb(t.G("input"),a);H.util.absorb(t.G("area"),a);H.util.absorb(t.G("select"),a);H.util.absorb(t.G("textarea"),a);for(i=0;i<a.length;i++){o=a[i];if(!o.nodeName.match(/select/i)){f(o,"click",mc);f(o,"focus",uf);f(o,"blur",ub);f(o,"keydown",ub);}if(o.nodeName.match(/form/i)){if(!b){if(o.onsubmit)o.ph_submit=o.onsubmit;o.onsubmit=hs;if(o.onreset)o.ph_reset=o.onreset;o.onreset=hr;}else{if(o.ph_submit)o.onsubmit=o.ph_submit;if(o.ph_reset)o.onreset=o.ph_reset;}}else if(o.nodeName.match(/select/i)){f(o,"click",hc);f(o,"change",hc);f(o,"focus",hc);f(o,"blur",hc);f(o,"keydown",hc);}}};t.removeMonitor=function(o){var m=t.o.monitors,i=0,b=0;if(!o)return 0;for(;i<m.length;i++){if(m[i]&&m[i].getObjectId()==o.getObjectId()){m[i]=0;b=1;}}return b;};t.addMonitor=function(o,c){var m=t.o.monitors,r=H.registry.service;if(!D.TO(o)||o==null||r.isRegistered(o)==false||!D.TF(o.initializeMonitor))return 0;if(!o.config_keys)o.config_keys={};if(D.TO(o.config_keys)&&D.TS(c))t.hashValue(c,"&",":",o.config_keys);o.getConfigKeys=function(){return o.config_keys};o.getConfigKey=function(n){return o.config_keys[n];};o.getMonitorService=function(){return t;};o.p.can_interval=1;o.p.interval_offset=0;if(o.initializeMonitor()){m[m.length]=o;return 1;}return 0;};t.handle_image_load=function(e){t.DE("image_load",e);};t.handle_image_abort=function(e){t.DE("image_abort",e);};t.handle_image_error=function(e){t.DE("image_error",e);};t.ImageProbe=function(b){var _a=(b?H.event.removeEventListener:H.event.addEventListener),_s=t.p,i,_i=document.images,l;if(t.r>4||!_i)return;l=_i.length;for(i=(b?0:_s.last_image_index);i<l;i++){_i[i].onload=t.handle_image_load;_i[i].onabort=t.handle_image_abort;_i[i].onerror=t.handle_image_error;_i[i]._ix=i;}_s.last_image_index=l;if(!_s.document_rendered)window.setTimeout(t.ImageProbe,10);};H.IM(t,"base_object","monitor_service","3.1.1");H.registry.service.addObject(t);t.initializeMonitorService();}},1);}());
/* End Hemi Framework 3.1 */
