// Library: /* DOMAssistant is developed by Robert Nyman, http://www.robertnyman.com, and it is released according to the Creative Commons Attribution-ShareAlike 2.5 license (http://creativecommons.org/licenses/by-sa/2.5/deed.en) For more information, please see http://www.robertnyman.com/domassistant */ var nav; var DOMAssistant={methodsToAdd:[],init:function(){this.applyMethod.call(window,"$",this.$);window.DOMAssistant=this;this.addBaseMethods();},addBaseMethods:function(){document.getElementsByClassName=this.getElementsByClassName;document.getElementsByAttribute=this.getElementsByAttribute;if(typeof HTMLElement=="function"){HTMLElement.prototype.getElementsByClassName=this.getElementsByClassName;HTMLElement.prototype.getElementsByAttribute=this.getElementsByAttribute;} this.methodsToAdd.push(["getElementsByClassName",this.getElementsByClassName]);this.methodsToAdd.push(["getElementsByAttribute",this.getElementsByAttribute]);},applyMethod:function(method,func){if(typeof this[method]!="function"){this[method]=func;}},addMethods:function(elm){if(elm){var elms=(elm.constructor==Array)?elm:[elm];for(var i=0;i1)?[]:null;var current;for(var i=0;i1){elm.push(current);} else{elm=current;}} DOMAssistant.addMethods(elm);} return elm;},getElementsByClassName:function(className,tag){var elms=((!tag||tag=="*")&&this.all)?this.all:this.getElementsByTagName(tag||"*");var returnElms=[];var className=className.replace(/\-/g,"\\-");var regExp=new RegExp("(^|\\s)"+className+"(\\s|$)");var elm;for(var i=0;i0){if(typeof attrVal=="undefined"||(attrVal&&attrVal.test(currentAttr))){returnElms.push(current);}}} return returnElms;}} DOMAssistant.init();DOMAssistant.initContent=function(){this.addContentMethods();};DOMAssistant.addContentMethods=function(){if(typeof HTMLElement=="function"){HTMLElement.prototype.prev=DOMAssistant.prev;HTMLElement.prototype.next=DOMAssistant.next;HTMLElement.prototype.create=DOMAssistant.create;HTMLElement.prototype.setAttributes=DOMAssistant.setAttributes;HTMLElement.prototype.addContent=DOMAssistant.addContent;HTMLElement.prototype.replaceContent=DOMAssistant.replaceContent;HTMLElement.prototype.remove=DOMAssistant.remove;} this.methodsToAdd.push(["prev",this.prev]);this.methodsToAdd.push(["next",this.next]);this.methodsToAdd.push(["create",this.create]);this.methodsToAdd.push(["setAttributes",this.setAttributes]);this.methodsToAdd.push(["addContent",this.addContent]);this.methodsToAdd.push(["replaceContent",this.replaceContent]);this.methodsToAdd.push(["remove",this.remove]);};DOMAssistant.prev=function(){var prevSib=this.previousSibling;while(prevSib&&prevSib.nodeType!=1){prevSib=prevSib.previousSibling;} return prevSib;};DOMAssistant.next=function(){var nextSib=this.nextSibling;while(nextSib&&nextSib.nodeType!=1){nextSib=nextSib.nextSibling;} return nextSib;};DOMAssistant.create=function(name,attr,append,content){var elm=document.createElement(name);elm=DOMAssistant.$(elm);if(attr){elm.setAttributes(attr);} if(typeof content!="undefined"){elm.addContent(content);} if(append){this.addContent(elm);} return elm;};DOMAssistant.setAttributes=function(attr){for(var i in attr){if(/class/i.test(i)){this.className=attr[i];} else{this.setAttribute(i,attr[i]);}}};DOMAssistant.addContent=function(content){var retVal=null;if(typeof content=="string"){retVal=this.innerHTML+=content;} else{retVal=this.appendChild(content);} return retVal;};DOMAssistant.replaceContent=function(newContent){for(var i=(this.childNodes.length-1);i>=0;i--){this.childNodes[i].parentNode.removeChild(this.childNodes[i]);} this.addContent(newContent);};DOMAssistant.remove=function(){this.parentNode.removeChild(this);};DOMAssistant.initContent();DOMAssistant.initCSS=function(){this.addCSSMethods();};DOMAssistant.addCSSMethods=function(){if(typeof HTMLElement=="function"){HTMLElement.prototype.addClass=this.addClass;HTMLElement.prototype.removeClass=this.removeClass;HTMLElement.prototype.hasClass=this.hasClass;HTMLElement.prototype.getStyle=this.getStyle;} this.methodsToAdd.push(["addClass",this.addClass]);this.methodsToAdd.push(["removeClass",this.removeClass]);this.methodsToAdd.push(["hasClass",this.hasClass]);this.methodsToAdd.push(["getStyle",this.getStyle]);};DOMAssistant.addClass=function(className){var currentClass=this.className;if(!new RegExp(("(^|\\s)"+className+"(\\s|$)"),"i").test(currentClass)){this.className=currentClass+((currentClass.length>0)?" ":"")+className;} return this.className;};DOMAssistant.removeClass=function(className){var classToRemove=new RegExp(("(^|\\s)"+className+"(\\s|$)"),"i");this.className=this.className.replace(classToRemove,"").replace(/^\s+|\s+$/g,"");return this.className;},DOMAssistant.hasClass=function(className){return new RegExp(("(^|\\s)"+className+"(\\s|$)"),"i").test(this.className);};DOMAssistant.getStyle=function(cssRule){var cssVal="";if(document.defaultView&&document.defaultView.getComputedStyle){cssVal=document.defaultView.getComputedStyle(this,"").getPropertyValue(cssRule);} else if(this.currentStyle){cssVal=cssRule.replace(/\-(\w)/g,function(match,p1){return p1.toUpperCase();});cssVal=this.currentStyle[cssVal];} return cssVal;};DOMAssistant.initCSS();DOMAssistant.initLoad=function(){this.DOMLoaded=false;this.DOMLoadTimer=null;};DOMAssistant.DOMHasLoaded=function(){if(DOMAssistant.DOMLoaded)return;DOMAssistant.DOMLoaded=true;DOMAssistant.execFunctions();};DOMAssistant.execFunctions=function(){if(this.DOMLoaded){clearInterval(this.DOMLoadTimer);} var functionToCall;for(var i=0;i "); $(thisSet[elem]).addContent(" "); } } } // daily image for the homepage function setHomeImage() { if($("iewrap") == '') return; var date = new Date(); var imageNumber = date.getDay() + 1; if(imageNumber > 5) { imageNumber = 5; } var newClassName = "image_" + imageNumber; $("iewrap").removeClass("image_1"); $("iewrap").addClass(newClassName); } DOMAssistant.functionsToCall = [ setCorners, setHomeImage ];