﻿/*=============================================================================================================================================
                                                               JUNE    FRAMEWORK                                                               
=============================================================================================================================================*/

/*==============================================================
        version 1.1  Minified                                   
        Last Edited: July 16, 2008                              
==============================================================*/

/*==================================================================================
    Copyright (c) 2008 Costin Trifan                        http://www.june-js.com/ 
                                                                                    
    Permission is hereby granted, free of charge, to any person obtaining a copy    
    of this software and associated documentation files (the "Software"), to deal   
    in the Software without restriction, including without limitation the rights    
    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell       
    copies of the Software, and to permit persons to whom the Software is           
    furnished to do so, subject to the following conditions:                        
                                                                                    
    The above copyright notice and this permission notice shall be included in      
    all copies or substantial portions of the Software.                             
                                                                                    
    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR      
    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,        
    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE     
    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER          
    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,   
    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN       
    THE SOFTWARE.                                                                   
                                                                                    
==================================================================================*/

var JUNE=(function(){var version='1.1';return{DEBUG:false,getVersion:function(){return version;},addMethodsTo:function(theObject,methods){if(!theObject){JUNE.Exceptions.argumentMissingException("JUNE.addMethodsTo","theObject!");}if(!methods){JUNE.Exceptions.argumentMissingException("JUNE.addMethodsTo","methods!");}try{for(var property in methods){theObject[property]=methods[property];}}catch(ex){}},clone:function(instanceToClone){if(!instanceToClone){JUNE.Exceptions.argumentMissingException("JUNE.clone","instanceToClone!");}if(typeof instanceToClone!='function'){JUNE.Exceptions.showGeneralError("JUNE.clone","The argument < instanceToClone > has to be a function!");}if(instanceToClone){var F=function(){};F.prototype=instanceToClone;return new F();}else{JUNE.Exceptions.argumentMissingException('JUNE.clone','instanceToClone');}}}})();if(document.addEventListener){JUNE.addEventListener=function(docElement,type,listener){docElement.addEventListener(type,listener,false);};JUNE.removeEventListener=function(docElement,type,listener){docElement.removeEventListener(type,listener,false);};JUNE.preventDefault=function(event){event.preventDefault();};JUNE.stopPropagation=function(event){event.stopPropagation();};JUNE.addMultipleListeners=function(docElement,events,listener){if(events.length>1){for(var e=0;e<events.length;e++){JUNE.addEventListener(docElement,events[e],listener);}}else{JUNE.Exceptions.showGeneralError('JUNE.addMultipleListeners','The argument < events > has to be an Array of events!');}};JUNE.removeMultipleListeners=function(docElement,events,listener){if(events.length>1){for(var e=0;e<events.length;e++){JUNE.removeEventListener(docElement,events[e],listener);}}else{JUNE.Exceptions.showGeneralError('JUNE.addMultipleListeners','The argument < events > has to be an Array of events!');}};}else if(document.attachEvent){JUNE.addEventListener=function(docElement,type,listener){if(JUNE._findListener(docElement,type,listener)!=-1){return;}var listener2=function(){var event=window.event;if(Function.prototype.call){listener.call(docElement,event);}else{docElement._currentListener=listener;docElement._currentListener(event);docElement._currentListener=null;}};docElement.attachEvent("on"+type,listener2);var listenerRecord={docElement:docElement,type:type,listener:listener,listener2:listener2};var targetDocument=docElement.document||docElement;var targetWindow=targetDocument.parentWindow;var listenerId="1"+JUNE._listenerCounter++;if(!targetWindow._allListeners){targetWindow._allListeners={};}
targetWindow._allListeners[listenerId]=listenerRecord;if(!docElement._listeners){docElement._listeners=[];}docElement._listeners[docElement._listeners.length]=listenerId;if(!targetWindow._unloadListenerAdded){targetWindow._unloadListenerAdded=true;targetWindow.attachEvent("onunload",JUNE._removeAllListeners);}};JUNE.removeEventListener=function(docElement,type,listener){var listenerIndex=JUNE._findListener(docElement,type,listener);if(listenerIndex==-1){return;}var targetDocument=docElement.document||docElement;var targetWindow=targetDocument.parentWindow;var listenerId=docElement._listeners[listenerIndex];var listenerRecord=targetWindow._allListeners[listenerId];docElement.detachEvent("on"+type,listenerRecord.listener2);docElement._listeners.splice(listenerIndex,1);delete targetWindow._allListeners[listenerId];};JUNE.preventDefault=function(event){event.returnValue=false;};JUNE.stopPropagation=function(event){event.cancelBubble=true;};JUNE._findListener=function(docElement,type,listener){var listeners=docElement._listeners;if(!listeners){return-1;}var targetDocument=docElement.document||docElement;var targetWindow=targetDocument.parentWindow;for(var i=listeners.length-1;i>=0;i--){var listenerId=listeners[i];var listenerRecord=targetWindow._allListeners[listenerId];if(listenerRecord.type==type&&listenerRecord.listener==listener){return i;}}return-1;};JUNE._removeAllListeners=function(){var targetWindow=this;for(id in targetWindow._allListeners){var listenerRecord=targetWindow._allListeners[id];listenerRecord.docElement.detachEvent("on"+listenerRecord.type,listenerRecord.listener2);delete targetWindow._allListeners[id];}};JUNE.addMultipleListeners=function(docElement,events,listener){if(events.length>1){for(var e=0;e<events.length;e++){JUNE.addEventListener(docElement,events[e],listener);}}else{JUNE.Exceptions.showGeneralError('JUNE.addMultipleListeners','The argument "events" has to be an Array of events!');}};JUNE.removeMultipleListeners=function(docElement,events,listener){if(events.length>1){for(var e=0;e<events.length;e++){JUNE.removeEventListener(docElement,events[e],listener);}}else{JUNE.Exceptions.showGeneralError('JUNE.addMultipleListeners','The argument "events" has to be an Array of events!');}};JUNE._listenerCounter=0;}JUNE.start=function(runnable){return JUNE.addEventListener(window,"load",runnable.init);};JUNE.addMethodsTo(String.prototype,{Trim:function(){return this.replace(/^\s+|\s+$/g,'');},IsLongerThan:function(charNumber){if(!charNumber){JUNE.Exceptions.argumentMissingException("String.prototype.IsLongerThan","charNumber");return false;}return(this.length>=charNumber)?true:false;},CutTextAt:function(CharAt){if(!CharAt){JUNE.Exceptions.argumentMissingException("String.prototype.CutTextAt","CharAt");}var _value=this;return(this.length>CharAt)?(_value=this.substring(0,CharAt)):this;},CalculateWords:function(){return this.split(' ').length;}});JUNE.addMethodsTo(Array.prototype,{ForEach:function(callback){if(typeof callback!="function"){JUNE.Exceptions.showGeneralError("Array.prototype.ForEach","The argument < callback > has to be a function.");}var len=this.length;var thisp=arguments[1];for(var i=0;i<len;i++){if(i in this){callback.call(thisp,this[i],i,this);}}},Every:function(callback){var len=this.length;if(typeof callback!="function"){JUNE.Exceptions.showGeneralError("Array.prototype.Every","The argument < callback > has to be a function.");}
var thisp=arguments[1];for(var i=0;i<len;i++){if(i in this&&!callback.call(thisp,this[i],i,this)){return false;}}return true;},Filter:function(callback){var len=this.length;if(typeof callback!="function"){JUNE.Exceptions.showGeneralError("Array.prototype.Filter","The argument < callback > has to be a function.");}var res=new Array();var thisp=arguments[1];for(var i=0;i<len;i++){if(i in this){var val=this[i];if(callback.call(thisp,val,i,this)){res.push(val);}}}return res;}});JUNE.ClientOS=(function(){return{isWindows:function(){return(navigator.appVersion.indexOf("Win")>=0);},isMacintosh:function(){return(navigator.appVersion.indexOf("Mac")>=0);},isLinux:function(){return(navigator.appVersion.indexOf("Linux")>=0);}}})();JUNE.Browser=(function(){var UA=window.navigator.userAgent.toLowerCase();return{isIE:function(version){switch(version){case 6:case'6':{return UA.indexOf("msie 6")>=0;};case 7:case'7':{return UA.indexOf("msie 7")>=0;};case 8:case'8':{return UA.indexOf("msie 8")>=0;};default:{return UA.indexOf("msie")>=0;};}},isOpera:function(){return(UA.indexOf("opera")>=0);},isMozilla:function(){return(UA.indexOf("gecko")>=0);},isNetscape:function(){return(UA.indexOf("navigator")>=0);},isFlock:function(){return(UA.indexOf("flock")>=0);},isSafari:function(){return(UA.indexOf("safari")>=0);},isFirefox:function(){if(JUNE.Browser.isNetscape()||JUNE.Browser.isFlock()||JUNE.Browser.isSafari()){return false;}else{return(UA.indexOf("firefox")>=0)?true:false;}},isCSS1Compat:function(){return document.compatMode=="CSS1Compat";},createPopupWindowFeatures:function(features){if(!features){JUNE.Exceptions.argumentMissingException("JUNE.Browser.createPopupWindowFeatures","features");}if(typeof features!='object'){JUNE.Exceptions.showGeneralError("JUNE.Browser.createPopupWindowFeatures","The argument < features > has to be an Object literal.");}var result='',popupFeatures={'left':features.left||0,'top':features.top||0,'width':features.width||400,'height':features.height||150,'status':features.status||0,'toolbar':features.toolbar||0,'location':features.location||0,'menubar':features.menubar||0,'directories':features.directories||0,'resizable':features.resizable||0,'scrollbars':features.scrollbars||0,'fullscreen':features.fullscreen||0};return result='left='+popupFeatures.left+', '+'top='+popupFeatures.top+', '+'width='+popupFeatures.width+', '+'height='+popupFeatures.height+', '+'status='+popupFeatures.status+', '+'toolbar='+popupFeatures.toolbar+', '+'location='+popupFeatures.location+', '+'menubar='+popupFeatures.menubar+', '+'directories='+popupFeatures.directories+', '+'resizable='+popupFeatures.resizable+', '+'scrollbars='+popupFeatures.scrollbars+', '+'fullscreen='+popupFeatures.fullscreen;},showPopupWindow:function(url,windowName,windowFeatures){if(!url){JUNE.Exceptions.argumentMissingException("JUNE.Browser.showPopupWindow","url");return false;}windowName=windowName||'PopupWindow';windowFeatures=windowFeatures||'';try{return window.open(url,windowName,windowFeatures);}catch(ex){}},createImagePreview:function(imageID,windowName,windowFeatures){if(!imageID){JUNE.Exceptions.argumentMissingException("JUNE.Browser.createImagePreview","imageID");}var imageSrc=imageID.getAttribute("src");if(!imageSrc){JUNE.Exceptions.showGeneralError("JUNE.Browser.createImagePreview","The source of the < "+imageID.id+" > image is missing.");}windowName=windowName||'PopupImageWindow';windowFeatures=windowFeatures||"width: 400, height: 200";JUNE.Browser.showPopupWindow(imageSrc,windowName,windowFeatures);},detectPopupBlocker:function(){var url='http://www.june-js.com',title='test',features=JUNE.Browser.createPopupWindowFeatures({'width':'1','height':'1'}),testWindow=JUNE.Browser.showPopupWindow(url,title,features);try{testWindow.close();return false;}catch(ex){}return true;},forceRefresh:function(){return document.URL=unescape(window.location.pathname);},redirectToPage:function(url){if(url){return document.URL=url;}else{JUNE.Exceptions.argumentMissingException("JUNE.Browser.redirectToPage","url");}},addPageToFavorites:function(){var title=document.title||"DefaultPageName",location=document.location;if(document.all){window.external.AddFavorite(location,title);}else if(window.sidebar){window.sidebar.addPanel(title,location,"");}else{JUNE.Exceptions.showGeneralError("JUNE.Browser.addPageToFavorites","Operation could not be completed.");}},setAsHomePage:function(docElement){if(!docElement){JUNE.Exceptions.argumentMissingException("JUNE.Browser.setAsHomePage","docElement");}var location=document.URL;if(docElement.style.behavior>=0){docElement.style.behavior="url(#default#homepage)";docElement.setHomePage(location);}else{JUNE.Exceptions.showGeneralError("JUNE.Browser.setAsHomePage","Operation is not supported by this browser.");}},parseQueryString:function(keyName){if(!keyName){JUNE.Exceptions.argumentMissingException("JUNE.Browser.parseQueryString","keyName");return false;}if(document.URL.indexOf('?')>=0){keyName=keyName.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");var regexS="[\\?&]"+keyName+"=([^&#]*)",regex=new RegExp(regexS),results=regex.exec(document.URL);if(!results){return"";}
else{return results[1];}}else{JUNE.Exceptions.showGeneralError("JUNE.Browser.parseQueryString","The querystring was not found!");}},getWindowWidth:function(){var Width=0;if(typeof(window.innerWidth)=='number'){return Width=window.innerWidth;}else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){return Width=document.documentElement.clientWidth;}else if(document.body&&(document.body.clientWidth||document.body.clientHeight)){return Width=document.body.clientWidth;}return Width;},getWindowHeight:function(){var Height=0;if(typeof(window.innerWidth)=='number'){return Height=window.innerHeight;}else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){return Height=document.documentElement.clientHeight;}else if(document.body&&(document.body.clientWidth||document.body.clientHeight)){return Height=document.body.clientHeight;}return Height;}}})();JUNE.Cookie=(function(){return{cookiesEnabled:function(){return navigator.cookieEnabled;},createCookie:function(cookieName,value,expiresAfter,path,domain,secure){if(!cookieName){JUNE.Exceptions.argumentMissingException('JUNE.Cookie.createCookie','cookieName');}if(!JUNE.Cookie.cookiesEnabled()){return false;}if(expiresAfter){var date=new Date(),time=date.getTime(),period=(expiresAfter*24*60*60*1000);date.setTime(time+period);var expires='; expires='+date.toGMTString();}else{expires='';}var optionals=((path)?('; path='+path):'')+((domain)?('; domain='+domain):'')+((secure)?('; secure'):'');document.cookie=cookieName+"="+escape(value)+expires+optionals;},readCookie:function(cookieName){if(!JUNE.Cookie.cookiesEnabled()){return false;}if(!cookieName){JUNE.Exceptions.argumentMissingException('JUNE.Cookie.readCookie','cookieName');}var ckName=cookieName+"=",cookies=document.cookie.split(';'),_c=null;for(var i=0;i<cookies.length;i++){_c=cookies[i];while(_c.charAt(0)==' '){_c=_c.substring(1,_c.length);}if(_c.indexOf(ckName)==0){return unescape(_c.substring(ckName.length,_c.length));}}return null;},deleteCookie:function(cookieName,path,domain,secure){try{if(!cookieName){JUNE.Exceptions.argumentMissingException('JUNE.Cookie.deleteCookie','cookieName');}var optionals=((path)?('; path='+path):'')+((domain)?('; domain='+domain):'')+((secure)?('; secure'):'');JUNE.Cookie.createCookie(cookieName,'',-7,optionals);}catch(ex){}}}})();JUNE.DOM=(function(){return{getById:function(docElement){var getElement=function(docElement){if(document.getElementById){return document.getElementById(docElement);}else if(document.all){return document.all[docElement];}else if(document.layers){return document.layers[docElement];}};var argsLength=arguments.length;if(!argsLength>0){JUNE.Exceptions.showGeneralError('JUNE.DOM.getById','At least one ID should be provided!');}var elements=[];for(var i=0;i<argsLength;i++){var element=arguments[i];if(typeof element=='string'){element=getElement(element);}if(argsLength>=2){elements.push(element);}else{return element;}}return elements;},getElementsByClass:function(theClassName){if(!theClassName){JUNE.Exceptions.argumentMissingException("JUNE.DOM.getElementsByClass","theClassName");}var elementArray=[];if(typeof document.all!="undefined"){elementArray=document.all;}else{elementArray=document.getElementsByTagName("*");}var matchedArray=[];var pattern=new RegExp("(^| )"+theClassName+"( |$)");for(var i=0;i<elementArray.length;i++){if(pattern.test(elementArray[i].className)){matchedArray[matchedArray.length]=elementArray[i];}}return matchedArray;},hasClass:function(docElement,theClassName){if(!docElement){JUNE.Exceptions.argumentMissingException("JUNE.DOM.hasClass","docElement");}if(!theClassName){JUNE.Exceptions.argumentMissingException("JUNE.DOM.hasClass","theClassName");}var pattern=new RegExp("(^| )"+theClassName+"( |$)");if(pattern.test(docElement.className)){return true};return false;},addClass:function(docElement,theClassName){if(!docElement){JUNE.Exceptions.argumentMissingException("JUNE.DOM.addClass","docElement");}if(!theClassName){JUNE.Exceptions.argumentMissingException("JUNE.DOM.addClass","theClassName");}if(!JUNE.DOM.hasClass(docElement,theClassName)){if(docElement.className==""){docElement.className=theClassName;}else{docElement.className+=" "+theClassName;}}},removeClass:function(docElement,theClassName){if(!docElement){JUNE.Exceptions.argumentMissingException("JUNE.DOM.removeClass","docElement");}if(!theClassName){JUNE.Exceptions.argumentMissingException("JUNE.DOM.removeClass","theClassName");}var pattern=new RegExp("(^| )"+theClassName+"( |$)");docElement.className=docElement.className.replace(pattern,"$1");docElement.className=docElement.className.replace(/ $/,"");},getComputedStyle:function(docElement,styleProperty){if(!docElement){JUNE.Exceptions.argumentMissingException("JUNE.DOM.getComputedStyle","docElement");}if(!styleProperty){JUNE.Exceptions.argumentMissingException("JUNE.DOM.getComputedStyle","styleProperty");}var computedStyle=null;if(typeof docElement.currentStyle!="undefined"){return computedStyle=docElement.currentStyle[styleProperty];}else{return computedStyle=document.defaultView.getComputedStyle(docElement,null).getPropertyValue(styleProperty);}return computedStyle;},showCentered:function(docElement){if(!docElement){JUNE.Exceptions.argumentMissingException("JUNE.DOM.showCentered","docElement");}var pos=JUNE.DOM.getComputedStyle(docElement,"position");if(pos!='absolute'){pos='absolute';docElement.style.position=pos;}var elementWidth=0,elementHeight=0;elementWidth=parseInt(JUNE.DOM.getComputedStyle(docElement,"width"),10);elementHeight=parseInt(JUNE.DOM.getComputedStyle(docElement,"height"),10);var windowWidth=JUNE.Browser.getWindowWidth(),windowHeight=JUNE.Browser.getWindowHeight(),Left=Math.round((windowWidth-elementWidth)/2),Top=Math.round((windowHeight-elementHeight)/2);docElement.style.left=Left+"px";docElement.style.top=Top+"px";},getClass:function(docElement){if(!docElement){JUNE.Exceptions.argumentMissingException("JUNE.DOM.getClass","docElement");}var theClassName=null;return(docElement.getAttributeNode("class"))?(theClassName=docElement.getAttributeNode("class").value):theClassName;},toggleCssClass:function(docElement,defaultClass,newClass){if(!docElement){JUNE.Exceptions.argumentMissingException("JUNE.DOM.toggleCssClass","docElement");}if(!defaultClass){JUNE.Exceptions.argumentMissingException("JUNE.DOM.toggleCssClass","defaultClass");}if(!newClass){JUNE.Exceptions.argumentMissingException("JUNE.DOM.setCssStyles","newClass");}if(!JUNE.DOM.hasClass(docElement,newClass)){JUNE.DOM.addClass(docElement,newClass);JUNE.DOM.removeClass(docElement,defaultClass);}else{JUNE.DOM.removeClass(docElement,newClass);JUNE.DOM.addClass(docElement,defaultClass);}},toggleState:function(docElement,defaultState,newState){if(!docElement){JUNE.Exceptions.argumentMissingException("JUNE.DOM.toggleState","docElement");}if(!newState){JUNE.Exceptions.argumentMissingException("JUNE.DOM.toggleState","newState");}var originalState=JUNE.DOM.getComputedStyle(docElement,'display')||'block';if(originalState==defaultState){return docElement.style.display=(docElement.style.display!=newState)?newState:defaultState;}else{return docElement.style.display=(docElement.style.display!=defaultState)?defaultState:newState;}},removeChild:function(docElement){if(!docElement){JUNE.Exceptions.argumentMissingException("JUNE.DOM.removeChild","docElement");}var parent=docElement.parentNode;try{parent.removeChild(docElement);}catch(ex){}},removeAllChildren:function(parentContainer){if(!parentContainer){JUNE.Exceptions.argumentMissingException("JUNE.DOM.removeAllChildren","parentContainer");}while(parentContainer.hasChildNodes()){var child=parentContainer.firstChild;parentContainer.removeChild(child);}},insertBefore:function(parentContainer,referenceNode,nodeToInsert){if(!parentContainer){JUNE.Exceptions.argumentMissingException("JUNE.DOM.insertBefore","parentContainer");}if(!referenceNode){JUNE.Exceptions.argumentMissingException("JUNE.DOM.insertBefore","referenceNode");}if(!nodeToInsert){JUNE.Exceptions.argumentMissingException("JUNE.DOM.insertBefore","nodeToInsert");}return parentContainer.insertBefore(nodeToInsert,referenceNode);},insertAfter:function(parentContainer,referenceNode,nodeToInsert){return parentContainer.insertBefore(nodeToInsert,referenceNode.nextSibling);},getNextSibling:function(referenceNode){var next_Sibling=referenceNode.nextSibling;while(next_Sibling.nodeType!=1){next_Sibling=next_Sibling.nextSibling;}return next_Sibling;},getPreviousSibling:function(referenceNode){var prevSibling=referenceNode.previousSibling;while(prevSibling.nodeType!=1){prevSibling=prevSibling.previousSibling;}return prevSibling;},setCssStyles:function(targetElements,styles){if(!targetElements){JUNE.Exceptions.argumentMissingException("JUNE.DOM.setCssStyles","targetElements");}if(!styles){JUNE.Exceptions.argumentMissingException("JUNE.DOM.setCssStyles","styles");}var setStyle=function(targetElements,prop,val){if(!JUNE.Util.isArray(targetElements)){return targetElements.style[prop]=val;}else{var _length=targetElements.length;for(var i=0;i<_length;i++){targetElements[i].style[prop]=val;}}};for(var prop in styles){if(styles.hasOwnProperty(prop)){setStyle(targetElements,prop,styles[prop]);}}},getByTags:function(tags,parentContainer){if(!tags){JUNE.Exceptions.argumentMissingException('JUNE.DOM.getByTags','tags');}
var elements=[],tempTags=null,tempTagsLength=null;if(JUNE.Util.isArray(tags)){if(parentContainer){for(var a=0;a<tags.length;a++){var element=tags[a];tempTags=parentContainer.getElementsByTagName(element);tempTagsLength=tempTags.length;for(var i=0;i<tempTagsLength;i++){elements.push(tempTags[i]);}}return elements;}else{for(var b=0;b<tags.length;b++){var _element=tags[b];tempTags=document.getElementsByTagName(_element);tempTagsLength=tempTags.length;for(var j=0;j<tempTagsLength;j++){elements.push(tempTags[j]);}}return elements;}}else{if(parentContainer){tempTags=parentContainer.getElementsByTagName(tags);tempTagsLength=tempTags.length;for(i=0;i<tempTagsLength;i++){elements.push(tempTags[i]);}return elements;}else{tempTags=document.getElementsByTagName(tags);tempTagsLength=tempTags.length;for(j=0;j<tempTagsLength;j++){elements.push(tempTags[j]);}return elements;}}}}})();JUNE.addMethodsTo(JUNE.DOM,{StyleSheets:{toggleStyleSheet:function(whichSheet){if(!whichSheet){JUNE.Exceptions.argumentMissingException("JUNE.DOM.StyleSheets.toggleStyleSheet","whichSheet");}whichSheet=whichSheet-1;var pageHeader=document.getElementsByTagName('head')[0];var StyleSheets=JUNE.$byTags('link',pageHeader);StyleSheets.ForEach(function(s,index){if(s.getAttribute('type')&&s.getAttribute('type').indexOf('text/css')>=0){if(index!=whichSheet){s.disabled=true;}else{s.disabled=false;}}});},disableStyleSheets:function(titleSelector){if(!titleSelector){JUNE.Exceptions.argumentMissingException('JUNE.DOM.StyleSheets.disableStyleSheets','titleSelector');}var whichSheets=[],pageHeader=document.getElementsByTagName('head')[0],links=pageHeader.getElementsByTagName('link');for(var i=0;i<links.length;i++){var temp=links[i];if(temp.rel.indexOf('stylesheet')>=0&&temp.title.indexOf(titleSelector)>=0){whichSheets.push(temp);}}for(var j in whichSheets){whichSheets[j].disabled=true;}},loadDependantFile:function(fileType,fileUrl,position,title){if(!fileType){JUNE.Exceptions.argumentMissingException('JUNE.DOM.StyleSheets.LoadDependantFile','fileType');return;}if(!fileUrl){JUNE.Exceptions.argumentMissingException('JUNE.DOM.StyleSheets.LoadDependantFile','fileUrl');return;}var pageHeader=document.getElementsByTagName('head')[0];function LoadStyleSheet(){if(pageHeader){var link=document.createElement('link');link.setAttribute('rel','stylesheet');link.setAttribute('type','text/css');link.setAttribute('href',fileUrl);if(title){link.setAttribute('title',title);}if(position){return link=pageHeader.insertBefore(link,pageHeader.childNodes[position]);}else{return pageHeader.appendChild(link);}}}function LoadJavaScript(){if(title){title=null;}if(pageHeader){var script=document.createElement('script');script.setAttribute('type','text/javascript');script.setAttribute('src',fileUrl);if(position){return script=pageHeader.insertBefore(script,pageHeader.childNodes[position]);}else{return pageHeader.appendChild(script);}}}switch(fileType.toLowerCase()){case"css":{return LoadStyleSheet();};case"js":{return LoadJavaScript();};}return null;}}});JUNE.addMethodsTo(JUNE.DOM,{Create:{element:function(newElement,content,newElementID,cssClass,style,child_nodes){if(!newElement){JUNE.Exceptions.argumentMissingException("JUNE.DOM.Create.element","newElement");}var element=document.createElement(newElement);if(content){element.innerHTML=content;}if(newElementID){element.id=newElementID;}if(cssClass){element.className=cssClass;}if(style){element.setAttribute("style",style);}if(child_nodes&&JUNE.Util.isArray(child_nodes)&&child_nodes.length>0){for(var i=0;i<child_nodes.length;i++){element.appendChild(child_nodes[i]);}}return element;},image:function(newElementID,src,alt,width,height,cssClass,style){if(!src){JUNE.Exceptions.argumentMissingException('JUNE.DOM.Create.image','src');}if(!alt){JUNE.Exceptions.argumentMissingException('JUNE.DOM.Create.image','alt');}var img=JUNE.DOM.Create.element("img",null,newElementID,cssClass,style);img.setAttribute("src",src);img.setAttribute("alt",alt);img.setAttribute("title",alt);if(width){img.setAttribute("width",width);}if(height){img.setAttribute("height",height);}return img;},link:function(newElementID,content,href,cssClass,style,child){var theLink=JUNE.DOM.Create.element("a",content,newElementID,cssClass,style,child);if(href){theLink.setAttribute("href",href);}if(newElementID){theLink.setAttribute("id",newElementID);}return theLink;},paragraph:function(newElementID,content,cssClass,style,child){return JUNE.DOM.Create.element("p",content,newElementID,cssClass,style,child);},div:function(newElementID,content,cssClass,style,child){return JUNE.DOM.Create.element("div",content,newElementID,cssClass,style,child);},label:function(newElementID,content,cssClass,style,child){return JUNE.DOM.Create.element("label",content,newElementID,cssClass,style,child);},heading:function(newElementID,content,headingType,cssClass,style,child){switch(headingType){case 1:{return JUNE.DOM.Create.element("h1",content,newElementID,cssClass,style,child);};case 2:{return JUNE.DOM.Create.element("h2",content,newElementID,cssClass,style,child);};case 3:{return JUNE.DOM.Create.element("h3",content,newElementID,cssClass,style,child);};case 4:{return JUNE.DOM.Create.element("h4",content,newElementID,cssClass,style,child);};case 5:{return JUNE.DOM.Create.element("h5",content,newElementID,cssClass,style,child);};case 6:{return JUNE.DOM.Create.element("h6",content,newElementID,cssClass,style,child);};default:{return JUNE.DOM.Create.element("h1",content,newElementID,cssClass,style,child);};}},em:function(newElementID,content,cssClass,style,child){return JUNE.DOM.Create.element("em",content,newElementID,cssClass,style,child);},blockquote:function(newElementID,content,cssClass,style,child){return JUNE.DOM.Create.element("blockquote",content,newElementID,cssClass,style,child);},cite:function(newElementID,content,cssClass,style,child){return JUNE.DOM.Create.element("cite",content,newElementID,cssClass,style,child);},list:function(listType,newElementID,cssClass,style,child){switch(listType.toLowerCase()){case'dl':{return JUNE.DOM.Create.element("dl",null,newElementID,cssClass,style,child);};case'dt':{return JUNE.DOM.Create.element("dt",null,newElementID,cssClass,style,child);};case'dd':{return JUNE.DOM.Create.element("dd",null,newElementID,cssClass,style,child);};case'ol':{return JUNE.DOM.Create.element("ol",null,newElementID,cssClass,style,child);};case'ul':{return JUNE.DOM.Create.element("ul",null,newElementID,cssClass,style,child);};case'li':{return JUNE.DOM.Create.element("li",null,newElementID,cssClass,style,child);};default:{JUNE.Exceptions.argumentMissingException("JUNE.DOM.Create.element","listType");return false;}}}}});JUNE.Form=(function(){return{getForm:function(theForm){if(!theForm){JUNE.Exceptions.argumentMissingException('JUNE.Form.getForm','theForm');}if(document.forms){return theForm=document.forms[theForm];}else{return theForm=JUNE.DOM.getById(theForm);}},hasElements:function(theForm){if(!theForm){JUNE.Exceptions.argumentMissingException("JUNE.Form.hasElements","theForm");}var childs=theForm.elements;return(childs.length>0);},toggleInputFieldText:function(docElement){if(!docElement){JUNE.Exceptions.argumentMissingException("JUNE.Form.toggleInputFieldText","docElement");}if(!docElement.title){JUNE.Exceptions.showGeneralError("JUNE.Form.toggleInputFieldText","The value and the title attributes have to be set and their values must match!");}if(docElement.value==docElement.title){return docElement.value='';}if(docElement.value==null||docElement.value==''){return docElement.value=docElement.title;}},setFocusOnElement:function(docElement){if(!docElement){JUNE.Exceptions.argumentMissingException("JUNE.Form.setFocusOnElement","docElement");}docElement.focus();},selectContent:function(docElement){if(!docElement){JUNE.Exceptions.argumentMissingException("JUNE.Form.selectContent","docElement");}if(docElement.value){docElement.select();}},clearElements:function(targetElements){if(!targetElements){JUNE.Exceptions.argumentMissingException("JUNE.Form.clearElements","targetElements");}if(JUNE.Util.isArray(targetElements)){targetElements.ForEach(function(element){if(element.value){element.value='';}});}},disableElements:function(targetElements){if(!targetElements){JUNE.Exceptions.argumentMissingException("JUNE.Form.disableElements","targetElements");}if(JUNE.Util.isArray(targetElements)){targetElements.ForEach(function(element){element.blur();element.disabled=true;});}},enableElements:function(targetElements){if(!targetElements){JUNE.Exceptions.argumentMissingException("JUNE.Form.enableElement","targetElements");}if(JUNE.Util.isArray(targetElements)){targetElements.ForEach(function(element){element.disabled=false;});}},isNullOrEmpty:function(docElement){if(!docElement){JUNE.Exceptions.argumentMissingException("JUNE.Form.isNullOrEmpty","docElement");}return(docElement==null)||(docElement.value.length==0);},requiredField:function(docElement,friendlyTitle,defaultCssClass,errorCssClass,onValidate){if(!docElement){JUNE.Exceptions.argumentMissingException("JUNE.Form.setAsRequiredField","docElement");}if(!friendlyTitle){JUNE.Exceptions.argumentMissingException("JUNE.Form.setAsRequiredField","friendlyTitle");}if(!defaultCssClass){JUNE.Exceptions.argumentMissingException("JUNE.Form.setAsRequiredField","defaultCssClass");}if(!errorCssClass){JUNE.Exceptions.argumentMissingException("JUNE.Form.setAsRequiredField","errorCssClass");}if(!onValidate){JUNE.Exceptions.argumentMissingException("JUNE.Form.setAsRequiredField","onValidate");}docElement.setAttribute('title',friendlyTitle);function onActivated(event){if(JUNE.DOM.hasClass(docElement,errorCssClass)){JUNE.DOM.removeClass(docElement,errorCssClass);JUNE.DOM.addClass(docElement,defaultCssClass);}}JUNE.addMultipleListeners(docElement,["click","focus"],onActivated);}}})();JUNE.DateTime=(function(){return{displayCurrentDate:function(docElement,separator){if(!docElement){JUNE.Exceptions.argumentMissingException('JUNE.DateTime.displayCurrentDate',"docElement");}if(!separator){separator='/';}var months=["January","February","March","April","May","June","July","August","September","October","November","December"],days=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],thisTime=new Date(),thisMonth=months[thisTime.getMonth()],thisDate=thisTime.getDate(),thisYear=thisTime.getYear();docElement.innerHTML=thisMonth+separator+thisDate+separator+thisYear;},isLeapYear:function(year){if(!year){JUNE.Exceptions.argumentMissingException('JUNE.DateTime.isLeapYear',"year");}if(!JUNE.Validate.Number(year)){JUNE.Exceptions.showGeneralError('JUNE.DateTime.isLeapYear','The argument "year" has to be a valid year!');}return!(year%4)&&(year%100)||!(year%400)?true:false;}}})();JUNE.Util=(function(){return{isArray:function(value){return value&&typeof value==='object'&&typeof value.length==='number'&&typeof value.splice==='function'&&!(value.propertyIsEnumerable('length'));},randomNumber:function(limitNumber){if(limitNumber&&!JUNE.Validate.Number(limitNumber)){JUNE.Exceptions.showGeneralError('JUNE.Util.randomNumber','The argument "limitNumber" has to be a valid Number!');}if(!limitNumber){limitNumber='200';}return Math.floor(Math.random()*limitNumber);},preloadImages:function(){if(!arguments.length>=1){JUNE.Exceptions.showGeneralError('JUNE.Util.preloadImages','At least one argument has to be provided!');return false;}if(document.images){for(var i=0;i<arguments.length;i++){var img=new Image();img.src=arguments[i];}}},scrollTo:function(docElement){if(docElement){docElement.scrollIntoView();}else{JUNE.Exceptions.argumentMissingException('JUNE.Util.scrollTo','docElement');}},escapeFromFrame:function(){if(top!=self){top.location=location;}}}})();JUNE.Keyboard=(function(){var Keys={KEY_RETURN:13,KEY_ESCAPE:27,KEY_TAB:9,KEY_SPACEBAR:32};return{isEnterKey:function(event){if(event){var keyCode=event.keyCode?event.keyCode:event.which?event.which:event.charCode;return keyCode==Keys.KEY_RETURN;}},getKeyName:function(event){if(event){return String.fromCharCode(event.charCode?event.charCode:event.keyCode);}},getKeyNumber:function(event){if(event){return event.keyCode?event.keyCode:event.which?event.which:event.charCode;}}}})();JUNE.Effects=(function(){return{setOpacity:function(docElement,opacityValue){if(!docElement){JUNE.Exceptions.argumentMissingException('JUNE.Effects.setOpacity','docElement');}if(!opacityValue){opacityValue=50;}if(opacityValue<0||opacityValue>100){JUNE.Exceptions.showGeneralError("JUNE.Effects.setOpacity","The argument < opacityValue > \nhas to be a number between 0 and 100");return false;}if(JUNE.Browser.isIE()){var __width__=parseInt(JUNE.DOM.getComputedStyle(docElement,"width"));var __height__=parseInt(JUNE.DOM.getComputedStyle(docElement,"height"));if(__width__>0||__height__>0){docElement.style.filter='alpha(opacity='+opacityValue+')';}else{JUNE.Exceptions.showGeneralError("JUNE.Effects.setOpacity",'The element < docElement > has to have the \n"width" or "height" attribute set.');return false;}}else{docElement.style.opacity=opacityValue/100;}},highlight:function(docElement,timeout){if(!docElement){JUNE.Exceptions.argumentMissingException('JUNE.Effects.highlight','docElement');}if(!timeout){timeout=60;}var b=155;(function fade(){docElement.style.background='rgb(255,255,'+(b+=4)+')';if(b<255){setTimeout(fade,timeout);}else{docElement.style.background='Transparent';}})();}}})();JUNE.Exceptions=(function(){return{showGeneralError:function(_function,_errorMessage){if(!_function){_function='';}if(!_errorMessage){_errorMessage='';}var defaultErrorMessage="Internal Error. \n\nFunction: "+_function+"\n\nError: "+_errorMessage;return(JUNE.DEBUG)?(alert("Internal Error. \n\nFunction: "+_function+"\n\nError: "+_errorMessage)):false;},argumentMissingException:function(_function,_argumentName){if(!_function){_function='';}if(!_argumentName){_argumentName='';}var errorMessage="The argument "+_argumentName+" is required!";JUNE.Exceptions.showGeneralError(_function,errorMessage);return false;}}})();JUNE.addMethodsTo(JUNE,{$:JUNE.DOM.getById,$F:JUNE.Form.getForm,$byTags:function(tags,parentContainer){return(parentContainer)?JUNE.DOM.getByTags(tags,parentContainer):JUNE.DOM.getByTags(tags);},$byClass:function(cssClasses){var elementsArray=[],tempElement=null,_length=cssClasses.length,_tempLength=0;if(!cssClasses){JUNE.Exceptions.argumentMissingException('JUNE.$byClass','cssClasses');}if(!_length>=1){JUNE.Exceptions.showGeneralError('JUNE.$byClass','The argument < cssClasses > has to be an Array of css classes.');}else{for(var i=0;i<_length;i++){tempElement=JUNE.DOM.getElementsByClass(cssClasses[i]);_tempLength=tempElement.length;for(var x=0;x<_tempLength;x++){elementsArray.push(tempElement[x]);}}return elementsArray;}}});JUNE.Validate=(function(){var emailPattern=new RegExp("^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,6}$","i"),urlPattern=new RegExp("^(ftp|http|https)+://[A-Za-z0-9-_]+\\.[A-Za-z0-9-_%&\?\/.=]+$"),usZipCodePattern=new RegExp(/(^\d{5}$)|(^\d{5}-\d{4}$)/),numberPattern=new RegExp(/^[0-9]+$/),decimalNumberPattern=new RegExp(/^-?(\d+|(\d*[.,]\d+))$/),stringPattern=new RegExp("^[a-z A-Z]+$");var isNumber=function(theNumberToTest){return numberPattern.test(theNumberToTest);};var isDecimal=function(number){if(isNumber(number)){return false;}return decimalNumberPattern.test(number);};var isString=function(stringToValidate){return stringPattern.test(stringToValidate);};return{Email:function(emailToValidate){if(!emailToValidate){JUNE.Exceptions.argumentMissingException('JUNE.Validate.Email','emailToValidate');return false;}var data=emailToValidate.toLowerCase();return emailPattern.test(data);},Url:function(urlToValidate){if(!urlToValidate){JUNE.Exceptions.argumentMissingException('JUNE.Validate.Url','urlToValidate');return false;}var data=urlToValidate.toLowerCase();return urlPattern.test(data);},ZipCode:function(zipCodeToValidate,countryCode){if(!zipCodeToValidate){JUNE.Exceptions.argumentMissingException('JUNE.Validate.ZipCode','zipCodeToValidate');return false;}if(!countryCode){countryCode='US';}switch(countryCode.toUpperCase()){case'US':{return usZipCodePattern.test(zipCodeToValidate);}default:{return usZipCodePattern.test(zipCodeToValidate);}}},Number:function(numberToValidate,allowDecimals){if(numberToValidate==null){JUNE.Exceptions.argumentMissingException('JUNE.Validate.Number','numberToValidate');return false;}return(allowDecimals)?isDecimal(numberToValidate):!isDecimal(numberToValidate);},Range:function(numberToValidate,lowerBound,upperBound,allowDecimals)
{if(numberToValidate==null){JUNE.Exceptions.argumentMissingException('JUNE.Validate.Range','numberToValidate');return false;}if(lowerBound==null){JUNE.Exceptions.argumentMissingException('JUNE.Validate.Range','lowerBound');return false;}if(upperBound==null){JUNE.Exceptions.argumentMissingException('JUNE.Validate.Range','upperBound');return false;}if(allowDecimals){if(!JUNE.Validate.Number(numberToValidate,true)){JUNE.Exceptions.showGeneralError('JUNE.Validate.Range','The argument "numberToValidate" is not a valid decimal number!');return false;}}else{if(!JUNE.Validate.Number(numberToValidate)){JUNE.Exceptions.showGeneralError('JUNE.Validate.Range','The argument "numberToValidate" is not a valid number!');return false;}}return(numberToValidate>lowerBound)&&(numberToValidate<upperBound);},ValueMatch:function(dataToValidate,matchValue){if(!dataToValidate){JUNE.Exceptions.argumentMissingException('JUNE.Validate.ValueMatch','dataToValidate');return false;}return matchValue==dataToValidate;},String:function(stringToValidate){if(!stringToValidate){JUNE.Exceptions.argumentMissingException('JUNE.Validate.String','stringToValidate');return false;}
return isString(stringToValidate);}}})();(function Clean(){var t;function Cleaner(){JUNE.addEventListener(window,'unload',function(event){for(var obj in JUNE){for(var t in JUNE[obj]){t=null;}
obj=null;}Clean=null;window.clearTimeout(t);});}t=window.setTimeout(Cleaner,5000);})();