var midori={browserType:window.opera?"Opera":((navigator.userAgent.indexOf("WebKit")!=-1)?"Safari":((navigator.userAgent.indexOf("MSIE")!=-1)?"MSIE":"Gecko")),browserOS:(navigator.userAgent.indexOf("Windows")!=-1)?"Win":((navigator.userAgent.indexOf("Macintosh")!=-1)?"Mac":"Other"),domReady:[],each:function(d,b,a){var e=d.firstChild;while(e){if(!a){b(e)}if(e.firstChild){this.each(e,b,a)}if(a){b(e)}e=e.nextSibling}},sibling:function(c,b){var a=c;if(b=="next"){do{a=a.nextSibling}while(a&&a.nodeType==3)}else{if(b=="prev"){do{a=a.previousSibling}while(a&&a.nodeType==3)}}return(a==c)?false:a},parseSelectors:function(b){var k=this.trim(b).split("");var l=-1;var a="";var d=[],n=[],e=[];var m=false,g=false,h=false;for(var f=0,j=k.length;f<j;f++){if(m){if(g){switch(k[f]){case'"':h=!h;break;case"]":if(!h){n[l].push(a);g=false;a=""}break;case"\\":a+=k[++f];break;default:a+=k[f]}}else{switch(k[f]){case"[":g=true;break;case" ":case">":case",":m=false;e[l]=k[f];break;case"\\":d[l]+=k[++f];break;default:d[l]+=k[f]}}}else{switch(k[f]){case" ":case">":case",":e[l]+=k[f];break;default:m=true;d[++l]=k[f];n[l]=[]}}}return{elements:d,attrs:n,separators:e}},processAttrs:function(e,c,g){for(var f=0,d=c.length,b;f<d;f++){b=(c[f]=="class")?(e.className?e.className:null):e.getAttribute(c[f]);switch(typeof g[f]){case"undefined":if(b==null){return false}break;case"string":if(b==g[f]){return false}break;default:if(!g[f].test(b)){return false}}}return true},processPseudo:function(e,h,d,b){var a,f,g=[],l=0;if(!(f=e.parentNode.getAttribute("midorinodekey"))){e.parentNode.setAttribute("midorinodekey",f=Math.random().toString().substr(2))}if(a=this.pCache[f]){g=a.parentChildren,l=a.pI}else{var i=e.parentNode.firstChild;while(i){if(i.nodeType==1){g.push(i)}i=i.nextSibling}this.pCache[f]={parentChildren:g,pI:0}}var j=g.length;switch(h){case"first-child":if(e==g[0]){return true}break;case"last-child":if(e==g[j-1]){return true}break;case"only-child":if(j==1){return true}break}if(h=="nth-child"){var k=d*l+b;var m=-50;while(k>-50&&k<=j){if(k>=0&&g[k-1]==e){this.pCache[f]["pI"]=(d>=0)?l+1:0;return true}l++,k+=d;if(k==m){break}m=k}}},getMatches:function(u,k,t,m){this.pCache={};var b=[],h=[];var j,g,d,e,l,f,p,o;this.postProcess=function(i){if(!r&&!e){b.push(i);return}var a=true;if(r&&!this.processAttrs(i,t,h)){a=false}if(e&&!this.processPseudo(i,l,p,o)){a=false}if(a){b.push(i)}};for(var q=0,r=t.length;q<r;q++){j=t[q].match(/([a-z0-9_-]+)\s*([=^$*|~!]{0,2})\s*"?([^"]*)"?$/i);t[q]=j[1];switch(j[2]){case"=":h[q]=new RegExp("^"+j[3]+"$","i");break;case"^=":h[q]=new RegExp("^"+j[3],"i");break;case"$=":h[q]=new RegExp(j[3]+"$","i");break;case"*=":h[q]=new RegExp(j[3],"i");break;case"~=":h[q]=new RegExp("^"+j[3]+"$|^"+j[3]+"\\s|\\s"+j[3]+"\\s|\\s"+j[3]+"$","i");break;case"!=":h[q]=j[3]}}if(k.indexOf(":")!=-1){j=k.split(":");k=j[0];e=j[1].match(/([a-z-]+)\(?([a-z0-9+-]*)\)?/i);l=e[1].toLowerCase();switch(f=e[2].toLowerCase()){case"odd":f="2n+1";break;case"even":f="2n"}j=f.match(/([0-9+-]*)(n?)([0-9+-]*)/i);p=parseInt(j[2]?(j[1]?((j[1]=="-")?-1:j[1]):1):0);o=parseInt(j[3]?j[3]:((j[1]&&!j[2])?j[1]:0))}if(k.indexOf("#")!=-1){this.postProcess(document.getElementById(k.substr(k.indexOf("#")+1)))}else{if(k.indexOf(".")!=-1){j=k.split(".");var n=k.substr(j[0].length+1).replace("."," ");var c=new RegExp("^"+n+"$|^"+n+"\\s|\\s"+n+"\\s|\\s"+n+"$","i");g=u.getElementsByTagName(j[0]?j[0]:"*");for(q=0,d=g.length;q<d;q++){if((!m&&c.test(g[q].className))||(m&&c.test(g[q].className)&&g[q].parentNode==u)){this.postProcess(g[q])}}}else{if(k=="*"||/^[A-Za-z0-9]+$/.test(k)){for(q=0,g=u.getElementsByTagName(k),d=g.length;q<d;q++){if(!m||(m&&g[q].parentNode==u)){this.postProcess(g[q])}}}}}return b},get:function(selectorText,startAt){var selectors=this.parseSelectors(selectorText);var numS=selectors.elements.length;if(!startAt){startAt=document}if(numS==1){var idMatch=selectors.elements[0].match(/^[a-z0-9*]*#([^,:]+)$/i);if(idMatch&&selectors.attrs[0]==""&&selectors.separators==""){return document.getElementById(idMatch[1])}}var objs=this.getMatches(startAt,selectors.elements[0],selectors.attrs[0]);var allObjs=[],newObjs,separator;for(var i=1;i<numS;i++){newObjs=[];separator=this.trim(selectors.separators[i-1]);if(separator==","){allObjs=this.concatUnique(allObjs,objs);objs=this.getMatches(startAt,selectors.elements[i],selectors.attrs[i])}else{var oneLevelOnly=(separator==">")?true:false;for(var j=0,numObjs=objs.length;j<numObjs;j++){if(!this.inArray(objs[j],newObjs)){newObjs=this.concatUnique(newObjs,this.getMatches(objs[j],selectors.elements[i],selectors.attrs[i]),oneLevelOnly)}}objs=newObjs}}allObjs=this.concatUnique(allObjs,objs);allObjs.apply=function(p){for(var i=0,numObjs=this.length;i<numObjs;i++){(typeof p=="function")?p(this[i]):eval("this[i]."+p)}};return allObjs},getCssRule:function(e,g,f){var b=[];var h=document.styleSheets[e];h=h.rules?h.rules:h.cssRules;g=g.toLowerCase();f=(this.browserType=="Safari")?f.replace(/([A-Z])/,"-$1").toLowerCase():f.toLowerCase();for(var d=0,a=h.length;d<a;d++){if(g=="*"||h[d].selectorText.toLowerCase()==g){for(var c in h[d].style){if(this.browserType=="Safari"){if(h[d].style[c].toLowerCase&&h[d].style[c].toLowerCase()==f){if(g=="*"){b[h[d].selectorText]=value}else{return h[d].style[h[d].style[c]]}}}else{if(c.toLowerCase()==f){if(g=="*"){b[h[d].selectorText]=h[d].style[c]}else{return h[d].style[c]}}}}}}return b},setStyles:function(c,b){for(var a in b){(a=="float")?this.setFloat(c,b[a]):c.style[a]=b[a]}},setAttributes:function(c,b){for(var a in b){(a=="className")?c.className=b[a]:c.setAttribute(a,b[a])}},removeNode:function(a){return a.parentNode.removeChild(a)},addEventListener:function(b,a,c){this.safariReady=function(){this.readyTimer=setInterval(function(){if(/loaded|complete/.test(document.readyState)){midori.runReadyEvents()}},10)};this.msieReady=function(){document.write('<script id="midori_onload" src="javascript: {}" defer="true"><\/script>');this.get("#midori_onload").onreadystatechange=function(){if(this.readyState=="complete"){midori.runReadyEvents()}}};if(b.addEventListener){if(a=="ready"){switch(this.browserType){case"Safari":this.domReady.push(c);if(!this.readyTimer){this.safariReady()}return;case"Opera":case"Gecko":a="DOMContentLoaded";break;default:a="load"}}b.addEventListener(a,c,false);return}if(a=="ready"){if(!this.domReady.length){this.msieReady()}this.domReady.push(c);return}b.attachEvent("on"+a,c)},runReadyEvents:function(){if(this.readyTimer){clearInterval(this.readyTimer)}for(var a=0,b=this.domReady.length;a<b;a++){this.domReady[a]()}},getEventTarget:function(a){var b=a.target?a.target:a.srcElement;if(b.nodeType==3){b=b.parentNode}return b},getMousePos:function(a){if(a.pageX||a.pageY){return{x:a.pageX,y:a.pageY}}else{return{x:a.clientX+document.documentElement.scrollLeft-document.body.clientLeft,y:a.clientY+document.documentElement.scrollTop-document.body.clientTop}}},preventBubble:function(a){a.stopPropagation?a.stopPropagation():window.event.cancelBubble=true},preventDefault:function(a){a.preventDefault?a.preventDefault():window.event.returnValue=false},getFloat:function(a){return((this.browserType=="MSIE")?a.style.styleFloat:a.style.cssFloat)},setFloat:function(b,a){(this.browserType=="MSIE")?b.style.styleFloat=a:b.style.cssFloat=a},ieObjectFix:function(b,a){b.innerHTML=a},getSelection:function(a){if(this.browserType!="MSIE"){return a.getSelection()}if(a==window){a=document}var b=a.selection.createRange();if(a.selection.type!="Control"){return b}},getSelectionText:function(a){return(this.browserType=="MSIE")?a.htmlText:a.toString()},getCookie:function(e){var c=document.cookie.split("; ");for(var a=0,b=c.length;a<b;a++){var d=c[a].split("=");if(d[0]==e){return unescape(d[1].replace(/\+/g," "))}}},setCookie:function(c,e,a,f,d){var b=new Date();document.cookie=c+"="+escape(e)+"; expires="+b.toUTCString(b.setSeconds(a))+(f?"; path="+f:"")+(d?"; domain="+d:"")},convertToFields:function(b,f,c){for(var d in c){if(typeof c[d]=="object"){this.convertToFields(b,f+"["+d+"]",c[d])}else{var e=document.createElement("input");this.setAttributes(e,{type:"hidden",name:f+"["+d+"]",value:c[d]});b.appendChild(e)}}},replace:function(a,e){var d=a.match(/:[A-Za-z0-9_]+/g).sort().reverse();for(var b=0,c=d.length;b<c;b++){a=a.replace(d[b],e[d[b].substr(1)])}return a},trim:function(a){return a.replace(/^\s+|\s+$/g,"")},uniqid:function(a){return Math.floor(Math.random()*(a?a:100000))},concatUnique:function(c,b){var a=[];for(var d=0,e=b.length;d<e;d++){if(!this.inArray(b[d],c)){a.push(b[d])}}return c.concat(a)},implode:function(f,b){if(typeof b!="object"){return b}var g="";if(b.length&&!b.propertyIsEnumerable("length")){for(var e=0,d=b.length;e<d;e++){g+=f+b[e]}}else{for(var c in b){g+=f+b[c]}}return g.substr(f.length)},inArray:function(c,b){for(var e=0,d=b.length;e<d;e++){if((c!=null&&b[e].constructor==Array&&c.constructor==Array&&b[e].toString()==c.toString())||(b[e]==c)){return true}}},shortenWords:function(b,a){a=a?a-3:45;this.each(b,function(h){if(h.nodeType!=3){return}var k=h.data.split(" ");var f=false,c;for(var e=0,j=k.length;e<j;e++){if((stLen=k[e].length)>a){var g=Math.floor(stLen-a);var d=Math.floor(stLen/2-g/2);k[e]=k[e].substr(0,d)+"..."+k[e].substr(d+g);f=true}}if(f){h.data=midori.implode(" ",k)}})},resizeImg:function(b,a){a=a?a:400;this.get("img",b).apply(function(c){if(c.width>a){if(c.style.msInterpolationMode){c.style.msInterpolationMode="bicubic"}c.width=a}})},saveCheckboxState:function(b,a,c){a.checked?b.innerHTML++:(--b.innerHTML==0)?b.innerHTML="":{};if(c){c(b.innerHTML)}},checkRequiredFields:function(h){h.required=h.required.split(",");var b=this.get("#"+h.formId);var a=false;var k,j,g,e;for(var f=0,d=h.required.length;f<d;f++){if(k=this.trim(h.required[f])){j=this.get("#"+k);g=(j.type.toLowerCase()=="checkbox")?"c":"t";e=(g=="c")?j.parentNode.style:j.style;e.backgroundColor="";if((g=="c"&&!j.checked)||(this.trim(j.value)=="")){e.backgroundColor="#FAA";a=true}}}this.get("#"+h.formId+"-status").innerHTML=a?h.message:"";var c=h.callback?h.callback():"";if(c===false||a){if(h.event){this.preventDefault(h.event)}return false}else{if(!h.event){b.submit()}}},getWindowDims:function(){if(this.browserType=="MSIE"){return{windowWidth:document.documentElement.clientWidth,windowHeight:document.documentElement.clientHeight,scrollTop:document.documentElement.scrollTop}}else{return{windowWidth:window.innerWidth,windowHeight:window.innerHeight,scrollTop:window.scrollY}}},getPos:function(b){var c=0,a=0;while(b.offsetParent!=null){c+=b.offsetLeft,a+=b.offsetTop-b.scrollTop,b=b.offsetParent}return{x:c,y:a}},highlightRow:function(c,a,b){this.get("td",c).apply(function(e){var d=e.className.split(" ");e.className=(d[d.length-1]==a)?e.className.substr(0,e.className.length-a.length-1):b?e.className:e.className+" "+a})}};