/*
 * Modernizr v1.6
 * http://www.modernizr.com
 *
 * Developed by: 
 * - Faruk Ates  http://farukat.es/
 * - Paul Irish  http://paulirish.com/
 *
 * Copyright (c) 2009-2010
 * Dual-licensed under the BSD or MIT licenses.
 * http://www.modernizr.com/license/
 */
window.Modernizr=function(i,e,u){function s(a,b){return(""+a).indexOf(b)!==-1}function D(a,b){for(var c in a)if(j[a[c]]!==u&&(!b||b(a[c],E)))return true}function n(a,b){var c=a.charAt(0).toUpperCase()+a.substr(1);c=(a+" "+F.join(c+" ")+c).split(" ");return!!D(c,b)}function S(){f.input=function(a){for(var b=0,c=a.length;b<c;b++)L[a[b]]=!!(a[b]in h);return L}("autocomplete autofocus list placeholder max min multiple pattern required step".split(" "));f.inputtypes=function(a){for(var b=0,c,k=a.length;b<
k;b++){h.setAttribute("type",a[b]);if(c=h.type!=="text"){h.value=M;if(/^range$/.test(h.type)&&h.style.WebkitAppearance!==u){l.appendChild(h);c=e.defaultView;c=c.getComputedStyle&&c.getComputedStyle(h,null).WebkitAppearance!=="textfield"&&h.offsetHeight!==0;l.removeChild(h)}else/^(search|tel)$/.test(h.type)||(c=/^(url|email)$/.test(h.type)?h.checkValidity&&h.checkValidity()===false:h.value!=M)}N[a[b]]=!!c}return N}("search tel url email datetime date month week time datetime-local number range color".split(" "))}
var f={},l=e.documentElement,E=e.createElement("modernizr"),j=E.style,h=e.createElement("input"),M=":)",O=Object.prototype.toString,q=" -webkit- -moz- -o- -ms- -khtml- ".split(" "),F="Webkit Moz O ms Khtml".split(" "),v={svg:"http://www.w3.org/2000/svg"},d={},N={},L={},P=[],w,Q=function(a){var b=document.createElement("style"),c=e.createElement("div");b.textContent=a+"{#modernizr{height:3px}}";(e.head||e.getElementsByTagName("head")[0]).appendChild(b);c.id="modernizr";l.appendChild(c);a=c.offsetHeight===
3;b.parentNode.removeChild(b);c.parentNode.removeChild(c);return!!a},o=function(){var a={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"};return function(b,c){c=c||document.createElement(a[b]||"div");b="on"+b;var k=b in c;if(!k){c.setAttribute||(c=document.createElement("div"));if(c.setAttribute&&c.removeAttribute){c.setAttribute(b,"");k=typeof c[b]=="function";if(typeof c[b]!="undefined")c[b]=u;c.removeAttribute(b)}}return k}}(),G={}.hasOwnProperty,R;R=
typeof G!=="undefined"&&typeof G.call!=="undefined"?function(a,b){return G.call(a,b)}:function(a,b){return b in a&&typeof a.constructor.prototype[b]==="undefined"};d.flexbox=function(){var a=e.createElement("div"),b=e.createElement("div");(function(k,g,r,x){g+=":";k.style.cssText=(g+q.join(r+";"+g)).slice(0,-g.length)+(x||"")})(a,"display","box","width:42px;padding:0;");b.style.cssText=q.join("box-flex:1;")+"width:10px;";a.appendChild(b);l.appendChild(a);var c=b.offsetWidth===42;a.removeChild(b);
l.removeChild(a);return c};d.canvas=function(){var a=e.createElement("canvas");return!!(a.getContext&&a.getContext("2d"))};d.canvastext=function(){return!!(f.canvas&&typeof e.createElement("canvas").getContext("2d").fillText=="function")};d.webgl=function(){var a=e.createElement("canvas");try{if(a.getContext("webgl"))return true}catch(b){}try{if(a.getContext("experimental-webgl"))return true}catch(c){}return false};d.touch=function(){return"ontouchstart"in i||Q("@media ("+q.join("touch-enabled),(")+
"modernizr)")};d.geolocation=function(){return!!navigator.geolocation};d.postmessage=function(){return!!i.postMessage};d.websqldatabase=function(){return!!i.openDatabase};d.indexedDB=function(){for(var a=-1,b=F.length;++a<b;){var c=F[a].toLowerCase();if(i[c+"_indexedDB"]||i[c+"IndexedDB"])return true}return false};d.hashchange=function(){return o("hashchange",i)&&(document.documentMode===u||document.documentMode>7)};d.history=function(){return!!(i.history&&history.pushState)};d.draganddrop=function(){return o("drag")&&
o("dragstart")&&o("dragenter")&&o("dragover")&&o("dragleave")&&o("dragend")&&o("drop")};d.websockets=function(){return"WebSocket"in i};d.rgba=function(){j.cssText="background-color:rgba(150,255,150,.5)";return s(j.backgroundColor,"rgba")};d.hsla=function(){j.cssText="background-color:hsla(120,40%,100%,.5)";return s(j.backgroundColor,"rgba")||s(j.backgroundColor,"hsla")};d.multiplebgs=function(){j.cssText="background:url(//:),url(//:),red url(//:)";return/(url\s*\(.*?){3}/.test(j.background)};d.backgroundsize=
function(){return n("backgroundSize")};d.borderimage=function(){return n("borderImage")};d.borderradius=function(){return n("borderRadius","",function(a){return s(a,"orderRadius")})};d.boxshadow=function(){return n("boxShadow")};d.textshadow=function(){return e.createElement("div").style.textShadow===""};d.opacity=function(){var a=q.join("opacity:.5;")+"";j.cssText=a;return s(j.opacity,"0.5")};d.cssanimations=function(){return n("animationName")};d.csscolumns=function(){return n("columnCount")};d.cssgradients=
function(){var a=("background-image:"+q.join("gradient(linear,left top,right bottom,from(#9f9),to(white));background-image:")+q.join("linear-gradient(left top,#9f9, white);background-image:")).slice(0,-17);j.cssText=a;return s(j.backgroundImage,"gradient")};d.cssreflections=function(){return n("boxReflect")};d.csstransforms=function(){return!!D(["transformProperty","WebkitTransform","MozTransform","OTransform","msTransform"])};d.csstransforms3d=function(){var a=!!D(["perspectiveProperty","WebkitPerspective",
"MozPerspective","OPerspective","msPerspective"]);if(a)a=Q("@media ("+q.join("transform-3d),(")+"modernizr)");return a};d.csstransitions=function(){return n("transitionProperty")};d.fontface=function(){var a,b=e.head||e.getElementsByTagName("head")[0]||l,c=e.createElement("style"),k=e.implementation||{hasFeature:function(){return false}};c.type="text/css";b.insertBefore(c,b.firstChild);a=c.sheet||c.styleSheet;b=k.hasFeature("CSS2","")?function(g){if(!(a&&g))return false;var r=false;try{a.insertRule(g,
0);r=!/unknown/i.test(a.cssRules[0].cssText);a.deleteRule(a.cssRules.length-1)}catch(x){}return r}:function(g){if(!(a&&g))return false;a.cssText=g;return a.cssText.length!==0&&!/unknown/i.test(a.cssText)&&a.cssText.replace(/\r+|\n+/g,"").indexOf(g.split(" ")[0])===0};f._fontfaceready=function(g){g(f.fontface)};return b('@font-face { font-family: "font"; src: "font.ttf"; }')};d.video=function(){var a=e.createElement("video"),b=!!a.canPlayType;if(b){b=new Boolean(b);b.ogg=a.canPlayType('video/ogg; codecs="theora"');
b.h264=a.canPlayType('video/mp4; codecs="avc1.42E01E"')||a.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"');b.webm=a.canPlayType('video/webm; codecs="vp8, vorbis"')}return b};d.audio=function(){var a=e.createElement("audio"),b=!!a.canPlayType;if(b){b=new Boolean(b);b.ogg=a.canPlayType('audio/ogg; codecs="vorbis"');b.mp3=a.canPlayType("audio/mpeg;");b.wav=a.canPlayType('audio/wav; codecs="1"');b.m4a=a.canPlayType("audio/x-m4a;")||a.canPlayType("audio/aac;")}return b};d.localstorage=function(){try{return"localStorage"in
i&&i.localStorage!==null}catch(a){return false}};d.sessionstorage=function(){try{return"sessionStorage"in i&&i.sessionStorage!==null}catch(a){return false}};d.webWorkers=function(){return!!i.Worker};d.applicationcache=function(){return!!i.applicationCache};d.svg=function(){return!!e.createElementNS&&!!e.createElementNS(v.svg,"svg").createSVGRect};d.inlinesvg=function(){var a=document.createElement("div");a.innerHTML="<svg/>";return(a.firstChild&&a.firstChild.namespaceURI)==v.svg};d.smil=function(){return!!e.createElementNS&&
/SVG/.test(O.call(e.createElementNS(v.svg,"animate")))};d.svgclippaths=function(){return!!e.createElementNS&&/SVG/.test(O.call(e.createElementNS(v.svg,"clipPath")))};for(var H in d)if(R(d,H)){w=H.toLowerCase();f[w]=d[H]();P.push((f[w]?"":"no-")+w)}f.input||S();f.crosswindowmessaging=f.postmessage;f.historymanagement=f.history;f.addTest=function(a,b){a=a.toLowerCase();if(!f[a]){b=!!b();l.className+=" "+(b?"":"no-")+a;f[a]=b;return f}};j.cssText="";E=h=null;i.attachEvent&&function(){var a=e.createElement("div");
a.innerHTML="<elem></elem>";return a.childNodes.length!==1}()&&function(a,b){function c(p){for(var m=-1;++m<r;)p.createElement(g[m])}function k(p,m){for(var I=p.length,t=-1,y,J=[];++t<I;){y=p[t];m=y.media||m;J.push(k(y.imports,m));J.push(y.cssText)}return J.join("")}var g="abbr|article|aside|audio|canvas|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video".split("|"),r=g.length,x=RegExp("<(/*)(abbr|article|aside|audio|canvas|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video)",
"gi"),T=RegExp("\\b(abbr|article|aside|audio|canvas|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video)\\b(?!.*[;}])","gi"),z=b.createDocumentFragment(),A=b.documentElement,K=A.firstChild,B=b.createElement("style"),C=b.createElement("body");B.media="all";c(b);c(z);a.attachEvent("onbeforeprint",function(){for(var p=-1;++p<r;)for(var m=b.getElementsByTagName(g[p]),I=m.length,t=-1;++t<I;)if(m[t].className.indexOf("iepp_")<0)m[t].className+=" iepp_"+
g[p];K.insertBefore(B,K.firstChild);B.styleSheet.cssText=k(b.styleSheets,"all").replace(T,".iepp_$1");z.appendChild(b.body);A.appendChild(C);C.innerHTML=z.firstChild.innerHTML.replace(x,"<$1bdo")});a.attachEvent("onafterprint",function(){C.innerHTML="";A.removeChild(C);K.removeChild(B);A.appendChild(z.firstChild)})}(this,document);f._enableHTML5=true;f._version="1.6";l.className=l.className.replace(/\bno-js\b/,"")+" js";l.className+=" "+P.join(" ");return f}(this,this.document);

/*!
 * jQuery Tools v1.2.6 - The missing UI library for the Web

 * 
 * scrollable/scrollable.js
 * tooltip/tooltip.js
 * 
 * NO COPYRIGHTS OR LICENSES. DO WHAT YOU LIKE.
 * 
 * http://flowplayer.org/tools/
 * 

 */
(function(a){a.tools=a.tools||{version:"v1.2.6"},a.tools.scrollable={conf:{activeClass:"active",circular:!1,clonedClass:"cloned",disabledClass:"disabled",easing:"swing",initialIndex:0,item:"> *",items:".items",keyboard:!0,mousewheel:!1,next:".next",prev:".prev",size:1,speed:400,vertical:!1,touch:!0,wheelSpeed:0}};function b(a,b){var c=parseInt(a.css(b),10);if(c)return c;var d=a[0].currentStyle;return d&&d.width&&parseInt(d.width,10)}function c(b,c){var d=a(c);return d.length<2?d:b.parent().find(c)}var d;function e(b,e){var f=this,g=b.add(f),h=b.children(),i=0,j=e.vertical;d||(d=f),h.length>1&&(h=a(e.items,b)),e.size>1&&(e.circular=!1),a.extend(f,{getConf:function(){return e},getIndex:function(){return i},getSize:function(){return f.getItems().size()},getNaviButtons:function(){return n.add(o)},getRoot:function(){return b},getItemWrap:function(){return h},getItems:function(){return h.find(e.item).not("."+e.clonedClass)},move:function(a,b){return f.seekTo(i+a,b)},next:function(a){return f.move(e.size,a)},prev:function(a){return f.move(-e.size,a)},begin:function(a){return f.seekTo(0,a)},end:function(a){return f.seekTo(f.getSize()-1,a)},focus:function(){d=f;return f},addItem:function(b){b=a(b),e.circular?(h.children().last().before(b),h.children().first().replaceWith(b.clone().addClass(e.clonedClass))):(h.append(b),o.removeClass("disabled")),g.trigger("onAddItem",[b]);return f},seekTo:function(b,c,k){b.jquery||(b*=1);if(e.circular&&b===0&&i==-1&&c!==0)return f;if(!e.circular&&b<0||b>f.getSize()||b<-1)return f;var l=b;b.jquery?b=f.getItems().index(b):l=f.getItems().eq(b);var m=a.Event("onBeforeSeek");if(!k){g.trigger(m,[b,c]);if(m.isDefaultPrevented()||!l.length)return f}var n=j?{top:-l.position().top}:{left:-l.position().left};i=b,d=f,c===undefined&&(c=e.speed),h.animate(n,c,e.easing,k||function(){g.trigger("onSeek",[b])});return f}}),a.each(["onBeforeSeek","onSeek","onAddItem"],function(b,c){a.isFunction(e[c])&&a(f).bind(c,e[c]),f[c]=function(b){b&&a(f).bind(c,b);return f}});if(e.circular){var k=f.getItems().slice(-1).clone().prependTo(h),l=f.getItems().eq(1).clone().appendTo(h);k.add(l).addClass(e.clonedClass),f.onBeforeSeek(function(a,b,c){if(!a.isDefaultPrevented()){if(b==-1){f.seekTo(k,c,function(){f.end(0)});return a.preventDefault()}b==f.getSize()&&f.seekTo(l,c,function(){f.begin(0)})}});var m=b.parents().add(b).filter(function(){if(a(this).css("display")==="none")return!0});m.length?(m.show(),f.seekTo(0,0,function(){}),m.hide()):f.seekTo(0,0,function(){})}var n=c(b,e.prev).click(function(a){a.stopPropagation(),f.prev()}),o=c(b,e.next).click(function(a){a.stopPropagation(),f.next()});e.circular||(f.onBeforeSeek(function(a,b){setTimeout(function(){a.isDefaultPrevented()||(n.toggleClass(e.disabledClass,b<=0),o.toggleClass(e.disabledClass,b>=f.getSize()-1))},1)}),e.initialIndex||n.addClass(e.disabledClass)),f.getSize()<2&&n.add(o).addClass(e.disabledClass),e.mousewheel&&a.fn.mousewheel&&b.mousewheel(function(a,b){if(e.mousewheel){f.move(b<0?1:-1,e.wheelSpeed||50);return!1}});if(e.touch){var p={};h[0].ontouchstart=function(a){var b=a.touches[0];p.x=b.clientX,p.y=b.clientY},h[0].ontouchmove=function(a){if(a.touches.length==1&&!h.is(":animated")){var b=a.touches[0],c=p.x-b.clientX,d=p.y-b.clientY;f[j&&d>0||!j&&c>0?"next":"prev"](),a.preventDefault()}}}e.keyboard&&a(document).bind("keydown.scrollable",function(b){if(!(!e.keyboard||b.altKey||b.ctrlKey||b.metaKey||a(b.target).is(":input"))){if(e.keyboard!="static"&&d!=f)return;var c=b.keyCode;if(j&&(c==38||c==40)){f.move(c==38?-1:1);return b.preventDefault()}if(!j&&(c==37||c==39)){f.move(c==37?-1:1);return b.preventDefault()}}}),e.initialIndex&&f.seekTo(e.initialIndex,0,function(){})}a.fn.scrollable=function(b){var c=this.data("scrollable");if(c)return c;b=a.extend({},a.tools.scrollable.conf,b),this.each(function(){c=new e(a(this),b),a(this).data("scrollable",c)});return b.api?c:this}})(jQuery);
(function(a){a.tools=a.tools||{version:"v1.2.6"},a.tools.tooltip={conf:{effect:"toggle",fadeOutSpeed:"fast",predelay:0,delay:30,opacity:1,tip:0,fadeIE:!1,position:["top","center"],offset:[0,0],relative:!1,cancelDefault:!0,events:{def:"mouseenter,mouseleave",input:"focus,blur",widget:"focus mouseenter,blur mouseleave",tooltip:"mouseenter,mouseleave"},layout:"<div/>",tipClass:"tooltip"},addEffect:function(a,c,d){b[a]=[c,d]}};var b={toggle:[function(a){var b=this.getConf(),c=this.getTip(),d=b.opacity;d<1&&c.css({opacity:d}),c.show(),a.call()},function(a){this.getTip().hide(),a.call()}],fade:[function(b){var c=this.getConf();!a.browser.msie||c.fadeIE?this.getTip().fadeTo(c.fadeInSpeed,c.opacity,b):(this.getTip().show(),b())},function(b){var c=this.getConf();!a.browser.msie||c.fadeIE?this.getTip().fadeOut(c.fadeOutSpeed,b):(this.getTip().hide(),b())}]};function c(b,c,d){var e=d.relative?b.position().top:b.offset().top,f=d.relative?b.position().left:b.offset().left,g=d.position[0];e-=c.outerHeight()-d.offset[0],f+=b.outerWidth()+d.offset[1],/iPad/i.test(navigator.userAgent)&&(e-=a(window).scrollTop());var h=c.outerHeight()+b.outerHeight();g=="center"&&(e+=h/2),g=="bottom"&&(e+=h),g=d.position[1];var i=c.outerWidth()+b.outerWidth();g=="center"&&(f-=i/2),g=="left"&&(f-=i);return{top:e,left:f}}function d(d,e){var f=this,g=d.add(f),h,i=0,j=0,k=d.attr("title"),l=d.attr("data-tooltip"),m=b[e.effect],n,o=d.is(":input"),p=o&&d.is(":checkbox, :radio, select, :button, :submit"),q=d.attr("type"),r=e.events[q]||e.events[o?p?"widget":"input":"def"];if(!m)throw"Nonexistent effect \""+e.effect+"\"";r=r.split(/,\s*/);if(r.length!=2)throw"Tooltip: bad events configuration for "+q;d.bind(r[0],function(a){clearTimeout(i),e.predelay?j=setTimeout(function(){f.show(a)},e.predelay):f.show(a)}).bind(r[1],function(a){clearTimeout(j),e.delay?i=setTimeout(function(){f.hide(a)},e.delay):f.hide(a)}),k&&e.cancelDefault&&(d.removeAttr("title"),d.data("title",k)),a.extend(f,{show:function(b){if(!h){l?h=a(l):e.tip?h=a(e.tip).eq(0):k?h=a(e.layout).addClass(e.tipClass).appendTo(document.body).hide().append(k):(h=d.next(),h.length||(h=d.parent().next()));if(!h.length)throw"Cannot find tooltip for "+d}if(f.isShown())return f;h.stop(!0,!0);var o=c(d,h,e);e.tip&&h.html(d.data("title")),b=a.Event(),b.type="onBeforeShow",g.trigger(b,[o]);if(b.isDefaultPrevented())return f;o=c(d,h,e),h.css({position:"absolute",top:o.top,left:o.left}),n=!0,m[0].call(f,function(){b.type="onShow",n="full",g.trigger(b)});var p=e.events.tooltip.split(/,\s*/);h.data("__set")||(h.unbind(p[0]).bind(p[0],function(){clearTimeout(i),clearTimeout(j)}),p[1]&&!d.is("input:not(:checkbox, :radio), textarea")&&h.unbind(p[1]).bind(p[1],function(a){a.relatedTarget!=d[0]&&d.trigger(r[1].split(" ")[0])}),e.tip||h.data("__set",!0));return f},hide:function(c){if(!h||!f.isShown())return f;c=a.Event(),c.type="onBeforeHide",g.trigger(c);if(!c.isDefaultPrevented()){n=!1,b[e.effect][1].call(f,function(){c.type="onHide",g.trigger(c)});return f}},isShown:function(a){return a?n=="full":n},getConf:function(){return e},getTip:function(){return h},getTrigger:function(){return d}}),a.each("onHide,onBeforeShow,onShow,onBeforeHide".split(","),function(b,c){a.isFunction(e[c])&&a(f).bind(c,e[c]),f[c]=function(b){b&&a(f).bind(c,b);return f}})}a.fn.tooltip=function(b){var c=this.data("tooltip");if(c)return c;b=a.extend(!0,{},a.tools.tooltip.conf,b),typeof b.position=="string"&&(b.position=b.position.split(/,?\s/)),this.each(function(){c=new d(a(this),b),a(this).data("tooltip",c)});return b.api?c:this}})(jQuery);

/* end jQuery Tools for hover nav */

// <![CDATA[
function addEvent(elm, evType, fn, useCapture) {
// cross-browser event handling for IE5+, NS6+ and Mozilla/Gecko
// By Scott Andrew
	if (elm.addEventListener) {
		elm.addEventListener(evType, fn, useCapture);
		return true;
	} else if (elm.attachEvent) {
		var r = elm.attachEvent('on' + evType, fn);
		return r;
	} else {
		elm['on' + evType] = fn;
	}
}
function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			oldonload();
			func();
		}
	}
}
/*
 * Clear Default Text: functions for clearing and replacing default text in
 * <input> elements.
 */
addEvent(window, 'load', init, false);

function init() {
  var formInputs = document.getElementsByTagName('input');
  for (var i = 0; i < formInputs.length; i++) {
    var theInput = formInputs[i];
    if (theInput.type == 'text' || theInput.type == 'textarea') {
      if (theInput.parentNode.id != 'dontclear' && theInput.type !='submit' || theInput.type == 'search' && theInput.className.match(/\bcleardefault\b/)) {
        /* Add event handlers */
        addEvent(theInput, 'focus', clearDefaultText, false);
        addEvent(theInput, 'blur', replaceDefaultText, false);
        /* Save the current value */
        if (theInput.value != '') { theInput.defaultText = theInput.value; }
      }
    }
  }
}
function clearDefaultText(e) {
  var target = window.event ? window.event.srcElement : e ? e.target : null;
  if (!target) return;
  if (target.value == target.defaultText) { target.value = ''; }
}
function replaceDefaultText(e) {
  var target = window.event ? window.event.srcElement : e ? e.target : null;
  if (!target) return;
  if (target.value == '' && target.defaultText) { target.value = target.defaultText; }
}
// show external links in new window
function externalLinks() {
  if (!document.getElementsByTagName) {
      // do nothing
  } else {
    var anchors = document.getElementsByTagName("a");
    for(var i=0; i<anchors.length; i++) {
      var anchor = anchors[i];
      if (anchor.getAttribute("rel") == "external") { anchor.target = "_blank"; }
      if (anchor.getAttribute("rel") == "webImage") { anchor.onclick = imageWindow; }
    }
  }
}
addEvent(window, "load", externalLinks, false);

// show and hide comparinator tabs
var cmp = {
	expandFirst: function() {
		if (!document.getElementById || !document.getElementsByTagName) { return; }
  	if (!document.getElementById('comparinator')) { return; }
		var comparinatorContent = document.getElementById('cmp-content');
		var comparinatorContainers = comparinatorContent.getElementsByTagName('dl');
		var links = document.getElementById("cmp-tabs").getElementsByTagName("a");
		var firstTab = links[0];
		comparinatorContainers[0].style.display = 'block';
		firstTab.parentNode.className = 'active';
	},
  hideContent: function() {
  	if (!document.getElementById || !document.getElementsByTagName) { return; }
  	if (!document.getElementById('comparinator')) { return; }
  	var comparinatorContent = document.getElementById('cmp-content');
  	var comparinatorContainers = comparinatorContent.getElementsByTagName('dl');
  	var links = document.getElementById("cmp-tabs").getElementsByTagName("a");
    for (var i=0; i<comparinatorContainers.length; i++) {
      comparinatorContainers[i].style.display = 'none';
      links[i].parentNode.className = '';
    }
	},
  clickedTab: function() {
    if (!document.getElementById || !document.getElementsByTagName) { return; }
    if (!document.getElementById('comparinator')) { return; }
    var comparinatorContent = document.getElementById('cmp-content');
    var comparinatorContainers = comparinatorContent.getElementsByTagName('dl');
    var links = document.getElementById("cmp-tabs").getElementsByTagName("a");
    for (var i=0; i<links.length; i++) {
      eval("links[i].onclick = function() { cmp.hideContent(); links["+i+"].parentNode.className = 'active'; comparinatorContainers["+i+"].style.display = 'block'; return false;}");
    }
  }
}
addLoadEvent(cmp.hideContent);
addLoadEvent(cmp.clickedTab);
addLoadEvent(cmp.expandFirst);

function inArray(needle) { for (var i=0; i < this.length; i++) { if (this[i] === needle) { return i; } } return false; } Array.inArray = inArray;
function addClass(theClass) { if (this.className != '') { this.className += ' ' + theClass; } else { this.className = theClass; } } Object.addClass = addClass;
// text utilities
function replaceText(el, text) {
  if (el != null) {
  	clearText(el);
  	var newNode = document.createTextNode(text);
  	el.appendChild(newNode);
  }
}
function clearText(el) {
  if (el != null) {
  	if (el.childNodes) {
  	  for (var i = 0; i < el.childNodes.length; i++) {
    		var childNode = el.childNodes[i];
    		el.removeChild(childNode);
  	  }
  	}
  }
}
function appendText(node, text) {
   var newTextNode = document.createTextNode(text);
   node.appendChild(newTextNode);
}
function getText(el) {
  var text = "";
  if (el != null) {
	if (el.childNodes) {
	  for (var i = 0; i < el.childNodes.length; i++) {
    	var childNode = el.childNodes[i];
    	if (childNode.nodeValue != null) { text = text + childNode.nodeValue; }
	  }
	 }
  }
  return text;
}

// ]]>

var primaryMenu = {
	init: function() {
		var c = 'active-menu';
		$('#menu li a').click(function() {
			if ($('#menu li').hasClass(c)) {
				$(this).parent('li').siblings('li').removeClass(c);
			}
			if ($(this).siblings('ul').length != 0) {
				if ($(this).parent('li').hasClass(c)) {
					$(this).parent('li').removeClass(c);
				} else {
					$(this).parent('li').addClass(c);
				}
				return false;
			}	
		});
	}
}

var hoverNav = {
	equipHoverInTimer: null,
	equipHoverOutTimer: null,
	has_faded_in: false,
	has_faded_out: false,
	debug: false,
	
	init: function() {
		
		hoverNav.bindNavEvents(); // bind events to equipment navigation buttons
		
		$('#equip-nav').mouseenter(function() {
  			if (hoverNav.has_faded_in && !hoverNav.has_faded_out) {
  				if (hoverNav.debug) console.log('clear hover out timer');
  				clearTimeout(hoverNav.equipHoverOutTimer);
  			}
  			if ($('.active-menu').length) hoverNav.removeConflict();
  		});
  		$('#equip-nav').mouseleave(function() {
  			if (hoverNav.has_faded_in && !hoverNav.has_faded_out) {
  				if (hoverNav.debug) console.log('start hover out timer');
  				hoverNav.equipHoverOutTimer = setTimeout('hoverNav.hoverFadeOut()', 800);
  			}
  		});
		
		$('.hovernav').hover(hoverNav.unbindNavEvents, hoverNav.bindNavEvents); // unbind events while navigating hovernav content
		$(".inner-hnav").scrollable(); // using Scrollable jQuery tool
		hoverNav.highlight(); // mark equipment nav button as active
	},
	bindNavEvents: function() {
		
		if (hoverNav.debug) console.log('bind equipment nav events');
		
		if (hoverNav.has_faded_in && !hoverNav.has_faded_out) {
			if (hoverNav.debug) console.log('clear hover out timer');
			clearTimeout(hoverNav.equipHoverOutTimer);
		}
		$('#equip-nav ul li').bind({
  			mouseenter: hoverNav.hoverIn,
  			mouseleave: hoverNav.hoverOut
  		});
  		$('#equip-nav ul li a.equip-btn').bind({
			//click: hoverNav.hoverClick,
			blur: hoverNav.hoverBlur
		});
  	},
  	unbindNavEvents: function() {
		
		if (hoverNav.debug) console.log('unbind equipment nav events');
		
		$('#equip-nav ul li').unbind({
  			mouseenter: hoverNav.hoverIn,
  			mouseleave: hoverNav.hoverOut
  		});
  		$('#equip-nav ul li a.equip-btn').unbind({
			//click: hoverNav.hoverClick,
			blur: hoverNav.hoverBlur
		});
  	},
  	hoverFadeIn: function() {
  		$('.active-equip-nav .hovernav').animate({ opacity: 'show' }, 200, function() {
  			$('.active-equip-nav').find('a.equip-btn').addClass('hover-active'); // show equip button pointer
  			hoverNav.has_faded_in = true;
  			hoverNav.has_faded_out = false;
  		});
  		if (hoverNav.debug) console.log('fade in hover nav');
  	},
	hoverIn: function() {
		$(this).addClass('active-equip-nav');
		if (hoverNav.has_faded_in) {
			$(this).children('.hovernav').show();
			$(this).find('a.equip-btn').addClass('hover-active');
			$(this).siblings('li').children('.hovernav').hide();
			$(this).siblings('li').find('a.equip-btn').removeClass('hover-active');
			if (hoverNav.debug) console.log('toggle active hover nav');
		} else {
			hoverNav.equipHoverInTimer = setTimeout('hoverNav.hoverFadeIn()', 400);
		}
	},
	hoverFadeOut: function() {
		$('.hovernav').animate({ opacity: 'hide' }, 600, function() {
			hoverNav.has_faded_out = true;
			hoverNav.has_faded_in = false;
		});
		if (hoverNav.debug) console.log('fade out hover nav');
	},
	hoverOut: function() {
		$(this).find('a.equip-btn').removeClass('hover-active');
		$(this).removeClass('active-equip-nav');
		if (!hoverNav.has_faded_in) {
			clearTimeout(hoverNav.equipHoverInTimer);
			if (hoverNav.debug) console.log('clear hover in timer');
		}
	},
	hoverClick: function() {
		if ($('.active-menu').length) hoverNav.removeConflict();
		$(this).parent('li').siblings('li').children('.hovernav').removeClass('hovernav-click');
		$(this).parent('li').children('.hovernav').fadeIn('fast');
		return false;
	},
	hoverBlur: function() {
		$(this).parent('li').children('.hovernav').fadeOut('slow');
		return false;
	},
	removeConflict: function() {
		$('#menu li').each(function() {
			if ($(this).hasClass('active-menu')) {
				$(this).removeClass('active-menu');
			}
		});
	},
	highlight: function() {
		locArray = window.location.pathname.split('/');
		if (locArray[1] != undefined) {
			var locSeg1 = locArray[1].toLowerCase();
		} else {
			var locSeg1 = 'one';
		}
		if (locArray[2] != undefined) {
			var locSeg2 = locArray[2].toLowerCase();
		} else {
			var locSeg2 = 'two';
		}
		if (locArray[3] != undefined) {
			var locSeg3 = locArray[3].toLowerCase();
		} else {
			var locSeg3 = 'three';
		}
		if (locSeg2 == "skidsteer" || locSeg3 == "skidsteer") { // ssl condition
			$('#equip-ssl a.equip-btn').addClass('active');
		} else if (locSeg2 == "compacttrack" || locSeg3 == "track") { // ctl condition
			$('#equip-ctl a.equip-btn').addClass('active');
		} else if (locSeg2 == "minitrack" || locSeg3 == "minitrackloader") { // mtl condition
			$('#equip-mtl a.equip-btn').addClass('active');
		} else if (locSeg1 == "excavators") { // ex condition
			$('#equip-mx a.equip-btn').addClass('active');
		} else if (locSeg1 == "versahandler") { // ttc condition
			$('#equip-ttc a.equip-btn').addClass('active');
		} else if (locSeg1 == "attachments") { // att condition
			$('#equip-att a.equip-btn').addClass('active');
		} else if (locSeg2 == "tractors") { // ct condition
			$('#equip-ct a.equip-btn').addClass('active');
		} else if (locSeg2 == "utility_vehicles") { // utv condition
			$('#equip-utv a.equip-btn').addClass('active');
		} else if (locSeg2 == "toolcat") { // uwm condition
			$('#equip-uwm a.equip-btn').addClass('active');
		}
	}
}

var jCat = { // JavaScript category organizer 
	init: function() {
		var catIndex = 1;
		$('.jCategory').each(function() {
			$(this).attr('id','jCat' + catIndex);

			var groupIndex = 1;
			$(this).children('div.group').each(function() {
				$(this).attr('id','cat' + catIndex + '-' + 'group' + groupIndex);
				groupIndex++;
			});

			var catId = $(this).attr('id');
			categoryItems = $(this).find('h4').length; // get total of items for category

			// index each item to use later for pagination
			var itemIndex = 1;
			$(this).find('h4').each(function() {
				$(this).attr('id','cat' + catIndex + '-' + itemIndex);
				itemIndex++;
			});

			catIndex++;

			$('.group[id$=group1]').addClass('activeGroup');
			jCat.sort(catId, categoryItems); // sort initial active items
		});
		$('.group:not("[id$=group1]")').hide(); // hide all but first category group
	},
	toggle: function() {
		$('.jCategory').append('<img src="http://netdrive.bobcat.com/shared/button_collapse.png" width="22" height="23" alt="button" title="collapse" class="noborder btn-toggle" />');
		// $('.btn-toggle').ifixpng();
		$('.btn-toggle').css('cursor','pointer');
		$('.btn-toggle').toggle(
			function() {
				$(this).parent().children('.activeGroup, .paginate').slideUp('fast');
				$(this).attr({ src: 'http://netdrive.bobcat.com/shared/button_expand.png', title: 'expand' });
				// $('.btn-toggle').ifixpng();
			},
			function() {
				$(this).parent().children('.activeGroup, .paginate').slideDown();
				$(this).attr({ src: 'http://netdrive.bobcat.com/shared/button_collapse.png', title: 'collapse' });
				// $('.btn-toggle').ifixpng();
			});
	},
	sort: function(catId, categoryItems) { // get first and last item from group for pagination
		$('#' + catId).children('.group').each(function() {
			if ($(this).is('.activeGroup')) {
				var firstItemId = $(this).find('h4:first').attr('id');
				var firstItemId = firstItemId.split('-');
				firstItem = firstItemId[1];
				var lastItemId = $(this).find('h4:last').attr('id');
				var lastItemId = lastItemId.split('-');
				lastItem = lastItemId[1];
				previousGroup = $(this).prev().attr('id'); // get previous group to display
				nextGroup = $(this).next().attr('id'); // get next group to display
				jCat.paginate(catId, categoryItems, firstItem, lastItem, previousGroup, nextGroup);
			}
		});
	},
	paginate: function(catId, categoryItems, firstItem, lastItem, previousGroup, nextGroup) { // display pagination
		if (categoryItems <= 4) { // no need for pagination
			var paginateHTML = '';
		} else if (firstItem <= 4 && categoryItems >= 5) { // add next link
			var paginateHTML = '<p class="paginate">Viewing ' + firstItem + '-' + lastItem + ' of ' + categoryItems + '&nbsp;&nbsp;<a href="#' + nextGroup + '" class="next">Next<\/a><\/p>';
		} else if (firstItem > 4 && lastItem < categoryItems) { // add previous and next links
			var paginateHTML = '<p class="paginate">Viewing ' + firstItem + '-' + lastItem + ' of ' + categoryItems + '&nbsp;&nbsp;<a href="#' + previousGroup + '" class="previous">Previous<\/a> | <a href="#' + nextGroup + '" class="next">Next<\/a><\/p>';
		} else if (firstItem == categoryItems) { // reached the end and there was only one item, add previous link
			var paginateHTML = '<p class="paginate">Viewing ' + firstItem + ' of ' + categoryItems + '&nbsp;&nbsp;<a href="#' + previousGroup + '" class="previous">Previous<\/a><\/p>';
		} else if (firstItem > 4 && lastItem == categoryItems) { // reached the end, add previous link
			var paginateHTML = '<p class="paginate">Viewing ' + firstItem + '-' + lastItem + ' of ' + categoryItems + '&nbsp;&nbsp;<a href="#' + previousGroup + '" class="previous">Previous<\/a><\/p>';
		}
		if ($('#' + catId).children().is('.paginate')) {
			$('#' + catId).children('.paginate').replaceWith(paginateHTML);
		} else {
			$('#' + catId).append(paginateHTML);
		}
		jCat.flip(catId, categoryItems);
	},
	flip: function(catId, categoryItems) {
		$('#' + catId + ' .paginate a').click(function() {
			var flipGroupId = $(this).attr('href');
			var flipGroupId = flipGroupId.split('#'); // fix for IE href value
			var flipGroup = flipGroupId[1];
			$('#' + flipGroup).siblings().removeClass('activeGroup');
			$('#' + flipGroup).addClass('activeGroup');
			$('#' + flipGroup).fadeIn().siblings("div").hide();
			jCat.sort(catId, categoryItems); // re-initialize displayed group to update pagination
			return false;
		});
	}
}
var tToggle = { // specifications table toggle	
	setTabs: function() {
		// assign ids to tables and hide them
		$('.tabletoggle table').each(function(i) {
			$(this).attr('id','toggletable' + i).hide();
		});
		$('.tabletoggle table:first').show();
		
		// create and place new elements for tabs
		$('.tabletoggle').prepend('<div class="tabbar"></div>');
		$('.tabletoggle h3').each(function() {
			var tablabel = $(this).text();
			$('.tabbar').append('<a href="#" class="toggletab-off"><span>' + tablabel + '</span></a>');
			$(this).remove();
		});
		$('.tabbar a:first').addClass('toggletab-on');
		
		// toggle tables and highlight active tab
		$('.toggletab-off').each(function(i) {
			$(this).click(function() {
				$(this).addClass('toggletab-on').siblings('a').removeClass('toggletab-on');
				$('#toggletable' + i).siblings('table').hide();
				$('#toggletable' + i).show(); return false;
			});
		});
	}
}
var mediaWidget = { // media widget chooser
	selectMedia: function() {
		var myAtt;
		var media;
		$("#media_widget_chooser").change(function() {
      		if (myAtt != undefined && media != undefined) $(media).clone().appendTo("#" + myAtt + "_clone"); // return clone
      		myAtt = $(this).find("option:selected").attr("lnk");
      		$("#media_widget").slideUp(function() {
          		$(this).empty();
          		media = $("#" + myAtt + "_clone").html();
          		$("#" + myAtt + "_clone").empty(); // avoid duplicates, lightbox gallery fix
          		$(media).clone().appendTo(this);
          		$(this).slideDown();
          		tb_init('a.thickbox, area.thickbox, input.thickbox');
          	});
        });
	}
}
function updateSICValue() {
    var sicValue = readCookie('_sic');
    if (sicValue != null) {
        var sicElement = document.getElementById('Sic');
        sicElement.setAttribute('value', sicValue);
    }
}
function readCookie(name) {
    var nameEQ = name + "=";
    var ca = document.cookie.split(';');
    for (var i = 0; i < ca.length; i++) {
        var c = ca[i];
        while (c.charAt(0) == ' ') c = c.substring(1, c.length);
        if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
    }
    return null;
}

/* --------------- URL grab functions --------------- */
var pageURL = document.URL;
function getParameter(queryString, parameterName) {
  /* Add "=" to the parameter name (i.e. parameterName=value) */
  var parameterName = parameterName + "=";
  if ( queryString.length > 0 ) {
    /* Find the beginning of the string */
    begin = queryString.indexOf ( parameterName );
    /* If the parameter name is not found, skip it, otherwise return the value */
    if ( begin != -1 ) {
      /* Add the length (integer) to the beginning */
      begin += parameterName.length;
      /* Multiple parameters are separated by the "&" sign */
      end = queryString.indexOf ( "&" , begin );
      if ( end == -1 ) {
        end = queryString.length;
      }
      /* Return the string */
      return unescape ( queryString.substring ( begin, end ) );
    }
    /* Return "" if no parameter has been found */
    return "";
  }
}
/* ------------- END URL grab functions ------------- */
/* ------------- Cookie functions ------------- */
function getCookie(c_name) {
  var i,x,y,ARRcookies=document.cookie.split(";");
  for (i=0;i<ARRcookies.length;i++) {
    x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
    y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
    x=x.replace(/^\s+|\s+$/g,"");
    if (x==c_name) { return unescape(y); }
  }
}
/* ------------- END Cookie functions ------------- */
/* ------------- Console Log Functions ------------- */
/* 
  What to setup on main page:
  First you need to set the reporting threshold.  Call function setThreshold([insert value]) at the top.
  Then when making alert calls, set an int for the reporting level.
  If the level is equal or higher than the threshold it will report.
  You can use setReportIE to determine if you want to skip reporting for IE or not.
    True means you want to report to IE.
  Once everything is in place, just change the threshold to show only what you want.
  Default is to report all '0';
  EX:
    setThreshold(0);
    alertConsole('hello world', 1);
    alertConsole('hello universe', 2);
*/

// Alerting function to allow for standards throughout projects
var rlThreshold = 0;    // Allows for a threshold or level of reporting
var reportIE = false;   // Report in IE or not
var ie = false;         // Determine if in IE
var ie6 = false;        // Determine if IE6
var ie7 = false;        // Determine if IE7
var ie8 = false;        // Determine if IE8

$(document).ready(function() { ieCheck(); });
function setThreshold(rlt) { rlThreshold = rlt; }
function setReportIE(rIE) { reportIE = rIE; }
function alertConsole(msg, lvl) {
  var r = false;        // If level req not met, don't alert
  if(lvl >= rlThreshold) { r = true; }
  else { r = false; }
  if(r){
    if(!ie) { console.log(msg); }
    else if(ie && reportIE) { alert(msg); }
  }
}
function ieCheck(){
  if($.browser.msie) {
    ie = true;
    if($.browser.version == "6.0") { ie6 = true;}
    if($.browser.version == "7.0") { ie7 = true;}
    if($.browser.version == "8.0") { ie8 = true;}
  }
}
/* ----------- END Console Log Functions ----------- */

/* ----------- Video Standard Vars/Function ----------- */
// Universal Video params
var vsBaseSWF = "http://netdrive.bobcat.com/videosharing/standard/player.swf";
var vsBaseSWF_HS = "http://netdrive.bobcat.com/videosharing/hero/player.swf";
var vsPostTag = "Bobcat";
var vsPostLocation = "Fargo,ND";	
var vsParams = { wmode: 'transparent', scale: 'noscale', allowScriptAccess: 'always' };
/* ----------- END Video Standard Vars/Funtcion ----------- */ 

/* ----------- Share with a Friend Function ----------- */
function emailToAFriend(postUrl, Fname, Lname, yourEmail, friendsEmail, friendsEmailTwo) {
  var formURL = "/forms/video_tell_a_friend/?";
  var formParams = {postURL:postUrl, fname:Fname, lname:Lname, youremail:yourEmail, email1:friendsEmail, email2:friendsEmailTwo};
  formParams = jQuery.param(formParams);                     
  formURL += formParams;
  $('#share-form').attr('src',formURL);
}
/* --------- END Share with a Friend Function --------- */
/* ----------- Subtab Function ----------- */
function runSubtabs() {
  $("#subtabs dd a").click(function(){
    var linkID  = $(this).attr("id");
    var divID   = linkID.replace("_link", "");
    
    $("div[name='tabDiv']").hide();
    $("#"+divID).show();
    $("#subtabs dd").each(function(){ $(this).removeClass("active"); });
    $(this).parent().addClass("active");
    return false;
  });
  /* trigger a 'click' of the first tab [default tab] */
  $("#subtabs dd a").first().trigger("click");
}
/* --------- END Subtab Function --------- */

// Check if in the imagelib section
if(pageURL.match('imagelib') != null) {
  $("link").each(function(){
    if($(this).attr("href") == "/imglib/includes/css/imglib.css" ||
       $(this).attr("href") == "/imglib/includes/css/imglib_search.css" ||
       $(this).attr("href") == "/imagelib/includes/css/content.css" ||
       $(this).attr("href") == "/publicadmin/elements/form.css") {
      this.media = "screen";
    }
  });  
}
/* ------------- MultiVid Function ------------- */
function switchMultiVid(lnk) { 
  $(".lightboxVid").hide();
  var mvVal = $("#" + lnk + "_sel").val();
  var vidTitle = $("a[data-relVid='" + mvVal + "'] span").text();
  $("#multiVideo_head h2").text(vidTitle);
  $("#" + mvVal).show();
}
/* ----------- END MultiVid Function ----------- */
$(document).ready(function() {
  if ($('.jCategory').length) { // check for JavaScript category class name
    jCat.init();
    jCat.toggle();
  }
  if ($('.tabletoggle').length) tToggle.setTabs();
  if ($('#media_widget_chooser').length) mediaWidget.selectMedia();
  if ($('#menu').length) primaryMenu.init();
  if ($('#equip-nav').length) hoverNav.init();
    
  // Handler for multi-video thickbox
  $(".multiVid").click(function(){
    var mvId = $(this).attr("id");
    switchMultiVid(mvId);
  });      
  $(".vidStill").click(function(){
    var vidLinkId = $(this).parents(".items").attr("data-vidLnk");
    var relVid = $(this).attr("data-relVid");
    var mv = $("#" + vidLinkId).attr("data-mv");
    $("#" + vidLinkId + "_sel").val(relVid);
    switchMultiVid(vidLinkId);
  });
  if ($('a.tb_close').length) {
  	$("a.tb_close").click(tb_remove);
  }
  
  // Check for a referred video to be triggered.
  var vid = getParameter(pageURL, "vidPop");
  if(vid != "") {
    var vid_sel = getParameter(pageURL, "vidPopSel");
    if (vid_sel != "") { $("#" + vid + "_sel").val(vid_sel); }
    $("#" + vid).click();
  }

  // Check for _ref and set to var if needed
  var q = getParameter(pageURL, '_ref');
  if(q != "" && q != null) {
    $("#00N30000002xEpq").val(q);
  } else {
    var c = getCookie("_ref_param");
    if(c != "" && c != null) { $("#00N30000002xEpq").val(c); }
  }
  if($("#subtabs").length) { runSubtabs(); }
});
