function GlobalObject(){this.Init();}
GlobalObject.prototype.Init=function(){this.IS_COOKIES_ENABLED=true;this.SELECTED_ELEMENT=null;}
GlobalObject.prototype.ModDisplayByID=function(id,value){globalObject_ModDisplay(document.getElementById(id),value)}
GlobalObject.prototype.ModDisplay=function(element,value){element.style.display=value;}
GlobalObject.prototype.ModImageSrc=function(image,append,value){var extension=image.src.substring(image.src.lastIndexOf('.'));var base=image.src.substring(0,image.src.lastIndexOf('.'));image.src=(append)?base+'-'+ value+ extension:base.substring(0,base.lastIndexOf('-'))+ extension;}
GlobalObject.prototype.GetEventSource=function(e){var targ;if(!e)e=window.event;if(e.target)targ=e.target;else if(e.srcElement)targ=e.srcElement;if(targ.nodeType==3)
targ=targ.parentNode;return(targ);}
GlobalObject.prototype.AddEventHandler=function(source,eventName,fn,bubble){if(source.attachEvent)
source.attachEvent(eventName,fn);else
source.addEventListener(eventName.substring(2),fn,bubble);}
GlobalObject.prototype.RemoveEventHandler=function(source,eventName,fn,bubble){if((source!=null)&&(fn!=null))
{if(source.removeEventListener)
source.removeEventListener(eventName.substring(2),fn,bubble);else
source.detachEvent(eventName,fn);}}
GlobalObject.prototype.ChangeSelectedValue=function(select,value){for(var i=0;i<select.options.length;i++){select.options[i].selected=(select.options[i].value==value)?true:false;}}
GlobalObject.prototype.GetAppliedStyleValue=function(element,attribute){if((element.style[attribute]!=null)&&(element.style[attribute]!=''))
return(element.style[attribute]);if(element.currentStyle!=null)
return(element.currentStyle[attribute]);else
return(document.defaultView.getComputedStyle(element,'').getPropertyValue(attribute));}
GlobalObject.prototype.GetLeftValue=function(element){var value=null;value=Global.GetAppliedStyleValue(element,'left');if(value!=null)
return(value.match(/^[0-9]+/));}
GlobalObject.prototype.GetTopValue=function(element){var value=null;value=Global.GetAppliedStyleValue(element,'top');if(value!=null)
return(value.match(/^[0-9]+/));}
GlobalObject.prototype.GetActiveXObject=function(id){if(window.ActiveXObject)
return(new ActiveXObject(id));return(new GeckoActiveXObject(id));}
GlobalObject.prototype.ClickButton=function(e,buttonid){var bt=document.getElementById(buttonid);e=Global.GetEvent(e);if(e.keyCode==13){bt.click();return false;}}
function ToggleElement(toggle,panel){if(arguments.length>0)
this.Init(toggle,panel);}
ToggleElement.prototype.Init=function(toggle,panel){this.ToggleSwitch=document.getElementById(toggle);this.Panel=document.getElementById(panel);this.IsOpen=true;var me=this;this.OnClick=function(){me.Toggle();}
this.OnPageUnLoad=function(){Global.RemoveEventHandler(this.ToggleSwitch,'onclick',me.OnClick,false);Global.RemoveEventHandler(window,'onunload',me.OnPageUnLoad,false);delete me.OnPageUnload;me=null;}
Global.AddEventHandler(this.ToggleSwitch,'onclick',this.OnClick,false);Global.AddEventHandler(window,'onunload',this.OnPageUnLoad,false);this.Toggle();}
ToggleElement.prototype.Toggle=function(){this.Panel.style.display=(this.IsOpen)?'none':'block';this.IsOpen=!this.IsOpen;}
function Cookie(name){if(arguments.length>0)
this.Init(name);}
Cookie.prototype.Init=function(name){this.Name=name;this.Value=null;this.Expires=null;this.Domain=null;this.Path='/';this.Secure=null;}
Cookie.prototype.Save=function(){if((this.Name!=null)&&(this.Value!=null)){var cookieString=escape(this.Name)+'='+ escape(this.Value)+'; ';cookieString=cookieString.substr(0,cookieString.length-2);cookieString+=(this.Expires)?'; expires='+(new Date(this.Expires)).toGMTString():'';cookieString+=(this.Path)?'; path='+ this.Path:'';cookieString+=(this.Domain)?'; domain='+ this.Domain:'';cookieString+=(this.Secure)?'; secure':'';document.cookie=cookieString;}}
Cookie.prototype.Load=function(){if(this.Name){var regEx=new RegExp(this.Name+"=([^;]+)");var value=regEx.exec(document.cookie);this.Value=(value!=null)?unescape(value[1]):null;}}
Cookie.prototype.SetDays=function(days){if(!isNaN(days))this.Expires=((new Date()).getTime()+ days*86400000);}
function List(){this.Init();}
List.prototype.Init=function(){this.Items=new Array();}
List.prototype.Count=function(){return(this.Items.length);}
List.prototype.Push=function(value){this.Items.push(value);}
List.prototype.Pop=function(){this.Items.pop();}
List.prototype.InsertAt=function(index,value){var left;var right;if(index>this.Count()){for(var i=0;i<index;i++)
this.Items.push(null);this.Items.Push(value);}else if(index>0){left=this.Items.slice(0,index);right=this.Items.slice(index+1,this.Count());this.Items=new Array();for(var i=0;i<left.length;i++)
this.Items.push(left[i]);this.Items.push(value);for(var i=0;i<right.length;i++)
this.Items.push(right[i]);}}
List.prototype.RemoveAt=function(index){var left;var right;if((index<this.Count())&&(index>=0)){right=this.Items.slice(index+1,this.Count());left=this.Items.slice(0,index);alert('left :'+ left);alert('right :'+ right);this.Items=new Array();for(var i=0;i<left.length;i++)
this.Items.push(left[i]);for(var i=0;i<right.length;i++)
this.Items.push(right[i]);}}
List.prototype.Remove=function(value){for(var i=0;i<this.Items.length;i++){if(this.Items[i]==value){this.RemoveAt(i)
break;}}}
List.prototype.Get=function(index){return(this.Items[index]);}
List.prototype.Set=function(index,value){return(this.list_InsertAt(index,value));}
function NameValuePair(name,value){if(name){this.Name=name.toString();this.Value=value;}}
function EventsCollection(){this.Init();}
EventsCollection.prototype.Init=function(){this.Events=new List();}
EventsCollection.prototype.Add=function(handler,fn){obj=new EventsObject(handler,fn)
Global.Debug.Write('Handler: '+ handler);Global.Debug.Write('Event Push: '+ fn);this.Events.Push(obj);}
EventsCollection.prototype.Remove=function(handler,fn){obj=new EventsObject(handler,fn)
this.Events.Remove(obj);}
EventsCollection.prototype.Fire=function(args){if(this.Events.Count()<=0)
Global.Debug.Write('No events to fire.');for(var i=0;i<this.Events.Count();i++){Global.Debug.Write('Event is Firing: '+ this.Events.Get(i));args.Handler=this.Events.Get(i).Handler;if(this.Events.Get(i).Handle!=null)
this.Events.Get(i).Handle(args);}}
function EventsObject(hndlr,hndl){this.Handler=hndlr;this.Handle=hndl;}
function Debug(){this.Init();}
Debug.prototype.Init=function(){this.Verbose=false;}
Debug.prototype.Write=function(value){if(this.Verbose)
alert(value);}
Debug.prototype.DumpProperties=function(obj,recurse,document){if(document==null)
document=window.open('about:blank','dump','height=400, width=400').document;var msg;document.write('<dl>');document.write('<dt>');document.write(obj);document.write('</dt>');document.write('<dd>');for(var i in obj){msg=i+"&nbsp;|&nbsp;"+((obj[i]!=null)?obj[i]:'undefined');document.write("<li>");document.write(msg);document.write("</li>");if(recurse&&(typeof obj[i]=='object')){document.write("<ul>");this.DumpProperties(obj[i],true,document);document.write("</ul>");}}
document.write('</dd>');document.write('</dl>');}
Debug.prototype.BenchMark=function(){if(this.BenchStartTime==null)
this.BenchStartTime=new Date().getTime();else{var endTime=new Date().getTime();alert('Elapsed time: '+((endTime- this.BenchStartTime)/1000)+' seconds.');delete this.BenchStartTime;delete endTime;}}
function ImageSwap(id){if(arguments.length>0)
this.Init(id);}
ImageSwap.prototype.Init=function(id){this.Element=document.getElementById(id);this.Images=this.Element.getElementsByTagName('IMG');var me=this;this.OnImageClick=function(e){me.Swap(Global.GetEventSource(e));}
for(var i=1,n=this.Images.length;i<n;i++){this.Images[i].style.cursor='hand';Global.AddEventHandler(this.Images[i],"onclick",this.OnImageClick,false);}}
ImageSwap.prototype.Swap=function(img){var temp=img.src;img.src=this.Images[0].src;this.Images[0].src=temp;}
Global=new GlobalObject();Global.Debug=new Debug();
