/*
 * jQuery JavaScript Library v1.3.2
 * http://jquery.com/
 *
 * Copyright (c) 2009 John Resig
 * Dual licensed under the MIT and GPL licenses.
 * http://docs.jquery.com/License
 *
 * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009)
 * Revision: 6246
 */
(function(){var l=this,g,y=l.jQuery,p=l.$,o=l.jQuery=l.$=function(E,F){return new o.fn.init(E,F)},D=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return F}}else{return o(H).find(E)}}else{if(o.isFunction(E)){return o(document).ready(E)}}if(E.selector&&E.context){this.selector=E.selector;this.context=E.context}return this.setArray(o.isArray(E)?E:o.makeArray(E))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(E){return E===g?Array.prototype.slice.call(this):this[E]},pushStack:function(F,H,E){var G=o(F);G.prevObject=this;G.context=this.context;if(H==="find"){G.selector=this.selector+(this.selector?" ":"")+E}else{if(H){G.selector=this.selector+"."+H+"("+E+")"}}return G},setArray:function(E){this.length=0;Array.prototype.push.apply(this,E);return this},each:function(F,E){return o.each(this,F,E)},index:function(E){return o.inArray(E&&E.jquery?E[0]:E,this)},attr:function(F,H,G){var E=F;if(typeof F==="string"){if(H===g){return this[0]&&o[G||"attr"](this[0],F)}else{E={};E[F]=H}}return this.each(function(I){for(F in E){o.attr(G?this.style:this,F,o.prop(this,E[F],G,I,F))}})},css:function(E,F){if((E=="width"||E=="height")&&parseFloat(F)<0){F=g}return this.attr(E,F,"curCSS")},text:function(F){if(typeof F!=="object"&&F!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(F))}var E="";o.each(F||this,function(){o.each(this.childNodes,function(){if(this.nodeType!=8){E+=this.nodeType!=1?this.nodeValue:o.fn.text([this])}})});return E},wrapAll:function(E){if(this[0]){var F=o(E,this[0].ownerDocument).clone();if(this[0].parentNode){F.insertBefore(this[0])}F.map(function(){var G=this;while(G.firstChild){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(E){return this.each(function(){o(this).contents().wrapAll(E)})},wrap:function(E){return this.each(function(){o(this).wrapAll(E)})},append:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})},prepend:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.insertBefore(E,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this)})},after:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this.nextSibling)})},end:function(){return this.prevObject||o([])},push:[].push,sort:[].sort,splice:[].splice,find:function(E){if(this.length===1){var F=this.pushStack([],"find",E);F.length=0;o.find(E,this[0],F);return F}else{return this.pushStack(o.unique(o.map(this,function(G){return o.find(E,G)})),"find",E)}},clone:function(G){var E=this.map(function(){if(!o.support.noCloneEvent&&!o.isXMLDoc(this)){var I=this.outerHTML;if(!I){var J=this.ownerDocument.createElement("div");J.appendChild(this.cloneNode(true));I=J.innerHTML}return o.clean([I.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(G===true){var H=this.find("*").andSelf(),F=0;E.find("*").andSelf().each(function(){if(this.nodeName!==H[F].nodeName){return}var I=o.data(H[F],"events");for(var K in I){for(var J in I[K]){o.event.add(this,K,I[K][J],I[K][J].data)}}F++})}return E},filter:function(E){return this.pushStack(o.isFunction(E)&&o.grep(this,function(G,F){return E.call(G,F)})||o.multiFilter(E,o.grep(this,function(F){return F.nodeType===1})),"filter",E)},closest:function(E){var G=o.expr.match.POS.test(E)?o(E):null,F=0;return this.map(function(){var H=this;while(H&&H.ownerDocument){if(G?G.index(H)>-1:o(H).is(E)){o.data(H,"closest",F);return H}H=H.parentNode;F++}})},not:function(E){if(typeof E==="string"){if(f.test(E)){return this.pushStack(o.multiFilter(E,this,true),"not",E)}else{E=o.multiFilter(E,this)}}var F=E.length&&E[E.length-1]!==g&&!E.nodeType;return this.filter(function(){return F?o.inArray(this,E)<0:this!=E})},add:function(E){return this.pushStack(o.unique(o.merge(this.get(),typeof E==="string"?o(E):o.makeArray(E))))},is:function(E){return !!E&&o.multiFilter(E,this).length>0},hasClass:function(E){return !!E&&this.is("."+E)},val:function(K){if(K===g){var E=this[0];if(E){if(o.nodeName(E,"option")){return(E.attributes.value||{}).specified?E.value:E.text}if(o.nodeName(E,"select")){var I=E.selectedIndex,L=[],M=E.options,H=E.type=="select-one";if(I<0){return null}for(var F=H?I:0,J=H?I+1:M.length;F<J;F++){var G=M[F];if(G.selected){K=o(G).val();if(H){return K}L.push(K)}}return L}return(E.value||"").replace(/\r/g,"")}return g}if(typeof K==="number"){K+=""}return this.each(function(){if(this.nodeType!=1){return}if(o.isArray(K)&&/radio|checkbox/.test(this.type)){this.checked=(o.inArray(this.value,K)>=0||o.inArray(this.name,K)>=0)}else{if(o.nodeName(this,"select")){var N=o.makeArray(K);o("option",this).each(function(){this.selected=(o.inArray(this.value,N)>=0||o.inArray(this.text,N)>=0)});if(!N.length){this.selectedIndex=-1}}else{this.value=K}}})},html:function(E){return E===g?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(E)},replaceWith:function(E){return this.after(E).remove()},eq:function(E){return this.slice(E,+E+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(E){return this.pushStack(o.map(this,function(G,F){return E.call(G,F,G)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=o.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild;if(H){for(var G=0,E=this.length;G<E;G++){L.call(K(this[G],H),this.length>1||G>0?I.cloneNode(true):I)}}if(F){o.each(F,z)}}return this;function K(N,O){return M&&o.nodeName(N,"table")&&o.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};o.fn.init.prototype=o.fn;function z(E,F){if(F.src){o.ajax({url:F.src,async:false,dataType:"script"})}else{o.globalEval(F.text||F.textContent||F.innerHTML||"")}if(F.parentNode){F.parentNode.removeChild(F)}}function e(){return +new Date}o.extend=o.fn.extend=function(){var J=arguments[0]||{},H=1,I=arguments.length,E=false,G;if(typeof J==="boolean"){E=J;J=arguments[1]||{};H=2}if(typeof J!=="object"&&!o.isFunction(J)){J={}}if(I==H){J=this;--H}for(;H<I;H++){if((G=arguments[H])!=null){for(var F in G){var K=J[F],L=G[F];if(J===L){continue}if(E&&L&&typeof L==="object"&&!L.nodeType){J[F]=o.extend(E,K||(L.length!=null?[]:{}),L)}else{if(L!==g){J[F]=L}}}}}return J};var b=/z-?index|font-?weight|opacity|zoom|line-?height/i,q=document.defaultView||{},s=Object.prototype.toString;o.extend({noConflict:function(E){l.$=p;if(E){l.jQuery=y}return o},isFunction:function(E){return s.call(E)==="[object Function]"},isArray:function(E){return s.call(E)==="[object Array]"},isXMLDoc:function(E){return E.nodeType===9&&E.documentElement.nodeName!=="HTML"||!!E.ownerDocument&&o.isXMLDoc(E.ownerDocument)},globalEval:function(G){if(G&&/\S/.test(G)){var F=document.getElementsByTagName("head")[0]||document.documentElement,E=document.createElement("script");E.type="text/javascript";if(o.support.scriptEval){E.appendChild(document.createTextNode(G))}else{E.text=G}F.insertBefore(E,F.firstChild);F.removeChild(E)}},nodeName:function(F,E){return F.nodeName&&F.nodeName.toUpperCase()==E.toUpperCase()},each:function(G,K,F){var E,H=0,I=G.length;if(F){if(I===g){for(E in G){if(K.apply(G[E],F)===false){break}}}else{for(;H<I;){if(K.apply(G[H++],F)===false){break}}}}else{if(I===g){for(E in G){if(K.call(G[E],E,G[E])===false){break}}}else{for(var J=G[0];H<I&&K.call(J,H,J)!==false;J=G[++H]){}}}return G},prop:function(H,I,G,F,E){if(o.isFunction(I)){I=I.call(H,F)}return typeof I==="number"&&G=="curCSS"&&!b.test(E)?I+"px":I},className:{add:function(E,F){o.each((F||"").split(/\s+/),function(G,H){if(E.nodeType==1&&!o.className.has(E.className,H)){E.className+=(E.className?" ":"")+H}})},remove:function(E,F){if(E.nodeType==1){E.className=F!==g?o.grep(E.className.split(/\s+/),function(G){return !o.className.has(F,G)}).join(" "):""}},has:function(F,E){return F&&o.inArray(E,(F.className||F).toString().split(/\s+/))>-1}},swap:function(H,G,I){var E={};for(var F in G){E[F]=H.style[F];H.style[F]=G[F]}I.call(H);for(var F in G){H.style[F]=E[F]}},css:function(H,F,J,E){if(F=="width"||F=="height"){var L,G={position:"absolute",visibility:"hidden",display:"block"},K=F=="width"?["Left","Right"]:["Top","Bottom"];function I(){L=F=="width"?H.offsetWidth:H.offsetHeight;if(E==="border"){return}o.each(K,function(){if(!E){L-=parseFloat(o.curCSS(H,"padding"+this,true))||0}if(E==="margin"){L+=parseFloat(o.curCSS(H,"margin"+this,true))||0}else{L-=parseFloat(o.curCSS(H,"border"+this+"Width",true))||0}})}if(H.offsetWidth!==0){I()}else{o.swap(H,G,I)}return Math.max(0,Math.round(L))}return o.curCSS(H,F,J)},curCSS:function(I,F,G){var L,E=I.style;if(F=="opacity"&&!o.support.opacity){L=o.attr(E,"opacity");return L==""?"1":L}if(F.match(/float/i)){F=w}if(!G&&E&&E[F]){L=E[F]}else{if(q.getComputedStyle){if(F.match(/float/i)){F="float"}F=F.replace(/([A-Z])/g,"-$1").toLowerCase();var M=q.getComputedStyle(I,null);if(M){L=M.getPropertyValue(F)}if(F=="opacity"&&L==""){L="1"}}else{if(I.currentStyle){var J=F.replace(/\-(\w)/g,function(N,O){return O.toUpperCase()});L=I.currentStyle[F]||I.currentStyle[J];if(!/^\d+(px)?$/i.test(L)&&/^\d/.test(L)){var H=E.left,K=I.runtimeStyle.left;I.runtimeStyle.left=I.currentStyle.left;E.left=L||0;L=E.pixelLeft+"px";E.left=H;I.runtimeStyle.left=K}}}}return L},clean:function(F,K,I){K=K||document;if(typeof K.createElement==="undefined"){K=K.ownerDocument||K[0]&&K[0].ownerDocument||document}if(!I&&F.length===1&&typeof F[0]==="string"){var H=/^<(\w+)\s*\/?>$/.exec(F[0]);if(H){return[K.createElement(H[1])]}}var G=[],E=[],L=K.createElement("div");o.each(F,function(P,S){if(typeof S==="number"){S+=""}if(!S){return}if(typeof S==="string"){S=S.replace(/(<(\w+)[^>]*?)\/>/g,function(U,V,T){return T.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?U:V+"></"+T+">"});var O=S.replace(/^\s+/,"").substring(0,10).toLowerCase();var Q=!O.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!O.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||O.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!O.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!O.indexOf("<td")||!O.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!O.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||!o.support.htmlSerialize&&[1,"div<div>","</div>"]||[0,"",""];L.innerHTML=Q[1]+S+Q[2];while(Q[0]--){L=L.lastChild}if(!o.support.tbody){var R=/<tbody/i.test(S),N=!O.indexOf("<table")&&!R?L.firstChild&&L.firstChild.childNodes:Q[1]=="<table>"&&!R?L.childNodes:[];for(var M=N.length-1;M>=0;--M){if(o.nodeName(N[M],"tbody")&&!N[M].childNodes.length){N[M].parentNode.removeChild(N[M])}}}if(!o.support.leadingWhitespace&&/^\s/.test(S)){L.insertBefore(K.createTextNode(S.match(/^\s*/)[0]),L.firstChild)}S=o.makeArray(L.childNodes)}if(S.nodeType){G.push(S)}else{G=o.merge(G,S)}});if(I){for(var J=0;G[J];J++){if(o.nodeName(G[J],"script")&&(!G[J].type||G[J].type.toLowerCase()==="text/javascript")){E.push(G[J].parentNode?G[J].parentNode.removeChild(G[J]):G[J])}else{if(G[J].nodeType===1){G.splice.apply(G,[J+1,0].concat(o.makeArray(G[J].getElementsByTagName("script"))))}I.appendChild(G[J])}}return E}return G},attr:function(J,G,K){if(!J||J.nodeType==3||J.nodeType==8){return g}var H=!o.isXMLDoc(J),L=K!==g;G=H&&o.props[G]||G;if(J.tagName){var F=/href|src|style/.test(G);if(G=="selected"&&J.parentNode){J.parentNode.selectedIndex}if(G in J&&H&&!F){if(L){if(G=="type"&&o.nodeName(J,"input")&&J.parentNode){throw"type property can't be changed"}J[G]=K}if(o.nodeName(J,"form")&&J.getAttributeNode(G)){return J.getAttributeNode(G).nodeValue}if(G=="tabIndex"){var I=J.getAttributeNode("tabIndex");return I&&I.specified?I.value:J.nodeName.match(/(button|input|object|select|textarea)/i)?0:J.nodeName.match(/^(a|area)$/i)&&J.href?0:g}return J[G]}if(!o.support.style&&H&&G=="style"){return o.attr(J.style,"cssText",K)}if(L){J.setAttribute(G,""+K)}var E=!o.support.hrefNormalized&&H&&F?J.getAttribute(G,2):J.getAttribute(G);return E===null?g:E}if(!o.support.opacity&&G=="opacity"){if(L){J.zoom=1;J.filter=(J.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(K)+""=="NaN"?"":"alpha(opacity="+K*100+")")}return J.filter&&J.filter.indexOf("opacity=")>=0?(parseFloat(J.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}G=G.replace(/-([a-z])/ig,function(M,N){return N.toUpperCase()});if(L){J[G]=K}return J[G]},trim:function(E){return(E||"").replace(/^\s+|\s+$/g,"")},makeArray:function(G){var E=[];if(G!=null){var F=G.length;if(F==null||typeof G==="string"||o.isFunction(G)||G.setInterval){E[0]=G}else{while(F){E[--F]=G[F]}}}return E},inArray:function(G,H){for(var E=0,F=H.length;E<F;E++){if(H[E]===G){return E}}return -1},merge:function(H,E){var F=0,G,I=H.length;if(!o.support.getAll){while((G=E[F++])!=null){if(G.nodeType!=8){H[I++]=G}}}else{while((G=E[F++])!=null){H[I++]=G}}return H},unique:function(K){var F=[],E={};try{for(var G=0,H=K.length;G<H;G++){var J=o.data(K[G]);if(!E[J]){E[J]=true;F.push(K[G])}}}catch(I){F=K}return F},grep:function(F,J,E){var G=[];for(var H=0,I=F.length;H<I;H++){if(!E!=!J(F[H],H)){G.push(F[H])}}return G},map:function(E,J){var F=[];for(var G=0,H=E.length;G<H;G++){var I=J(E[G],G);if(I!=null){F[F.length]=I}}return F.concat.apply([],F)}});var C=navigator.userAgent.toLowerCase();o.browser={version:(C.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1],safari:/webkit/.test(C),opera:/opera/.test(C),msie:/msie/.test(C)&&!/opera/.test(C),mozilla:/mozilla/.test(C)&&!/(compatible|webkit)/.test(C)};o.each({parent:function(E){return E.parentNode},parents:function(E){return o.dir(E,"parentNode")},next:function(E){return o.nth(E,2,"nextSibling")},prev:function(E){return o.nth(E,2,"previousSibling")},nextAll:function(E){return o.dir(E,"nextSibling")},prevAll:function(E){return o.dir(E,"previousSibling")},siblings:function(E){return o.sibling(E.parentNode.firstChild,E)},children:function(E){return o.sibling(E.firstChild)},contents:function(E){return o.nodeName(E,"iframe")?E.contentDocument||E.contentWindow.document:o.makeArray(E.childNodes)}},function(E,F){o.fn[E]=function(G){var H=o.map(this,F);if(G&&typeof G=="string"){H=o.multiFilter(G,H)}return this.pushStack(o.unique(H),E,G)}});o.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(E,F){o.fn[E]=function(G){var J=[],L=o(G);for(var K=0,H=L.length;K<H;K++){var I=(K>0?this.clone(true):this).get();o.fn[F].apply(o(L[K]),I);J=J.concat(I)}return this.pushStack(J,E,G)}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([this]).each(function(){o.event.remove(this);o.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){o(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(E,F){o.fn[E]=function(){return this.each(F,arguments)}});function j(E,F){return E[0]&&parseInt(o.curCSS(E[0],F,true),10)||0}var h="jQuery"+e(),v=0,A={};o.extend({cache:{},data:function(F,E,G){F=F==l?A:F;var H=F[h];if(!H){H=F[h]=++v}if(E&&!o.cache[H]){o.cache[H]={}}if(G!==g){o.cache[H][E]=G}return E?o.cache[H][E]:H},removeData:function(F,E){F=F==l?A:F;var H=F[h];if(E){if(o.cache[H]){delete o.cache[H][E];E="";for(E in o.cache[H]){break}if(!E){o.removeData(F)}}}else{try{delete F[h]}catch(G){if(F.removeAttribute){F.removeAttribute(h)}}delete o.cache[H]}},queue:function(F,E,H){if(F){E=(E||"fx")+"queue";var G=o.data(F,E);if(!G||o.isArray(H)){G=o.data(F,E,o.makeArray(H))}else{if(H){G.push(H)}}}return G},dequeue:function(H,G){var E=o.queue(H,G),F=E.shift();if(!G||G==="fx"){F=E[0]}if(F!==g){F.call(H)}}});o.fn.extend({data:function(E,G){var H=E.split(".");H[1]=H[1]?"."+H[1]:"";if(G===g){var F=this.triggerHandler("getData"+H[1]+"!",[H[0]]);if(F===g&&this.length){F=o.data(this[0],E)}return F===g&&H[1]?this.data(H[0]):F}else{return this.trigger("setData"+H[1]+"!",[H[0],G]).each(function(){o.data(this,E,G)})}},removeData:function(E){return this.each(function(){o.removeData(this,E)})},queue:function(E,F){if(typeof E!=="string"){F=E;E="fx"}if(F===g){return o.queue(this[0],E)}return this.each(function(){var G=o.queue(this,E,F);if(E=="fx"&&G.length==1){G[0].call(this)}})},dequeue:function(E){return this.each(function(){o.dequeue(this,E)})}});
/*
 * Sizzle CSS Selector Engine - v0.9.3
 *  Copyright 2009, The Dojo Foundation
 *  Released under the MIT, BSD, and GPL Licenses.
 *  More information: http://sizzlejs.com/
 */
(function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa<ab.length;aa++){if(ab[aa]===ab[aa-1]){ab.splice(aa--,1)}}}}}return ab};F.matches=function(T,U){return F(T,null,null,U)};F.find=function(aa,T,ab){var Z,X;if(!aa){return[]}for(var W=0,V=I.order.length;W<V;W++){var Y=I.order[W],X;if((X=I.match[Y].exec(aa))){var U=RegExp.leftContext;if(U.substr(U.length-1)!=="\\"){X[1]=(X[1]||"").replace(/\\/g,"");Z=I.find[Y](X,T,ab);if(Z!=null){aa=aa.replace(I.match[Y],"");break}}}}if(!Z){Z=T.getElementsByTagName("*")}return{set:Z,expr:aa}};F.filter=function(ad,ac,ag,W){var V=ad,ai=[],aa=ac,Y,T,Z=ac&&ac[0]&&Q(ac[0]);while(ad&&ac.length){for(var ab in I.filter){if((Y=I.match[ab].exec(ad))!=null){var U=I.filter[ab],ah,af;T=false;if(aa==ai){ai=[]}if(I.preFilter[ab]){Y=I.preFilter[ab](Y,aa,ag,ai,W,Z);if(!Y){T=ah=true}else{if(Y===true){continue}}}if(Y){for(var X=0;(af=aa[X])!=null;X++){if(af){ah=U(af,Y,X,aa);var ae=W^!!ah;if(ag&&ah!=null){if(ae){T=true}else{aa[X]=false}}else{if(ae){ai.push(af);T=true}}}}}if(ah!==g){if(!ag){aa=ai}ad=ad.replace(I.match[ab],"");if(!T){return[]}break}}}if(ad==V){if(T==null){throw"Syntax error, unrecognized expression: "+ad}else{break}}V=ad}return aa};var I=F.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(T){return T.getAttribute("href")}},relative:{"+":function(aa,T,Z){var X=typeof T==="string",ab=X&&!/\W/.test(T),Y=X&&!ab;if(ab&&!Z){T=T.toUpperCase()}for(var W=0,V=aa.length,U;W<V;W++){if((U=aa[W])){while((U=U.previousSibling)&&U.nodeType!==1){}aa[W]=Y||U&&U.nodeName===T?U||false:U===T}}if(Y){F.filter(T,aa,true)}},">":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){var W=Y.parentNode;Z[V]=W.nodeName===U?W:false}}}else{for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){Z[V]=X?Y.parentNode:Y.parentNode===U}}if(X){F.filter(U,Z,true)}}},"":function(W,U,Y){var V=L++,T=S;if(!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("parentNode",U,V,W,X,Y)},"~":function(W,U,Y){var V=L++,T=S;if(typeof U==="string"&&!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("previousSibling",U,V,W,X,Y)}},find:{ID:function(U,V,W){if(typeof V.getElementById!=="undefined"&&!W){var T=V.getElementById(U[1]);return T?[T]:[]}},NAME:function(V,Y,Z){if(typeof Y.getElementsByName!=="undefined"){var U=[],X=Y.getElementsByName(V[1]);for(var W=0,T=X.length;W<T;W++){if(X[W].getAttribute("name")===V[1]){U.push(X[W])}}return U.length===0?null:U}},TAG:function(T,U){return U.getElementsByTagName(T[1])}},preFilter:{CLASS:function(W,U,V,T,Z,aa){W=" "+W[1].replace(/\\/g,"")+" ";if(aa){return W}for(var X=0,Y;(Y=U[X])!=null;X++){if(Y){if(Z^(Y.className&&(" "+Y.className+" ").indexOf(W)>=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\/g,"")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]=="nth"){var U=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2]=="even"&&"2n"||T[2]=="odd"&&"2n+1"||!/\D/.test(T[2])&&"0n+"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\/g,"");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]==="~="){X[4]=" "+X[4]+" "}return X},PSEUDO:function(X,U,V,T,Y){if(X[1]==="not"){if(X[3].match(R).length>1||/^\w/.test(X[3])){X[3]=F(X[3],null,null,U)}else{var W=F.filter(X[3],U,V,true^Y);if(!V){T.push.apply(T,W)}return false}}else{if(I.match.POS.test(X[0])||I.match.CHILD.test(X[0])){return true}}return X},POS:function(T){T.unshift(true);return T}},filters:{enabled:function(T){return T.disabled===false&&T.type!=="hidden"},disabled:function(T){return T.disabled===true},checked:function(T){return T.checked===true},selected:function(T){T.parentNode.selectedIndex;return T.selected===true},parent:function(T){return !!T.firstChild},empty:function(T){return !T.firstChild},has:function(V,U,T){return !!F(T[3],V).length},header:function(T){return/h\d/i.test(T.nodeName)},text:function(T){return"text"===T.type},radio:function(T){return"radio"===T.type},checkbox:function(T){return"checkbox"===T.type},file:function(T){return"file"===T.type},password:function(T){return"password"===T.type},submit:function(T){return"submit"===T.type},image:function(T){return"image"===T.type},reset:function(T){return"reset"===T.type},button:function(T){return"button"===T.type||T.nodeName.toUpperCase()==="BUTTON"},input:function(T){return/input|select|textarea|button/i.test(T.nodeName)}},setFilters:{first:function(U,T){return T===0},last:function(V,U,T,W){return U===W.length-1},even:function(U,T){return T%2===0},odd:function(U,T){return T%2===1},lt:function(V,U,T){return U<T[3]-0},gt:function(V,U,T){return U>T[3]-0},nth:function(V,U,T){return T[3]-0==U},eq:function(V,U,T){return T[3]-0==U}},filter:{PSEUDO:function(Z,V,W,aa){var U=V[1],X=I.filters[U];if(X){return X(Z,W,V,aa)}else{if(U==="contains"){return(Z.textContent||Z.innerText||"").indexOf(V[3])>=0}else{if(U==="not"){var Y=V[3];for(var W=0,T=Y.length;W<T;W++){if(Y[W]===Z){return false}}return true}}}},CHILD:function(T,W){var Z=W[1],U=T;switch(Z){case"only":case"first":while(U=U.previousSibling){if(U.nodeType===1){return false}}if(Z=="first"){return true}U=T;case"last":while(U=U.nextSibling){if(U.nodeType===1){return false}}return true;case"nth":var V=W[2],ac=W[3];if(V==1&&ac==0){return true}var Y=W[0],ab=T.parentNode;if(ab&&(ab.sizcache!==Y||!T.nodeIndex)){var X=0;for(U=ab.firstChild;U;U=U.nextSibling){if(U.nodeType===1){U.nodeIndex=++X}}ab.sizcache=Y}var aa=T.nodeIndex-ac;if(V==0){return aa==0}else{return(aa%V==0&&aa/V>=0)}}},ID:function(U,T){return U.nodeType===1&&U.getAttribute("id")===T},TAG:function(U,T){return(T==="*"&&U.nodeType===1)||U.nodeName===T},CLASS:function(U,T){return(" "+(U.className||U.getAttribute("class"))+" ").indexOf(T)>-1},ATTR:function(Y,W){var V=W[1],T=I.attrHandle[V]?I.attrHandle[V](Y):Y[V]!=null?Y[V]:Y.getAttribute(V),Z=T+"",X=W[2],U=W[4];return T==null?X==="!=":X==="="?Z===U:X==="*="?Z.indexOf(U)>=0:X==="~="?(" "+Z+" ").indexOf(U)>=0:!U?Z&&T!==false:X==="!="?Z!=U:X==="^="?Z.indexOf(U)===0:X==="$="?Z.substr(Z.length-U.length)===U:X==="|="?Z===U||Z.substr(0,U.length+1)===U+"-":false},POS:function(X,U,V,Y){var T=U[2],W=I.setFilters[T];if(W){return W(X,V,U,Y)}}}};var M=I.match.POS;for(var O in I.match){I.match[O]=RegExp(I.match[O].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(U,T){U=Array.prototype.slice.call(U);if(T){T.push.apply(T,U);return T}return U};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(N){E=function(X,W){var U=W||[];if(H.call(X)==="[object Array]"){Array.prototype.push.apply(U,X)}else{if(typeof X.length==="number"){for(var V=0,T=X.length;V<T;V++){U.push(X[V])}}else{for(var V=0;X[V];V++){U.push(X[V])}}}return U}}var G;if(document.documentElement.compareDocumentPosition){G=function(U,T){var V=U.compareDocumentPosition(T)&4?-1:U===T?0:1;if(V===0){hasDuplicate=true}return V}}else{if("sourceIndex" in document.documentElement){G=function(U,T){var V=U.sourceIndex-T.sourceIndex;if(V===0){hasDuplicate=true}return V}}else{if(document.createRange){G=function(W,U){var V=W.ownerDocument.createRange(),T=U.ownerDocument.createRange();V.selectNode(W);V.collapse(true);T.selectNode(U);T.collapse(true);var X=V.compareBoundaryPoints(Range.START_TO_END,T);if(X===0){hasDuplicate=true}return X}}}}(function(){var U=document.createElement("form"),V="script"+(new Date).getTime();U.innerHTML="<input name='"+V+"'/>";var T=document.documentElement;T.insertBefore(U,T.firstChild);if(!!document.getElementById(V)){I.find.ID=function(X,Y,Z){if(typeof Y.getElementById!=="undefined"&&!Z){var W=Y.getElementById(X[1]);return W?W.id===X[1]||typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id").nodeValue===X[1]?[W]:g:[]}};I.filter.ID=function(Y,W){var X=typeof Y.getAttributeNode!=="undefined"&&Y.getAttributeNode("id");return Y.nodeType===1&&X&&X.nodeValue===W}}T.removeChild(U)})();(function(){var T=document.createElement("div");T.appendChild(document.createComment(""));if(T.getElementsByTagName("*").length>0){I.find.TAG=function(U,Y){var X=Y.getElementsByTagName(U[1]);if(U[1]==="*"){var W=[];for(var V=0;X[V];V++){if(X[V].nodeType===1){W.push(X[V])}}X=W}return X}}T.innerHTML="<a href='#'></a>";if(T.firstChild&&typeof T.firstChild.getAttribute!=="undefined"&&T.firstChild.getAttribute("href")!=="#"){I.attrHandle.href=function(U){return U.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var T=F,U=document.createElement("div");U.innerHTML="<p class='TEST'></p>";if(U.querySelectorAll&&U.querySelectorAll(".TEST").length===0){return}F=function(Y,X,V,W){X=X||document;if(!W&&X.nodeType===9&&!Q(X)){try{return E(X.querySelectorAll(Y),V)}catch(Z){}}return T(Y,X,V,W)};F.find=T.find;F.filter=T.filter;F.selectors=T.selectors;F.matches=T.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var T=document.createElement("div");T.innerHTML="<div class='test e'></div><div class='test'></div>";if(T.getElementsByClassName("e").length===0){return}T.lastChild.className="e";if(T.getElementsByClassName("e").length===1){return}I.order.splice(1,0,"CLASS");I.find.CLASS=function(U,V,W){if(typeof V.getElementsByClassName!=="undefined"&&!W){return V.getElementsByClassName(U[1])}}})()}function P(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1&&!ac){T.sizcache=Y;T.sizset=W}if(T.nodeName===Z){X=T;break}T=T[U]}ad[W]=X}}}function S(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1){if(!ac){T.sizcache=Y;T.sizset=W}if(typeof Z!=="string"){if(T===Z){X=true;break}}else{if(F.filter(Z,[T]).length>0){X=T;break}}}T=T[U]}ad[W]=X}}}var K=document.compareDocumentPosition?function(U,T){return U.compareDocumentPosition(T)&16}:function(U,T){return U!==T&&(U.contains?U.contains(T):true)};var Q=function(T){return T.nodeType===9&&T.documentElement.nodeName!=="HTML"||!!T.ownerDocument&&Q(T.ownerDocument)};var J=function(T,aa){var W=[],X="",Y,V=aa.nodeType?[aa]:aa;while((Y=I.match.PSEUDO.exec(T))){X+=Y[0];T=T.replace(I.match.PSEUDO,"")}T=I.relative[T]?T+"*":T;for(var Z=0,U=V.length;Z<U;Z++){F(T,V[Z],W)}return F.filter(X,W)};o.find=F;o.filter=F.filter;o.expr=F.selectors;o.expr[":"]=o.expr.filters;F.selectors.filters.hidden=function(T){return T.offsetWidth===0||T.offsetHeight===0};F.selectors.filters.visible=function(T){return T.offsetWidth>0||T.offsetHeight>0};F.selectors.filters.animated=function(T){return o.grep(o.timers,function(U){return T===U.elem}).length};o.multiFilter=function(V,T,U){if(U){V=":not("+V+")"}return F.matches(V,T)};o.dir=function(V,U){var T=[],W=V[U];while(W&&W!=document){if(W.nodeType==1){T.push(W)}W=W[U]}return T};o.nth=function(X,T,V,W){T=T||1;var U=0;for(;X;X=X[V]){if(X.nodeType==1&&++U==T){break}}return X};o.sibling=function(V,U){var T=[];for(;V;V=V.nextSibling){if(V.nodeType==1&&V!=U){T.push(V)}}return T};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,"handle"),false)}else{if(K.detachEvent){K.detachEvent("on"+O,o.data(K,"handle"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,"handle");if(L){L.elem=null}o.removeData(K,"events");o.removeData(K,"handle")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I==="object"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf("!")>=0){I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,"a")&&G=="click")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);K.currentTarget=this;var L=K.type.split(".");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp("(^|\\.)"+L.slice().sort().join(".*\\.")+"(\\.|$)");E=(o.data(this,"events")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp("(^|\\.)"+G[0]+"(\\.|$)");o.each((o.data(this,"events").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F=="unload"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(F<E.length){o.event.proxy(G,E[F++])}return this.click(o.event.proxy(G,function(H){this.lastToggle=(this.lastToggle||0)%F;H.preventDefault();return E[this.lastToggle++].apply(this,arguments)||false}))},hover:function(E,F){return this.mouseenter(E).mouseleave(F)},ready:function(E){B();if(o.isReady){E.call(document,o)}else{o.readyList.push(E)}return this},live:function(G,F){var E=o.event.proxy(F);E.guid+=this.selector+G;o(document).bind(i(G,this.selector),this.selector,E);return this},die:function(F,E){o(document).unbind(i(F,this.selector),E?{guid:E.guid+this.selector+F}:null);return this}});function c(H){var E=RegExp("(^|\\.)"+H.type+"(\\.|$)"),G=true,F=[];o.each(o.data(this,"events").live||[],function(I,J){if(E.test(J.type)){var K=o(H.target).closest(J.data)[0];if(K){F.push({elem:K,fn:J})}}});F.sort(function(J,I){return o.data(J.elem,"closest")-o.data(I.elem,"closest")});o.each(F,function(){if(this.fn.call(this.elem,H,this.fn.data)===false){return(G=false)}});return G}function i(F,E){return["live",F,E.replace(/\./g,"`").replace(/ /g,"|")].join(".")}o.extend({isReady:false,readyList:[],ready:function(){if(!o.isReady){o.isReady=true;if(o.readyList){o.each(o.readyList,function(){this.call(document,o)});o.readyList=null}o(document).triggerHandler("ready")}}});var x=false;function B(){if(x){return}x=true;if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){document.removeEventListener("DOMContentLoaded",arguments.callee,false);o.ready()},false)}else{if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);o.ready()}});if(document.documentElement.doScroll&&l==l.top){(function(){if(o.isReady){return}try{document.documentElement.doScroll("left")}catch(E){setTimeout(arguments.callee,0);return}o.ready()})()}}}o.event.add(l,"load",o.ready)}o.each(("blur,focus,load,resize,scroll,unload,click,dblclick,mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave,change,select,submit,keydown,keypress,keyup,error").split(","),function(F,E){o.fn[E]=function(G){return G?this.bind(E,G):this.trigger(E)}});o(l).bind("unload",function(){for(var E in o.cache){if(E!=1&&o.cache[E].handle){o.event.remove(o.cache[E].handle.elem)}}});(function(){o.support={};var F=document.documentElement,G=document.createElement("script"),K=document.createElement("div"),J="script"+(new Date).getTime();K.style.display="none";K.innerHTML='   <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>';var H=K.getElementsByTagName("*"),E=K.getElementsByTagName("a")[0];if(!H||!H.length||!E){return}o.support={leadingWhitespace:K.firstChild.nodeType==3,tbody:!K.getElementsByTagName("tbody").length,objectAll:!!K.getElementsByTagName("object")[0].getElementsByTagName("*").length,htmlSerialize:!!K.getElementsByTagName("link").length,style:/red/.test(E.getAttribute("style")),hrefNormalized:E.getAttribute("href")==="/a",opacity:E.style.opacity==="0.5",cssFloat:!!E.style.cssFloat,scriptEval:false,noCloneEvent:true,boxModel:null};G.type="text/javascript";try{G.appendChild(document.createTextNode("window."+J+"=1;"))}catch(I){}F.insertBefore(G,F.firstChild);if(l[J]){o.support.scriptEval=true;delete l[J]}F.removeChild(G);if(K.attachEvent&&K.fireEvent){K.attachEvent("onclick",function(){o.support.noCloneEvent=false;K.detachEvent("onclick",arguments.callee)});K.cloneNode(true).fireEvent("onclick")}o(function(){var L=document.createElement("div");L.style.width=L.style.paddingLeft="1px";document.body.appendChild(L);o.boxModel=o.support.boxModel=L.offsetWidth===2;document.body.removeChild(L).style.display="none"})})();var w=o.support.cssFloat?"cssFloat":"styleFloat";o.props={"for":"htmlFor","class":"className","float":w,cssFloat:w,styleFloat:w,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",tabindex:"tabIndex"};o.fn.extend({_load:o.fn.load,load:function(G,J,K){if(typeof G!=="string"){return this._load(G)}var I=G.indexOf(" ");if(I>=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("<div/>").append(M.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(E):M.responseText)}if(K){F.each(K,[M.responseText,L,M])}}});return this},serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?o.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(E,F){var G=o(this).val();return G==null?null:o.isArray(G)?o.map(G,function(I,H){return{name:F.name,value:I}}):{name:F.name,value:G}}).get()}});o.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(E,F){o.fn[F]=function(G){return this.bind(F,G)}});var r=e();o.extend({get:function(E,G,H,F){if(o.isFunction(G)){H=G;G=null}return o.ajax({type:"GET",url:E,data:G,success:H,dataType:F})},getScript:function(E,F){return o.get(E,null,F,"script")},getJSON:function(E,F,G){return o.get(E,F,G,"json")},post:function(E,G,H,F){if(o.isFunction(G)){H=G;G={}}return o.ajax({type:"POST",url:E,data:G,success:H,dataType:F})},ajaxSetup:function(E){o.extend(o.ajaxSettings,E)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return l.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(M){M=o.extend(true,M,o.extend(true,{},o.ajaxSettings,M));var W,F=/=\?(&|$)/g,R,V,G=M.type.toUpperCase();if(M.data&&M.processData&&typeof M.data!=="string"){M.data=o.param(M.data)}if(M.dataType=="jsonp"){if(G=="GET"){if(!M.url.match(F)){M.url+=(M.url.match(/\?/)?"&":"?")+(M.jsonp||"callback")+"=?"}}else{if(!M.data||!M.data.match(F)){M.data=(M.data?M.data+"&":"")+(M.jsonp||"callback")+"=?"}}M.dataType="json"}if(M.dataType=="json"&&(M.data&&M.data.match(F)||M.url.match(F))){W="jsonp"+r++;if(M.data){M.data=(M.data+"").replace(F,"="+W+"$1")}M.url=M.url.replace(F,"="+W+"$1");M.dataType="script";l[W]=function(X){V=X;I();L();l[W]=g;try{delete l[W]}catch(Y){}if(H){H.removeChild(T)}}}if(M.dataType=="script"&&M.cache==null){M.cache=false}if(M.cache===false&&G=="GET"){var E=e();var U=M.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+E+"$2");M.url=U+((U==M.url)?(M.url.match(/\?/)?"&":"?")+"_="+E:"")}if(M.data&&G=="GET"){M.url+=(M.url.match(/\?/)?"&":"?")+M.data;M.data=null}if(M.global&&!o.active++){o.event.trigger("ajaxStart")}var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(M.url);if(M.dataType=="script"&&G=="GET"&&Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)){var H=document.getElementsByTagName("head")[0];var T=document.createElement("script");T.src=M.url;if(M.scriptCharset){T.charset=M.scriptCharset}if(!W){var O=false;T.onload=T.onreadystatechange=function(){if(!O&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){O=true;I();L();T.onload=T.onreadystatechange=null;H.removeChild(T)}}}H.appendChild(T);return g}var K=false;var J=M.xhr();if(M.username){J.open(G,M.url,M.async,M.username,M.password)}else{J.open(G,M.url,M.async)}try{if(M.data){J.setRequestHeader("Content-Type",M.contentType)}if(M.ifModified){J.setRequestHeader("If-Modified-Since",o.lastModified[M.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}J.setRequestHeader("X-Requested-With","XMLHttpRequest");J.setRequestHeader("Accept",M.dataType&&M.accepts[M.dataType]?M.accepts[M.dataType]+", */*":M.accepts._default)}catch(S){}if(M.beforeSend&&M.beforeSend(J,M)===false){if(M.global&&!--o.active){o.event.trigger("ajaxStop")}J.abort();return false}if(M.global){o.event.trigger("ajaxSend",[J,M])}var N=function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}}else{if(!K&&J&&(J.readyState==4||X=="timeout")){K=true;if(P){clearInterval(P);P=null}R=X=="timeout"?"timeout":!o.httpSuccess(J)?"error":M.ifModified&&o.httpNotModified(J,M.url)?"notmodified":"success";if(R=="success"){try{V=o.httpData(J,M.dataType,M)}catch(Z){R="parsererror"}}if(R=="success"){var Y;try{Y=J.getResponseHeader("Last-Modified")}catch(Z){}if(M.ifModified&&Y){o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if(X){J.abort()}if(M.async){J=null}}}};if(M.async){var P=setInterval(N,13);if(M.timeout>0){setTimeout(function(){if(J&&!K){N("timeout")}},M.timeout)}}try{J.send(M.data)}catch(S){o.handleError(M,J,null,S)}if(!M.async){N()}function I(){if(M.success){M.success(V,R)}if(M.global){o.event.trigger("ajaxSuccess",[J,M])}}function L(){if(M.complete){M.complete(J,R)}if(M.global){o.event.trigger("ajaxComplete",[J,M])}if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}return J},handleError:function(F,H,E,G){if(F.error){F.error(H,E,G)}if(F.global){o.event.trigger("ajaxError",[H,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol=="file:"||(F.status>=200&&F.status<300)||F.status==304||F.status==1223}catch(E){}return false},httpNotModified:function(G,E){try{var H=G.getResponseHeader("Last-Modified");return G.status==304||H==o.lastModified[E]}catch(F){}return false},httpData:function(J,H,G){var F=J.getResponseHeader("content-type"),E=H=="xml"||!H&&F&&F.indexOf("xml")>=0,I=E?J.responseXML:J.responseText;if(E&&I.documentElement.tagName=="parsererror"){throw"parsererror"}if(G&&G.dataFilter){I=G.dataFilter(I,H)}if(typeof I==="string"){if(H=="script"){o.globalEval(I)}if(H=="json"){I=l["eval"]("("+I+")")}}return I},param:function(E){var G=[];function H(I,J){G[G.length]=encodeURIComponent(I)+"="+encodeURIComponent(J)}if(o.isArray(E)||E.jquery){o.each(E,function(){H(this.name,this.value)})}else{for(var F in E){if(o.isArray(E[F])){o.each(E[F],function(){H(F,this)})}else{H(F,o.isFunction(E[F])?E[F]():E[F])}}}return G.join("&").replace(/%20/g,"+")}});var m={},n,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function t(F,E){var G={};o.each(d.concat.apply([],d.slice(0,E)),function(){G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t("show",3),J,L)}else{for(var H=0,F=this.length;H<F;H++){var E=o.data(this[H],"olddisplay");this[H].style.display=E||"";if(o.css(this[H],"display")==="none"){var G=this[H].tagName,K;if(m[G]){K=m[G]}else{var I=o("<"+G+" />").appendTo("body");K=I.css("display");if(K==="none"){K="block"}I.remove();m[G]=K}o.data(this[H],"olddisplay",K)}}for(var H=0,F=this.length;H<F;H++){this[H].style.display=o.data(this[H],"olddisplay")||""}return this}},hide:function(H,I){if(H){return this.animate(t("hide",3),H,I)}else{for(var G=0,F=this.length;G<F;G++){var E=o.data(this[G],"olddisplay");if(!E&&E!=="none"){o.data(this[G],"olddisplay",o.css(this[G],"display"))}}for(var G=0,F=this.length;G<F;G++){this[G].style.display="none"}return this}},_toggle:o.fn.toggle,toggle:function(G,F){var E=typeof G==="boolean";return o.isFunction(G)&&o.isFunction(F)?this._toggle.apply(this,arguments):G==null||E?this.each(function(){var H=E?G:o(this).is(":hidden");o(this)[H?"show":"hide"]()}):this.animate(t("toggle",3),G,F)},fadeTo:function(E,G,F){return this.animate({opacity:G},E,F)},animate:function(I,F,H,G){var E=o.speed(F,H,G);return this[E.queue===false?"each":"queue"](function(){var K=o.extend({},E),M,L=this.nodeType==1&&o(this).is(":hidden"),J=this;for(M in I){if(I[M]=="hide"&&L||I[M]=="show"&&!L){return K.complete.call(this)}if((M=="height"||M=="width")&&this.style){K.display=o.css(this,"display");K.overflow=this.style.overflow}}if(K.overflow!=null){this.style.overflow="hidden"}K.curAnim=o.extend({},I);o.each(I,function(O,S){var R=new o.fx(J,K,O);if(/toggle|show|hide/.test(S)){R[S=="toggle"?L?"show":"hide":S](I)}else{var Q=S.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),T=R.cur(true)||0;if(Q){var N=parseFloat(Q[2]),P=Q[3]||"px";if(P!="px"){J.style[O]=(N||1)+P;T=((N||1)/R.cur(true))*T;J.style[O]=T+P}if(Q[1]){N=((Q[1]=="-="?-1:1)*N)+T}R.custom(T,N,P)}else{R.custom(T,S,"")}}});return true})},stop:function(F,E){var G=o.timers;if(F){this.queue([])}this.each(function(){for(var H=G.length-1;H>=0;H--){if(G[H].elem==this){if(E){G[H](true)}G.splice(H,1)}}});if(!E){this.dequeue()}return this}});o.each({slideDown:t("show",1),slideUp:t("hide",1),slideToggle:t("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(E,F){o.fn[E]=function(G,H){return this.animate(F,G,H)}});o.extend({speed:function(G,H,F){var E=typeof G==="object"?G:{complete:F||!F&&H||o.isFunction(G)&&G,duration:G,easing:F&&H||H&&!o.isFunction(H)&&H};E.duration=o.fx.off?0:typeof E.duration==="number"?E.duration:o.fx.speeds[E.duration]||o.fx.speeds._default;E.old=E.complete;E.complete=function(){if(E.queue!==false){o(this).dequeue()}if(o.isFunction(E.old)){E.old.call(this)}};return E},easing:{linear:function(G,H,E,F){return E+F*G},swing:function(G,H,E,F){return((-Math.cos(G*Math.PI)/2)+0.5)*F+E}},timers:[],fx:function(F,E,G){this.options=E;this.elem=F;this.prop=G;if(!E.orig){E.orig={}}}});o.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(o.fx.step[this.prop]||o.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(F){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var E=parseFloat(o.css(this.elem,this.prop,F));return E&&E>-10000?E:parseFloat(o.curCSS(this.elem,this.prop))||0},custom:function(I,H,G){this.startTime=e();this.start=I;this.end=H;this.unit=G||this.unit||"px";this.now=this.start;this.pos=this.state=0;var E=this;function F(J){return E.step(J)}F.elem=this.elem;if(F()&&o.timers.push(F)&&!n){n=setInterval(function(){var K=o.timers;for(var J=0;J<K.length;J++){if(!K[J]()){K.splice(J--,1)}}if(!K.length){clearInterval(n);n=g}},13)}},show:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.show=true;this.custom(this.prop=="width"||this.prop=="height"?1:0,this.cur());o(this.elem).show()},hide:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(H){var G=e();if(H||G>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var E=true;for(var F in this.options.curAnim){if(this.options.curAnim[F]!==true){E=false}}if(E){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(o.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){o(this.elem).hide()}if(this.options.hide||this.options.show){for(var I in this.options.curAnim){o.attr(this.elem.style,I,this.options.orig[I])}}this.options.complete.call(this.elem)}return false}else{var J=G-this.startTime;this.state=J/this.options.duration;this.pos=o.easing[this.options.easing||(o.easing.swing?"swing":"linear")](this.state,J,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};o.extend(o.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(E){o.attr(E.elem.style,"opacity",E.now)},_default:function(E){if(E.elem.style&&E.elem.style[E.prop]!=null){E.elem.style[E.prop]=E.now+E.unit}else{E.elem[E.prop]=E.now}}}});if(document.documentElement.getBoundingClientRect){o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}var G=this[0].getBoundingClientRect(),J=this[0].ownerDocument,F=J.body,E=J.documentElement,L=E.clientTop||F.clientTop||0,K=E.clientLeft||F.clientLeft||0,I=G.top+(self.pageYOffset||o.boxModel&&E.scrollTop||F.scrollTop)-L,H=G.left+(self.pageXOffset||o.boxModel&&E.scrollLeft||F.scrollLeft)-K;return{top:I,left:H}}}else{o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}o.offset.initialized||o.offset.initialize();var J=this[0],G=J.offsetParent,F=J,O=J.ownerDocument,M,H=O.documentElement,K=O.body,L=O.defaultView,E=L.getComputedStyle(J,null),N=J.offsetTop,I=J.offsetLeft;while((J=J.parentNode)&&J!==K&&J!==H){M=L.getComputedStyle(J,null);N-=J.scrollTop,I-=J.scrollLeft;if(J===G){N+=J.offsetTop,I+=J.offsetLeft;if(o.offset.doesNotAddBorder&&!(o.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(J.tagName))){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}F=G,G=J.offsetParent}if(o.offset.subtractsBorderForOverflowNotVisible&&M.overflow!=="visible"){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}E=M}if(E.position==="relative"||E.position==="static"){N+=K.offsetTop,I+=K.offsetLeft}if(E.position==="fixed"){N+=Math.max(H.scrollTop,K.scrollTop),I+=Math.max(H.scrollLeft,K.scrollLeft)}return{top:N,left:I}}}o.offset={initialize:function(){if(this.initialized){return}var L=document.body,F=document.createElement("div"),H,G,N,I,M,E,J=L.style.marginTop,K='<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>';M={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(E in M){F.style[E]=M[E]}F.innerHTML=K;L.insertBefore(F,L.firstChild);H=F.firstChild,G=H.firstChild,I=H.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(G.offsetTop!==5);this.doesAddBorderForTableAndCells=(I.offsetTop===5);H.style.overflow="hidden",H.style.position="relative";this.subtractsBorderForOverflowNotVisible=(G.offsetTop===-5);L.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(L.offsetTop===0);L.style.marginTop=J;L.removeChild(F);this.initialized=true},bodyOffset:function(E){o.offset.initialized||o.offset.initialize();var G=E.offsetTop,F=E.offsetLeft;if(o.offset.doesNotIncludeMarginInBodyOffset){G+=parseInt(o.curCSS(E,"marginTop",true),10)||0,F+=parseInt(o.curCSS(E,"marginLeft",true),10)||0}return{top:G,left:F}}};o.fn.extend({position:function(){var I=0,H=0,F;if(this[0]){var G=this.offsetParent(),J=this.offset(),E=/^body|html$/i.test(G[0].tagName)?{top:0,left:0}:G.offset();J.top-=j(this,"marginTop");J.left-=j(this,"marginLeft");E.top+=j(G,"borderTopWidth");E.left+=j(G,"borderLeftWidth");F={top:J.top-E.top,left:J.left-E.left}}return F},offsetParent:function(){var E=this[0].offsetParent||document.body;while(E&&(!/^body|html$/i.test(E.tagName)&&o.css(E,"position")=="static")){E=E.offsetParent}return o(E)}});o.each(["Left","Top"],function(F,E){var G="scroll"+E;o.fn[G]=function(H){if(!this[0]){return null}return H!==g?this.each(function(){this==l||this==document?l.scrollTo(!F?H:o(l).scrollLeft(),F?H:o(l).scrollTop()):this[G]=H}):this[0]==l||this[0]==document?self[F?"pageYOffset":"pageXOffset"]||o.boxModel&&document.documentElement[G]||document.body[G]:this[0][G]}});o.each(["Height","Width"],function(I,G){var E=I?"Left":"Top",H=I?"Right":"Bottom",F=G.toLowerCase();o.fn["inner"+G]=function(){return this[0]?o.css(this[0],F,false,"padding"):null};o.fn["outer"+G]=function(K){return this[0]?o.css(this[0],F,false,K?"margin":"border"):null};var J=G.toLowerCase();o.fn[J]=function(K){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+G]||document.body["client"+G]:this[0]==document?Math.max(document.documentElement["client"+G],document.body["scroll"+G],document.documentElement["scroll"+G],document.body["offset"+G],document.documentElement["offset"+G]):K===g?(this.length?o.css(this[0],J):null):this.css(J,typeof K==="string"?K:K+"px")}})})();
/**
 * cqEditAny allows the use of a javascript function to open any dialog to edit any content from any page
 * 
 * @requires jQuery 1.2.6 or higher
 * @param {string} pathAndDialogAndType provides the path to the content, the dialog to use and the resource type of the component in a comma delimited string
 * @param {boolean} newItem use true to insert a new item, false to edit the existing content
 * 
 * example: cqEditAny("/content/geometrixx/fr/jcr:content/header,/apps/geometrixx/components/header/dialog,geometrixx/components/header",false);
 */
function cqEditAny(pathAndDialogAndType,newItem) {
	var hasCQEditables = false;
	try { if (CQ.WCM.getEditables) { hasCQEditables = true; } } catch (e) {}
	
	if (hasCQEditables && typeof(jQuery) != "undefined") {
		// get the parameters needed for using the dialog
		var splits = pathAndDialogAndType.split(",");
		
		// create new element to put the dialog into, removing old one(s)
		jQuery(".GenericEditTarget").remove();
		var element = new CQ.Ext.Element(jQuery("body").append("<div class='GenericEditTarget' style='display:none'></div>").get(0));
		
		// clone an existing editable
		var editable = CQ.WCM.genericEditable = CQ.WCM.genericEditable || {};
		var editables = CQ.WCM.getContentWindow().CQ.WCM.getEditables();
		for (var i in editables) {
			foundEdit = true;
			break;
		}
		if (foundEdit) {
			for (var i in editables) {
				foundEdit = true;
			    jQuery.extend(editable,editables[i]);
			    break;
			}
			
			// customize the editable
			editable.path=splits[0];
			editable.dialog=splits[1];
			editable.params["./sling:resourceType"]=splits[2];
		
			// clear the old dialog out
		
			editable.dialogs[CQ.wcm.EditBase.EDIT]=undefined;

			// define the element the editable will appear "in"
			editable.element.dom=element;
			editable.element.linkedEditComponent=editable;

			// show the dialog
			CQ.wcm.EditBase.showDialog(editable,newItem ? CQ.wcm.EditBase.INSERT : CQ.wcm.EditBase.EDIT);
		} else {
			alert("Editing is not available on this page.")
		}
	} else {
		alert(pathAndDialogAndType);
	}
}

/**
 * Limit the number of paragraphs which can be present in a paragraph system 
 * 
 * @param parName the name/path for the paragraph system
 * @param max the maximum number of children to allow (including grandchildren)
 * @return
 */
function limitParCount(parName,max) {
    // retrieve all of the editable content items on the page
    var editables = CQ.WCM.getEditables();
    var parPath = "/jcr:content/"+parName+"/";
    var dropZone = parPath+"*";
    var ignore = parPath + "promo";

    // set the count of editables of the type parName (path,really)
    var count = 0;
   
    // a reference to be used for the full path of the par, including the page
    var p;

    // look through all the editables to check how many are at/below the parName path
    for (var path in editables) {
        // par in the path, but is not the parsys, nor the "new par" dropzone
        if (path.indexOf(parPath) != -1 && path.indexOf(dropZone) == -1 && path.indexOf(ignore) ==-1 ) {
           	// if the par is not a grandchild (has only one level of pathing below the parpath)
        	if (path.substring(path.indexOf(parPath)+parPath.length).split("/").length==1) {	
	            count++;
	            // if we've already met/exceeded the max, we want to disallow new pars
	            if (count >= max) {
	                // convert the par we found to the dropzone/new par reference
	                p = path.replace(new RegExp(parPath+".*","ig"),dropZone);
	                break;
	            }
        	}
        }
    }
    if (count >= max) {
        // tell the editable to hide
        editables[p].hide();
    }
}

/**
 * Set the three paths used by the custom content finder in the parent window if the page is called from within an iframe
 */
function setContentFinderPaths(options) {	
	if (window.parent) {
		window.parent.cfTabSpecificQuery = options.specific;
		window.parent.cfTabRelatedQuery = options.related;
		window.parent.cfTabCommonQuery = options.common;
	}	
}

/*
 * Queue Manager
 * 
 * Queue Manager provides a central timer for a webpage, allows for the prioritized queueing of javascript code execution, and allows objects to
 * implement queueability internally via the Queueable.prototype.queue method
 * 
 * @author Jonathan 'J5' Cook [jonathan.j5.cook@gmail.com]
 * @version 0.2
 */

(function(){

/**
 * Create an instance of the Queue Manager object (there should only be one instance per page)
 * 
 * @constructor
 * @param {number} levels the number of different priority levels the Queue will contain (sub-queues)
 * @param {number} interval the queue processor will execute at the given interval, in milliseconds
 * @param {boolean} advanced queued items should be executable at independent intervals (although execution will only happen at multiples of the manager's interval), repeatable, etc.
 */
jQuery.qmanager = function (levels,interval,advanced) {
	this.initialize(levels,interval,advanced);
};

/**
 * Create an instance of the Queuable object.  The Queueable object is only used as an abstract base class for other objects which directly implement queueing via the Queue object 
 *
 * @constructor
 */
jQuery.qmanageable = function () {};

/**
 * Prototype for the Queueable object, which defines the inheritable queue method
 *
 * @prototype
 */
jQuery.qmanageable.prototype = {
	/**
	 * Queues the given method for later execution.  If no method is supplied, the "load" method of the object is called
	 * The original method uses jQuery(document).ready to queue the code execution.
	 * When a Queue is added to the document, it will overload the method and take control of queueing Queuables
	 * 
	 * @param {string} the name of a method of the current object, defaults to "load" if none is specified
	 */
	queue: function(method) {
		var t = this;
		jQuery(document).ready(function() {
			t[method || "load"]();
		});
	}
};

/**
 * Queue Manager object prototype, which contains all methods for the Queue Manager
 *
 * @prototype
 */
jQuery.qmanager.prototype = {
	advanced: false,
	totalLength: 0,
	timerid: undefined,
	_uid: 0,
	/**
	 * Initialize the Queue Manager object, creating the queues, redefining the Queueable.prototype.queue method, etc.
	 * 
	 * @param {number} levels the number of subqueues to create, defaults to 3
	 * @param {number} interval the amount of time to wait (in milliseconds) between attempts to execute items in the queue, defaults to 1000 (one second)
	 * @param {boolean} advanced whether the queue will allow items which are executed repeatedly or at irregular intervals
	 */
	initialize: function(levels,interval,advanced) {
		var q = this;
		jQuery.qmanageable.prototype.queue = function(method,label) {
			var t = this;
			q.queue({
				func: function() {
				t[method || "load"]();
				}, label: label
			});
		};	
		
		this.queues = new Array(levels || 3);
		this.interval = interval || 1000;
		this.advanced = advanced || false;
		if (this.advanced) {
			this.params = new Array(levels || 3);
			this.undefinedLength = 0;
			this.cancelled = [];
		}
	},
	/**
	 * A unique label to identify the queued item if none was otherwise specified
	 * @returns {number} uid the unique identifier for this queued item
	 */
	_getUid: function() {
		return this._uid++;
	},
	/**
	 * Cancel the interval with the given label/uid
	 * 
	 * @param {number or string} the label or UID of the queued item
	 */
	cancel: function(label) {
		this.cancelled.push(label);
	},
	/**
	 * If the queued item has been cancelled, returns true
	 *
	 * @param {object} params the parameter portions of the queued item (i.e. interval, label, etc.)
	 * @returns {boolean} returns true if the queued item has been cancelled, else returns false
	 */
	_isCancelled: function(params) {
		if (jQuery.inArray(params.label,this.cancelled) != -1) {
			this.cancelled = jQuery.grep(this.cancelled, function(value) { return value==params.label ? false : true; });
			return true;
		} else {
			return false;
		}
	},
	/**
	 * Execute the given function on each member of the given array (or array-like object), asynchronously
	 * 
	 * Based on the chunk method by Nicholas C. Zakas
	 * http://www.nczonline.net/blog/2009/01/13/speed-up-your-javascript-part-1/
	 *
	 * @param {Object} options: an anonymous object containing all available chunking options:
			{array}		array: an array or array-like object to operate on (required)
			{function}	process: a function to call on each member of array (required)
			{Object}	context: an object context in which to execute the process function (required)
			{number}	interval: the interval (a number in milliseconds) at which to execute each "step", default is the interval of the Queue Manager
			{number}	level: the priority level (a number) for the execution of each step, default is the lowest priority
			{boolean}	immediate: whether or not to immediately execute the first "step", a boolean property
	 */
	chunk: function(options){
		var q = this;
		var options = jQuery.extend(true,{
			interval: q.interval,
			level: q.queues.length-1
		},options);
	    var items = options.array.concat();   //clone the array
	    this.queue({
			func: function(){
				var item = items.shift();
				q.process.call(options.context, item);
				if (items.length> 0){
	            	q.queue(jQuery.extend(true,options,{
						func: arguments.callee
					}));
				}
			},
			interval: options.immediate ? 0 : options.interval,
			level: options.level
		});
	},
	/**
	 * Queue the item for later execution
	 *
	 * @param {function or object} func either a function to direcly execute, or an object describing code to execute and parameters for that execution
	 * @param {number} level the priority level to assign to the item
	 * 
	 * When func is an object, the following properties are supported:
		{function}	func: the code to execute (required)
		{number}	level: the priority level, default is the lowest available priority level
		{string}	label: a unique label to identify the queued item, default is a "random" UID
		{number}	interval: the interval (in milliseconds) at which to execute the code, if possible, default is the Queue Manager's interval
		{boolean}	repeat: whether or not to repeat the code execution every interval, default is false
		{boolean}	process: whether or not to immediately begin queue processing (which may result in the code executing sooner), default is false
	 */
	queue: function(func,level) {
		var options;
		if (undefined!=level) {
			options = { func: func, level: level};
		} else {
			options = func;
		}
		this.totalLength++;
		var qlevel = options.level || this.queues.length-1;
		var qlevel = this.queues.length > qlevel ? qlevel : this.queues.length-1;
		
		if (this.queues[qlevel]==undefined) {
			this.queues[qlevel]=[];
			if (this.advanced) {
				this.params[qlevel]=[];
				this.params[qlevel].defined=0;
			}
		}
		
		var q = this.queues[qlevel];
		q.push(options.func);

		if (this.advanced) {
			var p = this.params[qlevel];
			p.push({
				"label": (options.label || this._getUid()),
				"internalTime": new Date().valueOf(),
				"interval": (options.interval || this.interval),
				"repeat": (options.repeat || false)
			});
			this.params[qlevel].defined++;
		}		
		if ((options.process || false)) { this.process(false); }
		return (options.label || true);
	},
	/**
	 * Return the next available function to be executed
	 * 
	 * @param {boolean} update whether or not to update the "internal"
	 * @returns {function or boolean} returns the function to execute if one exits, else returns false
	 */
	dequeue: function(update) {
		for (var qn = 0; qn < this.queues.length; qn++) {
			if (undefined != this.queues[qn] && this.queues[qn].length > 0) {
				// basic implementation allows no repeating code to be queued
				if (!this.advanced) {
					this.totalLength--;
					return this.queues[qn].shift();
				} else {
					// look for next executable method
					if (this.params[qn].defined == undefined || this.params[qn].defined > 0) {
						for (var f = 0; f < this.queues[qn].length; f++) {
							if (undefined != this.params[qn][f]) {
								with (this.params[qn][f]) {
									// has been cancelled?
									if (this._isCancelled(this.params[qn][f])) {
										this.queues[qn][f]=undefined;
										this.params[qn][f]=undefined;
										this.params[qn].defined--;
										this.undefinedLength++;										
									} else {
										// if the interval has passed since the internalTime was updated, pop and/or execute
										var currentTime = new Date().valueOf();
										if ((currentTime-internalTime) >= interval) {
											if (repeat) {
												internalTime = currentTime;
												return this.queues[qn][f];
											} else {
												var func = this.queues[qn][f];
												this.queues[qn][f]=undefined;
												this.params[qn][f]=undefined;
												this.params[qn].defined--;
												this.undefinedLength++;
												if (update) { internalTime = currentTime; }
												return func;
											}
										}
									}
								}
							}
						}
					} else {
						if (this.params[qn].length > this.params[qn].defined) {
							this.params[qn]=[];
							this.params[qn].defined=0;
						}
					}
				}
			}
		}
		return false;
	},
	/**
	 * Based on the callLazy function by Matt Snider
	 * http://mattsnider.com/architecture/architecture-function-calllazy/
	 * 
	 * when options.isReadyFunction evaluates to true, then execute options.func
	 * otherwise, wait options.interval and try again
     * 
	 * @param {object} options object
	 * 		{function}	func				the payload to execute
	 *		{function}	isReadyFunction		when this function returns true, func should execute
	 *		{number}	maxAttempts			the maximum number of attempts to make
	 *		{number}	attemptNumber		the current attempt number executing
	 *		{number}	interval			the interval at which to check isReadyFunction
	 */
	callLazy: function(options) {
		var max = (0 < options.maxAttempts) ? options.maxAttempts : 100,
			index = (0 < options.attemptNumber) ? options.attemptNumber : 0,
			interval = (0 < options.interval) ? options.interval : null;

		if (index > max) { return; } // this prevents these calls from running forever

		if (options.func) {
			if (options.isReadyFunction()) {
				options.func();
			}
			else {
				var t = this;
				t.queue({
					func: function() {
						t.callLazy({
							func: options.func,
							isReadyFunction: options.isReadyFunction,
							maxAttempts: max,
							attemptNumber: (index+1),
							interval: interval
						});
					},
					interval: interval,
					repeat: false,
					process: false
				});
			}
		}
	},
	/**
	 * Private function used with jQuery.grep method to filter out undefined items
	 * @param {any} value is the value of the array item to compare against undefined
	 * @returns {number} returns 0 if the value is undefined, 1 otherwise
	 */
	_filter: function(value,index) {
		return value==undefined ? 0 : 1;
	},
	/**
	 * Removes undefined elements from the sub-queues, when the number of undefined elements exceeds 1/2 of the total elements
	 */
	clean: function() {
		// clean only when the length of undefined items is 1/2 or more of the total length of items
		if (this.advanced && this.totalLength > 0 && this.undefinedLength >= (this.totalLength / 2)) {
			this.totalLength=0;
			for (var qn = 0; qn < this.queues.length; qn++) {
				if (undefined != this.queues[qn] && this.queues[qn].length > 0) {
					this.queues[qn] = jQuery.grep(this.queues[qn],this._filter);
					this.params[qn] = jQuery.grep(this.params[qn],this._filter);
					this.params[qn].defined = this.params[qn].length;
					this.totalLength += this.queues[qn].length;
				}
			}
			this.undefinedLength=0;
		}
	},
	/**
	 * Process the queues, executing code that has been queued and in the case of advanced Queue Managers, is ready to be executed
	 *
	 * @param {boolean} update when true, the internal time of queued items is updated
	 */
	process: function(update) {
		var qq = this;
		if (this.totalLength > 0) {
			if (undefined != this.timerid) {
				window.clearTimeout(this.timerid);
				this.timerid = undefined;
			}
			// dequeue the function, execute it, then immediately check for more queued stuff
			// that is ready to be executed
			var func = this.dequeue(update);
			// if nothing is ready to be executed, recheck next interval
			if (func) {
				func();
				this.timerid = setTimeout(function() { qq.process(false); },0);
				return true;
			}
		}
		// when everything in the queue is done executing,
		// go back to checking for work at the interval
		this.timerid = setTimeout(function() {
			qq.clean();
			qq.process(true);
		},this.interval);
	}
};
})();

//-- // #### URI ENFORCER ############################################################
var currentURI = window.location.href;
var isNissanSite = (location.hostname.indexOf('www.nissanusa.com') > -1 ||
location.hostname.indexOf('secure.nissanusa.com') > -1 ||
location.hostname.indexOf('stage.nissanusa.com') > -1) ? true: false;
var isStageEnv = (currentURI.search('stage.') > -1) ? true: false;

//  set paths for...                 Live site                       Staging environment
var securePath = (!isStageEnv) ? "https://secure.nissanusa.com": "https://www.stage.nissanusa.com";
var nonSecurePath = (currentURI.search('collage.') > -1) ? "http://collage.designory.com:92": ((currentURI.search('www.integ') > -1) ? "http://www.integ.nissanusa.nna": ((currentURI.search('www.qa2') > -1) ? "http://www.qa2.nissanusa.com": ((!isStageEnv) ? "http://www.nissanusa.com": "http://www.stage.nissanusa.com")));

//  non-secure URI         -->         -->         -->          secure URI
var secureURIs = [

// My Nissan - THESE ARE VALID
["http://www.nissanusa.com/apps/mynissan", "https://secure.nissanusa.com/apps/mynissan"],
["https://www.nissanusa.com/apps/mynissan", "https://secure.nissanusa.com/apps/mynissan"],
["http://secure.nissanusa.com/apps/mynissan", "https://secure.nissanusa.com/apps/mynissan"],
["http://www.stage.nissanusa.com/apps/mynissan", "https://www.stage.nissanusa.com/apps/mynissan"],

// PreApproval - THESE ARE VALID
["http://www.nissanusa.com/apps/preapprovedinput", "https://secure.nissanusa.com/apps/preapprovedinput"],
["https://www.nissanusa.com/apps/preapprovedinput", "https://secure.nissanusa.com/apps/preapprovedinput"],
["http://secure.nissanusa.com/apps/preapprovedinput", "https://secure.nissanusa.com/apps/preapprovedinput"],
["http://www.stage.nissanusa.com/apps/preapprovedinput", "https://www.stage.nissanusa.com/apps/preapprovedinput"],

// PreApproval - LDS
["http://www.nissanusa.com/apps/preapprovedconfirm", "https://secure.nissanusa.com/apps/preapprovedconfirm"],
["https://www.nissanusa.com/apps/preapprovedconfirm", "https://secure.nissanusa.com/apps/preapprovedconfirm"],
["http://secure.nissanusa.com/apps/preapprovedconfirm", "https://secure.nissanusa.com/apps/preapprovedconfirm"],
["http://www.stage.nissanusa.com/apps/preapprovedconfirm", "https://www.stage.nissanusa.com/apps/preapprovedconfirm"],
];
String.prototype.format = function() {
    var ar = arguments;
    return this.replace(/\{\d+\}/g,
    function(w) {
        return ar[ + w.replace(/[}{]/g, '')]
    });
}

var isSpanishPage = (/\bes(panol)?\b/.test(location.pathname) || /\blanguage=es\b/.test(location.search));
// latter half for search
var secureURIfound = false;
//    push user to secure URL
if (isNissanSite && currentURI.search('http://') > -1) {
    for (var i in secureURIs) {
        if (currentURI.search(secureURIs[i][0]) > -1) {
            secureURIfound = true;
            location.replace(currentURI.replace(secureURIs[i][0], secureURIs[i][1]));
        }
    }
    // no secure URI found, check & pull user from bad http://secure URI
    if (!secureURIfound && currentURI.search('http://secure.') > -1) {
        location.replace(currentURI.replace("http://secure.", "http://www."));
    }
}
//    pull user from secure URI
 else if (isNissanSite && currentURI.search('https://') > -1) {
    for (var i in secureURIs) {
        if (currentURI.search(secureURIs[i][1]) > -1) {
            secureURIfound = true;
        }
    }
    // no secure URI found, check & pull user from bad https://www URI
    if (!secureURIfound && currentURI.search('https://www.') > -1) {
        location.replace(currentURI.replace("https://www.", "http://www."));
    }
    // else pull user from standard secure URI to non secure URI
    else if (!secureURIfound) {
        location.replace(currentURI.replace(securePath, nonSecurePath));
    }
}
var allVehicles = ['altima', 'armada', 'frontier', 'maxima', 'murano', 'pathfinder', 'quest', 'sentra', 'ser', 'titan', 'versa', 'xterra', 'z'];
var allVehiclesPattern = new RegExp("\\b(" + allVehicles.join("|") + ")\\b", "i");
var isVehiclePage = allVehiclesPattern.test(location.pathname);
var thisVehicle = RegExp.$1;
// because of the line above, this is populated with '' or with the model name
if (typeof globalNavFv == 'undefined') var globalNavFv = {};
if (typeof footerNavFv == 'undefined') var footerNavFv = {};
if (typeof regionalNavFv == 'undefined') var regionalNavFv = {};

// #############################################################################
/* GLOBAL SCRIPTS */

// XML HTTP Request general use object
var xmlhttp = false;

if (!xmlhttp && typeof XMLHttpRequest != 'undefined')
 try {
    xmlhttp = new XMLHttpRequest();
} catch(e) {
    xmlhttp = false;
}
if (!xmlhttp && window.createRequest)
 try {
    xmlhttp = window.createRequest();
} catch(e) {
    xmlhttp = false;
}


// Function to safely register multiple functions with the onLoad browser event
function addLoadEvent(func) {
    var oldonload = window.onload;
    if (typeof window.onload != 'function') window.onload = func;
    else {
        window.onload = function() {
            oldonload();
            func();
        }
    }
}

// Shortcut getID function
function $(ee) {
    return document.getElementById(ee);
}

// Shortuct to innerHTML
// *** CHECK ***
function getHtml(elmId) {
    return $(elmId).innerHTML;
}

// *** CHECK ***
// Modifier for innerHTML
function setHtml(elmId, strContent) {
    $(elmId).innerHTML = strContent;
}

// This is Sean Schricker's implementation of SimplERSwap
// Modified to work with htc png fix everywhere spacer.gif is found
function setOverSrc(elem) {
    if (elem.src.indexOf('spacer.gif') > 0) {
        elem.overStatePreload = new Image();
        var imgSrc = jQuery(elem).css('filter').split("'")[1];
        elem.overStatePreload.src = imgSrc.replace(/(_on)*(\.\w+)$/, '_on$2');
    } else {
        elem.overStatePreload = new Image();
        elem.overStatePreload.src = elem.src.replace(/(_on)*(\.\w+)$/, '_on$2');
    }

    elem.onmouseover = function() {
        if (this.src.indexOf('spacer.gif') > 0) {
            var imgSrc = jQuery(this).css('filter').split("'")[1];
            this.src = imgSrc.replace(/(_on)*(\.\w+)$/, '_on$2');
        } else {
            this.src = this.src.replace(/(_on)*(\.\w+)$/, '_on$2');
        }
    };

    elem.onmouseout = function() {
        if (this.src.indexOf('spacer.gif') > 0) {
            var imgSrc = jQuery(this).css('filter').split("'")[1];
            this.src = imgSrc.replace(/(_on)+(\.\w+)$/, '$2');
        } else {
            this.src = this.src.replace(/(_on)+(\.\w+)$/, '$2');
        }
    };

    elem.onload = function() {};
}

// Open External links in new window
// Argument href is required, all others optional
// Usage: <a href="http://www.foo.bar" onclick="return popExt(this.href, 600, 400, 'myWin', 'resizeable=no,location=no')">
function popExt(href, width, height, name, params) {
    //console.log("popExt");
    var features = "";
    if (width) features += "width=" + width + ",left=" + Math.floor((screen.width - width) / 2);
    if (height) features += ",height=" + height + ",top=" + Math.floor((screen.height - height) / 2);
    if (params) features += "," + params;
    var winname = name ? name: "nissanusa_ext";
    window.open(href, winname, features);
    return false;
}

// using above for flash returns false for the page.
function popExtFL(href, width, height, name, params) {
    var features = "";
    if (width) features += "width=" + width + ",left=" + Math.floor((screen.width - width) / 2);
    if (height) features += ",height=" + height + ",top=" + Math.floor((screen.height - height) / 2);
    if (params) features += "," + params;
    var winname = name ? name: "nissanusa_ext";
    window.open(href, winname, features);
}

// widePage repositions bottom frame on apps
// called on page load
// should be called after rendering dynamic content
// *** CHECK ***
function widePage() {
    if (document.getElementById("frameContent")) {
        var h = document.getElementById("frameContent").clientHeight;
        var frameH = (h + 20);
        if (document.getElementById("frameBgTop")) {
            if (frameH > 539) {
                document.getElementById("frameBgBottom").style.height = (frameH - 539) + "px";
            } else {
                document.getElementById("frameBgBottom").style.display = "none";
            }
            document.getElementById("frameBgTop").style.height = frameH + "px";
        } else if (document.getElementById("frameBg") != null) {
            document.getElementById("frameBg").style.height = frameH + "px";
        }
    }

    setTimeout('setUpGlobalFooter()',1000);
}



// Return a value from the query string
function getQueryParam(paramName) {
    var qString = location.search.substring(1);
    if (qString.indexOf(paramName) == -1) return '';
    var pValueStart = qString.indexOf(paramName) + paramName.length + 1;
    var pValueEnd = qString.indexOf('&', pValueStart);
    if (pValueEnd == -1) pValueEnd = qString.length;
    return unescape(qString.substring(pValueStart, pValueEnd));
}

// Flash parameter detection and passing for MICROSITES
function checkSrcParam() {
    var src,
    html,
    qPos;

    src = getQueryParam('src');
    if (src == '') return;

    html = getHtml('ufoPFAMovie');
    if (html) {
        qPos = html.indexOf('?');
        if (qPos > -1)
        //existing querystring?
        html += '&';
        else
        html += '?';

        html = html + 'src=' + src;
        setHtml('ufoPFAMovie', html);
    }
}

// *** CHECK ***
function getCookie(name) {
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1) {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
    } else
    begin += 2;
    var end = document.cookie.indexOf(";", begin);
    if (end == -1)
    end = dc.length;
    return unescape(dc.substring(begin + prefix.length, end));
}

// Allows proper functionality of the Flash global nav
function swapIndexIn() {
    document.getElementById("movFlashGlobalNav_swf").style.height = "450px";
}

function swapIndexOut() {
    document.getElementById("movFlashGlobalNav_swf").style.height = "74px";
}

// If a VLP, allow Flash div layer to vary in height
function snapFlash(size) {
    if ((document.getElementById("movFlashCore"))) {
        // (!document.getElementById("movFlashGlobalNav")) &&
        document.getElementById("movFlashCore").style.height = size + "px";
        document.getElementById("movFlashCore_swf").style.height = size + "px";
        //document.getElementById("gFlashCore").style.height=size+"px";
        //document.getElementsByTagName('embed')[0].setAttribute('height',size);
    }
}

/**
 * Edited by Arjay
 * Use the path coming from flash instead of the shitty way
 */

function popWallpaper(wallpaperpath) {
    
    galleryWinObj = window.open('/html/wallpaper.html?wallpaper=' + wallpaperpath, "wallpaper", "width=800,height=720");

    galleryWinObj.focus();
}


// *** CHECK ***
function searchSite(myQuery) {
    if (window.console) console.log("searchsite");
    if (myQuery == 'null') {
        myQuery = 'nissan';
    }
    var languageCode = (isSpanishPage) ? 'es': 'en';
    var searchPageUrlTemplate = "http://search.nissanusa.com/search?q={0}&ie=UTF-8&language={1}&site=NissanUSA_{2}&output=xml_no_dtd&client=default_frontend_prod&proxystylesheet=default_frontend_prod&oe=UTF-8";
    location.href = searchPageUrlTemplate.format(escape(myQuery), languageCode, languageCode.toUpperCase());
}

//we only need this once, so it's going outside.
var swfoBaseURL = window.location.hostname;
var swfoBsplit = swfoBaseURL.split(".");

if (location.protocol == 'https:') {
    //if secure, then it'll only be one of these 2
    swfoBaseURL = (/stage/.test(location.host)) ? "www.stage.nissanusa.com": "secure.nissanusa.com";
} else if (swfoBsplit.length > 4 || swfoBsplit[0].toLowerCase() != "www") {
    var swfoNewbsplit = new Array();
    for (var bs = 0; bs < swfoBsplit.length; bs++) {
        if ((/(ww[w123]|dev|escher|qa|secure|stage|collage|nissanusa|prod|designory|com|nna|129|33|85|201|85|214)/i).test(swfoBsplit[bs])) {
            swfoNewbsplit.push(swfoBsplit[bs]);
        }
    }
    swfoBaseURL = swfoNewbsplit.join(".");
    if (swfoBaseURL.length == 0) {
        swfoBaseURL = "www.nissanusa.com";
    }
    if (! (/ww[w123]|collage|escher|prod|129/i).test(swfoBaseURL)) {
        swfoBaseURL = "www." + swfoBaseURL;
        //swfoBaseURL = window.location.protocol+"//"+swfoBaseURL;
    }
} else {
    swfoBaseURL = "";
}

//var swfoCoreURL = (swfoBaseURL : "") + "/flash/core.swf";
if (swfoBaseURL.length > 0) {
    swfoBaseURL = window.location.protocol + "//" + swfoBaseURL + ((location.port) ? (location.port == "8080" ? "": ":" + location.port) : "");
}

// moved to addHistory.js
//function updateHash(histId)
// #############################################################################
//                      content from dhtml_pop.js
// #############################################################################
var _currentDhtmlPop
var minX = 0,
maxX = 0
var minY = 0,
maxY = 0

function _snapWithinBounds(min, val1, val2, max) {
    if (isNaN(parseFloat(val2))) {
        val2 = val1
    }
    //val2 gives a second possible placement.
    if (((val1 >= max) & (val2 < val1)) || ((val1 <= min) & (val1 < val2))) {
        return Math.max(min, Math.min(val2, max))
    } else {
        return Math.max(min, Math.min(val1, max))
    }
}
function _snapX(val1, val2) {
    return _snapWithinBounds(minX, val1, val2, maxX)
}
function _snapY(val1, val2) {
    //if(_currentDhtmlPop.clientHeight > (maxY-minY)){
    //  //buggy, but may be worked with in the future to keep it onscreen.
    //  return _snapWithinBounds(minY,val1,null,minY)
    //}
    return _snapWithinBounds(minY, val1, val2, maxY)
}
function showDhtmlPop(obj, e, anchor, preferredPlacement, onopen, cleanupPop) {
    /// sample usage: showDhtmlPop('dhtmlPopID',event,this,3)
    /// second and third args MUST be event and this when called from an anchor
    /// There are 2 new extra args. References to functions to call on opening and after closing.
    // see the switch() below for the preferredPlacement options.
    if (typeof onopen == 'function') {
        onopen(anchor, obj)
    }

    hideDhtmlPop()

    obj = document.getElementById(obj)
    if (obj == null) return;
    obj.style.visibility = 'hidden'
    obj.style.display = 'inline'

    _currentDhtmlPop = obj

    var tempX = 0,
    originalX = 0;
    var tempY = 0,
    originalY = 0;
    var offset = 10;

    minX = (document.body.clientWidth - 964) / 2
    //For centered-content div pages.
    maxX = minX + 964 - obj.clientWidth

    minY = document.body.scrollTop
    maxY = document.body.clientHeight + document.body.scrollTop - (obj.clientHeight);

    tempX = originalX = (document.all) ? (event.clientX + document.body.scrollLeft - minX) : (e.pageX - minX);
    tempY = originalY = (document.all) ? (event.clientY + document.body.scrollTop) : (e.pageY);

    //height hack for IE7
    version = 0
    if (navigator.appVersion.indexOf("MSIE") != -1) {
        temp = navigator.appVersion.split("MSIE")
        version = parseFloat(temp[1])
    }
    if (version >= 6 && version > 0)
    //NON IE browser will return 0
    tempY += document.documentElement.scrollTop;

    switch (preferredPlacement.toLowerCase()) {
    case 'side':
        /// right/left, mainly right, centered vertically.
        tempX = _snapX(tempX + offset, tempX - obj.clientWidth - offset)
        tempY = _snapY(tempY - (obj.clientHeight / 2))
        break;

    case 'above':
        /// above.
        tempX = _snapX(tempX - (obj.clientWidth / 2) - offset)
        tempY = _snapY(tempY - (obj.clientHeight) - offset, tempY + offset)
        break;


    case 'below':
        /// below.
        tempX = _snapX(tempX - (obj.clientWidth / 2) + offset)
        tempY = _snapY(tempY + offset, tempY - (obj.clientHeight) - offset)
        break;

    case 'belowtallpage':
        /// belowTallPage.
        tempX = _snapX(tempX - (obj.clientWidth / 2) + offset)
        tempY = tempY + offset
        //_snapY(tempY+offset, tempY-(obj.clientHeight)-offset) //
        break;

    case 'anchorcenter':
        /// anchorCenter.
        tempX = _snapX(tempX - (obj.clientWidth / 2) + offset)
        tempY = tempY - (obj.clientHeight / 2) + offset

        // make sure the right of the popup is not off the main page
        if ((tempX + obj.clientWidth) > 964) {
            tempX = 964 - obj.clientWidth - 80;
        }

        // make sure the left of the popup positive
        if (tempX < 30) {
            tempX = 30;
        }

        break;

    case 'top':
        /// top.
        tempX = _snapX(tempX - (obj.clientWidth / 2) + offset) - 200
        tempY = 0

        //Detect IE
        version = 0
        if (navigator.appVersion.indexOf("MSIE") != -1) {
            temp = navigator.appVersion.split("MSIE")
            version = parseFloat(temp[1])
        }

        // IE
        if (version > 0) {
            // make sure popup is below the start of the visible client area
            if (tempY < document.body.scrollTop) {
                tempY = document.body.scrollTop + 30
            }

            // make sure the bottom of the popup is above the bottom of the visible client area
            if ((tempY + obj.clientHeight) > (document.body.scrollHeight - 200)) {
                tempY = document.body.scrollHeight - obj.clientHeight - 350
            }

            // Non-IE
        } else {
            // make sure popup is below the start of the visible client area
            if (tempY < window.scrollY) {
                tempY = window.scrollY + 30
            }

            // make sure the bottom of the popup is above the bottom of the visible client area
            if ((tempY + obj.clientHeight) > (window.scrollY + document.body.scrollHeight - 200)) {
                tempY = window.scrollY + document.body.scrollHeight - obj.clientHeight - 350
            }
        }

        // make sure the left of the popup positive
        if (tempX < 30) {
            tempX = 30;
        }

        // make sure the top of the popup is below the global header
        if (tempY < 50) {
            tempY = 50;
        }

        break;

    case 'anchorabove':
        /// anchorAbove.
        tempX = _snapX(tempX - (obj.clientWidth / 2) + offset)
        tempY = tempY - obj.clientHeight - offset - 400
        break;

    case 'salesevent':
        tempX = _snapX(tempX - (obj.clientWidth / 2) + offset)
        tempY = tempY - (obj.clientHeight / 2) + offset

        // make sure the right of the popup is not off the main page
        if ((tempX + obj.clientWidth) > 964) {
            tempX = 964 - obj.clientWidth - 80;
        }

        // make sure the left of the popup positive
        if (tempX < 30) {
            tempX = 30;
        }

        //Detect IE
        version = 0
        if (navigator.appVersion.indexOf("MSIE") != -1) {
            temp = navigator.appVersion.split("MSIE")
            version = parseFloat(temp[1])
        }

        // IE
        if (version > 0) {
            // make sure popup is below the start of the visible client area
            if (tempY < document.body.scrollTop) {
                tempY = document.body.scrollTop + 30
            }

            if (document.getElementById("tabSoaPageBgResize")) {
                // make sure the bottom of the popup is above the bottom of the visible client area
                if ((tempY + obj.clientHeight) > (document.getElementById("tabSoaPageBgResize").clientHeight)) {
                    tempY -= obj.clientHeight
                }
            } else {
                // make sure the bottom of the popup is above the bottom of the visible client area
                if ((tempY + obj.clientHeight) > (document.body.scrollHeight - 340)) {
                    tempY = document.body.scrollHeight - obj.clientHeight - 380
                }
            }

            // Non-IE
        } else {
            // make sure popup is below the start of the visible client area
            if (tempY < window.scrollY) {
                tempY = window.scrollY + 30
            }

            // make sure the bottom of the popup is above the bottom of the visible client are
            if (document.getElementById("tabSoaPageBgResize")) {
                if ((tempY + obj.clientHeight) > (document.getElementById("tabSoaPageBgResize").clientHeight)) {
                    tempY -= obj.clientHeight
                } else if ((tempY + obj.clientHeight) > (window.scrollY + document.body.scrollHeight - 340)) {
                    tempY = window.scrollY + document.body.scrollHeight - obj.clientHeight - 240
                }
            }
        }

        // make sure the top of the popup is below the global header
        if (tempY < 50)
        tempY = 50;

        break;

    default:
    }

    obj.style.top = (tempY) + 'px';
    obj.style.left = (tempX) + 'px';
    obj.style.visibility = 'visible'

    if (typeof cleanupPop == 'function') {
        cleanupPop()
    }
}
function _getElementNodes(popID) {
    var nodes = []
    var cn = $(popID).childNodes
    for (var i = 0; i < cn.length; i++) {
        if (cn[i].nodeType == 1) {
            nodes.push(cn[i])
        }
    }
    return nodes
}
function setDhtmlContentsTEMPLATE(popID) {
    ///begin prelim
    var nodes = _getElementNodes(popID)
    var header = nodes[1]
    var panel1 = nodes[2]
    var panel2 = nodes[3]
    ///end prelim
    ///begin your code ##########
    header.innerHTML = counterTest++

    return (popID)
}
function hideDhtmlPop(ref) {
    if (_currentDhtmlPop) {
        _currentDhtmlPop.style.display = 'none'
    }

    //if(ref){ref.style.display='none'}
    //$('mPopShadow').style.display='none'
}

function popup360(name, code, year, lang, type) {
    if (window.console) console.log("popup360");
    winObj = window.open('/popup360.html?' + 'name=' + name + '&code=' + code + '&year=' + year + '&lang=' + lang + '&type=' + type, "videoWindow", "width=640,height=500,resizable,top=30,left=30");
    winObj.focus();
}

//#############################################################################
//  content from load_background.js
//#############################################################################
var xmlhttp;
var ImageToLoad = '';

function loadBgImage(url)
 {
    xmlhttp = null;
    ImageToLoad = url;
    // code for Mozilla, etc.
    if (window.XMLHttpRequest)
    {
        xmlhttp = new XMLHttpRequest()
    }

    // code for IE
    else if (window.ActiveXObject)
    {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP")
    }
    if (xmlhttp != null)
    {
        xmlhttp.onreadystatechange = loadBgStateChange
        xmlhttp.open("GET", url, true)
        xmlhttp.send(null)
    }
    else
    {
        //alert("Your browser does not support XMLHTTP.")
        if (document.getElementById("tabSoaPageBg")) {
            document.getElementById("tabSoaPageBg").style.backgroundImage = "url('/img/bg/bg_gradient.jpg')";
        }
    }
}

function loadBgStateChange()
 {
    var newUrl = '';

    // if xmlhttp shows "loaded"
    if (xmlhttp.readyState == 4) {
        // if "OK"
        if (xmlhttp.status == 200) {
            if (document.getElementById("tabSoaPageBg")) {
                newUrl = "url('" + ImageToLoad + "')";
                document.getElementById("tabSoaPageBg").style.backgroundImage = newUrl;
            }
        } else {
            if (document.getElementById("tabSoaPageBg")) {
                document.getElementById("tabSoaPageBg").style.backgroundImage = "url('/img/bg/bg_gradient.jpg')";
            }
        }
    }
}


function convertToASCII(str) {
    if (window.console) console.log("convertToAscii");
    return str.replace(/(&#\d+;)/g,
    function(w) {
        return String.fromCharCode( + w.replace(/\D/g, ''))
    });
}

function testEnglishSpanishURL(str) {
    if (window.console) console.log("testEnglishSpanishURL");
    if (str.indexOf('/espanol/') > -1) {
        var myregexp = new RegExp("espanol/");
        str = str.replace(myregexp, '')
    } else if (str.indexOf('/configurator/es') > -1) {
        var myregexp = new RegExp("/configurator/es");
        str = str.replace(myregexp, '/configurator/en')
    } else if (str.indexOf('/configurator/en') > -1) {
        var myregexp = new RegExp("/configurator/en");
        str = str.replace(myregexp, '/configurator/es')
    } else {
        // find the position of the '/' that is AFTER '//'
        var startPos = str.indexOf('//') + 2;
        if (startPos < 0) startPos = 0;
        var insertPos = str.indexOf('/', startPos)
        // insert 'espanol' at that position
        var strBefore = str.substr(0, str.indexOf('/', insertPos) + 1);
        var strAfter = str.substr(insertPos);
        var str = strBefore + 'espanol' + strAfter;
    }
    return str;
}

var str = location.href;
if (str.indexOf('?dhash=') > -1) {
    var myregexp = new RegExp("\\?dhash=");
    str = str.replace(myregexp, '#')
    location.href = str;
}

// *** CHECK ***
function toggleEnglishSpanishURL() {
    if (window.console) console.log("toggleEnglishSpanishURL");
    // Test For Edmunds
    var externalSite = location.host;

    //var str = currentURI
    var str = location.href;
    if (str.indexOf('/espanol/') > -1) {
        var myregexp = new RegExp("espanol/");
        str = str.replace(myregexp, '')

        // Configurator App
    } else if (str.indexOf('/configurator/app') > -1) {
        var myregexp = new RegExp("/configurator/app");
        str = str.replace(myregexp, '/configurator/es')
    } else if (str.indexOf('/configurator/es') > -1) {
        var myregexp = new RegExp("/configurator/es");
        str = str.replace(myregexp, '/configurator/en')
    } else if (str.indexOf('/configurator/en') > -1) {
        var myregexp = new RegExp("/configurator/en");
        str = str.replace(myregexp, '/configurator/es')

        // REQUEST A QUOTE App
    } else if (str.indexOf('/requestquote/en') > -1) {
        var myregexp = new RegExp("/requestquote/en");
        str = str.replace(myregexp, '/requestquote/es')
    } else if (str.indexOf('/requestquote/es') > -1) {
        var myregexp = new RegExp("/requestquote/es");
        str = str.replace(myregexp, '/requestquote/en')

    } else if (str.indexOf('/apps/techpubs') > -1) {
        var myregexp = new RegExp("/apps/techpubs");
        str = str.replace(myregexp, '/apps/techpubs')

        // Apps
    } else if (str.indexOf('/apps/espanol') > -1) {
        var myregexp = new RegExp("/apps/espanol");
        str = str.replace(myregexp, '/apps')
    } else if (str.indexOf('/apps') > -1) {
        var myregexp = new RegExp("/apps");

        if ((! (externalSite.indexOf('nissanusa.com') > -1)) || (!(externalSite.indexOf('nissanusa.nna') > -1))) {
            str = 'http://www.nissanusa.com/espanol';
        } else {

            str = str.replace(myregexp, '/apps/espanol')
        }
        // Compare
    } else if (str.indexOf('/compare/en') > -1) {
        var myregexp = new RegExp("/compare/en");
        str = str.replace(myregexp, '/compare/es')
    } else if (str.indexOf('/compare/es') > -1) {
        var myregexp = new RegExp("/compare/es");
        str = str.replace(myregexp, '/compare/en')


    } else {
        // find the position of the '/' that is AFTER '//'
        var startPos = str.indexOf('//') + 2;
        if (startPos < 0) startPos = 0;
        var insertPos = str.indexOf('/', startPos)

        // insert 'espanol' at that position
        var strBefore = str.substr(0, str.indexOf('/', insertPos) + 1);
        var strAfter = str.substr(insertPos);
        var str = strBefore + 'espanol' + strAfter;
    }
    location.href = str;
}

function SOAAdjustHeight(addHeightIE) {
    // adds height to the frame for IE
    var addHeightIE = (addHeightIE == null) ? 0: addHeightIE;

    //Detect IE
    version = 0
    if (navigator.appVersion.indexOf("MSIE") != -1) {
        temp = navigator.appVersion.split("MSIE")
        version = parseFloat(temp[1])
    }

    // not IE
    if (version <= 0) {
        addHeightIE = 0;
    }

    // Call to adjust the heights of the tabSoaPageBgResize and tabSoaFrameBg to match the main page's variable frame height.
    var h = 0;
    var minPageHeight = 400;
    var frameH = 0;
    var pageH = 0;

    // we must have a tabSoaFrameContent element to proceed
    if (document.getElementById("tabSoaFrameContent")) {
        h = document.getElementById("tabSoaFrameContent").clientHeight + addHeightIE;
        frameH = (h + 20);

        // if we are using tabs, adjust the frame accordingly
        if (useTabs == 1)
        frameH -= 10;

        // expand frame height if necessary
        // if current frame height < new frame height
        if (document.getElementById("tabSoaFrameBg").clientHeight != frameH) {
            document.getElementById("tabSoaFrameBg").style.height = frameH + "px";
        }

        // expand page height if necessary
        if (document.getElementById("tabSoaFrameBg")) {
            pageH = (document.getElementById("tabSoaFrameBg").clientHeight + 50);

            //height hack for IE7
            version = 0
            if (useTabs == 1) {
                if (navigator.appVersion.indexOf("MSIE") != -1) {
                    temp = navigator.appVersion.split("MSIE")
                    version = parseFloat(temp[1])
                }
                if (version >= 7)
                //NON IE browser will return 0
                pageH -= 40;
            } else {
                pageH -= 50;
            }

            if (document.getElementById("tabSoaPageBgResize")) {
                // if the new page height is > min height AND current page height < new page height
                if ((pageH > minPageHeight) && (document.getElementById("tabSoaPageBgResize").clientHeight != pageH)) {
                    document.getElementById("tabSoaPageBgResize").style.height = pageH + "px";
                }
            }
        }
    }
};

/* call the adjustheight function after each image loads so the frame always is correct */
jQuery(function() {
    jQuery('#tabSoaFrameContent img').load(function() {
        soaHeightAdjust();
    });
});


useTabs = 0;

// reposition footer on SOA pages
function resetFooter() {
    if (jQuery("#tabSoaFrameContent").size() > 0) {
        var coHeight = jQuery("#tabSoaFrameContent").height();
        var coOffset = jQuery("#tabSoaFrameContent").offset();
        var ftHeight = jQuery(".globalfooter").height();
        var ftOffset = jQuery(".globalfooter").offset();
        var coTotal = coHeight + coOffset["top"];
        var ftTotal = ftHeight + ftOffset["top"];
        var newPos = (coTotal - ftTotal) + 10;
        //jQuery(".globalfooter").css("margin-top",newPos);
        jQuery(".globalfooter").css("position", "relative");
    }
}

jQuery(document).ready(function() {
    if (jQuery("#tabSoaFrameContent").size() > 0) {
        if (window.console) console.log(jQuery("#tabSoaFrameContent"));
        resetFooter();
    }
});

jQuery(document).ready(function() {
    jQuery(".imgSwap").hover(
    function()
    {
        var baseRef = this.src.substring(0, this.src.lastIndexOf("."));
        var extRef = this.src.substring(this.src.lastIndexOf("."));
        this.src = baseRef + "_on" + extRef;
    },
    function()
    {
        this.src = this.src.replace("_on", "");
    }
    );
});



jQuery(document).ready(function() {
    var i = 0;
     jQuery('h1.gSwap, h2.gSwap').each(function() { 
        var hn = jQuery(this);
      
        
        // only swap in swf if it hasn't been done yet.
        if (hn.find('object,embed').length == 0) {
            var tagName = this.tagName.toLowerCase();
            var copy = this.innerHTML;

            var forPrint = jQuery('<div class="gOnlyPrint">' + copy + '</div>');
            var forScreen = jQuery('<div class="gNoPrint"><div id="NisanH1EmbedFlash'+ i +'"></div></div>');
             
            hn.html('').append(forPrint, forScreen);
            var flashID = 'NisanH1EmbedFlash'+ i;
            var elemHeight = (tagName == 'h2') ? 16 : 22;
            swfobject.embedSWF("/content/dam/nissan/docroot/swf/h1.swf", flashID, "400", elemHeight, "9.0.0",null, {copy: copy, hn: tagName}, { wmode: "transparent"});
            
            i ++;
          
           
          
            
        }
    });
});

function resizeMe(hgt) {
    if (jQuery("#frameBg").size() > 0) {
        jQuery("#frameBg").height(hgt + 20);
        if (jQuery("#frameContent").height() + 50 > jQuery("#pageBg").height()) {
            //jQuery("#pageBg").height(jQuery("#pageBg").height()+20);
            }
    }
}

/*****************************************************
* Disclaimer popups (shared.js)
******************************************************/

var isDisclaimerStyled = false; 

var flashDisclaimersLoaded = [];
function flashDisclaimer(url){
    if(flashDisclaimersLoaded[url] != true){ 
        loadingUrl = url + " #discItem";
        idString = url.substring(url.search("/disclaimers/") + 12, url.indexOf(".html"));
        idString = idString.replace(/\//g, "-");
        jQuery("#ds").append("<div id=" + idString + "></div>");
        jQuery("#ds #" + idString).load(loadingUrl);
        flashDisclaimersLoaded[url] = true;
    }
    disclaimerPop(idString);
}

jQuery(document).ready(function() {
    var urlsLoaded = [];
    var loadingUrl = null;
    var idString = null;

    if (jQuery("a[target='Disclaimer'],a[target='Details'").size() > -1) {

        if (jQuery('#ds').length < 1) {
            jQuery("body").append("<div id='ds' style='display:none;'></div>");
        }

        jQuery.each(jQuery("a[target='Disclaimer'],a[target='Details']"), function() {
            if (this.target == "Details") {
                jQuery(this).css("border-bottom", "1px dashed #000000");
            }

            if (this.href.indexOf('.html') == -1) {
                this.href += '.html';
            }

            if ((location.pathname.indexOf('/cpo/') == -1) && (location.pathname.length > 1) && (location.pathname.indexOf('/buying/') == -1)) {
                jQuery(this).css("text-decoration", "none");
            }

            if (location.pathname.indexOf('/buying/') > 0) {
                jQuery(this).addClass('buyingDisclaimer');
            }

            loadingUrl = this.href.replace(/#/g, '') + " #discItem";

            if (urlsLoaded[loadingUrl] != true) {
                idString = this.href.substring(this.href.search("/disclaimers/") + 12, this.href.indexOf(".html"));
                idString = idString.replace(/\//g, "-");
                jQuery("#ds").append("<div id=" + idString + "></div>");
                jQuery("#ds #" + idString).load(loadingUrl);
                urlsLoaded[loadingUrl] = true;
            }
        });
        
        // Pulled out of the above each() loop and needs to be called with live(), 
        // otherwise the disclaimer for juke on /future-and-concept-vehicles/ will break
        jQuery("a[target='Disclaimer'],a[target='Details']").live("click", function(e) {
            if (this.target == "Details") {
                jQuery(this).removeClass("disc");
            } else {
                jQuery(this).removeClass("disc-details");
            }
            var theStr = this.href.substring(this.href.search("/disclaimers/") + 12, this.href.indexOf(".html"));
            return disclaimerPop(theStr.replace(/\//g, "-"), e.pageX, e.pageY, e.originalEvent);
        });
    }

    //ensure that only close button/x is clickable
    jQuery(".mainDisc").bind("dialogbeforeclose",
    function(event) {
        evtTgt = event.originalTarget || event.srcElement;
        if (evtTgt.className.toString().indexOf("ui-icon") > -1) {
            } else {
            return false;
        }
    });
});

function disclaimerPop(url, ex, ey, oe) {
    jQuery(".ui-dialog").each(function() {
        jQuery(this).remove();
    });

    var boldSelector = '#' + url + ' b';
    if (jQuery(boldSelector).length > 0 && jQuery(boldSelector).text().length > 0) {
        if (jQuery(boldSelector).next().is('br')) {
            jQuery(boldSelector).next().remove();
        }
        jQuery(boldSelector).remove();
    }     
    
    if (isIE8()&& location.pathname.indexOf('/future-and-concept-vehicles')< 0 )  {
        uiHgt = jQuery(".ui-dialog").height();
        uiWdh = jQuery(".ui-dialog").width();

        bonus = (jQuery("body").width() - jQuery(".gBody").width()) / 2;
        dist = ex - bonus;

        var newX;
        var newY;

        if (dist - 300 < 0) {
            newX = ex;
            newY = ey - 240;
        } else {
            newX = ex - 150;
            newY = ey;
        }

        jQuery("#" + url).dialog('destroy');

        if (location.pathname.indexOf('/buying/') > 0) {
            jQuery("#" + url).dialog({
                autoOpen: true,
                modal: false,
                closeText: "",
                stack: false,
                dialogClass: 'popDialog',
                position: [newX, newY],
                width: 510
            });
        } else if (location.pathname.length < 2) {
            jQuery("#" + url).dialog({
                autoOpen: true,
                modal: false,
                closeText: "",
                stack: false,
                dialogClass: 'popDialog',
                width: 456
            });
        } else if (location.pathname.indexOf('/chinese/') > 0) {
            jQuery("#" + url).dialog({
                autoOpen: true,
                modal: false,
                closeText: "",
                stack: false,
                dialogClass: 'popDialog',
                position: [ex - 150, ey],
                maxHeight: 250
            });
        } else {
            jQuery("#" + url).dialog({
                autoOpen: true,
                modal: false,
                closeText: "",
                stack: false,
                dialogClass: 'popDialog',
                position: [newX, newY],
                maxHeight: 250
            });
            jQuery('.ui-dialog .mainDisc').addClass('mainDiscHeightLimit');
        }

        if (location.pathname.length < 2) {
            jQuery('body').append("<div id='fade'></div>");
            jQuery('#fade').css({
                opacity: 0,
                display: 'block'
            }).animate({
                opacity: 0.2
            });
            jQuery('#' + url).bind('dialogclose',
            function() {
                jQuery('#fade').animate({
                    opacity: 0
                },
                function() {
                    jQuery('#fade').remove();
                });
            });
        }
    } else {        
        jQuery("#" + url).dialog('destroy');

        if (location.pathname.indexOf('/buying/') > 0) {
            jQuery("#" + url).dialog({
                autoOpen: true,
                modal: false,
                closeText: "",
                stack: false,
                dialogClass: 'popDialog',
                width: 510
            });
        } else if (location.pathname.length < 2) {
            jQuery("#" + url).dialog({
                autoOpen: true,
                modal: false,
                closeText: "",
                stack: false,
                dialogClass: 'popDialog',
                width:456
            });
        } else {
            jQuery("#" + url).dialog({
                autoOpen: true,
                modal: false,
                closeText: "",
                stack: false,
                dialogClass: 'popDialog',
                maxHeight: 250
            });
            jQuery('.ui-dialog .mainDisc').addClass('mainDiscHeightLimit');
        }

        uiHgt = jQuery(".ui-dialog").height();
        uiWdh = jQuery(".ui-dialog").width();

        bonusX = (jQuery("body").width() - jQuery(".gBody").width()) / 2;
        distX = ex - bonusX; 

        if (location.pathname.length > 2) {
            // handle X 
            if (distX - (uiWdh/2) < 0) {
                jQuery(".popDialog").css("left", ex);
            } else if(distX+(uiWdh/2)> ex){
                newLeft = ex-uiWdh;
                if(newLeft<0)
                    newLeft = 0;
                jQuery(".popDialog").css("left", newLeft);
            }else {
                //jQuery(".popDialog").css("top", ey);
                // Use distX instead of ex (mouse click x position) if the dialog goes outside the browser window
                if ((ex - 150) + uiWdh > jQuery("body").width()) {
                    jQuery(".popDialog").css("left", distX - 150);
                } else {
                    jQuery(".popDialog").css("left", ex - 150);
                }
            }
            // handle Y
            var tooFar=(ey + uiHgt) - (jQuery('html')[0].clientHeight + jQuery('html').scrollTop());
            if (tooFar>0) {
                // if it goes off the bottom of the screen, slide it up, but no further than the top of the visible part of the screen.
                jQuery(".popDialog").css("top", ey - Math.min(uiHgt,ey-jQuery('html').scrollTop()));
            }else {
                jQuery(".popDialog").css("top", ey);
            }
        } else {
            jQuery('body').append("<div id='fade'></div>");
            jQuery('#fade').css({
                opacity: 0,
                display: 'block'
            }).animate({
                opacity: 0.2
            });
            jQuery('#' + url).bind('dialogclose',
            function() {
                jQuery('#fade').animate({
                    opacity: 0
                },
                function() {
                    jQuery('#fade').remove();
                });
            });
        }
    }

    setCloseImageByPageLanguage();

    //change size if on buying
    if (location.pathname.indexOf('/buying/') > 0) {
        jQuery('.ui-dialog .mainDisc').css('height', '280px');
        jQuery('.ui-dialog .mainDisc p').css('line-height', '13px');
    }

    

    return false;
}  

function isIE8() {
    return (jQuery.browser.msie && jQuery.browser.version.substring(0, 1) === '8');
}

function isWebkit(){
    return (jQuery.browser.safari);
}

function isFireFox(){
    return (jQuery.browser.mozilla);
}

function isChrome(){
    browserDetect = navigator.userAgent.toLowerCase();
    return browserDetect.indexOf("chrome");
}

//for SHARE button
if (isFireFox()){
// write CSS to document
document.write("\n<style>\n");
document.write("#at16psf input  { padding: 0px 0px !important } \n");
document.write("</style>\n\n");
}
if (isChrome() < 0)
{   
    if (isWebkit()) {
        var os_detect = navigator.userAgent.toLowerCase();
        if (os_detect.indexOf("windows") > 0){
        document.write("\n<style>\n");
        document.write("#at16p  {   width: 320px !important } \n")
        document.write("#at16pt {   height: 20px !important } \n")
        document.write("#at16psf    {   height: 30px !important } \n")
        document.write("</style>\n\n");
        }
    }
}


function setCloseImageByPageLanguage() {
    var language;
    language = language == undefined && isSpanish() ? 'es' : undefined;
    language = language == undefined && isChinese() ? 'cn' : language;
    
    if (language != undefined) {
        var englishUrl = jQuery('.ui-dialog-titlebar').css('background-image');
        var languageUrl = englishUrl.replace('popup_close_btn.gif', 'popup_close_btn_' + language + '.gif');
        jQuery('.ui-dialog-titlebar').css('background-image', languageUrl);    
    }
}

function isSpanish() {
    return (location.pathname.indexOf('/espanol/') == 0) || (location.pathname.indexOf('/us/es/') > 0);
}

function isChinese() {
    return (location.pathname.indexOf('/chinese/') > 0) || (location.pathname.indexOf('/us/cn/') > 0);
}


function isSubGracenotePage(){
    if(location.pathname.indexOf("gracenote") > 0){
        if(location.pathname.indexOf("compactflash") > 0 || location.pathname.indexOf("usb-nonnavi") > 0 || location.pathname.indexOf("usb") > 0)
            return true;
        else
            return false
    }
}

function logger(value){
    
    if(window.console && console.log){
        console.log(value);
    }
}

function positionFooter(){
    
    if ((jQuery("#frameBg").size() > 0) && (jQuery("#frameContent").size() > 0)) {
    
        fOff = jQuery(".globalfooter").offset().top;
        fHeight = jQuery("#frameBg").height();
        fNew = (fHeight - fOff) + 150;

        //don't reposition if the offset is negative
        if (fNew > 0) { 
            jQuery(".globalfooter").css("margin-top", fNew);
        }
        if (location.pathname.indexOf("parts-accessories") > 0) {
            jQuery("#pageBg").height(jQuery("#frameContent").height() + 160);
        }
    }
}


//gets called from widePage()
function setUpGlobalFooter(){

    if(location.pathname.indexOf("gracenote") > 0){
        //fixes positioning issue on gracenote section
        jQuery(".globalfooter").css("margin-top", 64);

    }else{
        positionFooter();
    }
}


jQuery(document).ready(function(){
    widePage();
});

jQuery(window).load(function(){
        widePage();
});

/**
 * --------------------------------------------------------------------
 * jQuery-Plugin "pngFix"
 * Version: 1.1, 11.09.2007
 * by Andreas Eberhard, andreas.eberhard@gmail.com
 *                      http://jquery.andreaseberhard.de/
 *
 * Copyright (c) 2007 Andreas Eberhard
 * Licensed under GPL (http://www.opensource.org/licenses/gpl-license.php)
 */
eval(function(p,a,c,k,e,r){e=function(c){return(c<62?'':e(parseInt(c/62)))+((c=c%62)>35?String.fromCharCode(c+29):c.toString(36))};if('0'.replace(0,e)==0){while(c--)r[e(c)]=k[c];k=[function(e){return r[e]||e}];e=function(){return'([237-9n-zA-Z]|1\\w)'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(s(m){3.fn.pngFix=s(c){c=3.extend({P:\'blank.gif\'},c);8 e=(o.Q=="t R S"&&T(o.u)==4&&o.u.A("U 5.5")!=-1);8 f=(o.Q=="t R S"&&T(o.u)==4&&o.u.A("U 6.0")!=-1);p(3.browser.msie&&(e||f)){3(2).B("img[n$=.C]").D(s(){3(2).7(\'q\',3(2).q());3(2).7(\'r\',3(2).r());8 a=\'\';8 b=\'\';8 g=(3(2).7(\'E\'))?\'E="\'+3(2).7(\'E\')+\'" \':\'\';8 h=(3(2).7(\'F\'))?\'F="\'+3(2).7(\'F\')+\'" \':\'\';8 i=(3(2).7(\'G\'))?\'G="\'+3(2).7(\'G\')+\'" \':\'\';8 j=(3(2).7(\'H\'))?\'H="\'+3(2).7(\'H\')+\'" \':\'\';8 k=(3(2).7(\'V\'))?\'float:\'+3(2).7(\'V\')+\';\':\'\';8 d=(3(2).parent().7(\'href\'))?\'cursor:hand;\':\'\';p(2.9.v){a+=\'v:\'+2.9.v+\';\';2.9.v=\'\'}p(2.9.w){a+=\'w:\'+2.9.w+\';\';2.9.w=\'\'}p(2.9.x){a+=\'x:\'+2.9.x+\';\';2.9.x=\'\'}8 l=(2.9.cssText);b+=\'<y \'+g+h+i+j;b+=\'9="W:X;white-space:pre-line;Y:Z-10;I:transparent;\'+k+d;b+=\'q:\'+3(2).q()+\'z;r:\'+3(2).r()+\'z;\';b+=\'J:K:L.t.M(n=\\\'\'+3(2).7(\'n\')+\'\\\', N=\\\'O\\\');\';b+=l+\'"></y>\';p(a!=\'\'){b=\'<y 9="W:X;Y:Z-10;\'+a+d+\'q:\'+3(2).q()+\'z;r:\'+3(2).r()+\'z;">\'+b+\'</y>\'}3(2).hide();3(2).after(b)});3(2).B("*").D(s(){8 a=3(2).11(\'I-12\');p(a.A(".C")!=-1){8 b=a.13(\'url("\')[1].13(\'")\')[0];3(2).11(\'I-12\',\'none\');3(2).14(0).15.J="K:L.t.M(n=\'"+b+"\',N=\'O\')"}});3(2).B("input[n$=.C]").D(s(){8 a=3(2).7(\'n\');3(2).14(0).15.J=\'K:L.t.M(n=\\\'\'+a+\'\\\', N=\\\'O\\\');\';3(2).7(\'n\',c.P)})}return 3}})(3);',[],68,'||this|jQuery||||attr|var|style||||||||||||||src|navigator|if|width|height|function|Microsoft|appVersion|border|padding|margin|span|px|indexOf|find|png|each|id|class|title|alt|background|filter|progid|DXImageTransform|AlphaImageLoader|sizingMethod|scale|blankgif|appName|Internet|Explorer|parseInt|MSIE|align|position|relative|display|inline|block|css|image|split|get|runtimeStyle'.split('|'),0,{}))
/*
 * jQuery UI 1.7.1
 *
 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI
 */
jQuery.ui||(function(c){var i=c.fn.remove,d=c.browser.mozilla&&(parseFloat(c.browser.version)<1.9);c.ui={version:"1.7.1",plugin:{add:function(k,l,n){var m=c.ui[k].prototype;for(var j in n){m.plugins[j]=m.plugins[j]||[];m.plugins[j].push([l,n[j]])}},call:function(j,l,k){var n=j.plugins[l];if(!n||!j.element[0].parentNode){return}for(var m=0;m<n.length;m++){if(j.options[n[m][0]]){n[m][1].apply(j.element,k)}}}},contains:function(k,j){return document.compareDocumentPosition?k.compareDocumentPosition(j)&16:k!==j&&k.contains(j)},hasScroll:function(m,k){if(c(m).css("overflow")=="hidden"){return false}var j=(k&&k=="left")?"scrollLeft":"scrollTop",l=false;if(m[j]>0){return true}m[j]=1;l=(m[j]>0);m[j]=0;return l},isOverAxis:function(k,j,l){return(k>j)&&(k<(j+l))},isOver:function(o,k,n,m,j,l){return c.ui.isOverAxis(o,n,j)&&c.ui.isOverAxis(k,m,l)},keyCode:{BACKSPACE:8,CAPS_LOCK:20,COMMA:188,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38}};if(d){var f=c.attr,e=c.fn.removeAttr,h="http://www.w3.org/2005/07/aaa",a=/^aria-/,b=/^wairole:/;c.attr=function(k,j,l){var m=l!==undefined;return(j=="role"?(m?f.call(this,k,j,"wairole:"+l):(f.apply(this,arguments)||"").replace(b,"")):(a.test(j)?(m?k.setAttributeNS(h,j.replace(a,"aaa:"),l):f.call(this,k,j.replace(a,"aaa:"))):f.apply(this,arguments)))};c.fn.removeAttr=function(j){return(a.test(j)?this.each(function(){this.removeAttributeNS(h,j.replace(a,""))}):e.call(this,j))}}c.fn.extend({remove:function(){c("*",this).add(this).each(function(){c(this).triggerHandler("remove")});return i.apply(this,arguments)},enableSelection:function(){return this.attr("unselectable","off").css("MozUserSelect","").unbind("selectstart.ui")},disableSelection:function(){return this.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return false})},scrollParent:function(){var j;if((c.browser.msie&&(/(static|relative)/).test(this.css("position")))||(/absolute/).test(this.css("position"))){j=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test(c.curCSS(this,"position",1))&&(/(auto|scroll)/).test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0)}else{j=this.parents().filter(function(){return(/(auto|scroll)/).test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0)}return(/fixed/).test(this.css("position"))||!j.length?c(document):j}});c.extend(c.expr[":"],{data:function(l,k,j){return !!c.data(l,j[3])},focusable:function(k){var l=k.nodeName.toLowerCase(),j=c.attr(k,"tabindex");return(/input|select|textarea|button|object/.test(l)?!k.disabled:"a"==l||"area"==l?k.href||!isNaN(j):!isNaN(j))&&!c(k)["area"==l?"parents":"closest"](":hidden").length},tabbable:function(k){var j=c.attr(k,"tabindex");return(isNaN(j)||j>=0)&&c(k).is(":focusable")}});function g(m,n,o,l){function k(q){var p=c[m][n][q]||[];return(typeof p=="string"?p.split(/,?\s+/):p)}var j=k("getter");if(l.length==1&&typeof l[0]=="string"){j=j.concat(k("getterSetter"))}return(c.inArray(o,j)!=-1)}c.widget=function(k,j){var l=k.split(".")[0];k=k.split(".")[1];c.fn[k]=function(p){var n=(typeof p=="string"),o=Array.prototype.slice.call(arguments,1);if(n&&p.substring(0,1)=="_"){return this}if(n&&g(l,k,p,o)){var m=c.data(this[0],k);return(m?m[p].apply(m,o):undefined)}return this.each(function(){var q=c.data(this,k);(!q&&!n&&c.data(this,k,new c[l][k](this,p))._init());(q&&n&&c.isFunction(q[p])&&q[p].apply(q,o))})};c[l]=c[l]||{};c[l][k]=function(o,n){var m=this;this.namespace=l;this.widgetName=k;this.widgetEventPrefix=c[l][k].eventPrefix||k;this.widgetBaseClass=l+"-"+k;this.options=c.extend({},c.widget.defaults,c[l][k].defaults,c.metadata&&c.metadata.get(o)[k],n);this.element=c(o).bind("setData."+k,function(q,p,r){if(q.target==o){return m._setData(p,r)}}).bind("getData."+k,function(q,p){if(q.target==o){return m._getData(p)}}).bind("remove",function(){return m.destroy()})};c[l][k].prototype=c.extend({},c.widget.prototype,j);c[l][k].getterSetter="option"};c.widget.prototype={_init:function(){},destroy:function(){this.element.removeData(this.widgetName).removeClass(this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").removeAttr("aria-disabled")},option:function(l,m){var k=l,j=this;if(typeof l=="string"){if(m===undefined){return this._getData(l)}k={};k[l]=m}c.each(k,function(n,o){j._setData(n,o)})},_getData:function(j){return this.options[j]},_setData:function(j,k){this.options[j]=k;if(j=="disabled"){this.element[k?"addClass":"removeClass"](this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").attr("aria-disabled",k)}},enable:function(){this._setData("disabled",false)},disable:function(){this._setData("disabled",true)},_trigger:function(l,m,n){var p=this.options[l],j=(l==this.widgetEventPrefix?l:this.widgetEventPrefix+l);m=c.Event(m);m.type=j;if(m.originalEvent){for(var k=c.event.props.length,o;k;){o=c.event.props[--k];m[o]=m.originalEvent[o]}}this.element.trigger(m,n);return !(c.isFunction(p)&&p.call(this.element[0],m,n)===false||m.isDefaultPrevented())}};c.widget.defaults={disabled:false};c.ui.mouse={_mouseInit:function(){var j=this;this.element.bind("mousedown."+this.widgetName,function(k){return j._mouseDown(k)}).bind("click."+this.widgetName,function(k){if(j._preventClickEvent){j._preventClickEvent=false;k.stopImmediatePropagation();return false}});if(c.browser.msie){this._mouseUnselectable=this.element.attr("unselectable");this.element.attr("unselectable","on")}this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName);(c.browser.msie&&this.element.attr("unselectable",this._mouseUnselectable))},_mouseDown:function(l){l.originalEvent=l.originalEvent||{};if(l.originalEvent.mouseHandled){return}(this._mouseStarted&&this._mouseUp(l));this._mouseDownEvent=l;var k=this,m=(l.which==1),j=(typeof this.options.cancel=="string"?c(l.target).parents().add(l.target).filter(this.options.cancel).length:false);if(!m||j||!this._mouseCapture(l)){return true}this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){k.mouseDelayMet=true},this.options.delay)}if(this._mouseDistanceMet(l)&&this._mouseDelayMet(l)){this._mouseStarted=(this._mouseStart(l)!==false);if(!this._mouseStarted){l.preventDefault();return true}}this._mouseMoveDelegate=function(n){return k._mouseMove(n)};this._mouseUpDelegate=function(n){return k._mouseUp(n)};c(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);(c.browser.safari||l.preventDefault());l.originalEvent.mouseHandled=true;return true},_mouseMove:function(j){if(c.browser.msie&&!j.button){return this._mouseUp(j)}if(this._mouseStarted){this._mouseDrag(j);return j.preventDefault()}if(this._mouseDistanceMet(j)&&this._mouseDelayMet(j)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,j)!==false);(this._mouseStarted?this._mouseDrag(j):this._mouseUp(j))}return !this._mouseStarted},_mouseUp:function(j){c(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this._preventClickEvent=(j.target==this._mouseDownEvent.target);this._mouseStop(j)}return false},_mouseDistanceMet:function(j){return(Math.max(Math.abs(this._mouseDownEvent.pageX-j.pageX),Math.abs(this._mouseDownEvent.pageY-j.pageY))>=this.options.distance)},_mouseDelayMet:function(j){return this.mouseDelayMet},_mouseStart:function(j){},_mouseDrag:function(j){},_mouseStop:function(j){},_mouseCapture:function(j){return true}};c.ui.mouse.defaults={cancel:null,distance:1,delay:0}})(jQuery);;/*
 * jQuery UI Dialog 1.7.1
 *
 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Dialog
 *
 * Depends:
 *  ui.core.js
 *  ui.draggable.js
 *  ui.resizable.js
 */
(function(c){var b={dragStart:"start.draggable",drag:"drag.draggable",dragStop:"stop.draggable",maxHeight:"maxHeight.resizable",minHeight:"minHeight.resizable",maxWidth:"maxWidth.resizable",minWidth:"minWidth.resizable",resizeStart:"start.resizable",resize:"drag.resizable",resizeStop:"stop.resizable"},a="ui-dialog ui-widget ui-widget-content ui-corner-all ";c.widget("ui.dialog",{_init:function(){this.originalTitle=this.element.attr("title");var l=this,m=this.options,j=m.title||this.originalTitle||"&nbsp;",e=c.ui.dialog.getTitleId(this.element),k=(this.uiDialog=c("<div/>")).appendTo(document.body).hide().addClass(a+m.dialogClass).css({position:"absolute",overflow:"hidden",zIndex:m.zIndex}).attr("tabIndex",-1).css("outline",0).keydown(function(n){(m.closeOnEscape&&n.keyCode&&n.keyCode==c.ui.keyCode.ESCAPE&&l.close(n))}).attr({role:"dialog","aria-labelledby":e}).mousedown(function(n){l.moveToTop(false,n)}),g=this.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(k),f=(this.uiDialogTitlebar=c("<div></div>")).addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(k),i=c('<a href="#"/>').addClass("ui-dialog-titlebar-close ui-corner-all").attr("role","button").hover(function(){i.addClass("ui-state-hover")},function(){i.removeClass("ui-state-hover")}).focus(function(){i.addClass("ui-state-focus")}).blur(function(){i.removeClass("ui-state-focus")}).mousedown(function(n){n.stopPropagation()}).click(function(n){l.close(n);return false}).appendTo(f),h=(this.uiDialogTitlebarCloseText=c("<span/>")).addClass("ui-icon ui-icon-closethick").text(m.closeText).appendTo(i),d=c("<span/>").addClass("ui-dialog-title").attr("id",e).html(j).prependTo(f);f.find("*").add(f).disableSelection();(m.draggable&&c.fn.draggable&&this._makeDraggable());(m.resizable&&c.fn.resizable&&this._makeResizable());this._createButtons(m.buttons);this._isOpen=false;(m.bgiframe&&c.fn.bgiframe&&k.bgiframe());(m.autoOpen&&this.open())},destroy:function(){(this.overlay&&this.overlay.destroy());this.uiDialog.hide();this.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content ui-widget-content").hide().appendTo("body");this.uiDialog.remove();(this.originalTitle&&this.element.attr("title",this.originalTitle))},close:function(e){var d=this;if(false===d._trigger("beforeclose",e)){return}(d.overlay&&d.overlay.destroy());d.uiDialog.unbind("keypress.ui-dialog");(d.options.hide?d.uiDialog.hide(d.options.hide,function(){d._trigger("close",e)}):d.uiDialog.hide()&&d._trigger("close",e));c.ui.dialog.overlay.resize();d._isOpen=false},isOpen:function(){return this._isOpen},moveToTop:function(f,e){if((this.options.modal&&!f)||(!this.options.stack&&!this.options.modal)){return this._trigger("focus",e)}if(this.options.zIndex>c.ui.dialog.maxZ){c.ui.dialog.maxZ=this.options.zIndex}(this.overlay&&this.overlay.$el.css("z-index",c.ui.dialog.overlay.maxZ=++c.ui.dialog.maxZ));var d={scrollTop:this.element.attr("scrollTop"),scrollLeft:this.element.attr("scrollLeft")};this.uiDialog.css("z-index",++c.ui.dialog.maxZ);this.element.attr(d);this._trigger("focus",e)},open:function(){if(this._isOpen){return}var e=this.options,d=this.uiDialog;this.overlay=e.modal?new c.ui.dialog.overlay(this):null;(d.next().length&&d.appendTo("body"));this._size();this._position(e.position);d.show(e.show);this.moveToTop(true);(e.modal&&d.bind("keypress.ui-dialog",function(h){if(h.keyCode!=c.ui.keyCode.TAB){return}var g=c(":tabbable",this),i=g.filter(":first")[0],f=g.filter(":last")[0];if(h.target==f&&!h.shiftKey){setTimeout(function(){i.focus()},1)}else{if(h.target==i&&h.shiftKey){setTimeout(function(){f.focus()},1)}}}));c([]).add(d.find(".ui-dialog-content :tabbable:first")).add(d.find(".ui-dialog-buttonpane :tabbable:first")).add(d).filter(":first").focus();this._trigger("open");this._isOpen=true},_createButtons:function(g){var f=this,d=false,e=c("<div></div>").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix");this.uiDialog.find(".ui-dialog-buttonpane").remove();(typeof g=="object"&&g!==null&&c.each(g,function(){return !(d=true)}));if(d){c.each(g,function(h,i){c('<button type="button"></button>').addClass("ui-state-default ui-corner-all").text(h).click(function(){i.apply(f.element[0],arguments)}).hover(function(){c(this).addClass("ui-state-hover")},function(){c(this).removeClass("ui-state-hover")}).focus(function(){c(this).addClass("ui-state-focus")}).blur(function(){c(this).removeClass("ui-state-focus")}).appendTo(e)});e.appendTo(this.uiDialog)}},_makeDraggable:function(){var d=this,f=this.options,e;this.uiDialog.draggable({cancel:".ui-dialog-content",handle:".ui-dialog-titlebar",containment:"document",start:function(){e=f.height;c(this).height(c(this).height()).addClass("ui-dialog-dragging");(f.dragStart&&f.dragStart.apply(d.element[0],arguments))},drag:function(){(f.drag&&f.drag.apply(d.element[0],arguments))},stop:function(){c(this).removeClass("ui-dialog-dragging").height(e);(f.dragStop&&f.dragStop.apply(d.element[0],arguments));c.ui.dialog.overlay.resize()}})},_makeResizable:function(g){g=(g===undefined?this.options.resizable:g);var d=this,f=this.options,e=typeof g=="string"?g:"n,e,s,w,se,sw,ne,nw";this.uiDialog.resizable({cancel:".ui-dialog-content",alsoResize:this.element,maxWidth:f.maxWidth,maxHeight:f.maxHeight,minWidth:f.minWidth,minHeight:f.minHeight,start:function(){c(this).addClass("ui-dialog-resizing");(f.resizeStart&&f.resizeStart.apply(d.element[0],arguments))},resize:function(){(f.resize&&f.resize.apply(d.element[0],arguments))},handles:e,stop:function(){c(this).removeClass("ui-dialog-resizing");f.height=c(this).height();f.width=c(this).width();(f.resizeStop&&f.resizeStop.apply(d.element[0],arguments));c.ui.dialog.overlay.resize()}}).find(".ui-resizable-se").addClass("ui-icon ui-icon-grip-diagonal-se")},_position:function(i){var e=c(window),f=c(document),g=f.scrollTop(),d=f.scrollLeft(),h=g;if(c.inArray(i,["center","top","right","bottom","left"])>=0){i=[i=="right"||i=="left"?i:"center",i=="top"||i=="bottom"?i:"middle"]}if(i.constructor!=Array){i=["center","middle"]}if(i[0].constructor==Number){d+=i[0]}else{switch(i[0]){case"left":d+=0;break;case"right":d+=e.width()-this.uiDialog.outerWidth();break;default:case"center":d+=(e.width()-this.uiDialog.outerWidth())/2}}if(i[1].constructor==Number){g+=i[1]}else{switch(i[1]){case"top":g+=0;break;case"bottom":g+=e.height()-this.uiDialog.outerHeight();break;default:case"middle":g+=(e.height()-this.uiDialog.outerHeight())/2}}g=Math.max(g,h);this.uiDialog.css({top:g,left:d})},_setData:function(e,f){(b[e]&&this.uiDialog.data(b[e],f));switch(e){case"buttons":this._createButtons(f);break;case"closeText":this.uiDialogTitlebarCloseText.text(f);break;case"dialogClass":this.uiDialog.removeClass(this.options.dialogClass).addClass(a+f);break;case"draggable":(f?this._makeDraggable():this.uiDialog.draggable("destroy"));break;case"height":this.uiDialog.height(f);break;case"position":this._position(f);break;case"resizable":var d=this.uiDialog,g=this.uiDialog.is(":data(resizable)");(g&&!f&&d.resizable("destroy"));(g&&typeof f=="string"&&d.resizable("option","handles",f));(g||this._makeResizable(f));break;case"title":c(".ui-dialog-title",this.uiDialogTitlebar).html(f||"&nbsp;");break;case"width":this.uiDialog.width(f);break}c.widget.prototype._setData.apply(this,arguments)},_size:function(){var e=this.options;this.element.css({height:0,minHeight:0,width:"auto"});var d=this.uiDialog.css({height:"auto",width:e.width}).height();this.element.css({minHeight:Math.max(e.minHeight-d,0),height:e.height=="auto"?"auto":Math.max(e.height-d,0)})}});c.extend(c.ui.dialog,{version:"1.7.1",defaults:{autoOpen:true,bgiframe:false,buttons:{},closeOnEscape:true,closeText:"close",dialogClass:"",draggable:true,hide:null,height:"auto",maxHeight:false,maxWidth:false,minHeight:86,minWidth:150,modal:false,position:"center",resizable:true,show:null,stack:true,title:"",width:300,zIndex:1000},getter:"isOpen",uuid:0,maxZ:0,getTitleId:function(d){return"ui-dialog-title-"+(d.attr("id")||++this.uuid)},overlay:function(d){this.$el=c.ui.dialog.overlay.create(d)}});c.extend(c.ui.dialog.overlay,{instances:[],maxZ:0,events:c.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(d){return d+".dialog-overlay"}).join(" "),create:function(e){if(this.instances.length===0){setTimeout(function(){c(document).bind(c.ui.dialog.overlay.events,function(f){var g=c(f.target).parents(".ui-dialog").css("zIndex")||0;return(g>c.ui.dialog.overlay.maxZ)})},1);c(document).bind("keydown.dialog-overlay",function(f){(e.options.closeOnEscape&&f.keyCode&&f.keyCode==c.ui.keyCode.ESCAPE&&e.close(f))});c(window).bind("resize.dialog-overlay",c.ui.dialog.overlay.resize)}var d=c("<div></div>").appendTo(document.body).addClass("ui-widget-overlay").css({width:this.width(),height:this.height()});(e.options.bgiframe&&c.fn.bgiframe&&d.bgiframe());this.instances.push(d);return d},destroy:function(d){this.instances.splice(c.inArray(this.instances,d),1);if(this.instances.length===0){c([document,window]).unbind(".dialog-overlay")}d.remove()},height:function(){if(c.browser.msie&&c.browser.version<7){var e=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);var d=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight);if(e<d){return c(window).height()+"px"}else{return e+"px"}}else{return c(document).height()+"px"}},width:function(){if(c.browser.msie&&c.browser.version<7){var d=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth);var e=Math.max(document.documentElement.offsetWidth,document.body.offsetWidth);if(d<e){return c(window).width()+"px"}else{return d+"px"}}else{return c(document).width()+"px"}},resize:function(){var d=c([]);c.each(c.ui.dialog.overlay.instances,function(){d=d.add(this)});d.css({width:0,height:0}).css({width:c.ui.dialog.overlay.width(),height:c.ui.dialog.overlay.height()})}});c.extend(c.ui.dialog.overlay.prototype,{destroy:function(){c.ui.dialog.overlay.destroy(this.$el)}})})(jQuery);;
// $Id: engine.js 45610 2008-10-09 20:16:30Z thaxtonm $
// ####################### CONSTANTS & GLOBAL VARS #############################

// SR 15705
var crmZipCode = 'czc';              // Cookie name for zipcode
// END OF SR 15705

var crmLeadId = 'crmLeadId';        // Cookie name for Lead Id
var crmReferralSite="Site";         // Cookie and query param name for referral site
var crmReferralArea="Area";         // Cookie and query param name for referral area
var crmReferralCreative="Creative"; // Cookie and query param name for referral creative
var crmDoubleClickCampain="dcc";    // query param name for the DoubleClick campaign value
var crmDoubleClickPlacement="dcp";  // query param name for the DoubleClick campaign value
var crmUnknownSite = "UnknownSite"; // query param value for no referral site
var crmUnknownArea = "UnknownArea"; // query param value for no referral area
var crmUnknownCreative = "UnknownCreative"; // query param value for no referral creative
var crmVidCookieName = 'visitorID'; // Cookie name for visitor id
var crmPageLocale;                  // pagelocale value from script tag attribute
var crmPageSite;                    // pagesite value from script tag attribute
var crmPageId                       // pageid value from the script tag attribute
///var crmDebugIsOn;                    // crmdebug state from the query string
var crmDebugState=0;                // crmdebug state: 0=off, 1=alerts, 2=firebug with expanded function, 3=firebug with small function
var crmDebugCookie='crmDebugState'; // cookie name to track crmDebug state
var crmCondCallList=[];             // used to track conditional calls in the crmCondCall function
var crmUrl = location.pathname+location.search; // stores the the current page path + any querystring info
var crmJsURLPrefix;                 // will store the full URL of engine.js (url up to, but not including the engine.js filename)
var crmTagBucketId="pageTags";      // id value of the div in which to place dynamic tags (ie images)
var crmCollageHost="collage.designory.com"  // Collage hostname/ip (used for preview trapping)
var crmCollageContribPage="as_contrib_edit.jsp" // Collage contribution page (used for preview trapping)
var crmOffer;                       // Will contain an instance of CrmOfferClass on init
var crmCheckOfferFreq=250;          // frequency at which crmGetOffers checks the crmOffer obj (in ms)
var crmCheckOfferTimeOut=5000;      // how long to wait befor crmGetOffers gives up on crmOffer obj and shows defaults (in ms)
var crmPFALinkId='rtoPfaLink';      // id value for pfa link
var crmSMB1HeaderId='rtoSMB1Head';  // id value for smb1 link
var crmSMB1LinkId='rtoSMB1Link';    // id value for smb1 link
var crmSMB2LinkId='rtoSMB2Link';    // id value for smb2 link
var crmBuildNum;                    // Will hold the build number for which the current page tag file was created
var crmBuildDate;                   // Will hold the date (date object) for which the current page tag file was created
var crmClient;                      // Will hold the object based on the CrmClientDetectClass
var genTag = {};                    // Create generic tagging object

jQuery.noConflict();

function $(ee) {
    return document.getElementById(ee);
}

if (typeof crmAllowCreateVidCookie == 'undefined')
  var crmAllowCreateVidCookie = true;                   // Gives external files the ability to prevent the VisitorID cookie from being created

// ############################### CLASSES #####################################

// ###  CRM Client Detect Class
//      Creates an object that holds client detail information
//      Properties:
//          .OS - Operating system name
//          .browser - Web Browser name
//          .version - Web Browser Version
function CrmClientDetectClass () {
    var detect = navigator.userAgent.toLowerCase();
    var thestring;
    this.OS;
    this.browser;
    this.version;

    if (checkIt('konqueror'))
    {
        this.browser = "Konqueror";
        this.OS = "Linux";
    }
    else if (checkIt('safari')) this.browser = "Safari"
    else if (checkIt('omniweb')) this.browser = "OmniWeb"
    else if (checkIt('opera')) this.browser = "Opera"
    else if (checkIt('webtv')) this.browser = "WebTV";
    else if (checkIt('icab')) this.browser = "iCab"
    else if (checkIt('msie')) this.browser = "Internet Explorer"
    else if (!checkIt('compatible'))
    {
        this.browser = "Netscape Navigator"
        this.version = detect.charAt(8);
    }
    else this.browser = "An unknown browser";

    if (!this.version) this.version = detect.charAt(place + thestring.length);

    if (!this.OS)
    {
        if (checkIt('linux')) this.OS = "Linux";
        else if (checkIt('x11')) this.OS = "Unix";
        else if (checkIt('mac')) this.OS = "Mac"
        else if (checkIt('win')) this.OS = "Windows"
        else this.OS = "an unknown operating system";
    }

    function checkIt(string)
    {
        place = detect.indexOf(string) + 1;
        thestring = string;
        return place;
    }
}

// ###  CRM Offer Class
//      Holds dynamic offer information which is returned from providers
function CrmOfferClass () {
    var pfaSwf='', pfaSwfDefault='', pfaImg='', pfaImgDefault='', pfaText='', pfaTextDefault='', pfaLink='', pfaLinkDefault='', isLoaded=false;

    this.getPfaSwf = function () { return pfaSwf; }
    this.getPfaSwfDefault = function () { return pfaSwfDefault; }
    this.getPfaImg = function () { return pfaImg; }
    this.getPfaImgDefault = function () { return pfaImgDefault; }
    this.getPfaText = function () { return pfaText; }
    this.getPfaTextDefault = function () { return pfaTextDefault; }
    this.getPfaLink = function () { return pfaLink; }
    this.getPfaLinkDefault = function () { return pfaLinkDefault; }
    this.getLoaded = function () { return isLoaded; }

    this.setPfaSwf = function (value) { pfaSwf = value; }
    this.setPfaSwfDefault = function (value) { pfaSwfDefault = value; }
    this.setPfaImg = function (value) { pfaImg = value; }
    this.setPfaImgDefault = function (value) { pfaImgDefault = value; }
    this.setPfaText = function (value) { pfaText = value; }
    this.setPfaTextDefault = function (value) { pfaTextDefault = value; }
    this.setPfaLink = function (value) { pfaLink = value; }
    this.setPfaLinkDefault = function (value) { pfaLinkDefault = value; }
    this.setLoaded = function (value) { isLoaded = value; }
}

// ###  CRM Site Class
//      Associates nissan or infiniti with provider specific strings
//      Example: var localEnvObj = new CrmEnvironmentClass({
//                  nissan:     'NissanUSA_',
//                  infiniti:   'Infiniti_'});
function CrmSiteClass ( locSiteObj ) {
    var siteLocalObj = locSiteObj;
    this.isNissan = (crmPageSite=='nissan') ? true : false;
    this.isInfiniti = !this.isNissan;
    this.getSite = function () {
        if (crmPageSite=='nissan') return siteLocalObj.nissan;
        if (crmPageSite=='infiniti') {
            if(/.infinitiusaretailers/.test(location.host))
                return siteLocalObj.infinitiusaretailers;
            else
                return siteLocalObj.infiniti;
        }
        return null;
    }
    this.getSiteName = function () { return crmPageSite }
}

// ###  CRM Environment Class
//      Associates dev, qa, stage & prod with provider specific host and path names
//      Protocol should NOT be provided as it derived from the current page location
//      Example: var localEnvObj = new CrmEnvironmentClass({
//                  dev:      'some.dev.domain.com/path/to/file.html',
//                  qa:       'some.qa.domain.nna/path/to/file.html',
//                  stage:  'some.stage.domain.com/path/to/file.html',
//                  prod:     'some.prod.domain.com/path/to/file.html'});
function CrmEnvironmentClass ( locEnvObj ) {
    var envHostName = location.hostname.toLowerCase();
    var envPort = location.port;
    var envLocalEnvObj = locEnvObj;
    var envProtocol = location.protocol + '//';
    this.getProtocol = function () { return envProtocol; }
    this.getEnv = function () {

        if (/(9080|8080|9000|9091|1160|92|209|210)/.test(envPort) || /(collage.|integ.|designory|localhost|author|publish|vangogh)/.test(envHostName)) return envLocalEnvObj.dev;
        if (/(www.qa|prod.)/.test(envHostName) || envPort == 9090) return envLocalEnvObj.qa;
        if (/(stage)/.test(envHostName))    return envLocalEnvObj.stage;
        if (/(.nissanusa.com|.infiniti.com)/.test(envHostName)) return envLocalEnvObj.prod;
        return envLocalEnvObj.prod;
    }
}

// ###  CRM Language Local Class
//      Associates en (english) & es (spanish) with provider specific strings
//      Example: var locLocalObj = new CrmLocalClass ({
//                  es:     'parameter_string_for_spanish',
//                  en:     'parameter_string_for_english'});
function CrmLocaleClass ( localObj ) {
    var locLocalObj = localObj;
    this.getLocale = function () {
        if (crmPageLocale=='en' || crmPageLocale=='cn') return locLocalObj.en;
        if (crmPageLocale=='es') return locLocalObj.es;
        return null;
    }
}

// ########################## GENERAL FUNCTIONS ################################

// ###  Debugging alert box
function crmDebug ( msgObj ) {
    if( !crmDebugState ) return;
    if( ('console' in window) && crmDebugState>1 ) return crmDebugFirebug(msgObj);
    var buildInfo = "BUILD: Not specified in page tag file\n\n";
    if (typeof crmBuildDate != 'undefined')
        buildInfo = "BUILD: " + crmBuildNum + " (" + crmBuildDate.toLocaleString() + ")\n\n";
    var msgHeader = "___CRM DEBUG________________________________\n\n";
    if (typeof msgObj == 'function') { //assumes a crmEvent function object
        var funcName = "coreevent";
        var funcLine = msgObj.toString().substring(0,(msgObj.toString().indexOf('{')+1));
        var funcNameIndex = funcLine.toLowerCase().indexOf(funcName.toLowerCase());
        var funcOpenParensIndex = funcLine.indexOf('(');
        var funcCloseParensIndex = funcLine.indexOf(')');
        var eventID = funcLine.substring( (funcNameIndex + funcName.length),funcOpenParensIndex );
        var argsNameList = crmGetParamNames(msgObj);
        var argsDisplayText ='';
        for (n=0; n<argsNameList.length; n++)
            if (argsNameList[n].length > 0)
                argsDisplayText += (typeof msgObj.arguments[n] != 'undefined' ) ? argsNameList[n]+': '+msgObj.arguments[n]+'\n' : argsNameList[n]+': [no value passed in]\n';
        if ( !confirm( msgHeader + 'EVENT ID: ' + eventID + ' ................................. PAGE ID: '+crmPageId+'\n' + buildInfo + argsDisplayText ) )
            if( !confirm(msgHeader + msgObj,'Visitor ID: '+crmGetVID()) )
                prompt(msgHeader + 'Visitor ID:',crmGetVID());
    } else { // assumes a string
        if ( !confirm(msgHeader + msgObj) )
            prompt(msgHeader + 'Visitor ID:',crmGetVID());
    }
}

function crmDebugFirebug ( msgObj ) {
    if ( !crmDebugState ) return;

    var buildInfo="BUILD: "+((typeof crmBuildDate == 'undefined') ? "Not specified in page tag file" : "{0} ({1})".format(crmBuildNum,crmBuildDate.toLocaleString()));

    if (typeof msgObj == 'function') { //assumes a crmEvent function object
        var funcName = "coreEvent";
        var funcLine = msgObj.toString().substring(0,(msgObj.toString().indexOf('{')+1));
        var funcNameIndex = funcLine.toLowerCase().indexOf(funcName.toLowerCase());
        var funcOpenParensIndex = funcLine.indexOf('(');
        var funcCloseParensIndex = funcLine.indexOf(')');
        var eventID = funcLine.substring( (funcNameIndex + funcName.length),funcOpenParensIndex );
        var argsNameList = crmGetParamNames(msgObj);
        var argsDisplayText ='';

        console.group("CRM Page: "+crmPageId+"\tevent: "+eventID+"\t"+buildInfo)

        if(crmDebugState==3){ console.log(msgObj,"\t\t",'Visitor ID:\t' + crmGetVID()) }

        for (n=0; n<argsNameList.length; n++){
            if (argsNameList[n].length > 0){
                switch(typeof msgObj.arguments[n]){
                    case 'undefined':   console.warn(argsNameList[n]+':\t[no value passed in]');break;
                    case 'number':  console.info(argsNameList[n]+':\t%f',msgObj.arguments[n]);break;
                    case 'string':  console.info(argsNameList[n]+':\t%a',msgObj.arguments[n]);break;
                    default:    console.info(argsNameList[n]+':\t',msgObj.arguments[n]);
                }
            }
        }

        var myArgs=[];
        for(var i=0;i<argsNameList.length;i++){
            var mAi=msgObj.arguments[i];
            myArgs.push( (typeof mAi == 'string')?'"'+mAi+'"': mAi );
        }
        var myFuncCall="// {0}{1}({2})".format(funcName,eventID,myArgs.join(','));

        if(crmDebugState==2){
            setTimeout( function(){
                console.log(myFuncCall);
                var _fnc= String(msgObj).replace(/(s\.(\w+)) = (.+?);/g,function(){ //this will swap in computed values.
                            var A=arguments;
                            return ((/^"[^"]+"$/.test(A[3]))? A[0] : A[1]+' = "'+s[A[2]]+'"');//   // '+A[3]);
                        });
                //console.log(_fnc);
                var _ss=['','','',''];//save the first 4 for some vals
                var _fl=_fnc.replace(/= /g,'=\t').split(/\n\s*/);

                for(var i=0;i<_fl.length;i++){
                    if(/^s\.(pagename|prop10|channel|events)\b/i.test(_fl[i])){
                        switch(RegExp.$1.toLowerCase()){
                            case 'pagename' : _ss[0]=_fl[i];break;
                            case 'prop10'   : _ss[1]=_fl[i];break;
                            case 'channel'  : _ss[2]=_fl[i];break;
                            case 'events'   : _ss[3]=_fl[i];
                        }
                    }else if(/^(s\.\w+\b|olUpdateState|ping[^O])/.test(_fl[i])){
                        _ss.push(_fl[i]);
                    }
                }
                console.log(_ss.slice(0,4).join('\n'))
                console.log(_ss.slice(4).join('\n'))
                console.groupEnd();
            },5);
        }else{
            console.groupEnd();
        }

    } else { // assumes a string
        console.group("CRM\tPage: "+crmPageId+"\t"+buildInfo)
        console.info(msgObj);
        console.log('Visitor ID:\t'+crmGetVID());
        console.groupEnd();
    }
}


// ###  CRM cookie related functions
function crmSetCookie(name, value, expires, path, domain, secure) {
  var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires.toGMTString() : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
  document.cookie = curCookie;
}
function crmGetCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}
function crmDeleteCookie(name, path, domain) {
  if (crmGetCookie(name)) {
    document.cookie = name + "=" +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}
function crmMakeExpDate(days, hours, minutes) {
    var expDate = new Date( );
    if (typeof days == "number" && typeof hours == "number" &&
        typeof hours == "number") {
        expDate.setDate(expDate.getDate( ) + parseInt(days));
        expDate.setHours(expDate.getHours( ) + parseInt(hours));
        expDate.setMinutes(expDate.getMinutes( ) + parseInt(minutes));
        return expDate;
    }
}
function crmGetZipCode(){
    var zipParam=s.getQueryParam('zipCode','');
    var zipCookie=crmGetCookie(crmZipCode);
    return (zipParam) ? zipParam : zipCookie;
}// END CRM Cookie functions

// ###  Returns the string value of the param from the search/query string (location.search)
//      Returns empty string if null if no value is found
function crmGetQueryParam(paramName) {
    var qString = location.search.substring(1);
    if (qString.indexOf(paramName) == -1) return '';
    var pValueStart = qString.indexOf(paramName) + paramName.length + 1;
    var pValueEnd = qString.indexOf('&', pValueStart);
    if ( pValueEnd==-1 ) pValueEnd = qString.length;
    return unescape( qString.substring( pValueStart,pValueEnd ) );
}

// ###  Returns an array of name/value params from the query string (location.search)
//      Array is bothed named and index based. So values can be pulled by:
//          queryArray['paramName']
//      and
//          queryArray[n].name, queryArray[n].value
function crmGetQueryStringArray () {
    var qArray = new Array();
    var qString = location.search.substring(1);
    var nameValues = qString.split('&');
    for (n=0; n<nameValues.length; n++) {
        nameValue = nameValues[n].split('=');
        qArray[ unescape(nameValue[0]) ] = unescape(nameValue[1]);
        qArray[n] = { name:unescape(nameValue[0]), value:unescape(nameValue[1])};
    }
    return qArray;
}

// ###  Dynamic HTML tag creation function
//      tagName:            type of tag to create
//      tagInsertPoint:     tag name to insert this tag inside of (ie html, head, body).
//                          Will always insert new tag as the last item within the
//                          Insert Point container. OR a tag element object can be
//                          supplied (ie getElementById value can be passed in)
//      further arguments:  This function can be overloaded with further arguments.
//                          They represent the attributes of the tag and should be
//                          passed in as objects:
//                          crmCreateTag( 'img', 'body', {attrName: 'attribute name',attrValue: 'attribute value'}, ... , ...);
function crmCreateTag ( tagName, tagInsertPoint ) {
    try {
        insertElm = (typeof tagInsertPoint == 'string') ? document.getElementsByTagName( tagInsertPoint ).item(0) : tagInsertPoint;
        attrObjs = crmCreateTag.arguments;
        newElm = document.createElement( tagName.toLowerCase() );
        for( n=2; n < attrObjs.length; n++ )
            newElm.setAttribute( attrObjs[n].attrName.toLowerCase(), attrObjs[n].attrValue );
        insertElm.appendChild( newElm );
        return true;
    } catch (err) {
        crmDebug('crmCreateTag failed with:\n\n' + err);
        return false;
    }
}

// ###  Generates new random visitorIDs
//      calls: crmSha1Hash
function crmMakeNewVID() {
    var seed = navigator.userAgent;
    if (typeof screenX != 'undefined')
        seed += (screenX/screenY).toString();
    else if (typeof screenLeft != 'undefined')
        seed += (screenLeft/screenTop).toString();
    if (typeof document.body.clientHeight != 'undefined')
        seed += (document.body.clientHeight/document.body.clientWidth).toString();
    seed += (new Date()).getTime().toString();
    seed += Math.random().toString();
    substrIndex = Math.floor(Math.random()*21);
    newVid = crmSha1Hash(seed).substr(substrIndex,20);
    finalVid = '';
    for (n=0; n<newVid.length; n++)
        finalVid += (Math.floor(Math.random()*2)) ? newVid.charAt(n).toUpperCase() : newVid.charAt(n);
    return finalVid;
}

function crmGetHostName() {
    var h;
    var arrHostName=document.location.hostname.split(".");
    if (arrHostName[arrHostName.length-1] == "com" || arrHostName[arrHostName.length-1] == "nna")
    h="."+arrHostName[arrHostName.length-2]+"."+arrHostName[arrHostName.length-1];
  else
        h=document.location.hostname;

  return h;
}

// ###  Gets new VID and sets cookie
//      uses: crmVidCookieName
//      calls: crmGetCookie, crmMakeNewVID, crmDeleteCookie, crmSetCookie, crmMakeExpDate
function crmGetVID() {
    var vid = crmGetCookie(crmVidCookieName);
    if (vid==null) vid = crmMakeNewVID();
    var hostName = crmGetHostName();
  if (crmAllowCreateVidCookie) {
    crmDeleteCookie(crmVidCookieName,"/",hostName);
      crmSetCookie( crmVidCookieName, vid, crmMakeExpDate(365,0,0), "/", hostName);
  }
    return vid;
}

// ###  Sets Referral Cookies (session) if they are found in the query string
function crmSetReferralCookies () {
    var hostName = crmGetHostName();
    var queryList = crmGetQueryStringArray();
  var site="";
  var area="";
  var creative="";
  var dcc="";
  var dcp="";
  var cmp="";

  for(n=0; n<queryList.length; n++) {
        if ( queryList[n].name.toLowerCase() == crmReferralSite.toLowerCase() ) {
      site=queryList[n].value;
    } else if ( queryList[n].name.toLowerCase() == crmReferralArea.toLowerCase() ) {
      area=queryList[n].value
    } else if ( queryList[n].name.toLowerCase() == crmReferralCreative.toLowerCase() ) {
      creative=queryList[n].value
    } else if ( queryList[n].name.toLowerCase() == crmDoubleClickCampain.toLowerCase() ) {
      dcc=queryList[n].value
    } else if ( queryList[n].name.toLowerCase() == crmDoubleClickPlacement.toLowerCase() ) {
      dcp=queryList[n].value
    } else if ( queryList[n].name.toLowerCase() == "cmp" ) {
      cmp=queryList[n].value
    }
    }

  if ( dcc!="" || dcp!="" ) {
        crmDeleteCookie(crmDoubleClickCampain, '/', hostName);
        crmDeleteCookie(crmDoubleClickPlacement, '/', hostName);
        crmDeleteCookie(crmReferralSite, '/', hostName);
        crmDeleteCookie(crmReferralArea, '/', hostName);
        crmDeleteCookie(crmReferralCreative, '/', hostName);

        crmSetCookie(crmDoubleClickCampain, dcc, crmMakeExpDate(7,0,0), '/', hostName);
        crmSetCookie(crmDoubleClickPlacement, dcp, crmMakeExpDate(7,0,0), '/', hostName);
  } else if ( site!="" || area!="" || creative!="" ) {
        crmDeleteCookie(crmDoubleClickCampain, '/', hostName);
        crmDeleteCookie(crmDoubleClickPlacement, '/', hostName);
        crmDeleteCookie(crmReferralSite, '/', hostName);
        crmDeleteCookie(crmReferralArea, '/', hostName);
        crmDeleteCookie(crmReferralCreative, '/', hostName);

        crmSetCookie(crmReferralSite, site + ";", crmMakeExpDate(7,0,0), '/', hostName);
        crmSetCookie(crmReferralArea, area + ";", crmMakeExpDate(7,0,0), '/', hostName);
        crmSetCookie(crmReferralCreative, creative, crmMakeExpDate(7,0,0), '/', hostName);
  } else if (cmp != "") {
        crmDeleteCookie(crmDoubleClickCampain, '/', hostName);
        crmDeleteCookie(crmDoubleClickPlacement, '/', hostName);
        crmDeleteCookie(crmReferralSite, '/', hostName);
        crmDeleteCookie(crmReferralArea, '/', hostName);
        crmDeleteCookie(crmReferralCreative, '/', hostName);

        crmSetCookie(crmReferralSite, cmp + ";;", crmMakeExpDate(7,0,0), '/', hostName);
  }
}

// ###  Checks query string and cookie info to see how crmDebugState should be set
function crmSetDebug() {
    if(/crmdebug=(on|[1-3])/i.test(location.search)){
        crmDebugState=(RegExp.$1=='on')? 1 : +RegExp.$1 ;
        crmDeleteCookie(crmDebugCookie,'/',location.hostname);
        crmSetCookie(crmDebugCookie,crmDebugState,'','/',location.hostname);
    }else if(/crmdebug=(off|0)/i.test(location.search)){
        crmDebugState=0;
        crmDeleteCookie(crmDebugCookie,'/',location.hostname);
    }else{
        crmDebugState=crmGetCookie(crmDebugCookie);
    }
}

// ###  Checks to see if the value is null, undefined or empty string. If any of
//      these are true, it returns the safe value. Otherwise passes the value
//      back.
function crmGetSafeValue(initValue, safeValue) {
    if (typeof initValue == 'undefined' || initValue == null || initValue == '')
        return safeValue;
    return initValue;
}

// ###  Sets the the global vars crmBuildNum and crmBuildDate with provided values
function crmBuildInfo (buildNum, buildTime) {
    crmBuildNum = buildNum;
    crmBuildDate = new Date(buildTime);
}

// ###  Aggregates parameter values in the order required for the core event fucntion and returns them in an array
//      Determines if call is orderless or not and handles each case accordingly
function crmMarshallEventParams (evtFunc, coreFunc) {
    var args = evtFunc.arguments;
    var finalParams = [];
    if (typeof args[0] == 'object') { // assume orderless
        var paramsObj = args[0];
        var paramNames = crmGetParamNames(coreFunc);
        for(var n=0; n<paramNames.length; n++){
            if(typeof paramsObj[ paramNames[n] ] == 'string'){
                finalParams[n] = crmConvertParam(paramsObj[ paramNames[n] ]);
            }else{
                finalParams[n] = paramsObj[ paramNames[n] ];
            }
        }
    } else { // assume ordered
        for(var n=0; n<args.length; n++)
            if(typeof args[n] == 'string'){
                finalParams[n] = crmConvertParam(args[n]);
            }else{
                finalParams[n] = args[n];
            }
    }
    return finalParams;
}

// ###  Converts all space characters to underscores
//      This is used to make our parameters with spaces match BI's style
//      It also cleans up some of the various Z parameters to match BI's expectations
function crmConvertParam (str) {
    // remove any entities. BI never, ever wants them.
    str=str.replace(/&(amp;)?[#\w]+;|[™©®]/g,'');

    if (str.toLowerCase() =="juke™" || str.toLowerCase() =="juke"){
        str = "Juke"
    }
    str=str.replace(/ /g,"_");
    return str
} 


// ###  Returns an array of function parameters names associated to their argument position
//      Array is both indexed (returning arg name by position) and named (returning arg position by name)
function crmGetParamNames (func) {
    var funcStr = func.toString();
    var paramsStart = funcStr.indexOf('(')+1;
    var paramsEnd = funcStr.lastIndexOf(')',funcStr.indexOf('{'));
    var params = funcStr.substring(paramsStart,paramsEnd).replace(/\s/g,'').split(',');
    for (var index in params)
        params[ params[index] ] = index;
    return params;
}

// ###  SHA1 hashing functions
function crmSha1Hash(msg) {
    var K = [0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6];
    msg += String.fromCharCode(0x80);
    var l = Math.ceil(msg.length/4) + 2;
    var N = Math.ceil(l/16);
    var M = new Array(N);
    for (var i=0; i<N; i++) {
        M[i] = new Array(16);
        for (var j=0; j<16; j++) {
            M[i][j] = (msg.charCodeAt(i*64+j*4)<<24) | (msg.charCodeAt(i*64+j*4+1)<<16) |
                      (msg.charCodeAt(i*64+j*4+2)<<8) | (msg.charCodeAt(i*64+j*4+3));
        }
    }
    M[N-1][14] = ((msg.length-1) >>> 30) * 8;
    M[N-1][15] = ((msg.length-1)*8) & 0xffffffff;
    var H0 = 0x67452301;
    var H1 = 0xefcdab89;
    var H2 = 0x98badcfe;
    var H3 = 0x10325476;
    var H4 = 0xc3d2e1f0;
    var W = new Array(80); var a, b, c, d, e;
    for (var i=0; i<N; i++) {
        for (var t=0;  t<16; t++) W[t] = M[i][t];
        for (var t=16; t<80; t++) W[t] = ROTL(W[t-3] ^ W[t-8] ^ W[t-14] ^ W[t-16], 1);
        a = H0; b = H1; c = H2; d = H3; e = H4;
        for (var t=0; t<80; t++) {
            var s = Math.floor(t/20);
            var T = (ROTL(a,5) + f(s,b,c,d) + e + K[s] + W[t]) & 0xffffffff;
            e = d;
            d = c;
            c = ROTL(b, 30);
            b = a;
            a = T;
        }
        H0 = (H0+a) & 0xffffffff;
        H1 = (H1+b) & 0xffffffff;
        H2 = (H2+c) & 0xffffffff;
        H3 = (H3+d) & 0xffffffff;
        H4 = (H4+e) & 0xffffffff;
    }
    return H0.toHexStr() + H1.toHexStr() + H2.toHexStr() + H3.toHexStr() + H4.toHexStr();
}

function f(s, x, y, z) {
    switch (s) {
    case 0: return (x & y) ^ (~x & z);
    case 1: return x ^ y ^ z;
    case 2: return (x & y) ^ (x & z) ^ (y & z);
    case 3: return x ^ y ^ z;
    }
}
function ROTL(x, n) {
    return (x<<n) | (x>>>(32-n));
}
Number.prototype.toHexStr = function() {
    var s="", v;
    for (var i=7; i>=0; i--) { v = (this>>>(i*4)) & 0xf; s += v.toString(16); }
    return s;
}// END SHA1

  // ############################## INITIALIZE ###################################
  // ###    Validate script tag attributes. Check that the crmEngine
  if (jQuery("meta[name='pagesite']") &&
      jQuery("meta[name='pageid']") &&
      jQuery("meta[name='pagelocale']")){

/*    
  if    (   $('crmEngine') &&                                   // ensure that the crmEngine ID exists
        $('crmEngine').tagName.toLowerCase()=='script' &&   // ensure that crmEngine ID is assigned to a SCRIPT tag
        $('crmEngine').getAttribute('pageid') &&            // ensures that the pageid attribute is set
        $('crmEngine').getAttribute('pagelocale') &&        // ensures that the pagelocal attribute is set
        ( $('crmEngine').getAttribute('pagelocale')=='es' || $('crmEngine').getAttribute('pagelocale')=='en' ) &&
                                                            // ensures that the pagelocal attribute is set to either en or es
        $('crmEngine').getAttribute('pagesite') &&          // ensures that the pagesite attribute is set
        ( $('crmEngine').getAttribute('pagesite')=='nissan' || $('crmEngine').getAttribute('pagesite')=='infiniti' )
                                                            // ensures that the pagesite attribute is set to either nissan or infiniti
    ) {
*/      

    // Check crmDebug settings and set accordingly
    crmSetDebug();

    // Set global vars from tag attributes
    crmPageLocale = jQuery("meta[name='pagelocale']").attr("content");//$('crmEngine').getAttribute('pagelocale');  // en, es
    crmPageSite = jQuery("meta[name='pagesite']").attr("content");//$('crmEngine').getAttribute('pagesite');        // nissan, infiniti
    crmPageId = jQuery("meta[name='pageid']").attr("content");//$('crmEngine').getAttribute('pageid');

    // Setup base crmEvent# functions which will be redefined by tagging file
    for (n = 1; n <=99; n++) eval('crmEvent'+n+'= function(){ crmDebug("Event '+n+' Failed.\\n\\nThere is either no crmEvent'+n+' function in the '+crmPageId+'.js tagging file, \\nor this tagging file failed to load."); }');

    //Create our client detection object
    crmClient = new CrmClientDetectClass();

    //Create our offer object to hold real time offer info
    crmOffer = new CrmOfferClass();

    // Check for any referral params
    crmSetReferralCookies();

    // Determine URL prefix from current script
    crmJsURLPrefix =  "/content/nissan/us/en/crm/"; //$('crmEngine').src.substring( 0,$('crmEngine').src.indexOf('/engine.js')+1 ); // the '/' in '/engine.js' seems to be required for collage preview to work

    // default behavior for non-email matchback files
    if (crmAllowCreateVidCookie) {
            // Include provider specific js files
            //document.write('\n<scr'+'ipt src="' + crmJsURLPrefix +    'providers/atlas.js" language="JavaScript" type="text/javascript"></scr'+'ipt>\n');
            //document.write('<scr'+'ipt src="' + crmJsURLPrefix +  'providers/doubleclick.js" language="JavaScript" type="text/javascript"></scr'+'ipt>\n');
            //document.write('<scr'+'ipt src="' + crmJsURLPrefix +  'providers/eloyalty.js" language="JavaScript" type="text/javascript"></scr'+'ipt>\n');
            //document.write('<scr'+'ipt src="' + crmJsURLPrefix +  'providers/omniture.js" language="JavaScript" type="text/javascript"></scr'+'ipt>\n');
            //document.write('<scr'+'ipt src="' + crmJsURLPrefix +  'providers/legacy.js" language="JavaScript" type="text/javascript"></scr'+'ipt>\n');
            //document.write('<scr'+'ipt src="' + crmJsURLPrefix +  'providers/factortg.js" language="JavaScript" type="text/javascript"></scr'+'ipt>\n');
            //document.write('<scr'+'ipt src="' + crmJsURLPrefix +  'providers/opinionlab.js" language="JavaScript" type="text/javascript"></scr'+'ipt>\n');
            if(crmPageId != 19036 && crmPageId != 19047){
                //document.write('<scr'+'ipt src="' + crmJsURLPrefix +  'providers/surveygizmo.js" language="JavaScript" type="text/javascript"></scr'+'ipt>\n');
            }
    } else {
        // special behavior for email matchback
        //document.write('<scr'+'ipt src="' + crmJsURLPrefix +  'providers/omniture.js" language="JavaScript" type="text/javascript"></scr'+'ipt>\n');
    }

    // Include page specific tagging file
    document.write('<scr'+'ipt src="' + crmJsURLPrefix + crmPageId + '.js" language="JavaScript" type="text/javascript"></scr'+'ipt>\n');


  } else { // Create crmEngine failure debug message
    crmErrorMsg = "crmEngine FAILED\n";
    if ( !jQuery("meta[name='pageid']") )
        crmErrorMsg += '"crmEngine" ID not found';
    //else if ( $('crmEngine').tagName.toLowerCase() != 'script' )
    //  crmErrorMsg += '"crmEngine" ID not assigned to SCRIPT tag';
    else if ( !jQuery("meta[name='pageid']") )
        crmErrorMsg += '"pageid" attribute not found in the appropriate meta tag';
    else if ( !jQuery("meta[name='pagesite']") )
        crmErrorMsg += '"pagesite" attribute not found in the appropriate meta tag';
    else if ( jQuery("meta[name='pagesite']").attr("content")!='nissan' && jQuery("meta[name='pagesite']").attr("content")!='infiniti' )
        crmErrorMsg += '"pagesite" attribute must be set to either "nissan" or "infiniti" in the appropriate meta tag';
    else if ( !jQuery("meta[name='pagelocale']") )
        crmErrorMsg += '"pagelocale" attribute not found in the appropriate meta tag';
    else if ( jQuery("meta[name='pagelocale']").attr("content")!='es' && jQuery("meta[name='pagelocale']").attr("content")!='en' )
        crmErrorMsg += '"pagelocale" attribute must be set to either "en" or "es" in the appropriate meta tag';
    else
        crmErrorMsg += 'unkown error with the CRM Engine script tag structure';
    crmDebug(crmErrorMsg);
  }

// ###  CRM Conditional Call
//      key:                        A unique value that associates together all the calls to this function so that it can determine if its the first call or not
//      initialValue:               The value to be returned on the first call
//      subsequentValue (optional): The value to be returned on all subsequent calls
//                                  Will return an empty string if no value is provided
function crmCondCall (key, initialValue, subsequentValue) {
    if(crmCondCallList[key]) {
        return (typeof subsequentValue=='undefined') ? '' : subsequentValue;
    } else {
        crmCondCallList[key]=true;
        return initialValue
    }
}


// ###  Returns a named array of offer values. Will wait until crmOffer is loaded
//      and return the results. If crmOffer dosent return within a given amount
//      of time, function will timeout and return defaults
//      uses: crmOffer
function crmGetOffers(callBackFunc,callBackStartTime) {
    //if this is the first time called, time stamp this
    callBackStartTime = (typeof callBackStartTime == 'undefined') ? (new Date()).getTime() : callBackStartTime;

    //setup restults var in case we have results to return
    var result = [];

    // Check to see if offers have loaded
    if ( crmOffer.getLoaded() ) {
        //got offers back, return the values and fire the callback
        result['pfaSwf'] = crmOffer.getPfaSwf();
        result['pfaText'] = crmOffer.getPfaText();
        result['pfaImg'] = crmOffer.getPfaImg();
        result['pfaLink'] = crmOffer.getPfaLink();
        eval(callBackFunc+'(result)');
    } else {
        //check to see if we still have time to try again
        if ( ((new Date()).getTime() - callBackStartTime) < crmCheckOfferTimeOut ) {
            //still have time, try again
            setTimeout('crmGetOffers(\'' + callBackFunc + '\','+callBackStartTime+')',crmCheckOfferFreq);
        } else {
            //out of time, return default values and fire the callback;
            result['pfaSwf'] = crmOffer.getPfaSwfDefault();
            result['pfaText'] = crmOffer.getPfaTextDefault();
            result['pfaImg'] = crmOffer.getPfaImgDefault();
            result['pfaLink'] = crmOffer.getPfaLinkDefault();
            eval(callBackFunc+'(result)');
        }
    }
}

function callPromo(index){
       var currentPromo = promoTerser.data.promo.vehicleData[index]
       var url = currentPromo.link.href;
       var trackingCode = currentPromo.trackingCode;
       var crmev = currentPromo.link.crmEvent;
       var px = currentPromo.link.popupX;
       var py = currentPromo.link.popupY;
       var targ = currentPromo.link.target;
       var qamp = (url.indexOf('?')>=0)?'&':'?';
       var placement = index + 1;
       var gtMod;
       if(genTag.model == undefined){
           gtMod = "";
       }else{
           gtMod = genTag.model;
       }
       calledUrl = url + qamp + "intcmp=" + trackingCode + "." + genTag.siteSection + "." + genTag.pageName + ".P" + placement + "." + gtMod +".";
       var newWindow;
       if(targ=="_blank"){
           newWindow = window.open(calledUrl, '_blank');
           newWindow.focus();
       }else if(targ=="popup"){
           newWindow = window.open(calledUrl, "infinitiusa", "addressbar=no,menubar=no,location=no,resizable=yes,scrollbars=no,status=yes,width="+py+",height="+px);
           newWindow.focus();
       }else{
           location.href = calledUrl;
       }
}

function crmVehicleParam(param) {
return param.replace(/^[\W_]+|[\W_]+$/g,'') 
.replace(/(\b\w)/ig,function(letter){return String(letter).toUpperCase()})
.replace(/\W/g,'_')
.replace('JUKE','Juke')
.replace('Altimacoupe','Altima_Coupe')
.replace(/__+/g,'_');
}
// $Id: omniture.js 74749 2010-03-24 12:49:22Z chigurus $

jQuery(document).ready(function(){
    imn='s_i_'+s.fun;
    if(s.d.images[imn]){s.ios=1};
});

// ###  Sets the style for the reporting image so that it does not affect page layout
document.write('<style type="text/css">.omnReportImg{position:absolute;height:1px;width:1px;top:-1px;left:-1px;}</style>');

// ###  Sets all omniture variables to empty strings
//      Called before every call to omniture to make sure we don't resend parameters
function omnFlushObj() {
    for (n=1; n <= 50; n++) eval('s.prop'+n+'="";');
    for (n=1; n <= 50; n++) eval('s.eVar'+n+'="";');
    for (n=1; n <= 5;  n++) eval('s.heir'+n+'="";');
    s.channel="";
    s.campaign="";
    s.products="";
    s.state="";
    s.zip="";
    s.pageType="";
    s.pageName="";
}
// ###  For concatenating report suite IDs (e.g. nissanusacom)
var omnAccountSiteObj = new CrmSiteClass ({
                    nissan:     'nissan',
                    infinitiusaretailers: 'nissaninfinitiretailers',
                    infiniti:   'nissaninfiniti'});

// ###  For concatenating reporting domain (e.g. metrics.nissanusa.com)
var omnDomainSiteObj = new CrmSiteClass ({
                    nissan:     'nissanusa.com',
                    infinitiusaretailers: 'infinitiusa.com',
                    infiniti:   'infinitiusa.com'});

// ###  Associate Env URLS for this provider
var omnEnvObj = new CrmEnvironmentClass ({
                    dev:    'dev',
                    qa:     'dev',
                    stage:  'dev',
                    prod:   ''});

//SR 19115                  
var userAgentString = navigator.userAgent;
userAgentString = userAgentString.toLowerCase();
if(userAgentString.indexOf("regressiontest")!=-1)
{
    omnEnvObj = new CrmEnvironmentClass ({
                    dev:    'dev',
                    qa:     'dev',
                    stage:  'dev',
                    prod:   'dev'});

console.log("regressiontest captured");
}
//End of SR 19115

// ###  Associate langauges with provider specific strings
var omnLocaleObj=[];
if (omnAccountSiteObj.isNissan)
    omnLocaleObj = new CrmLocaleClass ({
                    es:     'espanol',
                    en:     'usacom' });
else
    omnLocaleObj = new CrmLocaleClass ({
                    es:     (omnEnvObj.getEnv() == "dev") ? "" : "com",
                    en:     (omnEnvObj.getEnv() == "dev") ? "" : "com" });

// ###  Primary tag firing function
function pingOmn () {
  // add querystring param 'owe' value to prop37 for tagging internal links for Owners Email Matchback
  if (s.getQueryParam('owe','') != '')
    s.prop37 = s.getQueryParam('owe','').toLowerCase();

  omnCustEvents();
  s.t();
}

// ###  Primary tag firing function
function pingOmnLink (linkType, linkName) {
  omnCustEvents();
  s.tl(this, linkType, linkName);
}

// ###  Applies custom event rules to the omniture object.
function omnCustEvents () {
    if (s.events=='') return;
    var evts = s.events.split(',');
    if ( listContains(evts,'event4') || listContains(evts,'event8') || listContains(evts,'event11') || listContains(evts,'event22') || listContains(evts,'event23') || listContains(evts,'event24') || listContains(evts,'event28') || listContains(evts,'event31') ) {
        s.events +=',event12';
        if (s.prop20 != "") {
            s.prop20 = s.prop20 + "_Lead";
        }
        crmDebug('Omniture: Added "event12" to s.events\n\ns.events = '+s.events);
    }
    if ( listContains(evts,'event1') || listContains(evts,'event2') || listContains(evts,'event6') || listContains(evts,'event44')) {
        s.events +=',event13';
        if (s.prop20 != "" && s.prop20.indexOf("_Lead") < 0) {
            s.prop20 = s.prop20 + "_Handraiser";
        }
        crmDebug('Omniture: Added "event13" to s.events\n\ns.events = '+s.events);
    }

    function listContains(stack, needle) {
        for(var idx in stack) {
            if ( stack[idx]==needle ) {
                return true;
            }
        }
        return false;
    }

    if (s.prop29 != '') {
        s.eVar29 = s.prop29;
    }
}

var doubleclickAccountIdObj=[];
if (omnAccountSiteObj.isNissan)
    doubleclickAccountIdObj = new CrmLocaleClass ({
                    es:     '1507209',
                    en:     '1507209' });
else
    doubleclickAccountIdObj = new CrmLocaleClass ({
                    es:     '',
                    en:     '1500855' });

function omnGetDoubleclickSite() {
    return 'DFA#' + doubleclickAccountIdObj.getLocale() + ':v26=[["DFA:"+lis+":"+lip+":"+lastimp+":"+lastimptime+":"+lcs+":"+lcp+":"+lastclk+":"+lastclktime]]';
}

/* SiteCatalyst code version: H.9.
Copyright 1997-2007 Omniture, Inc. More info available at
http://www.omniture.com */
/* Specify the Report Suite ID(s) to track here */
var s_account=omnEnvObj.getEnv() + omnAccountSiteObj.getSite() + omnLocaleObj.getLocale()
var s=s_gi(s_account)
/************************** CONFIG SECTION **************************/
/* You may add or alter any code config here. */
/* E-commerce Config */
s.currencyCode="USD"
/* Link Tracking Config */
s.trackDownloadLinks=true
s.trackExternalLinks=true
s.trackInlineStats=true
s.linkDownloadFileTypes="exe,zip,wav,mp3,mov,mpg,avi,wmv,doc,pdf,xls,ics"
//s.linkInternalFilters="javascript:,z.com,xterra.com,nissanmotoracceptance.com,nissanmotors.com,nissan-usa.com,nissandriven.com,nissanowner.com,nissan-na.com,nissanusa.com"
s.linkInternalFilters="javascript:,nissanusa.com/,infinitiusaretailers.com/,infinitiusa.com/"
s.linkLeaveQueryString=false
s.linkTrackVars="None"
s.linkTrackEvents="None"
s.fpcdomain=omnDomainSiteObj.getSite();
s.fpcsubdomain="metrics"
s.sslfpcsubdomain="smetrics"
s.vmk="43D8135C"
s.maxFlashVersion="9"
currentSite=location.href
s.variableProvider=omnGetDoubleclickSite();

/* WARNING: Changing any of the below variables will cause drastic
changes to how your visitor data is collected.  Changes should only be
made when instructed to do so by your account manager.*/
//s.fpcdomain=omnDomainSiteObj.getSite(); //Custom Code to grab current domain
s.trackingServer="metrics."+s.fpcdomain;
s.trackingServerSecure="smetrics."+s.fpcdomain;
s.dc=112


/* Plugin Config */
s.usePlugins=true;
function s_doPlugins(s) {
    /* Add calls to plugins here */


    // We need to set the appropriate campaign variables into prop38.  This is either a concatenation of dcp+dcc or Site+Area+Creative
    // or possibly CMP.  If we do NOT have a 'dcn' parameter, then we also set these values into eVar25.  If there IS a 'dcn' parameter,
    // this signifies that the link came from a doubleclick national campaign, and we will expect the DC/omn integration to fill in eVar25
    // instead.

    if (s.getQueryParam('dcp','') == '' && s.getQueryParam('dcc','') == '')
    {
        s.prop38=(s.getQueryParam('Site','')=='' || /search.(infinitiusaretailers|infinitiusa|nissanusa).com/.test(location.host)) ? s.getQueryParam('CMP','') : (s.getQueryParam('Site','') + '.' + s.getQueryParam('Area','') + '.' + s.getQueryParam('Creative',''));
    } else {
        s.prop38=s.getQueryParam('dcp','') + s.getQueryParam('dcc','');
    }

    s.prop38=s.getValOnce(s.prop38,'camp',0);

    s.eVar30= s.prop38;

    if (s.getQueryParam('dcn','') == '') {
        s.eVar25 = s.prop38;
    }

    // array of possible querystring value/prop42 value pairs, add/delete as needed
    var newArr = [
        ['cpi','CPO_Ad'],
        ['cpn','CPO_Ad'],
        ['dwi','Dealer_Website'],
        ['dwn','Dealer_Website'],
        ['ebr','eBrochure'],
        ['mci','Multi-cultural_Ad'],
        ['mcn','Multi-cultural_Ad'],    
        ['nml','Corporate_Referral'],   
        ['oii','Opt-In_Incentive'],
        ['oin','National_Ad'],
        ['oir','Regional_Ad'],
        ['omd','National_Ad'],
        ['oth','Other_Ad'],
        ['pages','YellowPages'],
        ['partner','Partner_Ad'],
        ['ppi','Paid_Search_National'],
        ['ppn','Paid_Search_National'],
        ['ppr','Paid_Search_Regional'],
        ['ppy','Paid_Inclusion'],
        ['snx','Social_Network'],
        ['taf','Tell-a-Friend'],
        ['tqd','National_Email'],
        ['vdx','Vanity_Domain'],
        ['widget','Widget'],
        ['yp','YellowPages'],
        ['zmm','Regional_Ad'],
        ['zmn','National_Ad']
        ];

    var p=s.prop38;
    var varFirst = s.getVisitStart("visitStart");
    var valFound = false;
    // possible "National Email" values for prop42
    var arrNatlEmail = ['n0','n1','i0','i1'];

    if(varFirst){
        if(typeof(eventArray)=="undefined") {
            eventArray = [];
        }
        eventArray.push("event42");
        s.events=eventArray.join(',');

        for(i=0;i<arrNatlEmail.length;i++){
            if(s.getQueryParam('site','').indexOf(arrNatlEmail[i])!=-1){
                s.prop42='National_Email';
                valFound=true;
            }
        }

        for(i=0;i<newArr.length;i++){
            if(p.indexOf(newArr[i][0])>-1){
                s.prop42=newArr[i][1];
                valFound=true;
            }
        }

        if(valFound==false){
            if((p==null) || (p=='')){
                s.prop42='VISTA';
            }else{
                s.prop42='Unknown_Ad';
            }
        }

    }else{
        s.prop42 = '';
    }

    s.prop36='';

    
    if(s.prop7 != '')
    {
        if(s.prop1!=undefined && s.prop1.toLowerCase() == 'regional' )
        {
            s.prop12= s.prop3+ '_' + s.prop7;
        }
        else{
            s.prop12 = 'National_' + s.prop7;
        }
        s.eVar12 = s.prop12;
    }
    

    s.eVar4=s.getQueryParam('intcmp','');
    s.eVar4=s.getValOnce(s.eVar4,'evar4',0);
    if (s.eVar4!=''){
        s.prop36= s.getValOnce('promo.'+s.eVar4,'evar4',0);
    }

    s.eVar5=s.getQueryParam('tool','');
    s.eVar5=s.getValOnce(s.eVar5,'evar5',0);
    if (s.eVar5!=''){
    s.prop36= s.getValOnce('toolbox.'+s.eVar5,'evar5',0);
    }

    s.eVar13=s.getQueryParam('rdx','');
    s.eVar13=s.getValOnce(s.eVar13,'evar13',0);
    if (s.eVar13!=''){
    s.prop36= s.getValOnce('redirect.'+s.eVar13,'evar13',0);
    }
    


    s.eVar38=s.getQueryParam('next','');
    s.eVar38=s.getValOnce(s.eVar38,'next',0);
    if (s.eVar38!=''){
    s.prop36= s.getValOnce('next_step.'+s.eVar38,'evar38',0);
    }

    s.eVar33=s.getQueryParam('offer','');
    s.eVar33=s.getValOnce(s.eVar33,'offer',0);


    if (s.prop40==''){
         s.prop40=s.getQueryParam('nvx','');
    }


    /*
     * Changed to match
     */
    s.prop41=s.detectFlash('s_fv');
    
    
    /*Time Parting: Set for EST (GMT - 5)*/

    var newDate = new Date();
    var theYear = newDate.getFullYear();
    s.prop45=s.getTimeParting('h','-5',theYear); // Set hour 
    s.prop46=s.getTimeParting('d','-5',theYear); // Set day

    // Added to support sending omniture properties to OpinionLab
    s.createOpinionLabObject();

    // Added to support call to doubleclick
    s.partnerDFACheck('dfa','dcn','prop23');
}
s.doPlugins=s_doPlugins




/************************** PLUGINS SECTION *************************/
/* You may insert any plugins you wish to use here.                 */

/*
 * Plugin: getVisitStart v2.0 - returns 1 on first page of visit
 * otherwise 0
 */
s.getVisitStart=new Function("c",""
+"var s=this,v=1,t=new Date;t.setTime(t.getTime()+1800000);if(s.c_r(c"
+")){v=0}if(!s.c_w(c,1,t)){s.c_w(c,1,0)}if(!s.c_r(c)){v=0}return v;");

/*
 * Plugin: getQueryParam 1.3 - Return query string parameter values
 */
s.getQueryParam=new Function("qp","d",""
+"var s=this,v='',i,t;d=d?d:'';while(qp){i=qp.indexOf(',');i=i<0?qp.l"
+"ength:i;t=s.gcgi(qp.substring(0,i));if(t)v+=v?d+t:t;qp=qp.substring"
+"(i==qp.length?i:i+1)}return v");
//changes to fix SR 16464: Start Here
var str = location.href;
var strHash = str.indexOf("#");
var strSearch = str.indexOf("?");
if(((strHash < strSearch) && strHash >-1) || strSearch == -1)
{   
    s.gcgi=new Function("k",""
    +"var v='',s=this;if(k&&s.wd.location.hash){var q=s.wd.location.has"
    +"h.toLowerCase(),qq=q.indexOf('?');q=qq<0?q:q.substring(qq+1);v=s."
    +"pt(q,'&','cgif',k.toLowerCase())}return v");
}else{
    s.gcgi=new Function("k",""
    +"var v='',s=this;if(k&&s.wd.location.search){var q=s.wd.location.sea"
    +"rch.toLowerCase(),qq=q.indexOf('?');q=qq<0?q:q.substring(qq+1);v=s."
    +"pt(q,'&','cgif',k.toLowerCase())}return v");
}
//changes to fix SR 16464: End Here
s.cgif=new Function("t","k",""
+"if(t){var s=this,i=t.indexOf('='),sk=i<0?t:t.substring(0,i),sv=i<0?"
+"'True':t.substring(i+1);if(sk.toLowerCase()==k)return s.epa(sv)}ret"
+"urn ''");

/*
 * Plugin: getValOnce 0.2 - get a value once per session or number of days
 */
s.getValOnce=new Function("v","c","e",""
+"var s=this,k=s.c_r(c),a=new Date;e=e?e:0;if(v){a.setTime(a.getTime("
+")+e*86400000);s.c_w(c,v,e?a:0);}return v==k?'':v");

/*
 * Plugin: Flash Detection 0.4 - Detect Flash version number
 */
s.detectFlash=new Function("cn",""
+"var s=this,fv=-1,dwi=0,r,w,mt=s.n.mimeTypes;if(cn&&s.c_r(cn))return"
+" s.c_r(cn);if(s.pl&&s.pl.length){if(s.pl['Shockwave Flash 2.0'])fv="
+"2;x=s.pl['Shockwave Flash'];if(x){fv=0;z=x.description;if(z)fv=z.su"
+"bstring(16,z.indexOf('.'));}}else if(mt&&mt.length){x=mt['applicati"
+"on/x-shockwave-flash'];if(x&&x.enabledPlugin)fv=0;}if(fv<=0)dwi=1;w"
+"=s.u.indexOf('Win')!=-1?1:0;if(dwi&&s.isie&&w&&execScript){result=f"
+"alse;for(var i=s.maxFlashVersion;i>=3&&result!=true;i--){execScript"
+"('on error resume next: result = IsObject(CreateObject(\"ShockwaveF"
+"lash.ShockwaveFlash.'+i+'\"))','VBScript');fv=i;}}r=fv==-1?'flash n"
+"ot detected':fv==0?'flash enabled (no version)':'flash '+fv;s.c_w(c"
+"n,r,0);return r;");

/*
 * Plugin: Create Partner Object for OpinionLab integration
 * Make sure call to this plugin is done after any prop/evar changes
 */
s.createOpinionLabObject=new Function(""
+"var p=this,t,x,z=0,y,d=',';omtr_opinionlab=new Object();p.vl='pageN"
+"ame,pageURL,referrer,purchaseID,channel,server,pageType,campaign,st"
+"ate,zip,events,products,linkName,linkType';for(var n=1;n<51;n++)p.v"
+"l+=',prop'+n+',eVar'+n+',hier'+n;t=x=p.vl;while(t){y=t.indexOf(d);y"
+"=y<0?t.length:y;t=t.substring(0,y);omtr_opinionlab[t]=p[t];z+=y+d.l"
+"ength;t=x.substring(z,x.length);t=z<x.length?t:''}");

/*
 * Partner Plugin: DFA Check 0.6 - Restrict DFA calls to once a visit,
 * per report suite, per click through. Used in conjunction with VISTA
 */
s.partnerDFACheck=new Function("c","src","p",""
+"var s=this,dl=',',cr,nc,q,g,i,j,k,fnd,v=1,t=new Date,cn=0,ca=new Ar"
+"ray,aa=new Array,cs=new Array;t.setTime(t.getTime()+1800000);cr=s.c"
+"_r(c);if(cr){v=0}ca=s.split(cr,dl);aa=s.split(s.un,dl);for(i=0;i<aa"
+".length;i++){fnd=0;for(j=0;j<ca.length;j++){if(aa[i]==ca[j]){fnd=1}"
+"}if(!fnd){cs[cn]=aa[i];cn++}}if(cs.length){for(k=0;k<cs.length;k++)"
+"{nc=(nc?nc+dl:'')+cs[k]}cr=(cr?cr+dl:'')+nc;s.vpr(p,nc);v=1}q=s.wd."
+"location.search.toLowerCase();g=q.indexOf(src.toLowerCase()+'=');if"
+"(g>0){s.vpr(p,cr);v=1}if(!s.c_w(c,cr,t)){s.c_w(c,cr,0)}if(!s.c_r(c)"
+"){v=0}if(v<1)s.vpr('variableProvider','')");

s.vpr=new Function("vs","v",
"var s=this,k=vs.substring(0,2)=='s.'?vs.substring(2):vs;s['vpv_'+k]="
+"v;s['vpm_'+k]=1");

/*
 * Utility Function: split v1.5 - split a string (JS 1.0 compatible)
 * REQUIRED for the above partnerDFACheck function (omn/doubleclick integration)
 */
s.split=new Function("l","d",""
+"var i,x=0,a=new Array;while(l){i=l.indexOf(d);i=i>-1?i:l.length;a[x"
+"++]=l.substring(0,i);l=l.substring(i+d.length);}return a");


/*
 * Plugin: getTimeParting 1.3 - Set timeparting values based on time zone
 */
s.getTimeParting=new Function("t","z","y",""
+"dc=new Date('1/1/2000');f=15;ne=8;if(dc.getDay()!=6||"
+"dc.getMonth()!=0){return'Data Not Available'}else{;z=parseInt(z);"
+"if(y=='2009'){f=8;ne=1};gmar=new Date('3/1/'+y);dsts=f-gmar.getDay("
+");gnov=new Date('11/1/'+y);dste=ne-gnov.getDay();spr=new Date('3/'"
+"+dsts+'/'+y);fl=new Date('11/'+dste+'/'+y);cd=new Date();"
+"if(cd>spr&&cd<fl){z=z+1}else{z=z};utc=cd.getTime()+(cd.getTimezoneO"
+"ffset()*60000);tz=new Date(utc + (3600000*z));thisy=tz.getFullYear("
+");var days=['Sunday','Monday','Tuesday','Wednesday','Thursday','Fr"
+"iday','Saturday'];if(thisy!=y){return'Data Not Available'}else{;thi"
+"sh=tz.getHours();thismin=tz.getMinutes();thisd=tz.getDay();var dow="
+"days[thisd];var ap='AM';var dt='Weekday';var mint='00';if(thismin>3"
+"0){mint='30'}if(thish>=12){ap='PM';thish=thish-12};if (thish==0){th"
+"ish=12};if(thisd==6||thisd==0){dt='Weekend'};var timestring=thish+'"
+":'+mint+ap;var daystring=dow;var endstring=dt;if(t=='h'){return tim"
+"estring}if(t=='d'){return daystring};if(t=='w'){return en"
+"dstring}}};"
);





/************* DO NOT ALTER ANYTHING BELOW THIS LINE ! **************/
var s_objectID;function s_c2fe(f){var x='',s=0,e,a,b,c;while(1){e=
f.indexOf('"',s);b=f.indexOf('\\',s);c=f.indexOf("\n",s);if(e<0||(b>=
0&&b<e))e=b;if(e<0||(c>=0&&c<e))e=c;if(e>=0){x+=(e>s?f.substring(s,e):
'')+(e==c?'\\n':'\\'+f.substring(e,e+1));s=e+1}else return x
+f.substring(s)}return f}function s_c2fa(f){var s=f.indexOf('(')+1,e=
f.indexOf(')'),a='',c;while(s>=0&&s<e){c=f.substring(s,s+1);if(c==',')
a+='","';else if(("\n\r\t ").indexOf(c)<0)a+=c;s++}return a?'"'+a+'"':
a}function s_c2f(cc){cc=''+cc;var fc='var f=new Function(',s=
cc.indexOf(';',cc.indexOf('{')),e=cc.lastIndexOf('}'),o,a,d,q,c,f,h,x
fc+=s_c2fa(cc)+',"var s=new Object;';c=cc.substring(s+1,e);s=
c.indexOf('function');while(s>=0){d=1;q='';x=0;f=c.substring(s);a=
s_c2fa(f);e=o=c.indexOf('{',s);e++;while(d>0){h=c.substring(e,e+1);if(
q){if(h==q&&!x)q='';if(h=='\\')x=x?0:1;else x=0}else{if(h=='"'||h=="'"
)q=h;if(h=='{')d++;if(h=='}')d--}if(d>0)e++}c=c.substring(0,s)
+'new Function('+(a?a+',':'')+'"'+s_c2fe(c.substring(o+1,e))+'")'
+c.substring(e+1);s=c.indexOf('function')}fc+=s_c2fe(c)+';return s");'
eval(fc);return f}function s_gi(un,pg,ss){var c="function s_c(un,pg,s"
+"s){var s=this;s.wd=window;if(!s.wd.s_c_in){s.wd.s_c_il=new Array;s."
+"wd.s_c_in=0;}s._il=s.wd.s_c_il;s._in=s.wd.s_c_in;s._il[s._in]=s;s.w"
+"d.s_c_in++;s.m=function(m){return (''+m).indexOf('{')<0};s.fl=funct"
+"ion(x,l){return x?(''+x).substring(0,l):x};s.co=function(o){if(!o)r"
+"eturn o;var n=new Object,x;for(x in o)if(x.indexOf('select')<0&&x.i"
+"ndexOf('filter')<0)n[x]=o[x];return n};s.num=function(x){x=''+x;for"
+"(var p=0;p<x.length;p++)if(('0123456789').indexOf(x.substring(p,p+1"
+"))<0)return 0;return 1};s.rep=function(x,o,n){var i=x.indexOf(o);wh"
+"ile(x&&i>=0){x=x.substring(0,i)+n+x.substring(i+o.length);i=x.index"
+"Of(o,i+n.length)}return x};s.ape=function(x){var s=this,i;x=x?s.rep"
+"(escape(''+x),'+','%2B'):x;if(x&&s.charSet&&s.em==1&&x.indexOf('%u'"
+")<0&&x.indexOf('%U')<0){i=x.indexOf('%');while(i>=0){i++;if(('89ABC"
+"DEFabcdef').indexOf(x.substring(i,i+1))>=0)return x.substring(0,i)+"
+"'u00'+x.substring(i);i=x.indexOf('%',i)}}return x};s.epa=function(x"
+"){var s=this;return x?unescape(s.rep(''+x,'+',' ')):x};s.pt=functio"
+"n(x,d,f,a){var s=this,t=x,z=0,y,r;while(t){y=t.indexOf(d);y=y<0?t.l"
+"ength:y;t=t.substring(0,y);r=s.m(f)?s[f](t,a):f(t,a);if(r)return r;"
+"z+=y+d.length;t=x.substring(z,x.length);t=z<x.length?t:''}return ''"
+"};s.isf=function(t,a){var c=a.indexOf(':');if(c>=0)a=a.substring(0,"
+"c);if(t.substring(0,2)=='s_')t=t.substring(2);return (t!=''&&t==a)}"
+";s.fsf=function(t,a){var s=this;if(s.pt(a,',','isf',t))s.fsg+=(s.fs"
+"g!=''?',':'')+t;return 0};s.fs=function(x,f){var s=this;s.fsg='';s."
+"pt(x,',','fsf',f);return s.fsg};s.c_d='';s.c_gdf=function(t,a){var "
+"s=this;if(!s.num(t))return 1;return 0};s.c_gd=function(){var s=this"
+",d=s.wd.location.hostname,n=s.fpCookieDomainPeriods,p;if(!n)n=s.coo"
+"kieDomainPeriods;if(d&&!s.c_d){n=n?parseInt(n):2;n=n>2?n:2;p=d.last"
+"IndexOf('.');if(p>=0){while(p>=0&&n>1){p=d.lastIndexOf('.',p-1);n--"
+"}s.c_d=p>0&&s.pt(d,'.','c_gdf',0)?d.substring(p):d}}return s.c_d};s"
+".c_r=function(k){var s=this;k=s.ape(k);var c=' '+s.d.cookie,i=c.ind"
+"exOf(' '+k+'='),e=i<0?i:c.indexOf(';',i),v=i<0?'':s.epa(c.substring"
+"(i+2+k.length,e<0?c.length:e));return v!='[[B]]'?v:''};s.c_w=functi"
+"on(k,v,e){var s=this,d=s.c_gd(),l=s.cookieLifetime,t;v=''+v;l=l?(''"
+"+l).toUpperCase():'';if(e&&l!='SESSION'&&l!='NONE'){t=(v!=''?parseI"
+"nt(l?l:0):-60);if(t){e=new Date;e.setTime(e.getTime()+(t*1000))}}if"
+"(k&&l!='NONE'){s.d.cookie=k+'='+s.ape(v!=''?v:'[[B]]')+'; path=/;'+"
+"(e&&l!='SESSION'?' expires='+e.toGMTString()+';':'')+(d?' domain='+"
+"d+';':'');return s.c_r(k)==v}return 0};s.eh=function(o,e,r,f){var s"
+"=this,b='s_'+e+'_'+s._in,n=-1,l,i,x;if(!s.ehl)s.ehl=new Array;l=s.e"
+"hl;for(i=0;i<l.length&&n<0;i++){if(l[i].o==o&&l[i].e==e)n=i}if(n<0)"
+"{n=i;l[n]=new Object}x=l[n];x.o=o;x.e=e;f=r?x.b:f;if(r||f){x.b=r?0:"
+"o[e];x.o[e]=f}if(x.b){x.o[b]=x.b;return b}return 0};s.cet=function("
+"f,a,t,o,b){var s=this,r;if(s.apv>=5&&(!s.isopera||s.apv>=7))eval('t"
+"ry{r=s.m(f)?s[f](a):f(a)}catch(e){r=s.m(t)?s[t](e):t(e)}');else{if("
+"s.ismac&&s.u.indexOf('MSIE 4')>=0)r=s.m(b)?s[b](a):b(a);else{s.eh(s"
+".wd,'onerror',0,o);r=s.m(f)?s[f](a):f(a);s.eh(s.wd,'onerror',1)}}re"
+"turn r};s.gtfset=function(e){var s=this;return s.tfs};s.gtfsoe=new "
+"Function('e','var s=s_c_il['+s._in+'];s.eh(window,\"onerror\",1);s."
+"etfs=1;var c=s.t();if(c)s.d.write(c);s.etfs=0;return true');s.gtfsf"
+"b=function(a){return window};s.gtfsf=function(w){var s=this,p=w.par"
+"ent,l=w.location;s.tfs=w;if(p&&p.location!=l&&p.location.host==l.ho"
+"st){s.tfs=p;return s.gtfsf(s.tfs)}return s.tfs};s.gtfs=function(){v"
+"ar s=this;if(!s.tfs){s.tfs=s.wd;if(!s.etfs)s.tfs=s.cet('gtfsf',s.tf"
+"s,'gtfset',s.gtfsoe,'gtfsfb')}return s.tfs};s.ca=function(){var s=t"
+"his,imn='s_i_'+s.fun;if(s.d.images&&s.apv>=3&&(!s.isopera||s.apv>=7"
+")&&(s.ns6<0||s.apv>=6.1)){s.ios=1;if(!s.d.images[imn]&&(!s.isns||(s"
+".apv<4||s.apv>=5))){s.d.write('<im'+'g class=\"omnReportImg\" name=\"'+imn+'\" height=1 wi" // added class for custom style -Designory
+"dth=1 border=0 alt=\"\">');if(!s.d.images[imn])s.ios=0}}};s.mr=func"
+"tion(sess,q,ta){var s=this,dc=s.dc,t1=s.trackingServer,t2=s.trackin"
+"gServerSecure,ns=s.visitorNamespace,unc=s.rep(s.fun,'_','-'),imn='s"
+"_i_'+s.fun,im,b,e,rs='http'+(s.ssl?'s':'')+'://'+(t1?(s.ssl&&t2?t2:"
+"t1):((ns?ns:(s.ssl?'102':unc))+'.'+(s.dc?s.dc:112)+'.2o7.net'))+'/b"
+"/ss/'+s.un+'/1/H.9-pdvu-2/'+sess+'?[AQB]&ndh=1'+(q?q:'')+(s.q?s.q:'"
+"')+'&[AQE]';if(s.isie&&!s.ismac){if(s.apv>5.5)rs=s.fl(rs,4095);else"
+" rs=s.fl(rs,2047)}if(s.ios||s.ss){if (!s.ss)s.ca();im=s.wd[imn]?s.w"
+"d[imn]:s.d.images[imn];if(!im)im=s.wd[imn]=new Image;im.src=rs;if(r"
+"s.indexOf('&pe=')>=0&&(!ta||ta=='_self'||ta=='_top'||(s.wd.name&&ta"
+"==s.wd.name))){b=e=new Date;while(e.getTime()-b.getTime()<500)e=new"
+" Date}return ''}return '<im'+'g class=\"omnReportImg\" sr'+'c=\"'+rs+'\" width=1 height=1 " // added class for custom style -Designory
+"border=0 alt=\"\">'};s.gg=function(v){var s=this;return s.wd['s_'+v"
+"]};s.glf=function(t,a){if(t.substring(0,2)=='s_')t=t.substring(2);v"
+"ar s=this,v=s.gg(t);if(v)s[t]=v};s.gl=function(v){var s=this;s.pt(v"
+",',','glf',0)};s.gv=function(v){var s=this;return s['vpm_'+v]?s['vp"
+"v_'+v]:(s[v]?s[v]:'')};s.havf=function(t,a){var s=this,b=t.substrin"
+"g(0,4),x=t.substring(4),n=parseInt(x),k='g_'+t,m='vpm_'+t,q=t,v=s.l"
+"inkTrackVars,e=s.linkTrackEvents;s[k]=s.gv(t);if(s.lnk||s.eo){v=v?v"
+"+','+s.vl_l:'';if(v&&!s.pt(v,',','isf',t))s[k]='';if(t=='events'&&e"
+")s[k]=s.fs(s[k],e)}s[m]=0;if(t=='visitorID')q='vid';else if(t=='pag"
+"eURL')q='g';else if(t=='referrer')q='r';else if(t=='vmk')q='vmt';el"
+"se if(t=='charSet'){q='ce';if(s[k]&&s.em==2)s[k]='UTF-8'}else if(t="
+"='visitorNamespace')q='ns';else if(t=='cookieDomainPeriods')q='cdp'"
+";else if(t=='cookieLifetime')q='cl';else if(t=='variableProvider')q"
+"='vvp';else if(t=='currencyCode')q='cc';else if(t=='channel')q='ch'"
+";else if(t=='campaign')q='v0';else if(s.num(x)) {if(b=='prop')q='c'"
+"+n;else if(b=='eVar')q='v'+n;else if(b=='hier'){q='h'+n;s[k]=s.fl(s"
+"[k],255)}}if(s[k]&&t!='linkName'&&t!='linkType')s.qav+='&'+q+'='+s."
+"ape(s[k]);return ''};s.hav=function(){var s=this;s.qav='';s.pt(s.vl"
+"_t,',','havf',0);return s.qav};s.lnf=function(t,h){t=t?t.toLowerCas"
+"e():'';h=h?h.toLowerCase():'';var te=t.indexOf('=');if(t&&te>0&&h.i"
+"ndexOf(t.substring(te+1))>=0)return t.substring(0,te);return ''};s."
+"ln=function(h){var s=this,n=s.linkNames;if(n)return s.pt(n,',','lnf"
+"',h);return ''};s.ltdf=function(t,h){t=t?t.toLowerCase():'';h=h?h.t"
+"oLowerCase():'';var qi=h.indexOf('?');h=qi>=0?h.substring(0,qi):h;i"
+"f(t&&h.substring(h.length-(t.length+1))=='.'+t)return 1;return 0};s"
+".ltef=function(t,h){t=t?t.toLowerCase():'';h=h?h.toLowerCase():'';i"
+"f(t&&h.indexOf(t)>=0)return 1;return 0};s.lt=function(h){var s=this"
+",lft=s.linkDownloadFileTypes,lef=s.linkExternalFilters,lif=s.linkIn"
+"ternalFilters;lif=lif?lif:s.wd.location.hostname;h=h.toLowerCase();"
+"if(s.trackDownloadLinks&&lft&&s.pt(lft,',','ltdf',h))return 'd';if("
+"s.trackExternalLinks&&(lef||lif)&&(!lef||s.pt(lef,',','ltef',h))&&("
+"!lif||!s.pt(lif,',','ltef',h)))return 'e';return ''};s.lc=new Funct"
+"ion('e','var s=s_c_il['+s._in+'],b=s.eh(this,\"onclick\");s.lnk=s.c"
+"o(this);s.t();s.lnk=0;if(b)return this[b](e);return true');s.bc=new"
+" Function('e','var s=s_c_il['+s._in+'],f;if(s.d&&s.d.all&&s.d.all.c"
+"ppXYctnr)return;s.eo=e.srcElement?e.srcElement:e.target;eval(\"try{"
+"if(s.eo&&(s.eo.tagName||s.eo.parentElement||s.eo.parentNode))s.t()}"
+"catch(f){}\");s.eo=0');s.ot=function(o){var a=o.type,b=o.tagName;re"
+"turn (a&&a.toUpperCase?a:b&&b.toUpperCase?b:o.href?'A':'').toUpperC"
+"ase()};s.oid=function(o){var s=this,t=s.ot(o),p=o.protocol,c=o.oncl"
+"ick,n='',x=0;if(!o.s_oid){if(o.href&&(t=='A'||t=='AREA')&&(!c||!p||"
+"p.toLowerCase().indexOf('javascript')<0))n=o.href;else if(c){n=s.re"
+"p(s.rep(s.rep(s.rep(''+c,\"\\r\",''),\"\\n\",''),\"\\t\",''),' ',''"
+");x=2}else if(o.value&&(t=='INPUT'||t=='SUBMIT')){n=o.value;x=3}els"
+"e if(o.src&&t=='IMAGE')n=o.src;if(n){o.s_oid=s.fl(n,100);o.s_oidt=x"
+"}}return o.s_oid};s.rqf=function(t,un){var s=this,e=t.indexOf('='),"
+"u=e>=0?','+t.substring(0,e)+',':'';return u&&u.indexOf(','+un+',')>"
+"=0?s.epa(t.substring(e+1)):''};s.rq=function(un){var s=this,c=un.in"
+"dexOf(','),v=s.c_r('s_sq'),q='';if(c<0)return s.pt(v,'&','rqf',un);"
+"return s.pt(un,',','rq',0)};s.sqp=function(t,a){var s=this,e=t.inde"
+"xOf('='),q=e<0?'':s.epa(t.substring(e+1));s.sqq[q]='';if(e>=0)s.pt("
+"t.substring(0,e),',','sqs',q);return 0};s.sqs=function(un,q){var s="
+"this;s.squ[un]=q;return 0};s.sq=function(q){var s=this,k='s_sq',v=s"
+".c_r(k),x,c=0;s.sqq=new Object;s.squ=new Object;s.sqq[q]='';s.pt(v,"
+"'&','sqp',0);s.pt(s.un,',','sqs',q);v='';for(x in s.squ)s.sqq[s.squ"
+"[x]]+=(s.sqq[s.squ[x]]?',':'')+x;for(x in s.sqq)if(x&&s.sqq[x]&&(x="
+"=q||c<2)){v+=(v?'&':'')+s.sqq[x]+'='+s.ape(x);c++}return s.c_w(k,v,"
+"0)};s.wdl=new Function('e','var s=s_c_il['+s._in+'],r=true,b=s.eh(s"
+".wd,\"onload\"),i,o,oc;if(b)r=this[b](e);for(i=0;i<s.d.links.length"
+";i++){o=s.d.links[i];oc=o.onclick?\"\"+o.onclick:\"\";if((oc.indexO"
+"f(\"s_gs(\")<0||oc.indexOf(\".s_oc(\")>=0)&&oc.indexOf(\".tl(\")<0)"
+"s.eh(o,\"onclick\",0,s.lc);}return r');s.wds=function(){var s=this;"
+"if(s.apv>3&&(!s.isie||!s.ismac||s.apv>=5)){if(s.b&&s.b.attachEvent)"
+"s.b.attachEvent('onclick',s.bc);else if(s.b&&s.b.addEventListener)s"
+".b.addEventListener('click',s.bc,false);else s.eh(s.wd,'onload',0,s"
+".wdl)}};s.vs=function(x){var s=this,v=s.visitorSampling,g=s.visitor"
+"SamplingGroup,k='s_vsn_'+s.un+(g?'_'+g:''),n=s.c_r(k),e=new Date,y="
+"e.getYear();e.setYear(y+10+(y<1900?1900:0));if(v){v*=100;if(!n){if("
+"!s.c_w(k,x,e))return 0;n=x}if(n%10000>v)return 0}return 1};s.dyasmf"
+"=function(t,m){if(t&&m&&m.indexOf(t)>=0)return 1;return 0};s.dyasf="
+"function(t,m){var s=this,i=t?t.indexOf('='):-1,n,x;if(i>=0&&m){var "
+"n=t.substring(0,i),x=t.substring(i+1);if(s.pt(x,',','dyasmf',m))ret"
+"urn n}return 0};s.uns=function(){var s=this,x=s.dynamicAccountSelec"
+"tion,l=s.dynamicAccountList,m=s.dynamicAccountMatch,n,i;s.un.toLowe"
+"rCase();if(x&&l){if(!m)m=s.wd.location.host;if(!m.toLowerCase)m=''+"
+"m;l=l.toLowerCase();m=m.toLowerCase();n=s.pt(l,';','dyasf',m);if(n)"
+"s.un=n}i=s.un.indexOf(',');s.fun=i<0?s.un:s.un.substring(0,i)};s.sa"
+"=function(un){s.un=un;if(!s.oun)s.oun=un;else if((','+s.oun+',').in"
+"dexOf(un)<0)s.oun+=','+un;s.uns()};s.t=function(){var s=this,trk=1,"
+"tm=new Date,sed=Math&&Math.random?Math.floor(Math.random()*10000000"
+"000000):tm.getTime(),sess='s'+Math.floor(tm.getTime()/10800000)%10+"
+"sed,yr=tm.getYear(),vt=tm.getDate()+'/'+tm.getMonth()+'/'+(yr<1900?"
+"yr+1900:yr)+' '+tm.getHours()+':'+tm.getMinutes()+':'+tm.getSeconds"
+"()+' '+tm.getDay()+' '+tm.getTimezoneOffset(),tfs=s.gtfs(),ta='',q="
+"'',qs='';s.uns();if(!s.q){var tl=tfs.location,x='',c='',v='',p='',b"
+"w='',bh='',j='1.0',k=s.c_w('s_cc','true',0)?'Y':'N',hp='',ct='',pn="
+"0,ps;if(s.apv>=4)x=screen.width+'x'+screen.height;if(s.isns||s.isop"
+"era){if(s.apv>=3){j='1.1';v=s.n.javaEnabled()?'Y':'N';if(s.apv>=4){"
+"j='1.2';c=screen.pixelDepth;bw=s.wd.innerWidth;bh=s.wd.innerHeight;"
+"if(s.apv>=4.06)j='1.3'}}s.pl=s.n.plugins}else if(s.isie){if(s.apv>="
+"4){v=s.n.javaEnabled()?'Y':'N';j='1.2';c=screen.colorDepth;if(s.apv"
+">=5){bw=s.d.documentElement.offsetWidth;bh=s.d.documentElement.offs"
+"etHeight;j='1.3';if(!s.ismac&&s.b){s.b.addBehavior('#default#homePa"
+"ge');hp=s.b.isHomePage(tl)?\"Y\":\"N\";s.b.addBehavior('#default#cl"
+"ientCaps');ct=s.b.connectionType}}}else r=''}if(s.pl)while(pn<s.pl."
+"length&&pn<30){ps=s.fl(s.pl[pn].name,100)+';';if(p.indexOf(ps)<0)p+"
+"=ps;pn++}s.q=(x?'&s='+s.ape(x):'')+(c?'&c='+s.ape(c):'')+(j?'&j='+j"
+":'')+(v?'&v='+v:'')+(k?'&k='+k:'')+(bw?'&bw='+bw:'')+(bh?'&bh='+bh:"
+"'')+(ct?'&ct='+s.ape(ct):'')+(hp?'&hp='+hp:'')+(p?'&p='+s.ape(p):''"
+")}if(s.usePlugins)s.doPlugins(s);var l=s.wd.location,r=tfs.document"
+".referrer;if(!s.pageURL)s.pageURL=s.fl(l?l:'',255);if(!s.referrer)s"
+".referrer=s.fl(r?r:'',255);if(s.lnk||s.eo){var o=s.eo?s.eo:s.lnk;if"
+"(!o)return '';var p=s.gv('pageName'),w=1,t=s.ot(o),n=s.oid(o),x=o.s"
+"_oidt,h,l,i,oc;if(s.eo&&o==s.eo){while(o&&!n&&t!='BODY'){o=o.parent"
+"Element?o.parentElement:o.parentNode;if(!o)return '';t=s.ot(o);n=s."
+"oid(o);x=o.s_oidt}oc=o.onclick?''+o.onclick:'';if((oc.indexOf(\"s_g"
+"s(\")>=0&&oc.indexOf(\".s_oc(\")<0)||oc.indexOf(\".tl(\")>=0)return"
+" ''}ta=n?o.target:1;h=o.href?o.href:'';i=h.indexOf('?');h=s.linkLea"
+"veQueryString||i<0?h:h.substring(0,i);l=s.linkName?s.linkName:s.ln("
+"h);t=s.linkType?s.linkType.toLowerCase():s.lt(h);if(t&&(h||l))q+='&"
+"pe=lnk_'+(t=='d'||t=='e'?s.ape(t):'o')+(h?'&pev1='+s.ape(h):'')+(l?"
+"'&pev2='+s.ape(l):'');else trk=0;if(s.trackInlineStats){if(!p){p=s."
+"gv('pageURL');w=0}t=s.ot(o);i=o.sourceIndex;if(s.gg('objectID')){n="
+"s.gg('objectID');x=1;i=1}if(p&&n&&t)qs='&pid='+s.ape(s.fl(p,255))+("
+"w?'&pidt='+w:'')+'&oid='+s.ape(s.fl(n,100))+(x?'&oidt='+x:'')+'&ot="
+"'+s.ape(t)+(i?'&oi='+i:'')}}if(!trk&&!qs)return '';if(s.p_r)s.p_r()"
+";var code='';if(trk&&s.vs(sed))code=s.mr(sess,(vt?'&t='+s.ape(vt):'"
+"')+s.hav()+q+(qs?qs:s.rq(s.un)),ta);s.sq(trk?'':qs);s.lnk=s.eo=s.li"
+"nkName=s.linkType=s.wd.s_objectID=s.ppu='';return code};s.tl=functi"
+"on(o,t,n){var s=this;s.lnk=s.co(o);s.linkType=t;s.linkName=n;s.t()}"
+";s.ssl=(s.wd.location.protocol.toLowerCase().indexOf('https')>=0);s"
+".d=document;s.b=s.d.body;s.n=navigator;s.u=s.n.userAgent;s.ns6=s.u."
+"indexOf('Netscape6/');var apn=s.n.appName,v=s.n.appVersion,ie=v.ind"
+"exOf('MSIE '),o=s.u.indexOf('Opera '),i;if(v.indexOf('Opera')>=0||o"
+">0)apn='Opera';s.isie=(apn=='Microsoft Internet Explorer');s.isns=("
+"apn=='Netscape');s.isopera=(apn=='Opera');s.ismac=(s.u.indexOf('Mac"
+"')>=0);if(o>0)s.apv=parseFloat(s.u.substring(o+6));else if(ie>0){s."
+"apv=parseInt(i=v.substring(ie+5));if(s.apv>3)s.apv=parseFloat(i)}el"
+"se if(s.ns6>0)s.apv=parseFloat(s.u.substring(s.ns6+10));else s.apv="
+"parseFloat(v);s.em=0;if(String.fromCharCode){i=escape(String.fromCh"
+"arCode(256)).toUpperCase();s.em=(i=='%C4%80'?2:(i=='%U0100'?1:0))}s"
+".sa(un);s.vl_l='visitorID,vmk,ppu,charSet,visitorNamespace,cookieDo"
+"mainPeriods,cookieLifetime,pageName,pageURL,referrer,currencyCode,p"
+"urchaseID';s.vl_t=s.vl_l+',variableProvider,channel,server,pageType"
+",campaign,state,zip,events,products,linkName,linkType';for(var n=1;"
+"n<51;n++)s.vl_t+=',prop'+n+',eVar'+n+',hier'+n;s.vl_g=s.vl_t+',trac"
+"kDownloadLinks,trackExternalLinks,trackInlineStats,linkLeaveQuerySt"
+"ring,linkDownloadFileTypes,linkExternalFilters,linkInternalFilters,"
+"linkNames';if(pg)s.gl(s.vl_g);s.ss=ss;if(!ss){s.wds();s.ca()}}",
l=window.s_c_il,n=navigator,u=n.userAgent,v=n.appVersion,e=v.indexOf(
'MSIE '),m=u.indexOf('Netscape6/'),a,i,s;if(l)for(i=0;i<l.length;i++){
s=l[i];if(s.oun==un)return s;else if(s.fs(s.oun,un)){s.sa(un);return s
}}if(e>0){a=parseInt(i=v.substring(e+5));if(a>3)a=parseFloat(i)}
else if(m>0)a=parseFloat(u.substring(m+10));else a=parseFloat(v);if(a
>=5&&v.indexOf('Opera')<0&&u.indexOf('Opera')<0){eval(c);return new
s_c(un,pg,ss)}else s=s_c2f(c);return s(un,pg,ss)}


// $Id: atlas.js 65 2006-06-21 20:31:51Z rootl $


//// ###	Associate Env URLS for this provider
// Doubleclick uses the same url for qa, stage and prod
var doubleclickEnvObj = new CrmEnvironmentClass ({
					dev:	'fls.doubleclick.net',
					qa:		'fls.doubleclick.net',
					stage:	'fls.doubleclick.net',
					prod:	'fls.doubleclick.net'});

// ###	Associate sites with provider specific strings
var doubleclickSiteObj = new CrmSiteClass ({
					nissan:		'1361549',
					infiniti:	'1361547'});


function pingDoubleclick ( type, cat, events ) {
    var axel = Math.random()+"";
    var a = axel * 10000000000000;

    var tagString = doubleclickEnvObj.getProtocol() + doubleclickEnvObj.getEnv() + '/activityi;src='+ doubleclickSiteObj.getSite() +';'
    tagString += 'type='+type+';'
    tagString += 'cat='+cat+';';
    tagString += events;
    tagString += 'ord=1;num='+ a + '?';


    crmCreateTag( 'iframe', $(crmTagBucketId),
                    {attrName:'src',	        attrValue: tagString },
                    {attrName:'id',		        attrValue: 'DoubleClickTag_'+new Date().getTime()},
                    {attrName:'height',	        attrValue: '1'},
                    {attrName:'width',	        attrValue: '1'},
                    {attrName:'frameborder',	attrValue: '0'} );
}
// ###      Applies custom event rules to the omniture object.
function dcCustEvents ( events ) {
      if (events=='') return;
      if ( events.indexOf('u1=true') || events.indexOf('u1=true') || events.indexOf('u1=true')) {
            events +='u6=true;';
            crmDebug('Doubleclick: Added "u6" to events\n\nevents = '+ events);
      }
}
// BEGIN SURVEYGIZMO
function getMetaContents(mn){
    t=document.getElementsByTagName("meta");
    for(i=0;i<t.length;i++){
        if(t[i].name==mn)
            return t[i].content;
    }
    return "undefined";
}

// Return a value from the query string
function sgGetQueryParam(paramName) {
    var qString = location.search.substring(1);
    if (qString.indexOf(paramName) == -1) return '';
    var pValueStart = qString.indexOf(paramName) + paramName.length + 1;
    var pValueEnd = qString.indexOf('&', pValueStart);
    if (pValueEnd == -1) pValueEnd = qString.length;
    return unescape(qString.substring(pValueStart, pValueEnd));
}

var sgObj = {};  
sgObj.sg = sgGetQueryParam("sg");
sgObj.sgPageID = getMetaContents("pageid");
if(sgObj.sgPageID=="undefined")
    sgObj.sgPageID = getMetaContents("application-container-pageid");

sgObj.sgPageLocale = getMetaContents("pagelocale");
if(sgObj.sgPageLocale=="undefined")
    sgObj.sgPageLocale = "en";

sgObj.aaFlag = 0;
sgObj.objFrameSrc = '';
sgObj.objFrameSrcFeedback = '';
sgObj.objFrameSrcRandom = '';
sgObj.customVarFeedback = '';
sgObj.customVarRandom = '';
sgObj.customQuery = '';

var sgRandOdds = "0";
var sgMinPagePoints = "0";
var sgPageInc = "0";
var sgVisitorID = "0";
var sgeList = "";
var myDebug = null;
var sgShowBoxCalled = false;
var sgUpdateCalled = false;
var sgInitCalled = false;
var sgShown = false;
var sgShownPopup = false;
var sgSurveyNameFeedback = "";
var sgSurveyNameRandom = "";
var sgEventName = "";

function sgGetPageCount() {
    var pageCount = sgGetCookie('sgPageCount')==null || sgGetCookie('sgPageCount')=="" || sgGetCookie('sgPageCount')==undefined || isNaN(sgGetCookie('sgPageCount')) ? 0 : parseInt(sgGetCookie('sgPageCount'));
    return pageCount;
}

function sgLog(message) {
    if (sgObj.sg == "1") {
        if (window.console)
            console.log(message);
        else
            alert(message);
    }
}

function sg() {
    if (sgObj.sg == "1") {
        var sgShown = sgGetShown();
        var sgPageCount = sgGetPageCount();
        var sgeList = sgGetCookie('sgeList')==null || sgGetCookie('sgeList')=="" || sgGetCookie('sgeList')==undefined ? "" : sgGetCookie('sgeList');
        if(typeof(console)!="undefined"){
            console.log(
                    'event:' + sgEventName + '  '
                  + 'sName feeback:' + sgSurveyNameFeedback + '  '
                  + 'sName random:' + sgSurveyNameRandom + '\n'
                  + 'randomOdds (sgr):' + sgRandOdds + '  '
                  + 'minPagePoints (sgm):' + sgMinPagePoints + '  '
                  + 'pageCount (sgp):' + sgPageCount + '  '
                  + 'pInc (sgi):' + sgPageInc + '  '
                  + 'shown (sgs):' + sgShown + '  '
                  + 'eList (sge):' + sgeList + '\n'
                  + 'custom var feedback:' + sgObj.customVarFeedback + '\n'
                  + 'custom var random:' + sgObj.customVarRandom + '\n'
                  + 'custom query:' + sgObj.customQuery + '\n'
                  + 'objFrameSrc:' + sgObj.objFrameSrc + '\n');
        } else {
            alert(  'event:' + sgEventName + '\n'
                  + 'sName feedback:' + sgSurveyNameFeedback + '\n'
                  + 'sName random:' + sgSurveyNameRandom + '\n'
                  + 'randomOdds (sgr):' + sgRandOdds + '\n'
                  + 'minPagePoints (sgm):' + sgMinPagePoints + '\n'
                  + 'pageCount (sgp):' + sgPageCount + '\n'
                  + 'pInc (sgi):' + sgPageInc + '\n'
                  + 'shown (sgs):' + sgShown + '\n'
                  + 'eList (sge):' + sgeList + '\n'
                  + 'custom var feedback:' + sgObj.customVarFeedback + '\n'
                  + 'custom var random:' + sgObj.customVarRandom + '\n'
                  + 'custom query:' + sgObj.customQuery + '\n'
                  + 'objFrameSrc:' + sgObj.objFrameSrc + '\n');
        }
    }
}

// Set Cookie sgObj.setCookie('username',username,365);
function sgSetCookie(c_name,value,expiredays){
    var exdate=new Date();
    exdate.setDate(exdate.getDate()+expiredays);
    document.cookie = c_name + "=" +escape(value) + ((expiredays==null) ? "" : ";expires=" + exdate.toUTCString()) + '; path=/';
}

function sgGetCookie(c_name){
    if (document.cookie.length>0) {
        c_start=document.cookie.indexOf(c_name + "=");
        if (c_start!=-1) {
            c_start=c_start + c_name.length+1;
            c_end=document.cookie.indexOf(";",c_start);
            if (c_end==-1) c_end=document.cookie.length;
            return unescape(document.cookie.substring(c_start,c_end));
        }
    }
    return "";  
}

function sgCheckCookie(c_name){
    var sgCookieName = c_name;
    sgCookieName=getCookie(sgCookieName);
    if (sgCookieName!=null && sgCookieName!="") {
        return 1;
    }else {
        return 0;  
    }   
}
// Delete Cookie sgObj.DeleteCookie('cookie name', '/', '') 
function sgDeleteCookie(name,path,domain){
    if ( getCookie( name ) ) document.cookie = name + "=" +
    ( ( path ) ? ";path=" + path : "") +
    ( ( domain ) ? ";domain=" + domain : "" ) +
    ";expires=Thu, 01-Jan-1970 00:00:01 GMT";   
}

function setParse(sgParam,sgDelimiter,sgSubDelimiter,sgSubBreak){
    this.sgParam = sgParam; 
    this.sgDelimiter = sgDelimiter;
    this.sgSubDelimiter = sgSubDelimiter;
    this.sgSubBreak = sgSubBreak;
    var splitParam = new Array();
    var subsplitParam = new Array();
    splitParam = this.sgParam.split(this.sgDelimiter);
    if(this.sgSubDelimiter != null){
        subsplitParam = splitParam[this.sgSubBreak].split(this.sgSubDelimiter);
        return(subsplitParam = splitParam[this.sgSubBreak].split(this.sgSubDelimiter));
    }else{
        return(splitParam = this.sgParam.split(this.sgDelimiter));  
    }
}

function sgRandomPop(e){
    this.popCheck = e;  
    if(this.popCheck == 0)
        return false;
    return true;
}

var ns4=document.layers
var ie4=document.all
var ns6=document.getElementById&&!document.all
var dragswitch=0
var nsx
var nsy
var nstemp

function drag_dropns(name){
if (!ns4)
return
temp=eval(name)
temp.captureEvents(Event.MOUSEDOWN | Event.MOUSEUP)
temp.onmousedown=gons
temp.onmousemove=dragns
temp.onmouseup=stopns
}

function gons(e){
temp.captureEvents(Event.MOUSEMOVE)
nsx=e.x
nsy=e.y
}
function dragns(e){
if (dragswitch==1){
temp.moveBy(e.x-nsx,e.y-nsy)
return false
}
}

function stopns(){
temp.releaseEvents(Event.MOUSEMOVE)
}

function drag_drop(e){
if (ie4&&dragapproved){
crossobj.style.left=tempx+event.clientX-offsetx
crossobj.style.top=tempy+event.clientY-offsety
return false
}
else if (ns6&&dragapproved){
crossobj.style.left=tempx+e.clientX-offsetx+"px"
crossobj.style.top=tempy+e.clientY-offsety+"px"
return false
}
}

function initializedrag(e){
crossobj=ns6? document.getElementById("showimage") : document.all.showimage
var firedobj=ns6? e.target : event.srcElement
var topelement=ns6? "html" : document.compatMode && document.compatMode!="BackCompat"? "documentElement" : "body"
while (firedobj.tagName!=topelement.toUpperCase() && firedobj.id!="dragbar"){
firedobj=ns6? firedobj.parentNode : firedobj.parentElement
}

if (firedobj.id=="dragbar"){
offsetx=ie4? event.clientX : e.clientX
offsety=ie4? event.clientY : e.clientY

tempx=parseInt(crossobj.style.left)
tempy=parseInt(crossobj.style.top)

dragapproved=true
document.onmousemove=drag_drop
}
}
document.onmouseup=new Function("dragapproved=false")

function showAsPopup() {
    window.open (sgObj.objFrameSrc,"mywindow","toolbar=0,location=0,status=0,menubar=0,directories=0,resizable=1,scrollbars=1,width=650,height=500");
    sgHideBox();
}  

function sgHideBox(){
    crossobj=ns6 ? document.getElementById("showimage") : document.all.showimage;
    if (ie4||ns6){
        crossobj.style.visibility="hidden";
        crossobj.style.display="none";
    }
    else if (ns4)
        document.showimage.visibility="hide";
}

function sgGetShown() {
    var shown = sgGetCookie('sgShown')==null || sgGetCookie('sgShown')=="" || sgGetCookie('sgShown')==undefined || isNaN(sgGetCookie('sgShown')) ? 0 : sgGetCookie('sgShown');

    var shownCookie = sgGetQueryParam("sgs");
    if(parseInt(shownCookie)==0)
        shown=0;
    
    return shown;
}

function sgShowBox(userRequested){
    var userRequested = userRequested!=1 ? 0 : 1;
    if(userRequested==0) {
        if(sgShowBoxCalled)
            return;
        sgShowBoxCalled = true;
    }
    
    sgInit();
    var sgShown = sgGetShown();
    if(userRequested==0) {
        sgSetCookie('sgShown',"1");
        if(sgShown == 1 || sgShownPopup) {
            return;
        }
    }
    
    if(sgObj.aaFlag==1 || userRequested==1)
        sgObj.objFrameSrc = sgObj.objFrameSrcFeedback;
    else
        sgObj.objFrameSrc = sgObj.objFrameSrcRandom;
    
    sgObj.aaFlag = 1;
    var aa = sgObj.objFrameSrc;
    ifrm = document.createElement("IFRAME");
    //ifrm.setAttribute("frameborder","0");
    ifrm.setAttribute("frameBorder","0");
    ifrm.setAttribute("src", aa);
    ifrm.style.width = 662+"px";
    ifrm.style.height = 480+"px";
    ifrm.id = ifrm.name = 'gzFrame';
    document.getElementById('putFrame').innerHTML = "";
    document.getElementById('putFrame').appendChild(ifrm);

    document.getElementById('showimage').style.display = 'inline';

    document.getElementById('showimage').style.display = 'inline';
    crossobj=ns6? document.getElementById("showimage") : document.all.showimage

    var iebody=(document.compatMode && document.compatMode != "BackCompat")? document.documentElement : document.body

    var dsocleft=document.all? iebody.scrollLeft : pageXOffset
    var dsoctop=document.all? iebody.scrollTop : pageYOffset

    var ieWidth = document.body.clientWidth / 2;
    var FFWidth = parent.window.innerWidth / 2;


    dsocleft = ns6? (dsocleft + FFWidth - 320) : (dsocleft + ieWidth - 320) ;
    dsoctop = dsoctop +100;

    crossobj=ns6? document.getElementById("showimage") : document.all.showimage
    if (ie4||ns6)
        crossobj.style.visibility="visible"
    else if (ns4)
        document.showimage.visibility="show"
        
    if(userRequested==0)
        sgShownPopup = true;
        
    sg();
}

function sgStartRandCheck(){
    var sgPageCount = sgGetPageCount();
    var sgShown = sgGetShown();
    
    //Start Min Page View Check
    //sgPS[2] = sgPS[2]*2; //need to double as function is called twice per load
    // Sets the addPageView to true only if the caller function is coreEvent1 -- assumes pageTags will always have function coreEvent1() else the pageview will never iterate

    if (sgShown != 1) { // do as long as survey hasn't been shown
        if (sgPageCount != 0) {
        
            var pageCountCookie = sgGetQueryParam("sgp");
            if(!isNaN(pageCountCookie) && pageCountCookie!="")
                sgPageCount = parseInt(pageCountCookie);
        
            if(sgPageCount >= parseInt(sgMinPagePoints)){ // compare current cookie pageview to what is passed from BI
                // Start Random Odds
                if(parseInt(sgRandOdds)>0 && Math.floor(Math.random()*parseInt(sgRandOdds))==0){    // range is 0 thru (sgRandOdds-1)   ie, sgRandOdds of 1: range is 0 thru 0
                    setTimeout(sgShowBox, 1000);
                } else {
                    sg();
                }
            } else {
                sg();
            }

            var pageCountCookie = sgGetQueryParam("sgp");
            if(isNaN(pageCountCookie) || pageCountCookie=="") {
                // increment after comparing to threshold
                sgPageCount = sgPageCount + parseInt(sgPageInc);    // if pageview hasn't reached the required sgMinPagePoints from BI, increment
                sgLog('Incrementing pageCount to ' + sgPageCount);
            }
            sgSetCookie('sgPageCount',sgPageCount, 30);         // set the above in the cookie
        } else {
            sgLog('Incrementing pageCount to ' + sgPageInc);
            sgSetCookie('sgPageCount',sgPageInc, 30);           // set initial pageview
            sg();
        }
    } else {
        sgLog('Already shown... no need to increment pageCount');
        sg();
    }
}

function sgUpdateState(surveyinfo,pagename){
    sgUpdateCalled = true;
    var stchoice = crmGetCookie("stchoice") == null ? "none" : crmGetCookie("stchoice");
    var sgParam1 = surveyinfo;
    var sgParam2 = pagename;
    var c_undefined = typeof(sgParam2) == "undefined" ? false : true;
    var sgParam2Split = new Array();
    var popRFlag = true;
    var getCallerFunc = (arguments.callee.caller!=null) ? arguments.callee.caller.toString() : "false";
    
    if(getCallerFunc != "false"){
        var startPos = getCallerFunc.search('coreEvent');
        var endPos = getCallerFunc.indexOf('(');
        var funcLen = endPos - startPos;
        sgEventName = getCallerFunc.substr(startPos, funcLen);
    } else {
        sgEventName = "";
    }
    //var getCFuncMatch = /coreEvent(1\(\)|3\(\))()/gi;
    //var getCFuncMatchArr = getCallerFunc.match(getCFuncMatch);
    var addPG = false;
    var startRand = false;
    
    sgParam1Split = setParse(sgParam1,"|");
    sgSurveyNameFeedback = sgParam1Split[1];
    sgSurveyNameRandom = sgParam1Split[6];
    
    // set random & pageview defaults
    sgParam2Split[1] = 500; // odds
    sgParam2Split[2] = 50;  // min Page Points
    sgParam2Split[3] = 10;  // page increment
    
    var e = parseInt(sgGetQueryParam('e'));
    if(c_undefined && sgParam2.indexOf('popup')>0) {
        try{
        sgParam2Split = setParse(sgParam2,"~","|","2");
        }
        catch (err) {}

        sgRandOdds = parseInt(sgParam2Split[1]);
        sgMinPagePoints = sgParam2Split[2];
        sgPageInc = parseInt(sgParam2Split[3]);
        if(typeof e==="number" && e>=0) {
        } else {
            e = parseInt(sgParam2Split[4]);
            if(typeof e==="number" && e>=0) {
            } else {
                e = "";
            }
        }
    } else {
        sgRandOdds = 500;
        sgMinPagePoints = 50;
        sgPageInc = 10;
        if(typeof e==="number" && e>=0) {
        } else {
            e = "";
        }
    }
    
    var r = parseInt(sgGetQueryParam('sgr'));
    if(typeof r==="number" && r >= 0) {
        sgRandOdds = r;
    }
    
    var mpp = parseInt(sgGetQueryParam('sgm'));
    if(typeof mpp==="number" && mpp > 0)
        sgMinPagePoints = mpp;

    var inc = parseInt(sgGetQueryParam('sgi'));
    if(typeof inc==="number" && inc>=0)
        sgPageInc = inc;

    var e = parseInt(sgGetQueryParam('sge'));
    if(typeof e==="number" && e>=0) {
    } else {
        e = parseInt(sgParam2Split[4]);
        if(typeof e==="number" && e>=0) {
        } else {
            e = "";
        }
    }
    
    if(sgGetCookie('sgeList')==null || sgGetCookie('sgeList')=="" || sgGetCookie('sgeList')==undefined) {
        if(e!="") {
            sgeList = "-" + e + "-";
            sgSetCookie('sgeList',sgeList,90);
        } else {
            sgeList = "";
        }
    } else {
        sgeList = sgGetCookie('sgeList');
        if(e!="" && sgeList.indexOf('-' + e + '-') == -1) {
            sgeList += e + '-';
            sgSetCookie('sgeList',sgeList,90);
        }
    }
        
    var custom_var_feedback = surveyinfo.substring(0,surveyinfo.indexOf('~'));
    var custom_var_random = surveyinfo.substring(surveyinfo.indexOf('~')+1);
    
    // Append to the front because the regex on the survey page fails to replace ~ to & if the character before ~ is not a word character
    // i.e.: /\b~/g
    var custom_query = 'stchoice=' + stchoice + '~' + pagename;
    var temp_query = '';
    
    // replace event flags with aggregated values from cookie
    /*
    if(typeof(pagename)!='undefined') {
        var myposition = pagename.indexOf("popup");
        if(myposition>0) {
            temp_query = pagename.substring(0,myposition) + 'popup=|' + sgRandOdds + '|' + sgMinPagePoints + '|' + sgPageInc + '|' + sgeList;
            custom_query = temp_query;
        }
    }
    */
    
    var sgPageCount = sgGetPageCount();
    sgVisitorID = crmGetVID();
    var custom_query_feedback = custom_query + '&sName=' + sgSurveyNameFeedback + '~visitorID=' + sgVisitorID + '~pCount=' + sgPageCount + '~eList=' +  sgeList;
    var custom_query_random = custom_query + '&sName=' + sgSurveyNameRandom + '~visitorID=' + sgVisitorID + '~pCount=' + sgPageCount + '~eList=' +  sgeList;
    sgObj.objFrameSrcFeedback = nonSecurePath + "/sgframe.html" + "?gizmo=" + custom_var_feedback + '::' + custom_query_feedback;
    sgObj.objFrameSrcRandom = nonSecurePath + "/sgframe.html" + "?gizmo=" + custom_var_random + '::' + custom_query_random;
    sgObj.customVarFeedback = custom_var_feedback;
    sgObj.customVarRandom = custom_var_random;
    sgObj.customQuery = custom_query;
    
    startRand = sgStartRandCheck();
}

function adjustSgFrame() {
    var iebody=(document.compatMode && document.compatMode != "BackCompat")? document.documentElement : document.body

    var dsocleft=document.all? iebody.scrollLeft : pageXOffset
    var dsoctop=document.all? iebody.scrollTop : pageYOffset

    var ieWidth = document.body.clientWidth / 2;
    var FFWidth = parent.window.innerWidth / 2;


    dsocleft = ns6 ? (dsocleft + FFWidth - 320) : (dsocleft + ieWidth - 320) ;
    if(typeof(document.getElementById('sgFrameLayer'))!='undefined')
        document.getElementById('sgFrameLayer').style.left=dsocleft+"px";
}

function coreEventDefault() {
    if(!sgUpdateCalled) {
        if(currentURI.indexOf('.infinitiusa.com') > -1) {
            sgUpdateState("HZ6KOHI60Q5PG4R80C9DE578AVHDOG-231519|Default|17|14|15|12","PageName=Page_Not_Yet_Loaded~TID=0~PID="+sgObj.sgPageID+"_"+sgObj.sgPageLocale);
        }
        else if(currentURI.indexOf('.nissanusa.com') > -1) {
            sgUpdateState("RH53T0GNWMFZ1P9667A02DI0BVC0R8-166320|Default|17|14|15|12","PageName=Page_Not_Yet_Loaded~TID=0~PID="+sgObj.sgPageID+"_"+sgObj.sgPageLocale);
        }
    }
}

function sgInit(){
    if(sgInitCalled)
        return;
    sgInitCalled = true;

    var sgD1=document.createElement("div");
    var sgFrameWidth = 680;/*changed value to 680 from 660 to fix SR 19548*/
    sgD1.id="sgFrameLayer";
    //Survey Gizmo changes start
    sgD1.style.position="fixed";
    /*var LeftPosition = (screen.width) ? (screen.width-600)/2 : 0;
    sgD1.style.left=LeftPosition+'px';*/
    sgD1.style.top="40px";
    sgD1.style.zIndex="10000";
    //Survey Gizmo changes end

    var _sgdi="";
    var brows=(brows=="moz")?"pointer":"hand"; //should sniff, later, but this works.

    var msie = navigator.appVersion.split("MSIE");
    var ieVersion = parseFloat(msie[1]);
    var ie7OrLower = (!isNaN(ieVersion) && ieVersion<=7);

    if(ie7OrLower){
        sgD1.style.position="absolute";
        sgD1.className="sgFrameLayer";
        var sgTableWidth = 680;
    } else {
        var sgTableWidth = 660;
    }

    _sgdi+='<div id="showimage" style="-moz-box-sizing:border-box; z-index: 100000; position:absolute;width:'+sgFrameWidth+'px;border:10px solid #999999; display:none;"><table border="0" width="'+sgTableWidth+'" cellspacing="0" cellpadding="0"><tr><td ><table border="0" cellspacing="0" cellpadding="0" height="36px"><tr><td class="sgLinkTD" bgcolor="#FFFFFF" id="dragbar" style="cursor:hand; cursor:pointer" width="600" align="right"><a class="sgGreyLink" href="#" onclick="javascript:showAsPopup();">Take survey later</a>&nbsp;&nbsp;&nbsp;</td><td width="30" align="right" bgcolor="#FFFFFF" id="dragbar" style="cursor:hand; cursor:pointer" width="90%"><a href="#" onClick="sgHideBox();return false" style="color:#000000;"><img src="'+nonSecurePath+'/non-flash/images/btn/popup_close_btn.gif" style="padding:13px 13px 13px 3px;"></a></td></tr><tr><td width="100%" bgcolor="#FFFFFF" colspan="2"><div id="putFrame" style="-moz-box-sizing:border-box;"></div></td></tr></table></td></tr></table></div>';
    sgD1.innerHTML=_sgdi;
    document.body.appendChild(sgD1);

    /*
    if(sgObj.sgPageID == "8270"){
        if(Math.floor(Math.random()*17) ==1) { 
            sgUpdateState("171B3D1LRO0BEXMWAE7LA1E8R5H6RV-230883|Config_Summary|17|122|15|12","PageName=Config_Summary~TID=0~PID="+sgObj.sgPageID+"_"+sgObj.sgPageLocale);
            sgran = true;
            sgShowBox();
        }
    } else {
        if(Math.floor(Math.random()*500)==1) { 
            sgUpdateState("RH53T0GNWMFZ1P9667A02DI0BVC0R8-166320|Random|17|14|15|12","PageName=Random_Survey~TID=0~PID="+sgPageID+"_"+sgObj.sgPageLocale);
            sgran = true;
            sgShowBox();
        }
    }
    */

    adjustSgFrame();
    
    setTimeout(coreEventDefault, 1000);
}

function sgShowImgLink(){
        var d=document.createElement("div");
        //d.outerHTML='<div style="background-color:red;width:100px;height:100px"></div>'
        d.id="sgcss";

        try {
            var fileref=document.createElement("link");
            fileref.setAttribute("rel", "stylesheet");
            fileref.setAttribute("type", "text/css");
            fileref.setAttribute("href", "/css/t/sgizmo.css");
            document.getElementsByTagName("head")[0].appendChild(fileref);
            d.className="sgcssIe7";
        }
        catch(e) {
        }
        
        var _di="";
        var brows=(brows=="moz")?"pointer":"hand"; //should sniff, later, but this works.
        
        _di+='<div onclick="sgShowBox(1);" style="cursor:pointer; position:fixed;_position:absolute;right:20px;bottom:19px;" id="gizmoS"><img src="'+nonSecurePath+'/img/surveygizmo/icon_nissan.gif" onload="setOverSrc(this);"></div>';   
        d.innerHTML=_di;
        document.body.appendChild(d);
        
        var msie = navigator.appVersion.split("MSIE");
        var ieVersion = parseFloat(msie[1]);
        var ie6OrLower = (!isNaN(ieVersion) && ieVersion<=6);

        //d.style.position='fixed';//removing for the fix for bluetooth
        if(ie6OrLower){
            //d.style.position='absolute';//removing for the fix for bluetooth
            d.className="sgcssIe6";
        }
}

function O_LC(){
    sgShowBox();
}
    
function addLoadEvent(func) {
    var oldonload = window.onload;
        if (typeof window.onload != 'function') {
            window.onload = func;
        } else {
            window.onload = function() {
            oldonload();
            func();
        }
    }
    

}
addLoadEvent(sgInit);
//window.onresize=adjustSgFrame;
addLoadEvent(sgShowImgLink);
// END SURVEYGIZMO


// CLICKTOCHAT CLICKTOCHAT CLICKTOCHAT CLICKTOCHAT CLICKTOCHAT CLICKTOCHAT
// addLoadEvent(function(){
//     // this file is now codepacked, so filter out of /es and /espanol 
//     if(location.pathname.indexOf('/es') >= 0){
//         return;
//     }
//     var shouldISeeTheLink=function(){
//         // CLICKTOCHAT PROBABILITY  
//         var probabilityToDisplay_InPercent = 80;
//         
//         switch(sgGetCookie('CTC')){
//             case 'true' : return true;
//             case 'false': return false;
//             default:
//                 var doShowSightMax = (probabilityToDisplay_InPercent/100) > Math.random();
//                 sgSetCookie(
//                     "CTC",
//                     String(doShowSightMax),
//                     90  //(new Date((new Date()).getTime()+60*3600*24*1000*0))
//                 );
//                 return doShowSightMax; 
//         }
//     }
//     var imageRef='http://www.nnainfo.com/SightMaxLeadPilot/SightMaxAgentInterface/chat.smgif?accountID=1&siteID=4&queueID=8';
//     var href="javascript: var e = window.open('http://www.nnainfo.com/SightMaxLeadPilot/SightMaxAgentInterface/PreChatSurvey.aspx?accountID=1&siteID=4&queueID=8', 'chatWindow','width=490,height=470,resizable=0,scrollbars=no,menubar=no,status=no');";
//     var pageMap={
//         'specifications':    'Specs',
//         'packaged-options':  'Package_Options',
//         'individual-options':'Individual_Options',
//         'accessories':       'Accessories'
//     }
// 
//     var specs=function(_pageName){
//         var tagParams={
//             model:location.pathname // obtain the model param--don't put semicolons in this multiline expression!
//                 .replace(/^(?:\/espanol)?\/([^\/]+).*/,'$1')
//                 .replace(/\b\w/g,function(letter){return letter.toUpperCase()})
//                 .replace(/gt-r/i,'GT-R') // screw it. Just replace this whole one.
//                 .replace(/altimacoupe/i,'Altima_Coupe') // screw it. Just replace this one, too.
//                 ,
//             page:pageMap[_pageName]||'Unknown'
//         }
// 
//         jQuery('#movFlashRegionalNav > a').remove();
//         
//         var newHeight=134+5; // height with no links, plus padding so it looks like the other chunks.
//         newHeight+=regionalnavTerser.data.regionalnav.mainnav.links.length*19;
//         newHeight+=regionalnavTerser.data.regionalnav.tools.links.length*19;
//         ///console.info(newHeight)
//         // old style, new style SWF object. 
//         jQuery('#movFlashRegionalNav_swf,object#movFlashRegionalNav').css('height',newHeight+'px');
//         
//         // add it to the div, old style. Cache buster
//         jQuery('div#movFlashRegionalNav').append(            "<a onclick=\"crmEvent10031({model:'"+tagParams.model+"',page:'"+tagParams.page+"'})\" style=\"z-index:-1; width:192px; height:118px; display:block; background:url("+imageRef+") -300px;position:absolute;top:"+(newHeight)+"px;left:20px\" href=\""+href+"\"></a>");
//         // add it to the div, new style. 
//         jQuery('object#movFlashRegionalNav').parent().append("<a onclick=\"crmEvent10031({model:'"+tagParams.model+"',page:'"+tagParams.page+"'})\" style=\"z-index:-1; width:192px; height:118px; display:block; background:url("+imageRef+") -300px;position:absolute;top:"+(39+newHeight)+"px;left:20px\" href=\""+href+"\"></a>");
// 
//         crmEvent10030(tagParams);
//     }
//     var config=function(){
//         // no jQuery on this page, so use pure JS.
//         var summaryContainer = document.getElementById('summaryContainer');
//         var goodies = "<a onclick=\"crmEvent11(defaultTaggingArgs);\" style=\"width:240px; height:112px; display:block; background:url("+imageRef+") no-repeat; padding-bottom: 25px;\" href=\""+href+"\"></a>";
//         summaryContainer.innerHTML = goodies + summaryContainer.innerHTML;
//         summaryContainer.style.paddingTop="15px";
//         crmEvent10(defaultTaggingArgs);
//     }
// 
//     // make a regex of the keys.
//     var pageNames=[];
//     for(var i in pageMap){
//         pageNames.push(i);
//     }
//     
//     if((new RegExp('^('+pageNames.join('|')+')')).test(location.pathname.split('/').pop())){
//         var thisPage=RegExp.$1;
//         if(shouldISeeTheLink()){
//             specs(thisPage);
//         }
//     }else if(location.search.indexOf('service=external/Summary')>=0){
//         if(shouldISeeTheLink()){
//             config();
//         }   
//     }
// 
// });
// $Id: factortg.js 44418 2008-09-24 10:07:03Z vangogh $

// ###	Associate Env URLS for this provider
var factortgEnvObj = new CrmEnvironmentClass ({
                                        dev:    'static.suitesmart.com/cs/sitetags/nissan/nna.js',
                                        qa:     'static.suitesmart.com/cs/sitetags/nissan/nna.js',
                                        stage:  'static.suitesmart.com/cs/sitetags/nissan/nna.js',
                                        prod:   'static.suitesmart.com/cs/sitetags/nissan/nna.js'});


// ###	Primary tag firing function
function pingFactortg ( eventNo, sPageName ) {

	crmCreateTag( 'script', 'head',
					{attrName:'language', attrValue: 'JavaScript'},
					{attrName:'src',	  attrValue: factortgEnvObj.getProtocol() + factortgEnvObj.getEnv() + "?" + "NNAID=" + eventNo + "&PLA=" + sPageName },
					{attrName:'ID',		  attrValue: 'FTG'+new Date().getTime()}
					);

}
// **** PAGE 1 START **** 


function crmEvent10000() { coreEvent10000.apply(null, crmMarshallEventParams(crmEvent10000, coreEvent10000) ); }
function coreEvent10000(model) {
try {
crmDebug(coreEvent10000);

// Tag for OMNITURE
omnFlushObj();
s.channel="Global";
s.prop10="Global_Postcard";
s.prop13="Global_Model_Selector";
s.prop14="Global_Nav.Postcard";
s.prop15="Global_Nav.Postcard." + model;
s.prop16="Global_Nav.Postcard." + model;
s.prop18="Flash";
s.prop19="Global_Model_Selector";
s.prop24="Global_Model_Selector";
s.prop28=crmGetVID();
s.prop30="11268";
s.prop31="English";
s.prop49=(crmGetCookie(crmZipCode) != null);
s.hier2="Generic_(No_Specific_Model).Global_Nav.Postcard." + model;
s.hier3="Global_Nav.Postcard." + model + ".Generic_(No_Specific_Model)";
eventArray = [];
s.events=eventArray.join(',');
s.pageName="Global_Postcard_" + model;
pingOmn();

// Tag for SURVEYGIZMO
sgUpdateState('CHC409B5WPD7WDFI63AV72030R8AJR-145034|Feedback_Default|17|14|15|12~RH53T0GNWMFZ1P9667A02DI0BVC0R8-166320|Random_Default|17|14|15|12','PageName=Global_Postcard~TID=11268~popup=|500|50|10|');

} catch (err) { crmDebug('crmEvent10000 Failed: \n\n' + err);}
}

function crmEvent10001() { coreEvent10001.apply(null, crmMarshallEventParams(crmEvent10001, coreEvent10001) ); }
function coreEvent10001() {
try {
crmDebug(coreEvent10001);

// Tag for OMNITURE
omnFlushObj();
s.channel="Intelliprice_External";
s.prop10="Intelliprice_External";
s.prop13="Intelliprice";
s.prop14="Promo.Intelliprice";
s.prop15="Promo.Intelliprice";
s.prop16="Promo.Intelliprice";
s.prop18="Flash";
s.prop19="External";
s.prop24="Intelliprice";
s.prop28=crmGetVID();
s.prop30="6774";
s.prop31="English";
s.prop49=(crmGetCookie(crmZipCode) != null);
s.eVar1="Intelliprice_Referral";
s.eVar4="Intelliprice.Promo.All_placements";
s.hier2="Generic_(No_Specific_Model).Promo.Intelliprice";
s.hier3="Promo.Intelliprice.Generic_(No_Specific_Model)";
eventArray = [];
eventArray.push("event32");
s.events=eventArray.join(',');
s.pageName="Intelliprice_External_-_Promo";
pingOmn();

// Tag for SURVEYGIZMO
sgUpdateState('CHC409B5WPD7WDFI63AV72030R8AJR-145034|Feedback_Default|17|14|15|12~RH53T0GNWMFZ1P9667A02DI0BVC0R8-166320|Random_Default|17|14|15|12','PageName=Intelliprice_External_-_Promo~TID=6774~popup=|500|50|0|');

} catch (err) { crmDebug('crmEvent10001 Failed: \n\n' + err);}
}

function crmEvent10002() { coreEvent10002.apply(null, crmMarshallEventParams(crmEvent10002, coreEvent10002) ); }
function coreEvent10002() {
try {
crmDebug(coreEvent10002);

// Tag for OMNITURE
omnFlushObj();
s.channel="MarcEcko_External";
s.prop10="Marc_Ecko_External";
s.prop13="Campaign-Marc_Ecko";
s.prop14="Promo.Marc_Ecko";
s.prop15="Promo.Marc_Ecko";
s.prop16="Promo.Marc_Ecko";
s.prop18="Flash";
s.prop19="External";
s.prop24="External";
s.prop28=crmGetVID();
s.prop30="6775";
s.prop31="English";
s.prop49=(crmGetCookie(crmZipCode) != null);
s.hier2="Generic_(No_Specific_Model).Promo.Marc_Ecko";
s.hier3="Promo.Marc_Ecko.Generic_(No_Specific_Model)";
eventArray = [];
s.events=eventArray.join(',');
s.pageName="Marc_Ecko_External_-_Promo";
pingOmn();

// Tag for SURVEYGIZMO
sgUpdateState('CHC409B5WPD7WDFI63AV72030R8AJR-145034|Feedback_Default|17|14|15|12~RH53T0GNWMFZ1P9667A02DI0BVC0R8-166320|Random_Default|17|14|15|12','PageName=Marc_Ecko_External_-_Promo~TID=6775~popup=|500|50|10|');

} catch (err) { crmDebug('crmEvent10002 Failed: \n\n' + err);}
}

function crmEvent10003() { coreEvent10003.apply(null, crmMarshallEventParams(crmEvent10003, coreEvent10003) ); }
function coreEvent10003() {
try {
crmDebug(coreEvent10003);

// Tag for OMNITURE
omnFlushObj();
s.channel="Nissan_Gear_External";
s.prop10="Nissan_Gear_External";
s.prop13="Nissan_Gear_External";
s.prop14="Promo.Nissan_Gear";
s.prop15="Promo.Nissan_Gear";
s.prop16="Promo.Nissan_Gear";
s.prop18="Flash";
s.prop19="External";
s.prop24="External";
s.prop28=crmGetVID();
s.prop30="6776";
s.prop31="English";
s.prop49=(crmGetCookie(crmZipCode) != null);
s.hier2="Generic_(No_Specific_Model).Promo.Nissan_Gear";
s.hier3="Promo.Nissan_Gear.Generic_(No_Specific_Model)";
eventArray = [];
s.events=eventArray.join(',');
s.pageName="Nissan_Gear_External_-_Promo";
pingOmn();

// Tag for SURVEYGIZMO
sgUpdateState('CHC409B5WPD7WDFI63AV72030R8AJR-145034|Feedback_Default|17|14|15|12~RH53T0GNWMFZ1P9667A02DI0BVC0R8-166320|Random_Default|17|14|15|12','PageName=Nissan_Gear_External_-_Promo~TID=6776~popup=|500|50|10|');

} catch (err) { crmDebug('crmEvent10003 Failed: \n\n' + err);}
}

function crmEvent10004() { coreEvent10004.apply(null, crmMarshallEventParams(crmEvent10004, coreEvent10004) ); }
function coreEvent10004() {
try {
crmDebug(coreEvent10004);

// Tag for OMNITURE
omnFlushObj();
s.channel="Nissan_News_External";
s.prop10="Nissan_News_External";
s.prop13="Nissan_News_External";
s.prop14="Promo.Nissan_News";
s.prop15="Promo.Nissan_News";
s.prop16="Promo.Nissan_News";
s.prop18="Flash";
s.prop19="External";
s.prop24="External";
s.prop28=crmGetVID();
s.prop30="6777";
s.prop31="English";
s.prop49=(crmGetCookie(crmZipCode) != null);
s.hier2="Generic_(No_Specific_Model).Promo.Nissan_News";
s.hier3="Promo.Nissan_News.Generic_(No_Specific_Model)";
eventArray = [];
s.events=eventArray.join(',');
s.pageName="Nissan_News_External_-_Promo";
pingOmn();

// Tag for SURVEYGIZMO
sgUpdateState('CHC409B5WPD7WDFI63AV72030R8AJR-145034|Feedback_Default|17|14|15|12~RH53T0GNWMFZ1P9667A02DI0BVC0R8-166320|Random_Default|17|14|15|12','PageName=Nissan_News_External_-_Promo~TID=6777~popup=|500|50|10|');

} catch (err) { crmDebug('crmEvent10004 Failed: \n\n' + err);}
}

function crmEvent10005() { coreEvent10005.apply(null, crmMarshallEventParams(crmEvent10005, coreEvent10005) ); }
function coreEvent10005(STATE,DlrCode,DlrName) {
try {
crmDebug(coreEvent10005);

// Tag for OMNITURE
omnFlushObj();
s.channel="Dealer_Website_External";
s.zip=crmGetZipCode();
s.prop10="Dealer_Website_from_Toolbox";
s.prop13="Dealer_Website";
s.prop14="Tool.Dealer_Website";
s.prop15="Dealer_Website." + STATE + "." + DlrName + "_" + DlrCode;
s.prop16="Dealer_Website." + STATE + "." + DlrName + "_" + DlrCode;
s.prop18="HTML";
s.prop19="Tools";
s.prop24="External";
s.prop28=crmGetVID();
s.prop30="6778";
s.prop31="English";
s.prop49=(crmGetCookie(crmZipCode) != null);
s.eVar1="Dealer_Website";
s.eVar20=crmGetZipCode();
s.hier2="Generic_(No_Specific_Model).Tool.Dealer_Website." + STATE + "." + DlrName + "_" + DlrCode;
s.hier3="Tool.Dealer_Website." + STATE + "." + DlrName + "_" + DlrCode + ".Generic_(No_Specific_Model)";
eventArray = [];
eventArray.push("event25");
s.events=eventArray.join(',');
s.pageName="Dealer_Website_" + STATE + "_" + DlrName + "_" + DlrCode;
pingOmn();

// Tag for SURVEYGIZMO
sgUpdateState('CHC409B5WPD7WDFI63AV72030R8AJR-145034|Feedback_Default|17|14|15|12~RH53T0GNWMFZ1P9667A02DI0BVC0R8-166320|Random_Default|17|14|15|12','PageName=Dealer_Website~TID=6778~popup=|500|50|10|');

} catch (err) { crmDebug('crmEvent10005 Failed: \n\n' + err);}
}

function crmEvent10006() { coreEvent10006.apply(null, crmMarshallEventParams(crmEvent10006, coreEvent10006) ); }
function coreEvent10006() {
try {
crmDebug(coreEvent10006);

// Tag for OMNITURE
omnFlushObj();
s.channel="ePrize_External";
s.prop10="ePrize_External";
s.prop13="Campaign-LiveSets";
s.prop14="Promo.ePrize";
s.prop15="Promo.ePrize";
s.prop16="Promo.ePrize";
s.prop18="Flash";
s.prop19="External";
s.prop24="External";
s.prop28=crmGetVID();
s.prop30="7659";
s.prop31="English";
s.prop49=(crmGetCookie(crmZipCode) != null);
s.hier2="Generic_(No_Specific_Model).Promo.ePrize";
s.hier3="Promo.ePrize.Generic_(No_Specific_Model)";
eventArray = [];
s.events=eventArray.join(',');
s.pageName="ePrize_External_-_Promo";
pingOmn();

// Tag for SURVEYGIZMO
sgUpdateState('CHC409B5WPD7WDFI63AV72030R8AJR-145034|Feedback_Default|17|14|15|12~RH53T0GNWMFZ1P9667A02DI0BVC0R8-166320|Random_Default|17|14|15|12','PageName=ePrize_External_-_Promo~TID=7659~popup=|500|50|10|');

} catch (err) { crmDebug('crmEvent10006 Failed: \n\n' + err);}
}

function crmEvent10007() { coreEvent10007.apply(null, crmMarshallEventParams(crmEvent10007, coreEvent10007) ); }
function coreEvent10007() {
try {
crmDebug(coreEvent10007);

// Tag for OMNITURE
omnFlushObj();
s.channel="Nissan_Global_External";
s.prop10="Nissan_Global_External";
s.prop13="Nissan_Global_External";
s.prop14="Promo.Nissan_Global";
s.prop15="Promo.Nissan_Global";
s.prop16="Promo.Nissan_Global";
s.prop18="Flash";
s.prop19="External";
s.prop24="External";
s.prop28=crmGetVID();
s.prop30="6780";
s.prop31="English";
s.prop49=(crmGetCookie(crmZipCode) != null);
s.hier2="Generic_(No_Specific_Model).Promo.Nissan_Global";
s.hier3="Promo.Nissan_Global.Generic_(No_Specific_Model)";
eventArray = [];
s.events=eventArray.join(',');
s.pageName="Nissan_Global_External_-_Promo";
pingOmn();

// Tag for SURVEYGIZMO
sgUpdateState('CHC409B5WPD7WDFI63AV72030R8AJR-145034|Feedback_Default|17|14|15|12~RH53T0GNWMFZ1P9667A02DI0BVC0R8-166320|Random_Default|17|14|15|12','PageName=Nissan_Global_External_-_Promo~TID=6780~popup=|500|50|10|');

} catch (err) { crmDebug('crmEvent10007 Failed: \n\n' + err);}
}

function crmEvent10008() { coreEvent10008.apply(null, crmMarshallEventParams(crmEvent10008, coreEvent10008) ); }
function coreEvent10008() {
try {
crmDebug(coreEvent10008);

// Tag for OMNITURE
omnFlushObj();
s.channel="Online_Bill_Pay_External";
s.prop10="OWN_Online_Bill_Pay_Toolbox_External";
s.prop13="Online_Bill_Pay";
s.prop14="Owner.PUB";
s.prop15="Owner.PUB.Online_Bill_Pay";
s.prop16="Owner.PUB.Online_Bill_Pay";
s.prop18="Flash";
s.prop19="External";
s.prop24="Owners_Section";
s.prop28=crmGetVID();
s.prop30="6782";
s.prop31="English";
s.prop49=(crmGetCookie(crmZipCode) != null);
s.hier2="Generic_(No_Specific_Model).Owner.PUB.Online_Bill_Pay";
s.hier3="Owner.PUB.Online_Bill_Pay.Generic_(No_Specific_Model)";
eventArray = [];
s.events=eventArray.join(',');
s.pageName="OWN_Online_Bill_Pay_Toolbox_External";
pingOmn();

// Tag for SURVEYGIZMO
sgUpdateState('CHC409B5WPD7WDFI63AV72030R8AJR-145034|Feedback_Default|17|14|15|12~RH53T0GNWMFZ1P9667A02DI0BVC0R8-166320|Random_Default|17|14|15|12','PageName=OWN_Online_Bill_Pay_Toolbox_External~TID=6782~popup=|500|50|10|');

} catch (err) { crmDebug('crmEvent10008 Failed: \n\n' + err);}
}

function crmEvent10009() { coreEvent10009.apply(null, crmMarshallEventParams(crmEvent10009, coreEvent10009) ); }
function coreEvent10009() {
try {
crmDebug(coreEvent10009);

// Tag for OMNITURE
omnFlushObj();
s.channel="Online_Bill_Pay_External";
s.prop10="OWN_Online_Bill_Pay_Toolbox_External";
s.prop13="Online_Bill_Pay";
s.prop14="Owner.PVT";
s.prop15="Owner.PVT.Online_Bill_Pay";
s.prop16="Owner.PVT.Online_Bill_Pay";
s.prop18="Flash";
s.prop19="External";
s.prop24="Owners_Section";
s.prop28=crmGetVID();
s.prop30="6783";
s.prop31="English";
s.prop49=(crmGetCookie(crmZipCode) != null);
s.hier2="Generic_(No_Specific_Model).Owner.PVT.Online_Bill_Pay";
s.hier3="Owner.PVT.Online_Bill_Pay.Generic_(No_Specific_Model)";
eventArray = [];
s.events=eventArray.join(',');
s.pageName="OWN_Online_Bill_Pay_Toolbox_External";
pingOmn();

// Tag for SURVEYGIZMO
sgUpdateState('CHC409B5WPD7WDFI63AV72030R8AJR-145034|Feedback_Default|17|14|15|12~RH53T0GNWMFZ1P9667A02DI0BVC0R8-166320|Random_Default|17|14|15|12','PageName=OWN_Online_Bill_Pay_Toolbox_External~TID=6783~popup=|500|50|10|');

} catch (err) { crmDebug('crmEvent10009 Failed: \n\n' + err);}
}

function crmEvent10010() { coreEvent10010.apply(null, crmMarshallEventParams(crmEvent10010, coreEvent10010) ); }
function coreEvent10010() {
try {
crmDebug(coreEvent10010);

// Tag for OMNITURE
omnFlushObj();
s.channel="Nissan_Gear_External";
s.prop10="Nissan_Gear_External";
s.prop13="Nissan_Gear_External";
s.prop14="Promo.Nissan_Gear";
s.prop15="Promo.Nissan_Gear";
s.prop16="Promo.Nissan_Gear";
s.prop18="Flash";
s.prop19="External";
s.prop24="External";
s.prop28=crmGetVID();
s.prop30="6784";
s.prop31="English";
s.prop49=(crmGetCookie(crmZipCode) != null);
s.hier2="Generic_(No_Specific_Model).Promo.Nissan_Gear";
s.hier3="Promo.Nissan_Gear.Generic_(No_Specific_Model)";
eventArray = [];
s.events=eventArray.join(',');
s.pageName="Nissan_Gear_External_-_Promo";
pingOmn();

// Tag for SURVEYGIZMO
sgUpdateState('CHC409B5WPD7WDFI63AV72030R8AJR-145034|Feedback_Default|17|14|15|12~RH53T0GNWMFZ1P9667A02DI0BVC0R8-166320|Random_Default|17|14|15|12','PageName=Nissan_Gear_External_-_Promo~TID=6784~popup=|500|50|10|');

} catch (err) { crmDebug('crmEvent10010 Failed: \n\n' + err);}
}

function crmEvent10011() { coreEvent10011.apply(null, crmMarshallEventParams(crmEvent10011, coreEvent10011) ); }
function coreEvent10011() {
try {
crmDebug(coreEvent10011);

// Tag for OMNITURE
omnFlushObj();
s.channel="Nissan_News_External";
s.prop10="Nissan_News_External";
s.prop13="Nissan_News_External";
s.prop14="Promo.Nissan_News";
s.prop15="Promo.Nissan_News";
s.prop16="Promo.Nissan_News";
s.prop18="Flash";
s.prop19="External";
s.prop24="External";
s.prop28=crmGetVID();
s.prop30="6785";
s.prop31="English";
s.prop49=(crmGetCookie(crmZipCode) != null);
s.hier2="Generic_(No_Specific_Model).Promo.Nissan_News";
s.hier3="Promo.Nissan_News.Generic_(No_Specific_Model)";
eventArray = [];
s.events=eventArray.join(',');
s.pageName="Nissan_News_External_-_Promo";
pingOmn();

// Tag for SURVEYGIZMO
sgUpdateState('CHC409B5WPD7WDFI63AV72030R8AJR-145034|Feedback_Default|17|14|15|12~RH53T0GNWMFZ1P9667A02DI0BVC0R8-166320|Random_Default|17|14|15|12','PageName=Nissan_News_External_-_Promo~TID=6785~popup=|500|50|10|');

} catch (err) { crmDebug('crmEvent10011 Failed: \n\n' + err);}
}

function crmEvent10012() { coreEvent10012.apply(null, crmMarshallEventParams(crmEvent10012, coreEvent10012) ); }
function coreEvent10012() {
try {
crmDebug(coreEvent10012);

// Tag for OMNITURE
omnFlushObj();
s.channel="Nissan_Global_External";
s.prop10="Nissan_Global_External";
s.prop13="Nissan_Global_External";
s.prop14="Promo.Nissan_Global";
s.prop15="Promo.Nissan_Global";
s.prop16="Promo.Nissan_Global";
s.prop18="Flash";
s.prop19="External";
s.prop24="External";
s.prop28=crmGetVID();
s.prop30="6786";
s.prop31="English";
s.prop49=(crmGetCookie(crmZipCode) != null);
s.hier2="Generic_(No_Specific_Model).Promo.Nissan_Global";
s.hier3="Promo.Nissan_Global.Generic_(No_Specific_Model)";
eventArray = [];
s.events=eventArray.join(',');
s.pageName="Nissan_Global_External_-_Promo";
pingOmn();

// Tag for SURVEYGIZMO
sgUpdateState('CHC409B5WPD7WDFI63AV72030R8AJR-145034|Feedback_Default|17|14|15|12~RH53T0GNWMFZ1P9667A02DI0BVC0R8-166320|Random_Default|17|14|15|12','PageName=Nissan_Global_External_-_Promo~TID=6786~popup=|500|50|10|');

} catch (err) { crmDebug('crmEvent10012 Failed: \n\n' + err);}
}

function crmEvent10013() { coreEvent10013.apply(null, crmMarshallEventParams(crmEvent10013, coreEvent10013) ); }
function coreEvent10013() {
try {
crmDebug(coreEvent10013);

// Tag for OMNITURE
omnFlushObj();
s.channel="Reto_Final_External";
s.prop10="Reto_Final_External";
s.prop13="Campaign-Reto_Final";
s.prop14="Promo.Reto_Final";
s.prop15="Promo.Reto_Final";
s.prop16="Promo.Reto_Final";
s.prop18="Flash";
s.prop19="External";
s.prop24="External";
s.prop28=crmGetVID();
s.prop30="7178";
s.prop31="English";
s.prop49=(crmGetCookie(crmZipCode) != null);
s.hier2="Generic_(No_Specific_Model).Promo.Reto_Final";
s.hier3="Promo.Reto_Final.Generic_(No_Specific_Model)";
eventArray = [];
s.events=eventArray.join(',');
s.pageName="Reto_Final_External_-_Promo";
pingOmn();

// Tag for SURVEYGIZMO
sgUpdateState('CHC409B5WPD7WDFI63AV72030R8AJR-145034|Feedback_Default|17|14|15|12~RH53T0GNWMFZ1P9667A02DI0BVC0R8-166320|Random_Default|17|14|15|12','PageName=Reto_Final_External_-_Promo~TID=7178~popup=|500|50|10|');

} catch (err) { crmDebug('crmEvent10013 Failed: \n\n' + err);}
}

function crmEvent10014() { coreEvent10014.apply(null, crmMarshallEventParams(crmEvent10014, coreEvent10014) ); }
function coreEvent10014() {
try {
crmDebug(coreEvent10014);

// Tag for OMNITURE
omnFlushObj();
s.channel="ePrize_External";
s.prop10="ePrize_External";
s.prop13="Campaign-LiveSets";
s.prop14="Promo.ePrize";
s.prop15="Promo.ePrize";
s.prop16="Promo.ePrize";
s.prop18="Flash";
s.prop19="External";
s.prop24="External";
s.prop28=crmGetVID();
s.prop30="7660";
s.prop31="English";
s.prop49=(crmGetCookie(crmZipCode) != null);
s.hier2="Generic_(No_Specific_Model).Promo.ePrize";
s.hier3="Promo.ePrize.Generic_(No_Specific_Model)";
eventArray = [];
s.events=eventArray.join(',');
s.pageName="ePrize_External_-_Promo";
pingOmn();

// Tag for SURVEYGIZMO
sgUpdateState('CHC409B5WPD7WDFI63AV72030R8AJR-145034|Feedback_Default|17|14|15|12~RH53T0GNWMFZ1P9667A02DI0BVC0R8-166320|Random_Default|17|14|15|12','PageName=ePrize_External_-_Promo~TID=7660~popup=|500|50|10|');

} catch (err) { crmDebug('crmEvent10014 Failed: \n\n' + err);}
}

function crmEvent10015() { coreEvent10015.apply(null, crmMarshallEventParams(crmEvent10015, coreEvent10015) ); }
function coreEvent10015() {
try {
crmDebug(coreEvent10015);

// Tag for OMNITURE
omnFlushObj();
s.channel="GTR_External";
s.prop10="GTR_External";
s.prop13="GT-R";
s.prop14="Promo.GTR";
s.prop15="Promo.GTR";
s.prop16="Promo.GTR";
s.prop18="Flash";
s.prop19="External";
s.prop24="External";
s.prop28=crmGetVID();
s.prop30="8083";
s.prop31="English";
s.prop49=(crmGetCookie(crmZipCode) != null);
s.hier2="Generic_(No_Specific_Model).Promo.GTR";
s.hier3="Promo.GTR.Generic_(No_Specific_Model)";
eventArray = [];
s.events=eventArray.join(',');
s.pageName="GT-R_Tokyo_Reveal_-_Promo";
pingOmn();

// Tag for SURVEYGIZMO
sgUpdateState('CHC409B5WPD7WDFI63AV72030R8AJR-145034|Feedback_Default|17|14|15|12~RH53T0GNWMFZ1P9667A02DI0BVC0R8-166320|Random_Default|17|14|15|12','PageName=GT-R_Tokyo_Reveal_-_Promo~TID=8083~popup=|500|50|10|');

} catch (err) { crmDebug('crmEvent10015 Failed: \n\n' + err);}
}

function crmEvent10016() { coreEvent10016.apply(null, crmMarshallEventParams(crmEvent10016, coreEvent10016) ); }
function coreEvent10016() {
try {
crmDebug(coreEvent10016);

// Tag for OMNITURE
omnFlushObj();
s.channel="Z_Sweepstakes_External";
s.prop10="Z_Sweepstakes_External";
s.prop13="Z_Sweepstakes_External";
s.prop14="Promo.Z_Sweepstakes";
s.prop15="Promo.Z_Sweepstakes";
s.prop16="Promo.Z_Sweepstakes";
s.prop18="Flash";
s.prop28=crmGetVID();
s.prop30="9370";
s.prop31="English";
s.prop49=(crmGetCookie(crmZipCode) != null);
s.hier2="Generic_(No_Specific_Model).Promo.Z_Sweepstakes";
s.hier3="Promo.Z_Sweepstakes.Generic_(No_Specific_Model)";
eventArray = [];
s.events=eventArray.join(',');
s.pageName="Z_Sweepstakes_External_-Promo";
pingOmn();

// Tag for SURVEYGIZMO
sgUpdateState('CHC409B5WPD7WDFI63AV72030R8AJR-145034|Feedback_Default|17|14|15|12~RH53T0GNWMFZ1P9667A02DI0BVC0R8-166320|Random_Default|17|14|15|12','PageName=Z_Sweepstakes_External_-Promo~TID=9370~popup=|500|50|10|');

} catch (err) { crmDebug('crmEvent10016 Failed: \n\n' + err);}
}

function crmEvent10017() { coreEvent10017.apply(null, crmMarshallEventParams(crmEvent10017, coreEvent10017) ); }
function coreEvent10017() {
try {
crmDebug(coreEvent10017);

// Tag for OMNITURE
omnFlushObj();
s.channel="NCV_External";
s.prop10="NCV_External";
s.prop14="Promo.NCV";
s.prop15="Promo.NCV";
s.prop16="Promo.NCV";
s.prop18="Flash";
s.prop19="External";
s.prop24="External";
s.prop28=crmGetVID();
s.prop30="10259";
s.prop31="English";
s.prop49=(crmGetCookie(crmZipCode) != null);
s.hier2="Generic_(No_Specific_Model).Promo.NCV";
s.hier3="Promo.NCV.Generic_(No_Specific_Model)";
eventArray = [];
s.events=eventArray.join(',');
s.pageName="NCV_External_-_Promo";
pingOmn();

// Tag for SURVEYGIZMO
sgUpdateState('CHC409B5WPD7WDFI63AV72030R8AJR-145034|Feedback_Default|17|14|15|12~RH53T0GNWMFZ1P9667A02DI0BVC0R8-166320|Random_Default|17|14|15|12','PageName=NCV_External_-_Promo~TID=10259~popup=|500|50|10|');

} catch (err) { crmDebug('crmEvent10017 Failed: \n\n' + err);}
}

function crmEvent10018() { coreEvent10018.apply(null, crmMarshallEventParams(crmEvent10018, coreEvent10018) ); }
function coreEvent10018() {
try {
crmDebug(coreEvent10018);

// Tag for OMNITURE
omnFlushObj();
s.channel="Express_Service_Sweeps";
s.prop10="Express_Service_Sweeps";
s.prop14="Promo.Express_Service";
s.prop15="Promo.Express_Service";
s.prop16="Promo.Express_Service";
s.prop18="Flash";
s.prop19="External";
s.prop24="External";
s.prop28=crmGetVID();
s.prop30="10613";
s.prop31="English";
s.prop49=(crmGetCookie(crmZipCode) != null);
s.hier2="Generic_(No_Specific_Model).Promo.Express_Service";
s.hier3="Promo.Express_Service.Generic_(No_Specific_Model)";
eventArray = [];
s.events=eventArray.join(',');
s.pageName="Express_Service_Sweep-Promo";
pingOmn();

// Tag for SURVEYGIZMO
sgUpdateState('CHC409B5WPD7WDFI63AV72030R8AJR-145034|Feedback_Default|17|14|15|12~RH53T0GNWMFZ1P9667A02DI0BVC0R8-166320|Random_Default|17|14|15|12','PageName=Express_Service_Sweep-Promo~TID=10613~popup=|500|50|10|');

} catch (err) { crmDebug('crmEvent10018 Failed: \n\n' + err);}
}

function crmEvent10019() { coreEvent10019.apply(null, crmMarshallEventParams(crmEvent10019, coreEvent10019) ); }
function coreEvent10019() {
try {
crmDebug(coreEvent10019);

// Tag for OMNITURE
omnFlushObj();
s.channel="CPO";
s.prop10="CPO_Brochure_PDF";
s.prop13="CPO";
s.prop14="CPO.Toolbox";
s.prop15="CPO.Toolbox.Brochure_PDF";
s.prop16="CPO.Toolbox.Brochure_PDF";
s.prop18="HTML";
s.prop24="CPO_Section";
s.prop28=crmGetVID();
s.prop30="10945";
s.prop31="English";
s.prop49=(crmGetCookie(crmZipCode) != null);
s.hier2="Generic_(No_Specific_Model).CPO.Toolbox.Brochure_PDF";
s.hier3="CPO.Toolbox.Brochure_PDF.Generic_(No_Specific_Model)";
eventArray = [];
s.events=eventArray.join(',');
s.pageName="CPO_Toolbox_Brochure_PDF";
pingOmn();

// Tag for SURVEYGIZMO
sgUpdateState('CHC409B5WPD7WDFI63AV72030R8AJR-145034|Feedback_Default|17|14|15|12~RH53T0GNWMFZ1P9667A02DI0BVC0R8-166320|Random_Default|17|14|15|12','PageName=CPO_Toolbox_Brochure_PDF~TID=10945~popup=|500|50|10|');

} catch (err) { crmDebug('crmEvent10019 Failed: \n\n' + err);}
}

function crmEvent10020() { coreEvent10020.apply(null, crmMarshallEventParams(crmEvent10020, coreEvent10020) ); }
function coreEvent10020() {
try {
crmDebug(coreEvent10020);

// Tag for OMNITURE
omnFlushObj();
s.channel="CPO";
s.prop10="CPO_Offers_PDF";
s.prop13="CPO";
s.prop14="CPO.Toolbox";
s.prop15="CPO.Toolbox.Offers_PDF";
s.prop16="CPO.Toolbox.Offers_PDF";
s.prop18="HTML";
s.prop24="CPO_Section";
s.prop28=crmGetVID();
s.prop30="10946";
s.prop31="English";
s.prop49=(crmGetCookie(crmZipCode) != null);
s.hier2="Generic_(No_Specific_Model).CPO.Toolbox.Offers_PDF";
s.hier3="CPO.Toolbox.Offers_PDF.Generic_(No_Specific_Model)";
eventArray = [];
s.events=eventArray.join(',');
s.pageName="CPO_Toolbox_Offers_PDF";
pingOmn();

// Tag for SURVEYGIZMO
sgUpdateState('CHC409B5WPD7WDFI63AV72030R8AJR-145034|Feedback_Default|17|14|15|12~RH53T0GNWMFZ1P9667A02DI0BVC0R8-166320|Random_Default|17|14|15|12','PageName=CPO_Toolbox_Offers_PDF~TID=10946~popup=|500|50|10|');

} catch (err) { crmDebug('crmEvent10020 Failed: \n\n' + err);}
}

function crmEvent10025() { coreEvent10025.apply(null, crmMarshallEventParams(crmEvent10025, coreEvent10025) ); }
function coreEvent10025() {
try {
crmDebug(coreEvent10025);

// Tag for OMNITURE
omnFlushObj();
s.channel="Facebook_External";
s.prop10="Facebook_External";
s.prop13="Facebook";
s.prop14="Promo.Facebook";
s.prop15="Promo.Facebook.Altima";
s.prop16="Promo.Facebook.Altima";
s.prop18="Flash";
s.prop28=crmGetVID();
s.prop30="11180";
s.prop31="English";
s.prop49=(crmGetCookie(crmZipCode) != null);
s.hier2="Generic_(No_Specific_Model).Promo.Facebook.Altima";
s.hier3="Promo.Facebook.Altima.Generic_(No_Specific_Model)";
eventArray = [];
s.events=eventArray.join(',');
s.pageName="Facebook_Altima_External-_Promo";
pingOmn();

// Tag for SURVEYGIZMO
sgUpdateState('CHC409B5WPD7WDFI63AV72030R8AJR-145034|Feedback_Default|17|14|15|12~RH53T0GNWMFZ1P9667A02DI0BVC0R8-166320|Random_Default|17|14|15|12','PageName=Facebook_Altima_External-_Promo~TID=11180~popup=|500|50|10|');

} catch (err) { crmDebug('crmEvent10025 Failed: \n\n' + err);}
}

function crmEvent10026() { coreEvent10026.apply(null, crmMarshallEventParams(crmEvent10026, coreEvent10026) ); }
function coreEvent10026() {
try {
crmDebug(coreEvent10026);

// Tag for OMNITURE
omnFlushObj();
s.channel="Facebook_External";
s.prop10="Facebook_External";
s.prop13="Facebook";
s.prop14="Promo.Facebook";
s.prop15="Promo.Facebook.Cube";
s.prop16="Promo.Facebook.Cube";
s.prop18="Flash";
s.prop28=crmGetVID();
s.prop30="11181";
s.prop31="English";
s.prop49=(crmGetCookie(crmZipCode) != null);
s.hier2="Generic_(No_Specific_Model).Promo.Facebook.Cube";
s.hier3="Promo.Facebook.Cube.Generic_(No_Specific_Model)";
eventArray = [];
s.events=eventArray.join(',');
s.pageName="Facebook_Cube_External-_Promo";
pingOmn();

// Tag for SURVEYGIZMO
sgUpdateState('CHC409B5WPD7WDFI63AV72030R8AJR-145034|Feedback_Default|17|14|15|12~RH53T0GNWMFZ1P9667A02DI0BVC0R8-166320|Random_Default|17|14|15|12','PageName=Facebook_Cube_External-_Promo~TID=11181~popup=|500|50|10|');

} catch (err) { crmDebug('crmEvent10026 Failed: \n\n' + err);}
}

function crmEvent10027() { coreEvent10027.apply(null, crmMarshallEventParams(crmEvent10027, coreEvent10027) ); }
function coreEvent10027() {
try {
crmDebug(coreEvent10027);

// Tag for OMNITURE
omnFlushObj();
s.channel="Parts&Service_Sweeps";
s.prop10="Keep_Summer_Rolling_Sweeps";
s.prop13="Sweepstakes";
s.prop14="Promo.Keep_Summer_Rolling";
s.prop15="Promo.Keep_Summer_Rolling.Sweeps";
s.prop16="Promo.Keep_Summer_Rolling.Sweeps";
s.prop18="Flash";
s.prop19="External";
s.prop24="External";
s.prop28=crmGetVID();
s.prop30="11742";
s.prop31="English";
s.prop49=(crmGetCookie(crmZipCode) != null);
s.hier2="Generic_(No_Specific_Model).Promo.Keep_Summer_Rolling.Sweeps";
s.hier3="Promo.Keep_Summer_Rolling.Sweeps.Generic_(No_Specific_Model)";
eventArray = [];
s.events=eventArray.join(',');
s.pageName="Keep_Summer_Rolling_Sweeps_External_-_Promo";
pingOmn();

// Tag for SURVEYGIZMO
sgUpdateState('CHC409B5WPD7WDFI63AV72030R8AJR-145034|Feedback_Default|17|14|15|12~RH53T0GNWMFZ1P9667A02DI0BVC0R8-166320|Random_Default|17|14|15|12','PageName=Keep_Summer_Rolling_Sweeps_External_-_Promo~TID=11742~popup=|500|50|10|');

} catch (err) { crmDebug('crmEvent10027 Failed: \n\n' + err);}
}

function crmEvent10028() { coreEvent10028.apply(null, crmMarshallEventParams(crmEvent10028, coreEvent10028) ); }
function coreEvent10028(CampaignName) {
try {
crmDebug(coreEvent10028);

// Tag for OMNITURE
omnFlushObj();
s.prop14="Promo." + CampaignName;
s.prop15="Promo." + CampaignName;
s.prop16="Promo." + CampaignName;
s.prop18="Flash";
s.prop28=crmGetVID();
s.prop30="12010";
s.prop31="English";
s.prop49=(crmGetCookie(crmZipCode) != null);
s.hier2="Generic_(No_Specific_Model).Promo." + CampaignName;
s.hier3="Promo." + CampaignName + ".Generic_(No_Specific_Model)";
eventArray = [];
s.events=eventArray.join(',');
s.pageName=CampaignName + "_-_Promo";
pingOmn();

// Tag for SURVEYGIZMO
sgUpdateState('CHC409B5WPD7WDFI63AV72030R8AJR-145034|Feedback_Default|17|14|15|12~RH53T0GNWMFZ1P9667A02DI0BVC0R8-166320|Random_Default|17|14|15|12','PageName=-_Promo~TID=12010~popup=|500|50|10|');

} catch (err) { crmDebug('crmEvent10028 Failed: \n\n' + err);}
}

function crmEvent10030() { coreEvent10030.apply(null, crmMarshallEventParams(crmEvent10030, coreEvent10030) ); }
function coreEvent10030(model,page) {
try {
crmDebug(coreEvent10030);

// Tag for OMNITURE
omnFlushObj();
s.channel=model;
s.prop7=model;
s.prop10="Mdl_" + page + "_Live_Chat_Widget";
s.prop13="Live_Chat_Widget";
s.prop14=model + ".Spec_Options";
s.prop15=model + ".Spec_Options._" + page;
s.prop16=model + ".Spec_Options._" + page + ".Live_Chat";
s.prop18="HTML";
s.prop19="Model_Section";
s.prop20=model + "_Research";
s.prop24="Model_Section";
s.prop28=crmGetVID();
s.prop30="12802";
s.prop31="English";
s.prop48="Model_Live_Chat_Widget";
s.prop49=(crmGetCookie(crmZipCode) != null);
s.hier2=model + ".Model.Spec_Options._" + page + ".Live_Chat.Widget";
s.hier3="Model.Spec_Options._" + page + ".Live_Chat.Widget." + model;
eventArray = [];
s.events=eventArray.join(',');
s.pageName=model + "_" + page + "_Live_Chat_Widget";
pingOmn();

// Tag for SURVEYGIZMO
sgUpdateState('CHC409B5WPD7WDFI63AV72030R8AJR-145034|Feedback_Default|17|14|15|12~RH53T0GNWMFZ1P9667A02DI0BVC0R8-166320|Random_Default|17|14|15|12','PageName=Live_Chat_Widget~TID=12802~popup=|0|50|10|');

} catch (err) { crmDebug('crmEvent10030 Failed: \n\n' + err);}
}

function crmEvent10031() { coreEvent10031.apply(null, crmMarshallEventParams(crmEvent10031, coreEvent10031) ); }
function coreEvent10031(model,page) {
try {
crmDebug(coreEvent10031);

// Tag for OMNITURE
omnFlushObj();
s.channel=model;
s.prop7=model;
s.prop10="Mdl_" + page + "_Live_Chat_Form";
s.prop13="Live_Chat_Form";
s.prop14=model + ".Spec_Options";
s.prop15=model + ".Spec_Options._" + page;
s.prop16=model + ".Spec_Options._" + page + ".Live_Chat";
s.prop18="HTML";
s.prop19="Model_Section";
s.prop20=model + "_Research";
s.prop24="Model_Section";
s.prop28=crmGetVID();
s.prop30="12803";
s.prop31="English";
s.prop48="Model_Live_Chat_Form";
s.prop49=(crmGetCookie(crmZipCode) != null);
s.eVar1="Click_to_Chat";
s.hier2=model + ".Model.Spec_Options._" + page + ".Live_Chat.Form";
s.hier3="Model.Spec_Options._" + page + ".Live_Chat.Form." + model;
eventArray = [];
eventArray.push("event46");
s.events=eventArray.join(',');
s.pageName=model + "_" + page + "_Live_Chat_Form";
pingOmn();

// Tag for SURVEYGIZMO
sgUpdateState('CHC409B5WPD7WDFI63AV72030R8AJR-145034|Feedback_Default|17|14|15|12~RH53T0GNWMFZ1P9667A02DI0BVC0R8-166320|Random_Default|17|14|15|12','PageName=Live_Chat_Form~TID=12803~popup=|0|50|10|');

} catch (err) { crmDebug('crmEvent10031 Failed: \n\n' + err);}
}

function crmEvent10032() { coreEvent10032.apply(null, crmMarshallEventParams(crmEvent10032, coreEvent10032) ); }
function coreEvent10032() {
try {
crmDebug(coreEvent10032);

// Tag for OMNITURE
omnFlushObj();
s.channel="Juke_Studio_External";
s.prop10="Juke_Studio_External";
s.prop13="Juke_Studio_External";
s.prop14="Promo.Juke_Studio";
s.prop15="Promo.Juke_Studio";
s.prop16="Promo.Juke_Studio";
s.prop18="Flash";
s.prop28=crmGetVID();
s.prop30="12874";
s.prop31="English";
s.prop49=(crmGetCookie(crmZipCode) != null);
s.hier2="Generic_(No_Specific_Model).Promo.Juke_Studio";
s.hier3="Promo.Juke_Studio.Generic_(No_Specific_Model)";
eventArray = [];
s.events=eventArray.join(',');
s.pageName="Juke_Studio_External_-Promo";
pingOmn();

// Tag for SURVEYGIZMO
sgUpdateState('CHC409B5WPD7WDFI63AV72030R8AJR-145034|Feedback_Default|17|14|15|12~RH53T0GNWMFZ1P9667A02DI0BVC0R8-166320|Random_Default|17|14|15|12','PageName=Juke_Studio_External_-Promo~TID=12874~popup=|500|50|10|');

} catch (err) { crmDebug('crmEvent10032 Failed: \n\n' + err);}
}

function crmEvent10040() { coreEvent10040.apply(null, crmMarshallEventParams(crmEvent10040, coreEvent10040) ); }
function coreEvent10040(name) {
try {
crmDebug(coreEvent10040);

// Tag for OMNITURE
omnFlushObj();
s.channel="Video_Gallery";
s.prop10="Video_Gallery_Video_" + name;
s.prop13="Videos";
s.prop14="Promo.Video_Start";
s.prop15="Promo.Video_Start." + name;
s.prop16="Promo.Video_Start." + name;
s.prop18="Video_Start";
s.prop19="Video_Gallery";
s.prop24="Video_Gallery";
s.prop28=crmGetVID();
s.prop30="13538";
s.prop31="English";
s.prop49=(crmGetCookie(crmZipCode) != null);
s.hier2="Generic_(No_Specific_Model).Promo.Video_Start." + name;
s.hier3="Promo.Video_Start." + name + ".Generic_(No_Specific_Model)";
eventArray = [];
s.events=eventArray.join(',');
s.pageName="Video_Gallery_Video_" + name + "_Start";
pingOmn();

// Tag for SURVEYGIZMO
sgUpdateState('CHC409B5WPD7WDFI63AV72030R8AJR-145034|Feedback_Default|17|14|15|12~RH53T0GNWMFZ1P9667A02DI0BVC0R8-166320|Random_Default|17|14|15|12','PageName=Video_Gallery_Video_Start~TID=13538~popup=|0|50|10|');

} catch (err) { crmDebug('crmEvent10040 Failed: \n\n' + err);}
}

function crmEvent10041() { coreEvent10041.apply(null, crmMarshallEventParams(crmEvent10041, coreEvent10041) ); }
function coreEvent10041(name) {
try {
crmDebug(coreEvent10041);

// Tag for OMNITURE
omnFlushObj();
s.channel="Video_Gallery";
s.prop10="Video_Gallery_Video_" + name;
s.prop13="Videos";
s.prop14="Promo.Video_80%";
s.prop15="Promo.Video_80%." + name;
s.prop16="Promo.Video_80%." + name;
s.prop18="Video_80%";
s.prop19="Video_Gallery";
s.prop24="Video_Gallery";
s.prop28=crmGetVID();
s.prop30="13539";
s.prop31="English";
s.prop49=(crmGetCookie(crmZipCode) != null);
s.hier2="Generic_(No_Specific_Model).Promo.Video_80%." + name;
s.hier3="Promo.Video_80%." + name + ".Generic_(No_Specific_Model)";
eventArray = [];
s.events=eventArray.join(',');
s.pageName="Video_Gallery_Video_" + name + "_80%";
pingOmn();

// Tag for SURVEYGIZMO
sgUpdateState('CHC409B5WPD7WDFI63AV72030R8AJR-145034|Feedback_Default|17|14|15|12~RH53T0GNWMFZ1P9667A02DI0BVC0R8-166320|Random_Default|17|14|15|12','PageName=Video_Gallery_Video_80%~TID=13539~popup=|0|50|10|');

} catch (err) { crmDebug('crmEvent10041 Failed: \n\n' + err);}
}

function crmEvent10042() { coreEvent10042.apply(null, crmMarshallEventParams(crmEvent10042, coreEvent10042) ); }
function coreEvent10042(name) {
try {
crmDebug(coreEvent10042);

// Tag for OMNITURE
omnFlushObj();
s.channel="Video_Gallery";
s.prop10="Video_Gallery_Video_" + name;
s.prop13="Videos";
s.prop14="Promo.Video_End";
s.prop15="Promo.Video_End." + name;
s.prop16="Promo.Video_End." + name;
s.prop18="Video_End";
s.prop19="Video_Gallery";
s.prop24="Video_Gallery";
s.prop28=crmGetVID();
s.prop30="13540";
s.prop31="English";
s.prop49=(crmGetCookie(crmZipCode) != null);
s.hier2="Generic_(No_Specific_Model).Promo.Video_End." + name;
s.hier3="Promo.Video_End." + name + ".Generic_(No_Specific_Model)";
eventArray = [];
s.events=eventArray.join(',');
s.pageName="Video_Gallery_Video_" + name + "_End";
pingOmn();

// Tag for SURVEYGIZMO
sgUpdateState('CHC409B5WPD7WDFI63AV72030R8AJR-145034|Feedback_Default|17|14|15|12~RH53T0GNWMFZ1P9667A02DI0BVC0R8-166320|Random_Default|17|14|15|12','PageName=Video_Gallery_Video_End~TID=13540~popup=|0|50|10|');

} catch (err) { crmDebug('crmEvent10042 Failed: \n\n' + err);}
}

// **** PAGE 1 END ****

/*! SWFObject v2.1 <http://code.google.com/p/swfobject/>
	Copyright (c) 2007-2008 Geoff Stearns, Michael Williams, and Bobby van der Sluis
	This software is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
*/

var swfobject = function() {
	
	var UNDEF = "undefined",
		OBJECT = "object",
		SHOCKWAVE_FLASH = "Shockwave Flash",
		SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
		FLASH_MIME_TYPE = "application/x-shockwave-flash",
		EXPRESS_INSTALL_ID = "SWFObjectExprInst",
		
		win = window,
		doc = document,
		nav = navigator,
		
		domLoadFnArr = [],
		regObjArr = [],
		objIdArr = [],
		listenersArr = [],
		script,
		timer = null,
		storedAltContent = null,
		storedAltContentId = null,
		isDomLoaded = false,
		isExpressInstallActive = false;
	
	/* Centralized function for browser feature detection
		- Proprietary feature detection (conditional compiling) is used to detect Internet Explorer's features
		- User agent string detection is only used when no alternative is possible
		- Is executed directly for optimal performance
	*/	
	var ua = function() {
		var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,
			playerVersion = [0,0,0],
			d = null;
		if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
			d = nav.plugins[SHOCKWAVE_FLASH].description;
			if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+
				d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
				playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
				playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
				playerVersion[2] = /r/.test(d) ? parseInt(d.replace(/^.*r(.*)$/, "$1"), 10) : 0;
			}
		}
		else if (typeof win.ActiveXObject != UNDEF) {
			var a = null, fp6Crash = false;
			try {
				a = new ActiveXObject(SHOCKWAVE_FLASH_AX + ".7");
			}
			catch(e) {
				try { 
					a = new ActiveXObject(SHOCKWAVE_FLASH_AX + ".6");
					playerVersion = [6,0,21];
					a.AllowScriptAccess = "always";	 // Introduced in fp6.0.47
				}
				catch(e) {
					if (playerVersion[0] == 6) {
						fp6Crash = true;
					}
				}
				if (!fp6Crash) {
					try {
						a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
					}
					catch(e) {}
				}
			}
			if (!fp6Crash && a) { // a will return null when ActiveX is disabled
				try {
					d = a.GetVariable("$version");	// Will crash fp6.0.21/23/29
					if (d) {
						d = d.split(" ")[1].split(",");
						playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
					}
				}
				catch(e) {}
			}
		}
		var u = nav.userAgent.toLowerCase(),
			p = nav.platform.toLowerCase(),
			webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit
			ie = false,
			windows = p ? /win/.test(p) : /win/.test(u),
			mac = p ? /mac/.test(p) : /mac/.test(u);
		/*@cc_on
			ie = true;
			@if (@_win32)
				windows = true;
			@elif (@_mac)
				mac = true;
			@end
		@*/
		return { w3cdom:w3cdom, pv:playerVersion, webkit:webkit, ie:ie, win:windows, mac:mac };
	}();

	/* Cross-browser onDomLoad
		- Based on Dean Edwards' solution: http://dean.edwards.name/weblog/2006/06/again/
		- Will fire an event as soon as the DOM of a page is loaded (supported by Gecko based browsers - like Firefox -, IE, Opera9+, Safari)
	*/ 
	var onDomLoad = function() {
		if (!ua.w3cdom) {
			return;
		}
		addDomLoadEvent(main);
		if (ua.ie && ua.win) {
			try {	 // Avoid a possible Operation Aborted error
				doc.write("<scr" + "ipt id=__ie_ondomload defer=true src=//:></scr" + "ipt>"); // String is split into pieces to avoid Norton AV to add code that can cause errors 
				script = getElementById("__ie_ondomload");
				if (script) {
					addListener(script, "onreadystatechange", checkReadyState);
				}
			}
			catch(e) {}
		}
		if (ua.webkit && typeof doc.readyState != UNDEF) {
			timer = setInterval(function() { if (/loaded|complete/.test(doc.readyState)) { callDomLoadFunctions(); }}, 10);
		}
		if (typeof doc.addEventListener != UNDEF) {
			doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, null);
		}
		addLoadEvent(callDomLoadFunctions);
	}();
	
	function checkReadyState() {
		if (script.readyState == "complete") {
			script.parentNode.removeChild(script);
			callDomLoadFunctions();
		}
	}
	
	function callDomLoadFunctions() {
		if (isDomLoaded) {
			return;
		}
		if (ua.ie && ua.win) { // Test if we can really add elements to the DOM; we don't want to fire it too early
			var s = createElement("span");
			try { // Avoid a possible Operation Aborted error
				var t = doc.getElementsByTagName("body")[0].appendChild(s);
				t.parentNode.removeChild(t);
			}
			catch (e) {
				return;
			}
		}
		isDomLoaded = true;
		if (timer) {
			clearInterval(timer);
			timer = null;
		}
		var dl = domLoadFnArr.length;
		for (var i = 0; i < dl; i++) {
			domLoadFnArr[i]();
		}
	}
	
	function addDomLoadEvent(fn) {
		if (isDomLoaded) {
			fn();
		}
		else { 
			domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+
		}
	}
	
	/* Cross-browser onload
		- Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/
		- Will fire an event as soon as a web page including all of its assets are loaded 
	 */
	function addLoadEvent(fn) {
		if (typeof win.addEventListener != UNDEF) {
			win.addEventListener("load", fn, false);
		}
		else if (typeof doc.addEventListener != UNDEF) {
			doc.addEventListener("load", fn, false);
		}
		else if (typeof win.attachEvent != UNDEF) {
			addListener(win, "onload", fn);
		}
		else if (typeof win.onload == "function") {
			var fnOld = win.onload;
			win.onload = function() {
				fnOld();
				fn();
			};
		}
		else {
			win.onload = fn;
		}
	}
	
	/* Main function
		- Will preferably execute onDomLoad, otherwise onload (as a fallback)
	*/
	function main() { // Static publishing only
		var rl = regObjArr.length;
		for (var i = 0; i < rl; i++) { // For each registered object element
			var id = regObjArr[i].id;
			if (ua.pv[0] > 0) {
				var obj = getElementById(id);
				if (obj) {
					regObjArr[i].width = obj.getAttribute("width") ? obj.getAttribute("width") : "0";
					regObjArr[i].height = obj.getAttribute("height") ? obj.getAttribute("height") : "0";
					if (hasPlayerVersion(regObjArr[i].swfVersion)) { // Flash plug-in version >= Flash content version: Houston, we have a match!
						if (ua.webkit && ua.webkit < 312) { // Older webkit engines ignore the object element's nested param elements
							fixParams(obj);
						}
						setVisibility(id, true);
					}
					else if (regObjArr[i].expressInstall && !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac)) { // Show the Adobe Express Install dialog if set by the web page author and if supported (fp6.0.65+ on Win/Mac OS only)
						showExpressInstall(regObjArr[i]);
					}
					else { // Flash plug-in and Flash content version mismatch: display alternative content instead of Flash content
						displayAltContent(obj);
					}
				}
			}
			else {	// If no fp is installed, we let the object element do its job (show alternative content)
				setVisibility(id, true);
			}
		}
	}
	
	/* Fix nested param elements, which are ignored by older webkit engines
		- This includes Safari up to and including version 1.2.2 on Mac OS 10.3
		- Fall back to the proprietary embed element
	*/
	function fixParams(obj) {
		var nestedObj = obj.getElementsByTagName(OBJECT)[0];
		if (nestedObj) {
			var e = createElement("embed"), a = nestedObj.attributes;
			if (a) {
				var al = a.length;
				for (var i = 0; i < al; i++) {
					if (a[i].nodeName == "DATA") {
						e.setAttribute("src", a[i].nodeValue);
					}
					else {
						e.setAttribute(a[i].nodeName, a[i].nodeValue);
					}
				}
			}
			var c = nestedObj.childNodes;
			if (c) {
				var cl = c.length;
				for (var j = 0; j < cl; j++) {
					if (c[j].nodeType == 1 && c[j].nodeName == "PARAM") {
						e.setAttribute(c[j].getAttribute("name"), c[j].getAttribute("value"));
					}
				}
			}
			obj.parentNode.replaceChild(e, obj);
		}
	}
	
	/* Show the Adobe Express Install dialog
		- Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75
	*/
	function showExpressInstall(regObj) {
		isExpressInstallActive = true;
		var obj = getElementById(regObj.id);
		if (obj) {
			if (regObj.altContentId) {
				var ac = getElementById(regObj.altContentId);
				if (ac) {
					storedAltContent = ac;
					storedAltContentId = regObj.altContentId;
				}
			}
			else {
				storedAltContent = abstractAltContent(obj);
			}
			if (!(/%$/.test(regObj.width)) && parseInt(regObj.width, 10) < 310) {
				regObj.width = "310";
			}
			if (!(/%$/.test(regObj.height)) && parseInt(regObj.height, 10) < 137) {
				regObj.height = "137";
			}
			doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";
			var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn",
				dt = doc.title,
				fv = "MMredirectURL=" + win.location + "&MMplayerType=" + pt + "&MMdoctitle=" + dt,
				replaceId = regObj.id;
			// For IE when a SWF is loading (AND: not available in cache) wait for the onload event to fire to remove the original object element
			// In IE you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
			if (ua.ie && ua.win && obj.readyState != 4) {
				var newObj = createElement("div");
				replaceId += "SWFObjectNew";
				newObj.setAttribute("id", replaceId);
				obj.parentNode.insertBefore(newObj, obj); // Insert placeholder div that will be replaced by the object element that loads expressinstall.swf
				obj.style.display = "none";
				var fn = function() {
					obj.parentNode.removeChild(obj);
				};
				addListener(win, "onload", fn);
			}
			createSWF({ data:regObj.expressInstall, id:EXPRESS_INSTALL_ID, width:regObj.width, height:regObj.height }, { flashvars:fv }, replaceId);
		}
	}
	
	/* Functions to abstract and display alternative content
	*/
	function displayAltContent(obj) {
		if (ua.ie && ua.win && obj.readyState != 4) {
			// For IE when a SWF is loading (AND: not available in cache) wait for the onload event to fire to remove the original object element
			// In IE you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
			var el = createElement("div");
			obj.parentNode.insertBefore(el, obj); // Insert placeholder div that will be replaced by the alternative content
			el.parentNode.replaceChild(abstractAltContent(obj), el);
			obj.style.display = "none";
			var fn = function() {
				obj.parentNode.removeChild(obj);
			};
			addListener(win, "onload", fn);
		}
		else {
			obj.parentNode.replaceChild(abstractAltContent(obj), obj);
		}
	} 

	function abstractAltContent(obj) {
		var ac = createElement("div");
		if (ua.win && ua.ie) {
			ac.innerHTML = obj.innerHTML;
		}
		else {
			var nestedObj = obj.getElementsByTagName(OBJECT)[0];
			if (nestedObj) {
				var c = nestedObj.childNodes;
				if (c) {
					var cl = c.length;
					for (var i = 0; i < cl; i++) {
						if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) {
							ac.appendChild(c[i].cloneNode(true));
						}
					}
				}
			}
		}
		return ac;
	}
	
	/* Cross-browser dynamic SWF creation
	*/
	function createSWF(attObj, parObj, id) {
		var r, el = getElementById(id);
		if (el) {
			if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content
				attObj.id = id;
			}
			if (ua.ie && ua.win) { // IE, the object element and W3C DOM methods do not combine: fall back to outerHTML
				var att = "";
				for (var i in attObj) {
					if (attObj[i] != Object.prototype[i]) { // Filter out prototype additions from other potential libraries, like Object.prototype.toJSONString = function() {}
						if (i.toLowerCase() == "data") {
							parObj.movie = attObj[i];
						}
						else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
							att += ' class="' + attObj[i] + '"';
						}
						else if (i.toLowerCase() != "classid") {
							att += ' ' + i + '="' + attObj[i] + '"';
						}
					}
				}
				var par = "";
				for (var j in parObj) {
					if (parObj[j] != Object.prototype[j]) { // Filter out prototype additions from other potential libraries
						par += '<param name="' + j + '" value="' + parObj[j] + '" />';
					}
				}
				el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';
				objIdArr[objIdArr.length] = attObj.id; // Stored to fix object 'leaks' on unload (dynamic publishing only)
				r = getElementById(attObj.id);	
			}
			else if (ua.webkit && ua.webkit < 312) { // Older webkit engines ignore the object element's nested param elements: fall back to the proprietary embed element
				var e = createElement("embed");
				e.setAttribute("type", FLASH_MIME_TYPE);
				for (var k in attObj) {
					if (attObj[k] != Object.prototype[k]) { // Filter out prototype additions from other potential libraries
						if (k.toLowerCase() == "data") {
							e.setAttribute("src", attObj[k]);
						}
						else if (k.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
							e.setAttribute("class", attObj[k]);
						}
						else if (k.toLowerCase() != "classid") { // Filter out IE specific attribute
							e.setAttribute(k, attObj[k]);
						}
					}
				}
				for (var l in parObj) {
					if (parObj[l] != Object.prototype[l]) { // Filter out prototype additions from other potential libraries
						if (l.toLowerCase() != "movie") { // Filter out IE specific param element
							e.setAttribute(l, parObj[l]);
						}
					}
				}
				el.parentNode.replaceChild(e, el);
				r = e;
			}
			else { // Well-behaving browsers
				var o = createElement(OBJECT);
				o.setAttribute("type", FLASH_MIME_TYPE);
				for (var m in attObj) {
					if (attObj[m] != Object.prototype[m]) { // Filter out prototype additions from other potential libraries
						if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
							o.setAttribute("class", attObj[m]);
						}
						else if (m.toLowerCase() != "classid") { // Filter out IE specific attribute
							o.setAttribute(m, attObj[m]);
						}
					}
				}
				for (var n in parObj) {
					if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // Filter out prototype additions from other potential libraries and IE specific param element
						createObjParam(o, n, parObj[n]);
					}
				}
				el.parentNode.replaceChild(o, el);
				r = o;
			}
		}
		return r;
	}
	
	function createObjParam(el, pName, pValue) {
		var p = createElement("param");
		p.setAttribute("name", pName);	
		p.setAttribute("value", pValue);
		el.appendChild(p);
	}
	
	/* Cross-browser SWF removal
		- Especially needed to safely and completely remove a SWF in Internet Explorer
	*/
	function removeSWF(id) {
		var obj = getElementById(id);
		if (obj && (obj.nodeName == "OBJECT" || obj.nodeName == "EMBED")) {
			if (ua.ie && ua.win) {
				if (obj.readyState == 4) {
					removeObjectInIE(id);
				}
				else {
					win.attachEvent("onload", function() {
						removeObjectInIE(id);
					});
				}
			}
			else {
				obj.parentNode.removeChild(obj);
			}
		}
	}
	
	function removeObjectInIE(id) {
		var obj = getElementById(id);
		if (obj) {
			for (var i in obj) {
				if (typeof obj[i] == "function") {
					obj[i] = null;
				}
			}
			obj.parentNode.removeChild(obj);
		}
	}
	
	/* Functions to optimize JavaScript compression
	*/
	function getElementById(id) {
		var el = null;
		try {
			el = doc.getElementById(id);
		}
		catch (e) {}
		return el;
	}
	
	function createElement(el) {
		return doc.createElement(el);
	}
	
	/* Updated attachEvent function for Internet Explorer
		- Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks
	*/	
	function addListener(target, eventType, fn) {
		target.attachEvent(eventType, fn);
		listenersArr[listenersArr.length] = [target, eventType, fn];
	}
	
	/* Flash Player and SWF content version matching
	*/
	function hasPlayerVersion(rv) {
		var pv = ua.pv, v = rv.split(".");
		v[0] = parseInt(v[0], 10);
		v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0"
		v[2] = parseInt(v[2], 10) || 0;
		return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;
	}
	
	/* Cross-browser dynamic CSS creation
		- Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php
	*/	
	function createCSS(sel, decl) {
		if (ua.ie && ua.mac) {
			return;
		}
		var h = doc.getElementsByTagName("head")[0], s = createElement("style");
		s.setAttribute("type", "text/css");
		s.setAttribute("media", "screen");
		if (!(ua.ie && ua.win) && typeof doc.createTextNode != UNDEF) {
			s.appendChild(doc.createTextNode(sel + " {" + decl + "}"));
		}
		h.appendChild(s);
		if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) {
			var ls = doc.styleSheets[doc.styleSheets.length - 1];
			if (typeof ls.addRule == OBJECT) {
				ls.addRule(sel, decl);
			}
		}
	}
	
	function setVisibility(id, isVisible) {
		var v = isVisible ? "visible" : "hidden";
		if (isDomLoaded && getElementById(id)) {
			getElementById(id).style.visibility = v;
		}
		else {
			createCSS("#" + id, "visibility:" + v);
		}
	}

	/* Filter to avoid XSS attacks 
	*/
	function urlEncodeIfNecessary(s) {
		var regex = /[\\\"<>\.;]/;
		var hasBadChars = regex.exec(s) != null;
		return hasBadChars ? encodeURIComponent(s) : s;
	}
	
	/* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only)
	*/
	var cleanup = function() {
		if (ua.ie && ua.win) {
			window.attachEvent("onunload", function() {
				// remove listeners to avoid memory leaks
				var ll = listenersArr.length;
				for (var i = 0; i < ll; i++) {
					listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]);
				}
				// cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect
				var il = objIdArr.length;
				for (var j = 0; j < il; j++) {
					removeSWF(objIdArr[j]);
				}
				// cleanup library's main closures to avoid memory leaks
				for (var k in ua) {
					ua[k] = null;
				}
				ua = null;
				for (var l in swfobject) {
					swfobject[l] = null;
				}
				swfobject = null;
			});
		}
	}();
	
	
	return {
		/* Public API
			- Reference: http://code.google.com/p/swfobject/wiki/SWFObject_2_0_documentation
		*/ 
		registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr) {
			if (!ua.w3cdom || !objectIdStr || !swfVersionStr) {
				return;
			}
			var regObj = {};
			regObj.id = objectIdStr;
			regObj.swfVersion = swfVersionStr;
			regObj.expressInstall = xiSwfUrlStr ? xiSwfUrlStr : false;
			regObjArr[regObjArr.length] = regObj;
			setVisibility(objectIdStr, false);
		},
		
		getObjectById: function(objectIdStr) {
			var r = null;
			if (ua.w3cdom) {
				var o = getElementById(objectIdStr);
				if (o) {
					var n = o.getElementsByTagName(OBJECT)[0];
					if (!n || (n && typeof o.SetVariable != UNDEF)) {
							r = o;
					}
					else if (typeof n.SetVariable != UNDEF) {
						r = n;
					}
				}
			}
			return r;
		},
		
		embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj) {
			if (!ua.w3cdom || !swfUrlStr || !replaceElemIdStr || !widthStr || !heightStr || !swfVersionStr) {
				return;
			}
			widthStr += ""; // Auto-convert to string
			heightStr += "";
			if (hasPlayerVersion(swfVersionStr)) {
				setVisibility(replaceElemIdStr, false);
				var att = {};
				if (attObj && typeof attObj === OBJECT) {
					for (var i in attObj) {
						if (attObj[i] != Object.prototype[i]) { // Filter out prototype additions from other potential libraries
							att[i] = attObj[i];
						}
					}
				}
				att.data = swfUrlStr;
				att.width = widthStr;
				att.height = heightStr;
				var par = {}; 
				if (parObj && typeof parObj === OBJECT) {
					for (var j in parObj) {
						if (parObj[j] != Object.prototype[j]) { // Filter out prototype additions from other potential libraries
							par[j] = parObj[j];
						}
					}
				}
				if (flashvarsObj && typeof flashvarsObj === OBJECT) {
					for (var k in flashvarsObj) {
						if (flashvarsObj[k] != Object.prototype[k]) { // Filter out prototype additions from other potential libraries
							if (typeof par.flashvars != UNDEF) {
								par.flashvars += "&" + k + "=" + flashvarsObj[k];
							}
							else {
								par.flashvars = k + "=" + flashvarsObj[k];
							}
						}
					}
				}
				addDomLoadEvent(function() {
					createSWF(att, par, replaceElemIdStr);
					if (att.id == replaceElemIdStr) {
						setVisibility(replaceElemIdStr, true);
					}
				});
			}
			else if (xiSwfUrlStr && !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac)) {
				isExpressInstallActive = true; // deferred execution
				setVisibility(replaceElemIdStr, false);
				addDomLoadEvent(function() {
					var regObj = {};
					regObj.id = regObj.altContentId = replaceElemIdStr;
					regObj.width = widthStr;
					regObj.height = heightStr;
					regObj.expressInstall = xiSwfUrlStr;
					showExpressInstall(regObj);
				});
			}
		},
		
		getFlashPlayerVersion: function() {
			return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };
		},
		
		hasFlashPlayerVersion: hasPlayerVersion,
		
		createSWF: function(attObj, parObj, replaceElemIdStr) {
			if (ua.w3cdom) {
				return createSWF(attObj, parObj, replaceElemIdStr);
			}
			else {
				return undefined;
			}
		},
		
		removeSWF: function(objElemIdStr) {
			if (ua.w3cdom) {
				removeSWF(objElemIdStr);
			}
		},
		
		createCSS: function(sel, decl) {
			if (ua.w3cdom) {
				createCSS(sel, decl);
			}
		},
		
		addDomLoadEvent: addDomLoadEvent,
		
		addLoadEvent: addLoadEvent,
		
		getQueryParamValue: function(param) {
			var q = doc.location.search || doc.location.hash;
			if (param == null) {
				return urlEncodeIfNecessary(q);
			}
			if (q) {
				var pairs = q.substring(1).split("&");
				for (var i = 0; i < pairs.length; i++) {
					if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
						return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1)));
					}
				}
			}
			return "";
		},
		
		// For internal usage only
		expressInstallCallback: function() {
			if (isExpressInstallActive && storedAltContent) {
				var obj = getElementById(EXPRESS_INSTALL_ID);
				if (obj) {
					obj.parentNode.replaceChild(storedAltContent, obj);
					if (storedAltContentId) {
						setVisibility(storedAltContentId, true);
						if (ua.ie && ua.win) {
							storedAltContent.style.display = "block";
						}
					}
					storedAltContent = null;
					storedAltContentId = null;
					isExpressInstallActive = false;
				}
			} 
		}
	};
}();

;(function($){
/*******************************************************************************************/	
// jquery.pajinate.js - version 0.2
// A jQuery plugin for paginating through any number of DOM elements
// 
// Copyright (c) 2010, Wes Nolte (http://wesnolte.com)
// Liscensed under the MIT License (MIT-LICENSE.txt)
// http://www.opensource.org/licenses/mit-license.php
// Created: 2010-04-16 | Updated: 2010-04-26
/*******************************************************************************************/

	$.fn.pajinate = function(options){
		// Set some state information
		var current_page = 'current_page';
		var items_per_page = 'items_per_page';
		
		var meta;
	
		// Setup default option values
		var defaults = {
			item_container_id : '.content',
			items_per_page : 10,			
			nav_panel_id : '.page_navigation',
			num_page_links_to_display : 20,			
			start_page : 0,
			nav_label_first : 'First',
			nav_label_prev : 'Prev',
			nav_label_next : 'Next',
			nav_label_last : 'Last'
		};
		var options = $.extend(defaults,options);
		var $item_container;
		var $page_container;
		var $items;
		var $nav_panels;
	
		return this.each(function(){
			$page_container = $(this);
			$item_container = $(this).find(options.item_container_id);
			$items = $page_container.find(options.item_container_id).children(':not(.exclude)');
			meta = $page_container;
			
			// Initialise meta data
			meta.data(current_page,0);
			meta.data(items_per_page, options.items_per_page);
					
			// Get the total number of items
			var total_items = $items.size();
		
			
			// Calculate the number of pages needed
			var number_of_pages = Math.ceil(total_items/options.items_per_page);
			
			// Construct the nav bar
			var more = '<span class="ellipse more">...</span>';
			var less = '<span class="ellipse less">...</span>';
			
			var navigation_html = '<a class="previous_link" href="#">'+ options.nav_label_prev +'</a>'+ less;
			var current_link = 0;
			while(number_of_pages > current_link){
				navigation_html += '<a class="page_link" href="#" longdesc="' + current_link +'">'+ (current_link + 1) +'</a>';
				current_link++;
			}
			navigation_html += more + '<a class="next_link" href="#">'+ options.nav_label_next +'</a>';
			
			// And add it to the appropriate area of the DOM	
			$nav_panels = $page_container.find(options.nav_panel_id);			
			$nav_panels.html(navigation_html).each(function(){
			
				$(this).find('.page_link:first').addClass('first');
				$(this).find('.page_link:last').addClass('last');
				
			});
			
			// Hide the more/less indicators
			$nav_panels.children('.ellipse').hide();
			
			// Set the active page link styling
			$nav_panels.find('.previous_link').next().next().addClass('active_page');
			
			/* Setup Page Display */
			// And hide all pages
			$items.hide();
			// Show the first page			
			$items.slice(0, meta.data(items_per_page)).show();

			/* Setup Nav Menu Display */
			// Page number slices
			
			var total_page_no_links = $page_container.children(options.nav_panel_id+':first').children('.page_link').size();
			options.num_page_links_to_display = Math.min(options.num_page_links_to_display,total_page_no_links);

			$nav_panels.children('.page_link').hide(); // Hide all the page links
			
			// And only show the number we should be seeing
			$nav_panels.each(function(){
				$(this).children('.page_link').slice(0, options.num_page_links_to_display).show();			
			});
			
			/* Bind the actions to their respective links */
			 
			// Event handler for 'First' link
			$page_container.find('.first_link').click(function(e){
				e.preventDefault();
				
				movePageNumbersRight($(this),0);
				goto(0);				
			});			
			
			// Event handler for 'Last' link
			$page_container.find('.last_link').click(function(e){
				e.preventDefault();
				var lastPage = total_page_no_links - 1;
				movePageNumbersLeft($(this),lastPage);
				goto(lastPage);				
			});			
			
			// Event handler for 'Prev' link
			$page_container.find('.previous_link').click(function(e){
				
				showPrevPage($(this));
			});
			
			
			// Event handler for 'Next' link
			$page_container.find('.next_link').click(function(e){
							
				showNextPage($(this));
			});
			
			// Event handler for each 'Page' link
			$page_container.find('.page_link').click(function(e){

				goto($(this).attr('longdesc'));
			});			
			
			// Goto the required page
			goto(parseInt(options.start_page));
			toggleMoreLess();
		});
		
		function showPrevPage(e){
			new_page = parseInt(meta.data(current_page)) - 1;						
			
			// Check that we aren't on a boundary link
			if($(e).siblings('.active_page').prev('.page_link').length==true){
				movePageNumbersRight(e,new_page);
				goto(new_page);
			}
				
		};
			
		function showNextPage(e){
			new_page = parseInt(meta.data(current_page)) + 1;
			
			// Check that we aren't on a boundary link
			if($(e).siblings('.active_page').next('.page_link').length==true){		
				movePageNumbersLeft(e,new_page);
				goto(new_page);
			}
				
		};
			
		function goto(page_num){
			
			var ipp = meta.data(items_per_page);
			
			var isLastPage = false;
			
			// Find the start of the next slice
			start_from = page_num * ipp;
			
			// Find the end of the next slice
			end_on = start_from + ipp;
			// Hide the current page	
			if ($items.length <= 0) {
				jQuery(options.nav_panel_id).hide();
				jQuery(options.item_container_id).children().hide();
				jQuery('#no-articles').show();
			} else {
				jQuery('#no-articles').hide();
				jQuery(options.nav_panel_id).show();
				
				$items.hide()
					.slice(start_from, end_on)
					.show()
					.siblings('.exclude').hide();
				
				//tracking for innovations
				if (parseInt(page_num) > 0) {
					var trackingData = {
							num: (parseInt(page_num)+1)
					}
					try{crmEvent2(trackingData)}catch(e){}
				}
				
				// Reassign the active class
				$page_container.find(options.nav_panel_id).children('.page_link[longdesc=' + page_num +']').addClass('active_page')
													 .siblings('.active_page')
													 .removeClass('active_page');										 
			}
			// Set the current page meta data							
			meta.data(current_page,page_num);
			
			//determine whether to hide or show previous and next buttons
			showHideNextPrevItmes();
			
			// Hide the more and/or less indicators
			toggleMoreLess(current_page);
		};	
		
		// Methods to shift the diplayed index of page numbers to the left or right
		function movePageNumbersLeft(e, new_p){
			var new_page = new_p;
			
			var $current_active_link = $(e).siblings('.active_page');
		
			if($current_active_link.siblings('.page_link[longdesc=' + new_page +']').css('display') == 'none'){
				
				$nav_panels.each(function(){
							$(this).children('.page_link')
								.hide() // Hide all the page links
								.slice(parseInt(new_page - options.num_page_links_to_display + 1) , new_page + 1)
								.show();		
							});
			}
			
		} 
		
		function movePageNumbersRight(e, new_p){
			var new_page = new_p;
			
			var $current_active_link = $(e).siblings('.active_page');
			
			if($current_active_link.siblings('.page_link[longdesc=' + new_page +']').css('display') == 'none'){
												
				$nav_panels.each(function(){
							$(this).children('.page_link')
								.hide() // Hide all the page links
								.slice( new_page , new_page + parseInt(options.num_page_links_to_display))
								.show();
							});
			}
		}
		// added in Function to show and hide the previoius and next buttons based on where you are in pagination
		function showHideNextPrevItmes() {
			var activePage = jQuery('.pagination-nav').children('.active_page');
			var prevLink = jQuery('.pagination-nav .previous_link');
			var nextLink = jQuery('.pagination-nav .next_link');
			if (activePage.hasClass('first')) {
				prevLink.hide();
				nextLink.show();
			} else if(activePage.hasClass('last')){
				nextLink.hide();
				prevLink.show();
			} else {
				prevLink.show();
				nextLink.show();
			}
			
			
		}
		
		// Show or remove the ellipses that indicate that more page numbers exist in the page index than are currently shown
		function toggleMoreLess(){
													 
			if(!$nav_panels.children('.page_link:visible').hasClass('last')){					
				$nav_panels.children('.more').show();
			}else {
				$nav_panels.children('.more').hide();
			}
			
			if(!$nav_panels.children('.page_link:visible').hasClass('first')){
				$nav_panels.children('.less').show();
			}else {
				$nav_panels.children('.less').hide();
			}			
		}
		
	};
	
})(jQuery);



(function($){

/**         VIDEO PLAYER MODAL PLUGIN
 * _________ 
 * @author Arjay Aquino
 * @date 05.09.11
 * @desc Creates a modal which will load the video player
 * @usage Use with <a> tag ie: <a href="/content/nissan/us/en/homepage/videogallery.html?category=cat-name&video=video-name" class="video-modal-link" >Launch Latest Category</a>
 */
    $.fn.videoplayermodal = function(options){
        
        var settings = {
                height         : "775",
                width          : "710",
                animationSpeed : "slow",
                language       : "en",
                modalHTML      : '<div id="video-modal">\
                                     <a href="#" class="modal-close">Close</a>\
                                     <iframe id="video-modal-content" width="100%" height="100%" marginWidth="0" marginHeight="0" frameBorder="0" scrolling="no" title=""></iframe>\
                                 </div>',
               modalMaskHTML    : '<div id="video-modal-mask"></div>',
               loadingHTML      : '<div id="video-modal-loading"><img src="/content/dam/nissan/docroot/img/videogallery/ajax-loader.gif"/></div>'
        }
        
        
        return this.each(function(){
            
            var $element     = $(this);
            var modalWindow;
            
            
            if(options){
                $.extend(settings, options);
            }

            
            $element.bind("click", function(e){ 
                e.preventDefault();
                
                var url      = $element.attr("href");
                
                modalWindow = new ModalWindow(url, settings);
            });
            
        });
    };


/*                      MODAL WINDOW OBJECT
 * ______________________
 */
    ModalWindow = function(url, settings){
        
        this.url      = url;
        this.settings = settings;
        
    //elements
        this.$body = $("body");
        this.$modalMask;
        this.$modalWindow;
        this.$modalContent;
        this.$closeButton;
        this.$loading;
        
    //initial calls
        this.createLoading();
        this.createModalMask();
        this.createModalWindow();
        this.initBrowserResizeListener();
        this.initCloseEvents();
    }

    
    /**
     * Create a loading animation which is displayed until the modal is loaded
     */
    ModalWindow.prototype.createLoading = function(){
        
        this.$body.append(this.settings.loadingHTML);
        
        this.$loading = $("#video-modal-loading");
        
        this.centerElement(this.$loading);
    }
    
    
        
    /**
     * Create the modal mask and then show it
     */
    ModalWindow.prototype.createModalMask = function(){
        
        var height = $(document).height();
        var width  = $(window).width();
        
        this.$body.append(this.settings.modalMaskHTML);
        
        this.$modalMask = $("#video-modal-mask");
        
        this.$modalMask.css({'width':width,'height':height})
        .fadeTo(0,0);
    }
    
    
    /**
     * Create the modal window and fade it in
     */
    ModalWindow.prototype.createModalWindow = function(){
        
        var windowHeight   = $(window).height();
        var windowWidth    = $(window).width();
        
        this.$body.append(this.settings.modalHTML);
        
        this.$modalWindow  = $("#video-modal");
        this.$closeButton  = this.$modalWindow.find(".modal-close");
        this.$modalContent = this.$modalWindow.find("#video-modal-content");
        
        this.$modalWindow.css({'width':this.settings.width+"px",'height':this.settings.height+"px"})
        .fadeTo(0,0);
        
        this.centerElement(this.$modalWindow);
        
        this.loadPage();
    }
    
    
    ModalWindow.prototype.loadPage = function(){
        
        var self   = this;
        var params = "&language="+this.settings.language;
        
        this.$modalContent.attr("src", this.url+params).load(function(){
            self.$loading.remove();
            self.$modalMask.show().fadeTo(self.settings.animationSpeed, 0.8);
            self.$modalWindow.show().fadeTo(self.settings.animationSpeed, 1);
        });
        
    }
    
    
    
    /**
     * Bind close events to close button and modal mask
     */
    ModalWindow.prototype.initCloseEvents = function(){
        
        var self = this;
        
        this.$closeButton.bind("click", function(e){
            e.preventDefault();
            self.closeModal();
        });
        
        this.$modalMask.bind("click", function(e){
            e.preventDefault();
            self.closeModal();
        });
    }
    
    
    /**
     * Fade out Modal call dispose after
     */
    ModalWindow.prototype.closeModal = function(){
        
        var self = this;
        
        this.$modalWindow.fadeOut(0);
        this.$modalMask.fadeOut(0, function(){
            self.dispose();
        });
    }
    
    
    /**
     * Remove any events and elements
     */
    ModalWindow.prototype.dispose = function(){
        
        $(window).unbind("resize");
        this.$closeButton.unbind();
        this.$modalMask.unbind();
        
        this.$modalMask.remove();
        this.$modalWindow.remove();
    }
    
    
    /**
     * Listen for when the browser resizes.
     * Update the size of the modal mask and the position of the window.
     */
    ModalWindow.prototype.initBrowserResizeListener = function(){
        
        var self = this;
        
        $(window).bind("resize", function(e){
            
            self.updateModalPosition();
        })
        .trigger("resize");
    }
    
    
    /**
     * Gets called on window resize event
     */
    ModalWindow.prototype.updateModalPosition = function(){
        
        var documentHeight = $(document).height();
        var windowWidth    = $(window).width();
        
        this.$modalMask.css({'width':windowWidth,'height':documentHeight});
        
        this.centerElement(this.$modalWindow);
    }
    
    
    /**
     * use to center an element based on window size
     */
    ModalWindow.prototype.centerElement = function($element){
        
        var isWebkit = navigator.userAgent.match(/webkit/i) != null; //scrollTop works differently in webkit
        
        var elementWidth  = $element.width();
        var elementHeight = $element.height();
        var windowWidth   = $(window).width();
        var windowHeight  = $(window).height();
        var scrollTop     = (isWebkit) ? jQuery(window).scrollTop() : jQuery('html').scrollTop();
        
        var left = (windowWidth / 2) - (elementWidth / 2);
        var top  = scrollTop + ((windowHeight / 2) - (elementHeight / 2));
        
        top  = (top  < 0) ? 0 : top;
        left = (left < 0) ? 0 : left;
    
        $element.css({
            top: top,
            left: left
        });
    }

    
    
})(jQuery);

