﻿//p: 2010-03-11 03:24:09
var Cufon=(function(){var m=function(){return m.replace.apply(null,arguments)};var x=m.DOM={ready:(function(){var C=false,E={loaded:1,complete:1};var B=[],D=function(){if(C){return}C=true;for(var F;F=B.shift();F()){}};if(document.addEventListener){document.addEventListener("DOMContentLoaded",D,false);window.addEventListener("pageshow",D,false)}if(!window.opera&&document.readyState){(function(){E[document.readyState]?D():setTimeout(arguments.callee,10)})()}if(document.readyState&&document.createStyleSheet){(function(){try{document.body.doScroll("left");D()}catch(F){setTimeout(arguments.callee,1)}})()}q(window,"load",D);return function(F){if(!arguments.length){D()}else{C?F():B.push(F)}}})(),root:function(){return document.documentElement||document.body}};var n=m.CSS={Size:function(C,B){this.value=parseFloat(C);this.unit=String(C).match(/[a-z%]*$/)[0]||"px";this.convert=function(D){return D/B*this.value};this.convertFrom=function(D){return D/this.value*B};this.toString=function(){return this.value+this.unit}},addClass:function(C,B){var D=C.className;C.className=D+(D&&" ")+B;return C},color:j(function(C){var B={};B.color=C.replace(/^rgba\((.*?),\s*([\d.]+)\)/,function(E,D,F){B.opacity=parseFloat(F);return"rgb("+D+")"});return B}),fontStretch:j(function(B){if(typeof B=="number"){return B}if(/%$/.test(B)){return parseFloat(B)/100}return{"ultra-condensed":0.5,"extra-condensed":0.625,condensed:0.75,"semi-condensed":0.875,"semi-expanded":1.125,expanded:1.25,"extra-expanded":1.5,"ultra-expanded":2}[B]||1}),getStyle:function(C){var B=document.defaultView;if(B&&B.getComputedStyle){return new a(B.getComputedStyle(C,null))}if(C.currentStyle){return new a(C.currentStyle)}return new a(C.style)},gradient:j(function(F){var G={id:F,type:F.match(/^-([a-z]+)-gradient\(/)[1],stops:[]},C=F.substr(F.indexOf("(")).match(/([\d.]+=)?(#[a-f0-9]+|[a-z]+\(.*?\)|[a-z]+)/ig);for(var E=0,B=C.length,D;E<B;++E){D=C[E].split("=",2).reverse();G.stops.push([D[1]||E/(B-1),D[0]])}return G}),quotedList:j(function(E){var D=[],C=/\s*((["'])([\s\S]*?[^\\])\2|[^,]+)\s*/g,B;while(B=C.exec(E)){D.push(B[3]||B[1])}return D}),recognizesMedia:j(function(G){var E=document.createElement("style"),D,C,B;E.type="text/css";E.media=G;try{E.appendChild(document.createTextNode("/**/"))}catch(F){}C=g("head")[0];C.insertBefore(E,C.firstChild);D=(E.sheet||E.styleSheet);B=D&&!D.disabled;C.removeChild(E);return B}),removeClass:function(D,C){var B=RegExp("(?:^|\\s+)"+C+"(?=\\s|$)","g");D.className=D.className.replace(B,"");return D},supports:function(D,C){var B=document.createElement("span").style;if(B[D]===undefined){return false}B[D]=C;return B[D]===C},textAlign:function(E,D,B,C){if(D.get("textAlign")=="right"){if(B>0){E=" "+E}}else{if(B<C-1){E+=" "}}return E},textDecoration:function(G,F){if(!F){F=this.getStyle(G)}var C={underline:null,overline:null,"line-through":null};for(var B=G;B.parentNode&&B.parentNode.nodeType==1;){var E=true;for(var D in C){if(!k(C,D)||C[D]){continue}if(F.get("textDecoration").indexOf(D)!=-1){C[D]=F.get("color")}E=false}if(E){break}F=this.getStyle(B=B.parentNode)}return C},textShadow:j(function(F){if(F=="none"){return null}var E=[],G={},B,C=0;var D=/(#[a-f0-9]+|[a-z]+\(.*?\)|[a-z]+)|(-?[\d.]+[a-z%]*)|,/ig;while(B=D.exec(F)){if(B[0]==","){E.push(G);G={};C=0}else{if(B[1]){G.color=B[1]}else{G[["offX","offY","blur"][C++]]=B[2]}}}E.push(G);return E}),textTransform:(function(){var B={uppercase:function(C){return C.toUpperCase()},lowercase:function(C){return C.toLowerCase()},capitalize:function(C){return C.replace(/\b./g,function(D){return D.toUpperCase()})}};return function(E,D){var C=B[D.get("textTransform")];return C?C(E):E}})(),whiteSpace:(function(){var B={inline:1,"inline-block":1,"run-in":1};return function(E,C,D){if(B[C.get("display")]){return E}if(!D.previousSibling){E=E.replace(/^\s+/,"")}if(!D.nextSibling){E=E.replace(/\s+$/,"")}return E}})()};n.ready=(function(){var B=!n.recognizesMedia("all"),E=false;var D=[],H=function(){B=true;for(var K;K=D.shift();K()){}};var I=g("link"),J=g("style");function C(K){return K.disabled||G(K.sheet,K.media||"screen")}function G(M,P){if(!n.recognizesMedia(P||"all")){return true}if(!M||M.disabled){return false}try{var Q=M.cssRules,O;if(Q){search:for(var L=0,K=Q.length;O=Q[L],L<K;++L){switch(O.type){case 2:break;case 3:if(!G(O.styleSheet,O.media.mediaText)){return false}break;default:break search}}}}catch(N){}return true}function F(){if(document.createStyleSheet){return true}var L,K;for(K=0;L=I[K];++K){if(L.rel.toLowerCase()=="stylesheet"&&!C(L)){return false}}for(K=0;L=J[K];++K){if(!C(L)){return false}}return true}x.ready(function(){if(!E){E=n.getStyle(document.body).isUsable()}if(B||(E&&F())){H()}else{setTimeout(arguments.callee,10)}});return function(K){if(B){K()}else{D.push(K)}}})();function s(C){var B=this.face=C.face;this.glyphs=C.glyphs;this.w=C.w;this.baseSize=parseInt(B["units-per-em"],10);this.family=B["font-family"].toLowerCase();this.weight=B["font-weight"];this.style=B["font-style"]||"normal";this.viewBox=(function(){var E=B.bbox.split(/\s+/);var D={minX:parseInt(E[0],10),minY:parseInt(E[1],10),maxX:parseInt(E[2],10),maxY:parseInt(E[3],10)};D.width=D.maxX-D.minX;D.height=D.maxY-D.minY;D.toString=function(){return[this.minX,this.minY,this.width,this.height].join(" ")};return D})();this.ascent=-parseInt(B.ascent,10);this.descent=-parseInt(B.descent,10);this.height=-this.ascent+this.descent}function f(){var C={},B={oblique:"italic",italic:"oblique"};this.add=function(D){(C[D.style]||(C[D.style]={}))[D.weight]=D};this.get=function(H,I){var G=C[H]||C[B[H]]||C.normal||C.italic||C.oblique;if(!G){return null}I={normal:400,bold:700}[I]||parseInt(I,10);if(G[I]){return G[I]}var E={1:1,99:0}[I%100],K=[],F,D;if(E===undefined){E=I>400}if(I==500){I=400}for(var J in G){if(!k(G,J)){continue}J=parseInt(J,10);if(!F||J<F){F=J}if(!D||J>D){D=J}K.push(J)}if(I<F){I=F}if(I>D){I=D}K.sort(function(M,L){return(E?(M>I&&L>I)?M<L:M>L:(M<I&&L<I)?M>L:M<L)?-1:1});return G[K[0]]}}function r(){function D(F,G){if(F.contains){return F.contains(G)}return F.compareDocumentPosition(G)&16}function B(G){var F=G.relatedTarget;if(!F||D(this,F)){return}C(this)}function E(F){C(this)}function C(F){setTimeout(function(){m.replace(F,d.get(F).options,true)},10)}this.attach=function(F){if(F.onmouseenter===undefined){q(F,"mouseover",B);q(F,"mouseout",B)}else{q(F,"mouseenter",E);q(F,"mouseleave",E)}}}function u(){var C=[],D={};function B(H){var E=[],G;for(var F=0;G=H[F];++F){E[F]=C[D[G]]}return E}this.add=function(F,E){D[F]=C.push(E)-1};this.repeat=function(){var E=arguments.length?B(arguments):C,F;for(var G=0;F=E[G++];){m.replace(F[0],F[1],true)}}}function A(){var D={},B=0;function C(E){return E.cufid||(E.cufid=++B)}this.get=function(E){var F=C(E);return D[F]||(D[F]={})}}function a(B){var D={},C={};this.extend=function(E){for(var F in E){if(k(E,F)){D[F]=E[F]}}return this};this.get=function(E){return D[E]!=undefined?D[E]:B[E]};this.getSize=function(F,E){return C[F]||(C[F]=new n.Size(this.get(F),E))};this.isUsable=function(){return !!B}}function q(C,B,D){if(C.addEventListener){C.addEventListener(B,D,false)}else{if(C.attachEvent){C.attachEvent("on"+B,function(){return D.call(C,window.event)})}}}function v(C,B){var D=d.get(C);if(D.options){return C}if(B.hover&&B.hoverables[C.nodeName.toLowerCase()]){b.attach(C)}D.options=B;return C}function j(B){var C={};return function(D){if(!k(C,D)){C[D]=B.apply(null,arguments)}return C[D]}}function c(F,E){var B=n.quotedList(E.get("fontFamily").toLowerCase()),D;for(var C=0;D=B[C];++C){if(i[D]){return i[D].get(E.get("fontStyle"),E.get("fontWeight"))}}return null}function g(B){return document.getElementsByTagName(B)}function k(C,B){return C.hasOwnProperty(B)}function h(){var B={},D,F;for(var E=0,C=arguments.length;D=arguments[E],E<C;++E){for(F in D){if(k(D,F)){B[F]=D[F]}}}return B}function o(E,M,C,N,F,D){var K=document.createDocumentFragment(),H;if(M===""){return K}var L=N.separate;var I=M.split(p[L]),B=(L=="words");if(B&&t){if(/^\s/.test(M)){I.unshift("")}if(/\s$/.test(M)){I.push("")}}for(var J=0,G=I.length;J<G;++J){H=z[N.engine](E,B?n.textAlign(I[J],C,J,G):I[J],C,N,F,D,J<G-1);if(H){K.appendChild(H)}}return K}function l(C,J){var B=n.getStyle(v(C,J)).extend(J);var D=c(C,B),E,H,G,F,I;for(E=C.firstChild;E;E=G){H=E.nodeType;G=E.nextSibling;if(H==3){if(F){F.appendData(E.data);C.removeChild(E)}else{F=E}if(G){continue}}if(F){C.replaceChild(o(D,n.whiteSpace(F.data,B,E),B,J,E,C),F);F=null}if(H==1&&E.firstChild){if(/cufon/.test(E.className)){z[J.engine](D,null,B,J,E,C)}else{arguments.callee(E,J)}}}}var t=" ".split(/\s+/).length==0;var d=new A();var b=new r();var y=new u();var e=false;var z={},i={},w={enableTextDecoration:false,engine:null,forceHitArea:false,hover:false,hoverables:{a:true},printable:true,selector:(window.Sizzle||(window.jQuery&&function(B){return jQuery(B)})||(window.dojo&&dojo.query)||(window.$$&&function(B){return $$(B)})||(window.$&&function(B){return $(B)})||(document.querySelectorAll&&function(B){return document.querySelectorAll(B)})||(window.Ext&&Ext.query)||g),separate:"words",textShadow:"none"};var p={words:/[^\S\u00a0]+/,characters:"",none:/^/};m.now=function(){x.ready();return m};m.refresh=function(){y.repeat.apply(y,arguments);return m};m.registerEngine=function(C,B){if(!B){return m}z[C]=B;return m.set("engine",C)};m.registerFont=function(D){var B=new s(D),C=B.family;if(!i[C]){i[C]=new f()}i[C].add(B);return m.set("fontFamily",'"'+C+'"')};m.replace=function(D,C,B){C=h(w,C);if(!C.engine){return m}if(!e){n.addClass(x.root(),"cufon-active cufon-loading");n.ready(function(){n.removeClass(x.root(),"cufon-loading")});e=true}if(C.hover){C.forceHitArea=true}if(typeof C.textShadow=="string"){C.textShadow=n.textShadow(C.textShadow)}if(typeof C.color=="string"&&/^-/.test(C.color)){C.textGradient=n.gradient(C.color)}if(!B){y.add(D,arguments)}if(D.nodeType||typeof D=="string"){D=[D]}n.ready(function(){for(var F=0,E=D.length;F<E;++F){var G=D[F];if(typeof G=="string"){m.replace(C.selector(G),C,true)}else{l(G,C)}}});return m};m.set=function(B,C){w[B]=C;return m};return m})();Cufon.registerEngine("canvas",(function(){var b=document.createElement("canvas");if(!b||!b.getContext||!b.getContext.apply){return}b=null;var a=Cufon.CSS.supports("display","inline-block");var e=!a&&(document.compatMode=="BackCompat"||/frameset|transitional/i.test(document.doctype.publicId));var f=document.createElement("style");f.type="text/css";f.appendChild(document.createTextNode((".cufon-canvas{text-indent:0;}@media screen,projection{.cufon-canvas{display:inline;display:inline-block;position:relative;vertical-align:middle;"+(e?"":"font-size:1px;line-height:1px;")+"}.cufon-canvas .cufon-alt{display:-moz-inline-box;display:inline-block;width:0;height:0;overflow:hidden;text-indent:-10000in;}"+(a?".cufon-canvas canvas{position:relative;}":".cufon-canvas canvas{position:absolute;}")+"}@media print{.cufon-canvas{padding:0;}.cufon-canvas canvas{display:none;}.cufon-canvas .cufon-alt{display:inline;}}").replace(/;/g,"!important;")));document.getElementsByTagName("head")[0].appendChild(f);function d(p,h){var n=0,m=0;var g=[],o=/([mrvxe])([^a-z]*)/g,k;generate:for(var j=0;k=o.exec(p);++j){var l=k[2].split(",");switch(k[1]){case"v":g[j]={m:"bezierCurveTo",a:[n+~~l[0],m+~~l[1],n+~~l[2],m+~~l[3],n+=~~l[4],m+=~~l[5]]};break;case"r":g[j]={m:"lineTo",a:[n+=~~l[0],m+=~~l[1]]};break;case"m":g[j]={m:"moveTo",a:[n=~~l[0],m=~~l[1]]};break;case"x":g[j]={m:"closePath"};break;case"e":break generate}h[g[j].m].apply(h,g[j].a)}return g}function c(m,k){for(var j=0,h=m.length;j<h;++j){var g=m[j];k[g.m].apply(k,g.a)}}return function(ah,H,Z,D,L,ai){var n=(H===null);if(n){H=L.alt}var J=ah.viewBox;var p=Z.getSize("fontSize",ah.baseSize);var X=Z.get("letterSpacing");X=(X=="normal")?0:p.convertFrom(parseInt(X,10));var K=0,Y=0,W=0,F=0;var I=D.textShadow,U=[];if(I){for(var ag=I.length;ag--;){var O=I[ag];var T=p.convertFrom(parseFloat(O.offX));var R=p.convertFrom(parseFloat(O.offY));U[ag]=[T,R];if(R<K){K=R}if(T>Y){Y=T}if(R>W){W=R}if(T<F){F=T}}}var al=Cufon.CSS.textTransform(H,Z).split(""),B;var o=ah.glyphs,E,r,ac;var h=0,v,N=[];for(var ag=0,ae=0,ab=al.length;ag<ab;++ag){E=o[B=al[ag]]||ah.missingGlyph;if(!E){continue}if(r){h-=ac=r[B]||0;N[ae-1]-=ac}h+=v=N[ae++]=~~(E.w||ah.w)+X;r=E.k}if(v===undefined){return null}Y+=J.width-v;F+=J.minX;var C,q;if(n){C=L;q=L.firstChild}else{C=document.createElement("span");C.className="cufon cufon-canvas";C.alt=H;q=document.createElement("canvas");C.appendChild(q);if(D.printable){var ad=document.createElement("span");ad.className="cufon-alt";ad.appendChild(document.createTextNode(H));C.appendChild(ad)}}var am=C.style;var Q=q.style;var m=p.convert(J.height);var ak=Math.ceil(m);var V=ak/m;var P=V*Cufon.CSS.fontStretch(Z.get("fontStretch"));var S=h*P;var aa=Math.ceil(p.convert(S+Y-F));var t=Math.ceil(p.convert(J.height-K+W));q.width=aa;q.height=t;Q.width=aa+"px";Q.height=t+"px";K+=J.minY;Q.top=Math.round(p.convert(K-ah.ascent))+"px";Q.left=Math.round(p.convert(F))+"px";var A=Math.ceil(p.convert(S))+"px";if(a){am.width=A;am.height=p.convert(ah.height)+"px"}else{am.paddingLeft=A;am.paddingBottom=(p.convert(ah.height)-1)+"px"}var aj=q.getContext("2d"),M=m/J.height;aj.scale(M,M*V);aj.translate(-F,-K);aj.lineWidth=ah.face["underline-thickness"];aj.save();function s(i,g){aj.strokeStyle=g;aj.beginPath();aj.moveTo(0,i);aj.lineTo(h,i);aj.stroke()}var u=D.enableTextDecoration?Cufon.CSS.textDecoration(ai,Z):{};if(u.underline){s(-ah.face["underline-position"],u.underline)}if(u.overline){s(ah.ascent,u.overline)}function af(){aj.scale(P,1);for(var x=0,k=0,g=al.length;x<g;++x){var y=o[al[x]]||ah.missingGlyph;if(!y){continue}if(y.d){aj.beginPath();if(y.code){c(y.code,aj)}else{y.code=d("m"+y.d,aj)}aj.fill()}aj.translate(N[k++],0)}aj.restore()}if(I){for(var ag=I.length;ag--;){var O=I[ag];aj.save();aj.fillStyle=O.color;aj.translate.apply(aj,U[ag]);af()}}var z=D.textGradient;if(z){var G=z.stops,w=aj.createLinearGradient(0,J.minY,0,J.maxY);for(var ag=0,ab=G.length;ag<ab;++ag){w.addColorStop.apply(w,G[ag])}aj.fillStyle=w}else{aj.fillStyle=Z.get("color")}af();if(u["line-through"]){s(-ah.descent,u["line-through"])}return C}})());Cufon.registerEngine("vml",(function(){if(!document.namespaces){return}if(document.namespaces.cvml==null){document.namespaces.add("cvml","urn:schemas-microsoft-com:vml")}var b=document.createElement("cvml:shape");b.style.behavior="url(#default#VML)";if(!b.coordsize){return}b=null;var f=(document.documentMode||0)<8;document.write(('<style type="text/css">.cufon-vml-canvas{text-indent:0;}@media screen{cvml\\:shape,cvml\\:rect,cvml\\:fill,cvml\\:shadow{behavior:url(#default#VML);display:block;antialias:true;position:absolute;}.cufon-vml-canvas{position:absolute;text-align:left;}.cufon-vml{display:inline-block;position:relative;vertical-align:'+(f?"middle":"text-bottom")+";}.cufon-vml .cufon-alt{position:absolute;left:-10000in;font-size:1px;}a .cufon-vml{cursor:pointer}}@media print{.cufon-vml *{display:none;}.cufon-vml .cufon-alt{display:inline;}}</style>").replace(/;/g,"!important;"));function c(g,h){return a(g,/(?:em|ex|%)$|^[a-z-]+$/i.test(h)?"1em":h)}function a(j,k){if(/px$/i.test(k)){return parseFloat(k)}var i=j.style.left,h=j.runtimeStyle.left;j.runtimeStyle.left=j.currentStyle.left;j.style.left=k.replace("%","em");var g=j.style.pixelLeft;j.style.left=i;j.runtimeStyle.left=h;return g}var e={};function d(n){var o=n.id;if(!e[o]){var l=n.stops,m=document.createElement("cvml:fill"),g=[];m.type="gradient";m.angle=180;m.focus="0";m.method="sigma";m.color=l[0][1];for(var i=1,h=l.length-1;i<h;++i){g.push(l[i][0]*100+"% "+l[i][1])}m.colors=g.join(",");m.color2=l[h][1];e[o]=m}return e[o]}return function(ai,J,ac,F,N,aj,aa){var n=(J===null);if(n){J=N.alt}var L=ai.viewBox;var p=ac.computedFontSize||(ac.computedFontSize=new Cufon.CSS.Size(c(aj,ac.get("fontSize"))+"px",ai.baseSize));var Z=ac.computedLspacing;if(Z==undefined){Z=ac.get("letterSpacing");ac.computedLspacing=Z=(Z=="normal")?0:~~p.convertFrom(a(aj,Z))}var B,q;if(n){B=N;q=N.firstChild}else{B=document.createElement("span");B.className="cufon cufon-vml";B.alt=J;q=document.createElement("span");q.className="cufon-vml-canvas";B.appendChild(q);if(F.printable){var af=document.createElement("span");af.className="cufon-alt";af.appendChild(document.createTextNode(J));B.appendChild(af)}if(!aa){B.appendChild(document.createElement("cvml:shape"))}}var ao=B.style;var U=q.style;var h=p.convert(L.height),al=Math.ceil(h);var Y=al/h;var S=Y*Cufon.CSS.fontStretch(ac.get("fontStretch"));var X=L.minX,W=L.minY;U.height=al;U.top=Math.round(p.convert(W-ai.ascent));U.left=Math.round(p.convert(X));ao.height=p.convert(ai.height)+"px";var u=F.enableTextDecoration?Cufon.CSS.textDecoration(aj,ac):{};var I=ac.get("color");var an=Cufon.CSS.textTransform(J,ac).split(""),A;var o=ai.glyphs,G,r,ae;var g=0,O=[],V=0,w;var y,K=F.textShadow;for(var ah=0,ag=0,ad=an.length;ah<ad;++ah){G=o[A=an[ah]]||ai.missingGlyph;if(!G){continue}if(r){g-=ae=r[A]||0;O[ag-1]-=ae}g+=w=O[ag++]=~~(G.w||ai.w)+Z;r=G.k}if(w===undefined){return null}var z=-X+g+(L.width-w);var am=p.convert(z*S),ab=Math.round(am);var R=z+","+L.height,m;var M="r"+R+"ns";var x=F.textGradient&&d(F.textGradient);for(ah=0,ag=0;ah<ad;++ah){G=o[an[ah]]||ai.missingGlyph;if(!G){continue}if(n){y=q.childNodes[ag];while(y.firstChild){y.removeChild(y.firstChild)}}else{y=document.createElement("cvml:shape");q.appendChild(y)}y.stroked="f";y.coordsize=R;y.coordorigin=m=(X-V)+","+W;y.path=(G.d?"m"+G.d+"xe":"")+"m"+m+M;y.fillcolor=I;if(x){y.appendChild(x.cloneNode(false))}var ak=y.style;ak.width=ab;ak.height=al;if(K){var t=K[0],s=K[1];var E=Cufon.CSS.color(t.color),C;var Q=document.createElement("cvml:shadow");Q.on="t";Q.color=E.color;Q.offset=t.offX+","+t.offY;if(s){C=Cufon.CSS.color(s.color);Q.type="double";Q.color2=C.color;Q.offset2=s.offX+","+s.offY}Q.opacity=E.opacity||(C&&C.opacity)||1;y.appendChild(Q)}V+=O[ag++]}var P=y.nextSibling,v,D;if(F.forceHitArea){if(!P){P=document.createElement("cvml:rect");P.stroked="f";P.className="cufon-vml-cover";v=document.createElement("cvml:fill");v.opacity=0;P.appendChild(v);q.appendChild(P)}D=P.style;D.width=ab;D.height=al}else{if(P){q.removeChild(P)}}ao.width=Math.max(Math.ceil(p.convert(g*S)),0);if(f){var T=ac.computedYAdjust;if(T===undefined){var H=ac.get("lineHeight");if(H=="normal"){H="1em"}else{if(!isNaN(H)){H+="em"}}ac.computedYAdjust=T=0.5*(a(aj,H)-parseFloat(ao.height))}if(T){ao.marginTop=Math.ceil(T)+"px";ao.marginBottom=T+"px"}}return B}})());
var fontRegistered = false;
(function(c){c.tools=c.tools||{version:{}};c.tools.version.scrollable="1.0.5";var a=null;function b(i,o){var r=this;if(!a){a=r}function p(t,u){c(r).bind(t,function(w,v){if(u&&u.call(this,v.index)===false&&v){v.proceed=false}});return r}c.each(o,function(t,u){if(c.isFunction(u)){p(t,u)}});var s=!o.vertical;var e=c(o.items,i);var k=0;function n(u,t){return u.indexOf("#")!=-1?c(u).eq(0):t.siblings(u).eq(0)}var j=n(o.navi,i);var f=n(o.prev,i);var h=n(o.next,i);var g=n(o.prevPage,i);var q=n(o.nextPage,i);c.extend(r,{getIndex:function(){return k},getConf:function(){return o},getSize:function(){return r.getItems().size()},getPageAmount:function(){return Math.ceil(this.getSize()/o.size)},getPageIndex:function(){return Math.ceil(k/o.size)},getRoot:function(){return i},getItemWrap:function(){return e},getItems:function(){return e.children()},getVisibleItems:function(){return r.getItems().slice(k,k+o.size)},seekTo:function(w,u,A){if(u===undefined){u=o.speed}if(c.isFunction(u)){A=u;u=o.speed}if(w<0){w=0}if(w>r.getSize()-o.size){return r}var B=r.getItems().eq(w);if(!B.length){return r}var t={index:w,proceed:true};c(r).trigger("onBeforeSeek",t);if(!t.proceed){return r}if(s){var v=-B.position().left;e.animate({left:v},u,o.easing,A?function(){A.call(r)}:null)}else{var z=-B.position().top;e.animate({top:z},u,o.easing,A?function(){A.call(r)}:null)}if(j.length){var x=o.activeClass;var y=Math.ceil(w/o.size);y=Math.min(y,j.children().length-1);j.children().removeClass(x).eq(y).addClass(x)}if(w===0){f.add(g).addClass(o.disabledClass)}else{f.add(g).removeClass(o.disabledClass)}if(w>=r.getSize()-o.size){h.add(q).addClass(o.disabledClass)}else{h.add(q).removeClass(o.disabledClass)}a=r;k=w;c(r).trigger("onSeek",{index:w});return r},move:function(v,u,t){var w=k+v;if(o.loop&&w>(r.getSize()-o.size)){w=0}return this.seekTo(w,u,t)},next:function(u,t){return this.move(1,u,t)},prev:function(u,t){return this.move(-1,u,t)},movePage:function(v,u,t){return this.move(o.size*v,u,t)},setPage:function(y,t,w){var v=o.size;var u=v*y;var x=u+v>=this.getSize();if(x){u=this.getSize()-o.size}return this.seekTo(u,t,w)},prevPage:function(u,t){return this.setPage(this.getPageIndex()-1,u,t)},nextPage:function(u,t){return this.setPage(this.getPageIndex()+1,u,t)},begin:function(u,t){return this.seekTo(0,u,t)},end:function(u,t){return this.seekTo(this.getSize()-o.size,u,t)},reload:function(){return m()},click:function(w,z,x){var y=r.getItems().eq(w);var v=o.activeClass;if(w<0||w>=this.getSize()){return r}if(o.size==2){if(w==r.getIndex()){w--}r.getItems().removeClass(v);y.addClass(v);return this.seekTo(w,z,x)}if(!y.hasClass(v)){r.getItems().removeClass(v);y.addClass(v);var u=Math.floor(o.size/2);var t=w-u;if(t>r.getSize()-o.size){t=r.getSize()-o.size}if(t!==w){return this.seekTo(t,z,x)}}return r},onBeforeSeek:function(t){return p("onBeforeSeek",t)},onSeek:function(t){return p("onSeek",t)}});if(c.isFunction(c.fn.mousewheel)){i.bind("mousewheel.scrollable",function(u,v){var t=c.browser.opera?1:-1;r.move(v>0?t:-t,50);return false})}f.addClass(o.disabledClass).click(function(){r.prev()});h.click(function(){r.next()});q.click(function(){r.nextPage()});g.addClass(o.disabledClass).click(function(){r.prevPage()});if(o.keyboard){c(document).unbind("keydown.scrollable").bind("keydown.scrollable",function(t){var u=a;if(!u||t.altKey||t.ctrlKey){return}if(s&&(t.keyCode==37||t.keyCode==39)){u.move(t.keyCode==37?-1:1);return t.preventDefault()}if(!s&&(t.keyCode==38||t.keyCode==40)){u.move(t.keyCode==38?-1:1);return t.preventDefault()}return true})}function m(){if(j.is(":empty")||j.data("me")==r){j.empty();j.data("me",r);for(var u=0;u<r.getPageAmount();u++){var v=c("<"+o.naviItem+"/>").attr("href",u).click(function(x){var w=c(this);w.parent().children().removeClass(o.activeClass);w.addClass(o.activeClass);r.setPage(w.attr("href"));return x.preventDefault()});if(u===0){v.addClass(o.activeClass)}j.append(v)}}else{var t=j.children();t.each(function(w){var x=c(this);x.attr("href",w);if(w===0){x.addClass(o.activeClass)}x.click(function(){j.find("."+o.activeClass).removeClass(o.activeClass);x.addClass(o.activeClass);r.setPage(x.attr("href"))})})}if(o.clickable){r.getItems().each(function(y,x){var w=c(this);if(!w.data("set")){w.bind("click.scrollable",function(){r.click(y)});w.data("set",true)}})}if(o.hoverClass){r.getItems().hover(function(){c(this).addClass(o.hoverClass)},function(){c(this).removeClass(o.hoverClass)})}return r}m();var d=null;function l(){if(d){return}d=setInterval(function(){if(o.interval===0){clearInterval(d);d=0;return}r.next()},o.interval)}if(o.interval>0){i.hover(function(){clearInterval(d);d=0},function(){l()});l()}}c.fn.scrollable=function(f){var d=this.eq(typeof f=="number"?f:0).data("scrollable");if(d){return d}var e={size:5,vertical:false,clickable:true,loop:false,interval:0,speed:400,keyboard:true,activeClass:"active",disabledClass:"disabled",hoverClass:null,easing:"swing",items:".items",prev:".prev",next:".next",prevPage:".prevPage",nextPage:".nextPage",navi:".navi",naviItem:"a",api:false,onBeforeSeek:null,onSeek:null};c.extend(e,f);this.each(function(){d=new b(c(this),e);c(this).data("scrollable",d)});return e.api?d:this}})(jQuery);jQuery.fn.tooltip=function(N){var I=$(this),E="",c="",R,C,G,x,U,Q;var F,H,B,J,L,K,M,O,S,V;var D={x:"",y:"",xPop:"",yPop:"",yOut:0,delayIn:250,delayOut:250,calling:function(){},callBackOver:function(){},callBackOut:function(){},html:"",title:false,wrapIds:"",Zindex:"150"};D=$.extend(D,N);x=(D.delay)?parseInt(D.delay,10):0;K=(D.xPop)?parseInt(D.xPop,10):0;M=(D.yPop)?parseInt(D.yPop,10):20;J=(D.x)?parseInt(D.x,10):0;L=(D.y)?parseInt(D.y,10):-15;c=(D.html)?D.html:'<div id="tooltipWrap"> <div class="tooltipTop"></div> <div class="tooltipBody"> <div id="tooltipTitle" class="tooltipTitle"></div> <div id="tooltipContent" class="tooltipContent"></div> </div> <div class="tooltipFoot"></div> </div>';$("body").append(c);R=(D.wrapIds)?$(D.wrapIds.wrapID):$("#tooltipWrap");G=(D.wrapIds)?$(D.wrapIds.titleID):$("#tooltipTitle");C=(D.wrapIds)?$(D.wrapIds.contentID):$("#tooltipContent");V=Math.floor(R.height());var T=function(a){a=a||I;B=Math.floor(a.width()/2);O=Math.floor(R.width()/2);S=Math.floor(R.height())-V;F=Math.floor(((a.offset().left+B)+J)-O);H=Math.ceil(((a.offset().top+L)-M)-S);R.show();R.css({left:F,top:H,"z-index":D.Zindex,position:"absolute",opacity:"0"})};T();var P=function(){R.css({left:"9999px"}).hide()};if(D.title){(function(){var e=I.length,a,d=0,b;while(d<e){a=$(I[d]);b=a.attr("title");a.removeAttr("title").attr("toolTip",b);d+=1}}())}var y=function(a){var b="";a=a||I;E=(D.title)?a.attr("toolTip"):a.attr("alt");if(!D.title){E=E.split("||");E=(E[1])?E[1]:false}if(E&&D.title){b=E.split("::");U=$.trim(b[0]);Q=$.trim(b[1]);if(U&&U!=" "){G.css({overflow:"visible"});G.html(U)}else{G.css({overflow:"hidden"})}if(Q){C.css({overflow:"visible"});C.html(Q)}else{C.css({overflow:"hidden"})}T(a)}else{P()}};P();I.hover(function(){I=$(this);y(I);R.stop();D.calling();R.animate({opacity:"1",top:(H-M)},D.delayIn,"linear",D.callBackOver())},function(){R.stop();R.animate({opacity:"0",top:(H+M)-D.yOut},D.delayOut,"linear",function(){D.callBackOut();P()})}).click(function(){return false});return this};jQuery.extend({selectBoxIncNr:1});jQuery.fn.selectBox=function(a){var b={newClass:"sb",dropspeed:150,callBack:function(){},callOnLoad:function(){},highlight:true,itemToList:false,zIndex:20,location:false,multi:true,startAt:200};b=jQuery.extend(b,a);jQuery(this).each(function(){var H=jQuery(this),P,S,x,r=false,W,J,A,z,B,G,p,L,I,t,s,D,u=0,T=0,R=0,Q=0,O=0,N=0,o,f=[],w="",U="",E,n,K,d,X,q,h=[],e,V,y=[],F;H.css({position:"absolute",right:"9999px"});F=jQuery.selectBoxIncNr;jQuery.selectBoxIncNr+=1;P=jQuery.makeArray(H.children());S=P.length;B=(b.multi)?F:0;while(T<S){A=jQuery(P[T]);if(A.is("optgroup")){R=0;U=(A.attr("label"))?'<li class="'+b.newClass+'-optTitle"><em>'+A.attr("label")+"</em></li>":"";G=jQuery.makeArray(A.children());I=G.length;w+=U;w+='<ul class="optgroup">';N+=1;while(R<I){z=jQuery(G[R]);f.push(z);if(z.attr("selected")){r=true;W=(z.val())?A.val():z.html();J=z.html();U=(z.val())?'<li class="'+b.newClass+"-li"+F+' liover" thevalue="'+z.val()+'">'+z.html()+"</li>":'<li class="'+b.newClass+"-li"+F+'" thevalue="'+z.html()+'">'+z.html()+"</li>"}else{U=(z.val())?'<li class="'+b.newClass+"-li"+F+'" thevalue="'+z.val()+'">'+z.html()+"</li>":'<li class="'+b.newClass+"-li"+F+'" thevalue="'+z.html()+'">'+z.html()+"</li>"}w+=U;R+=1;N+=1}w+="</ul>"}else{if(A.attr("selected")){r=true;W=(A.val())?A.val():A.html();J=A.html();U=(A.val())?'<li class="'+b.newClass+"-li"+F+' liover" thevalue="'+A.val()+'">'+A.html()+"</li>":'<li class="'+b.newClass+"-li"+F+'" thevalue="'+A.html()+'">'+A.html()+"</li>"}else{U=(A.val())?'<li class="'+b.newClass+"-li"+F+' " thevalue="'+A.val()+'">'+A.html()+"</li>":'<li class="'+b.newClass+"-li"+F+'" thevalue="'+A.html()+'">'+A.html()+"</li>"}f.push(A);w+=U}T+=1;N+=1}if(r){x=J}else{x=f[0].html()}w='<div class="'+b.newClass+'-sb" id="sb-Selctboxnr'+F+'"><div class="'+b.newClass+'-top-wrap" id="sb-topSelctboxnr'+F+'"><div class="'+b.newClass+'-top" id="sb-inTopSelctboxnr'+F+'"><span class="'+b.newClass+'-disp" id="sb-dispSelctboxnr'+F+'" >'+x+'</span></div><span class="'+b.newClass+'-btn" id="sb-btnSelctboxnr'+F+'"></span><span class="'+b.newClass+'-btnIn" id="sb-btnInSelctboxnr'+F+'"></span></div><div class="'+b.newClass+'-slide" id="sb-slideSelctboxnr'+F+'"><ul class="'+b.newClass+'-list" id="sb-listSelctboxnr'+F+'">'+w+'</ul><div class="'+b.newClass+'-slideBottom"></div></div>';H.after(w);K=jQuery("#sb-topSelctboxnr"+F);p=jQuery("#sb-inTopSelctboxnr"+F);t=jQuery("#sb-btnSelctboxnr"+F);s=jQuery("#sb-dispSelctboxnr"+F);E=jQuery("."+b.newClass+"-li"+F);n=jQuery("#sb-slideSelctboxnr"+F);d=E.outerHeight(true);L=jQuery("."+b.newClass+"-slideBottom");L=L.outerHeight(true);X=(b.itemToList)?(d*b.itemToList):(d*N)+L;jQuery("#sb-Selctboxnr"+F).css({position:"relative","z-index":(b.zIndex-B)+b.startAt});n.css({position:"absolute",overflow:"hidden",height:"0px","z-index":((b.zIndex+10)-B)+b.startAt}).hide().data("open",false);E.css({cursor:"default"});e=f.length;while(Q<e){V=jQuery(f[Q]);h.push(V.text());Q+=1}e=E.length;while(O<e){D=jQuery(E[O]);if(D.is("ul")){}if(A.is(".optgroup")){}else{y.push(D)}O+=1}var v=function(i){i=i.replace(/\s+/g,"");window.location=i};var c=function(){n.stop();n.show().animate({height:X},b.dropspeed,"linear",function(){b.callBack()});t.addClass("sbBtnOpen");n.data("open",true)};var C=function(){n.stop();n.animate({height:0},b.dropspeed,"linear",function(){n.hide()});t.removeClass("sbBtnOpen");n.data("open",false)};var g=function(i){if(i===(e-1)){return}else{E.removeClass("liover");u+=1;i+=1}jQuery(y[i]).addClass("liover")};var M=function(i){E.removeClass("liover");if(i<0||i===0){jQuery(y[i]).addClass("liover")}else{u-=1;i-=1}jQuery(y[i]).addClass("liover")};K.bind("click",function(i){if(n.data("open")){p.removeClass("sbfocus");H.data("focus",false);C()}else{jQuery(document).trigger("click");p.addClass("sbfocus");H.data("focus",true);c()}i.stopPropagation()});jQuery(document).bind("click",function(){if(n.data("open")||H.data("focus")){H.data("focus",false);p.removeClass("sbfocus");C()}});jQuery(document).keydown(function(i){if(H.data("focus")){switch(i.keyCode){case 13:(i.preventDefault)?i.preventDefault():(i.returnValue=false);if(n.data("open")){o=jQuery(y[u]);H.val(o.attr("thevalue"));if(typeof H.change==="function"){H.change()}s.html(o.html());C()}else{c()}break;case 38:(i.preventDefault)?i.preventDefault():(i.returnValue=false);M(u);break;case 40:(i.preventDefault)?i.preventDefault():(i.returnValue=false);g(u);break}}else{p.removeClass("sbfocus")}});H.focus(function(){jQuery(document).trigger("click");p.addClass("sbfocus");H.data("focus",true)}).blur(function(){p.removeClass("sbfocus");H.data("focus",false);C()});E.bind("mouseover",function(i){(q)?q.removeClass("liover"):E.removeClass("liover");q=jQuery(i.target);q.addClass("liover")}).click(function(){s.html(q.html());q.addClass("liover");H.val(q.attr("thevalue"));if(typeof H.change==="function"){H.change()}u=jQuery.inArray(q.text(),h);p.removeClass("sbfocus");C();if(b.location){v(q.attr("thevalue"))}});b.callOnLoad();return this})};(function(c){var d=function(a){if(!a){var a=window.event}a.cancelBubble=true;if(a.stopPropagation){a.stopPropagation()}};c.fn.checkbox=function(h){try{document.execCommand("BackgroundImageCache",false,true)}catch(a){}var b={cls:"jquery-checkbox",empty:"empty.png"};b=c.extend(b,h||{});var e=function(l){var f=l.checked;var k=l.disabled;var g=c(l);if(l.stateInterval){clearInterval(l.stateInterval)}l.stateInterval=setInterval(function(){if(l.disabled!=k){g.trigger((k=!!l.disabled)?"disable":"enable")}if(l.checked!=f){g.trigger((f=!!l.checked)?"check":"uncheck")}},10);return g};return this.each(function(){var f=this;var g=e(f);if(f.wrapper){f.wrapper.remove()}f.wrapper=c('<span class="'+b.cls+'"><span class="mark"><img src="'+b.empty+'" /></span></span>');f.wrapperInner=f.wrapper.children("span:eq(0)");f.wrapper.hover(function(i){f.wrapperInner.addClass(b.cls+"-hover");d(i)},function(i){f.wrapperInner.removeClass(b.cls+"-hover");d(i)});g.css({position:"absolute",zIndex:-1,visibility:"hidden"}).after(f.wrapper);var j=false;if(g.attr("id")){j=c("label[for="+g.attr("id")+"]");if(!j.length){j=false}}if(!j){j=g.closest?g.closest("label"):g.parents("label:eq(0)");if(!j.length){j=false}}if(j){j.hover(function(i){f.wrapper.trigger("mouseover",[i])},function(i){f.wrapper.trigger("mouseout",[i])});j.click(function(i){g.trigger("click",[i]);d(i);return false})}f.wrapper.click(function(i){g.trigger("click",[i]);d(i);return false});g.click(function(i){d(i)});g.bind("disable",function(){f.wrapperInner.addClass(b.cls+"-disabled")}).bind("enable",function(){f.wrapperInner.removeClass(b.cls+"-disabled")});g.bind("check",function(){f.wrapper.addClass(b.cls+"-checked")}).bind("uncheck",function(){f.wrapper.removeClass(b.cls+"-checked")});c("img",f.wrapper).bind("dragstart",function(){return false}).bind("mousedown",function(){return false});if(window.getSelection){f.wrapper.css("MozUserSelect","none")}if(f.checked){f.wrapper.addClass(b.cls+"-checked")}if(f.disabled){f.wrapperInner.addClass(b.cls+"-disabled")}})}})(jQuery);(function(b){b.widget("ui.accordion",{_init:function(){var e=this.options,a=this;this.running=0;if(e.collapsible==b.ui.accordion.defaults.collapsible&&e.alwaysOpen!=b.ui.accordion.defaults.alwaysOpen){e.collapsible=!e.alwaysOpen}if(e.navigation){var f=this.element.find("a").filter(e.navigationFilter);if(f.length){if(f.filter(e.header).length){this.active=f}else{this.active=f.parent().parent().prev();f.addClass("ui-accordion-content-active")}}}this.element.addClass("ui-accordion ui-widget ui-helper-reset");if(this.element[0].nodeName=="UL"){this.element.children("li").addClass("ui-accordion-li-fix")}this.headers=this.element.find(e.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all").bind("mouseenter.accordion",function(){b(this).addClass("ui-state-hover")}).bind("mouseleave.accordion",function(){b(this).removeClass("ui-state-hover")}).bind("focus.accordion",function(){b(this).addClass("ui-state-focus")}).bind("blur.accordion",function(){b(this).removeClass("ui-state-focus")});this.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom");this.active=this._findActive(this.active||e.active).toggleClass("ui-state-default").toggleClass("ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top");this.active.next().addClass("ui-accordion-content-active");b("<span/>").addClass("ui-icon "+e.icons.header).prependTo(this.headers);this.active.find(".ui-icon").toggleClass(e.icons.header).toggleClass(e.icons.headerSelected);if(b.browser.msie){this.element.find("a").css("zoom","1")}this.resize();this.element.attr("role","tablist");this.headers.attr("role","tab").bind("keydown",function(c){return a._keydown(c)}).next().attr("role","tabpanel");this.headers.not(this.active||"").attr("aria-expanded","false").attr("tabIndex","-1").next().hide();if(!this.active.length){this.headers.eq(0).attr("tabIndex","0")}else{this.active.attr("aria-expanded","true").attr("tabIndex","0")}if(!b.browser.safari){this.headers.find("a").attr("tabIndex","-1")}if(e.event){this.headers.bind((e.event)+".accordion",function(c){return a._clickHandler.call(a,c,this)})}},destroy:function(){var d=this.options;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role").unbind(".accordion").removeData("accordion");this.headers.unbind(".accordion").removeClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("tabindex");this.headers.find("a").removeAttr("tabindex");this.headers.children(".ui-icon").remove();var a=this.headers.next().css("display","").removeAttr("role").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active");if(d.autoHeight||d.fillHeight){a.css("height","")}},_setData:function(a,d){if(a=="alwaysOpen"){a="collapsible";d=!d}b.widget.prototype._setData.apply(this,arguments)},_keydown:function(j){var h=this.options,i=b.ui.keyCode;if(h.disabled||j.altKey||j.ctrlKey){return}var k=this.headers.length;var a=this.headers.index(j.target);var l=false;switch(j.keyCode){case i.RIGHT:case i.DOWN:l=this.headers[(a+1)%k];break;case i.LEFT:case i.UP:l=this.headers[(a-1+k)%k];break;case i.SPACE:case i.ENTER:return this._clickHandler({target:j.target},j.target)}if(l){b(j.target).attr("tabIndex","-1");b(l).attr("tabIndex","0");l.focus();return false}return true},resize:function(){var f=this.options,g;if(f.fillSpace){if(b.browser.msie){var a=this.element.parent().css("overflow");this.element.parent().css("overflow","hidden")}g=this.element.parent().height();if(b.browser.msie){this.element.parent().css("overflow",a)}this.headers.each(function(){g-=b(this).outerHeight()});var h=0;this.headers.next().each(function(){h=Math.max(h,b(this).innerHeight()-b(this).height())}).height(Math.max(0,g-h)).css("overflow","auto")}else{if(f.autoHeight){g=0;this.headers.next().each(function(){g=Math.max(g,b(this).outerHeight())}).height(g)}}},activate:function(a){var d=this._findActive(a)[0];this._clickHandler({target:d},d)},_findActive:function(a){return a?typeof a=="number"?this.headers.filter(":eq("+a+")"):this.headers.not(this.headers.not(a)):a===false?b([]):this.headers.filter(":eq(0)")},_clickHandler:function(r,n){var p=this.options;if(p.disabled){return false}if(!r.target&&p.collapsible){this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").find(".ui-icon").removeClass(p.icons.headerSelected).addClass(p.icons.header);this.active.next().addClass("ui-accordion-content-active");var l=this.active.next(),o={options:p,newHeader:b([]),oldHeader:p.active,newContent:b([]),oldContent:l},q=(this.active=b([]));this._toggle(q,l,o);return false}var m=b(r.currentTarget||n);var k=m[0]==this.active[0];if(this.running||(!p.collapsible&&k)){return false}this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").find(".ui-icon").removeClass(p.icons.headerSelected).addClass(p.icons.header);this.active.next().addClass("ui-accordion-content-active");if(!k){m.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top").find(".ui-icon").removeClass(p.icons.header).addClass(p.icons.headerSelected);m.next().addClass("ui-accordion-content-active")}var q=m.next(),l=this.active.next(),o={options:p,newHeader:k&&p.collapsible?b([]):m,oldHeader:this.active,newContent:k&&p.collapsible?b([]):q.find("> *"),oldContent:l.find("> *")},a=this.headers.index(this.active[0])>this.headers.index(m[0]);this.active=k?b([]):m;this._toggle(q,l,o,k,a);return false},_toggle:function(x,q,s,p,o){var v=this.options,a=this;this.toShow=x;this.toHide=q;this.data=s;var w=function(){if(!a){return}return a._completed.apply(a,arguments)};this._trigger("changestart",null,this.data);this.running=q.size()===0?x.size():q.size();if(v.animated){var t={};if(v.collapsible&&p){t={toShow:b([]),toHide:q,complete:w,down:o,autoHeight:v.autoHeight||v.fillSpace}}else{t={toShow:x,toHide:q,complete:w,down:o,autoHeight:v.autoHeight||v.fillSpace}}if(!v.proxied){v.proxied=v.animated}if(!v.proxiedDuration){v.proxiedDuration=v.duration}v.animated=b.isFunction(v.proxied)?v.proxied(t):v.proxied;v.duration=b.isFunction(v.proxiedDuration)?v.proxiedDuration(t):v.proxiedDuration;var n=b.ui.accordion.animations,u=v.duration,r=v.animated;if(!n[r]){n[r]=function(c){this.slide(c,{easing:r,duration:u||700})}}n[r](t)}else{if(v.collapsible&&p){x.toggle()}else{q.hide();x.show()}w(true)}q.prev().attr("aria-expanded","false").attr("tabIndex","-1").blur();x.prev().attr("aria-expanded","true").attr("tabIndex","0").focus()},_completed:function(a){var d=this.options;this.running=a?0:--this.running;if(this.running){return}if(d.clearStyle){this.toShow.add(this.toHide).css({height:"",overflow:""})}this._trigger("change",null,this.data)}});b.extend(b.ui.accordion,{version:"1.7.2",defaults:{active:null,alwaysOpen:true,animated:"slide",autoHeight:true,clearStyle:false,collapsible:false,event:"click",fillSpace:false,header:"> li > :first-child,> :not(li):even",icons:{header:"ui-icon-triangle-1-e",headerSelected:"ui-icon-triangle-1-s"},navigation:false,navigationFilter:function(){return this.href.toLowerCase()==location.href.toLowerCase()}},animations:{slide:function(a,l){a=b.extend({easing:"swing",duration:300},a,l);if(!a.toHide.size()){a.toShow.animate({height:"show"},a);return}if(!a.toShow.size()){a.toHide.animate({height:"hide"},a);return}var q=a.toShow.css("overflow"),m,p={},n={},o=["height","paddingTop","paddingBottom"],r;var k=a.toShow;r=k[0].style.width;k.width(parseInt(k.parent().width(),10)-parseInt(k.css("paddingLeft"),10)-parseInt(k.css("paddingRight"),10)-(parseInt(k.css("borderLeftWidth"),10)||0)-(parseInt(k.css("borderRightWidth"),10)||0));b.each(o,function(e,c){n[c]="hide";var d=(""+b.css(a.toShow[0],c)).match(/^([\d+-.]+)(.*)$/);p[c]={value:d[1],unit:d[2]||"px"}});a.toShow.css({height:0,overflow:"hidden"}).show();a.toHide.filter(":hidden").each(a.complete).end().filter(":visible").animate(n,{step:function(d,c){if(c.prop=="height"){m=(c.now-c.start)/(c.end-c.start)}a.toShow[0].style[c.prop]=(m*p[c.prop].value)+p[c.prop].unit},duration:a.duration,easing:a.easing,complete:function(){if(!a.autoHeight){a.toShow.css("height","")}a.toShow.css("width",r);a.toShow.css({overflow:q});a.complete()}})},bounceslide:function(a){this.slide(a,{easing:a.down?"easeOutBounce":"swing",duration:a.down?1000:200})},easeslide:function(a){this.slide(a,{easing:"easeinout",duration:700})}}})})(jQuery);
$(document).ready(function()
{
    //globals
    if (global_type === undefined || global_type === null) global_type = "consumer";
    if (global_lang === undefined || global_lang === null) global_lang = "lv";
    global_appserver = 'http://apps.tele2.lv/'; //json functionality server - predefined, but can be changed with function parameters
    if (window.console && window.console.firebug) console.log('Globals:\n\tLanguage: ' + global_lang + '\n\tType: ' + global_type); //Firebug
    handleToURL = new Array(); //VAS services handle2url
    handSubscriptionUrl =  new Array();
    
    if (global_lang == "ru")
    { //russian constants
        if (global_type == "consumer")
        {
            phonePage = "/ru/telefoni.html";
            devicePage = "/ru/internet/modemi_i_kompjuteri.html";
            newsPage = "/ru/novosti.html";
            newsPageID = "30710328-fce9-4e46-9921-82bda28e623c";
            isBusiness = "false";
            
            handleToURL["tele2_wap"] = "/ru/internet.html";
            handleToURL["videozvans"] = "/ru/predlagajemije_uslugi/ischo/videozvonok.html";
            handleToURL["iszinas"] = "/ru/predlagajemije_uslugi/ischo/sms_uslugi.html";
            handleToURL["zinas"] = "/ru/novosti_v_telefone.html";
            handleToURL["muzika"] = "/ru/muzika.html";
            handleToURL["sports"] = "/ru/sport.html";
            handleToURL["mani_kontakti"] = "/ru/mk.html";
            handleToURL["speles"] = "/ru/klub_igr.html";
            handleToURL["e_pasts"] = "/ru/elektronnaja_pocta_v_telefone.html";
            handleToURL["internets_telefona"] = "/ru/internet.html";
            
            handSubscriptionUrl["savejie"] = "/ru/tarifi/savejie.html";
            handSubscriptionUrl["brivais1"] = "/ru/tarifi/brivais.html";
            handSubscriptionUrl["brivais3"] = "/ru/tarifi/brivais.html";
            handSubscriptionUrl["brivais6"] = "/ru/tarifi/brivais.html";
            handSubscriptionUrl["brivais10"] = "/ru/tarifi/brivais.html";
            handSubscriptionUrl["brivais14"] = "/ru/tarifi/brivais.html";
            handSubscriptionUrl["brivais18"] = "/ru/tarifi/brivais.html";
            handSubscriptionUrl["meteorits"] = "/ru/tarifi/meteorits.html";
            handSubscriptionUrl["ekonomiskais"] = "/ru/tarifi_peredaci_dannih.html";
            handSubscriptionUrl["klasiskais"] = "/ru/tarifi_peredaci_dannih.html";
            handSubscriptionUrl["minimalais"] = "/ru/tarifi_peredaci_dannih.html";
            handSubscriptionUrl["biznesa_piedavajums"] = "/ru/biznes/tarifi/individualnie_tarifi.html";
            handSubscriptionUrl["biznesa_piedavajums_modemiem"] = "/ru/biznes/internet/internet_postoplatnij.html";
            handSubscriptionUrl["zz_interneta_komplekts"] = "/ru/internet/internet_postoplatnij.html";
        }
        else
        {
            phonePage = "/ru/biznes/telefoni.html";
            devicePage = "/ru/biznes/internet/modem.html";
            newsPage = "/ru/biznes/novosti.html";
            newsPageID = "30135d21-6746-45d2-9cf2-37cf47ac42e6";
            isBusiness = "true";
            
            handleToURL["tele2_wap"] = "/ru/biznes/internet.html";
            handleToURL["videozvans"] = "/ru/biznes/predlagajemije_uslugi/ischo/videozvonok.html";
            handleToURL["iszinas"] = "/ru/biznes/predlagajemije_uslugi/ischo/sms_uslugi.html";
            handleToURL["zinas"] = "/ru/biznes/novosti_v_telefone.html";
            handleToURL["muzika"] = "/ru/biznes/muzika.html";
            handleToURL["sports"] = "/ru/biznes/sport.html";
            handleToURL["mani_kontakti"] = "/ru/biznes/mk.html";
            handleToURL["speles"] = "/ru/biznes/klub_igr.html";
            handleToURL["e_pasts"] = "/ru/biznes/elektronnaja_pocta_v_telefone.html";
            handleToURL["internets_telefona"] = "/ru/biznes/internet.html";
            
            handSubscriptionUrl["savejie"] = "/ru/biznes/tarifi/savejie.html";
            handSubscriptionUrl["brivais1"] = "/ru/biznes/tarifi/brivais.html";
            handSubscriptionUrl["brivais3"] = "/ru/biznes/tarifi/brivais.html";
            handSubscriptionUrl["brivais6"] = "/ru/biznes/tarifi/brivais.html";
            handSubscriptionUrl["brivais10"] = "/ru/biznes/tarifi/brivais.html";
            handSubscriptionUrl["brivais14"] = "/ru/biznes/tarifi/brivais.html";
            handSubscriptionUrl["brivais18"] = "/ru/biznes/tarifi/brivais.html";
            handSubscriptionUrl["meteorits"] = "#";
            handSubscriptionUrl["ekonomiskais"] = "/ru/biznes/tarifi_peredaci_dannih.html";
            handSubscriptionUrl["klasiskais"] = "/ru/biznes/tarifi_peredaci_dannih.html";
            handSubscriptionUrl["minimalais"] = "/ru/biznes/tarifi_peredaci_dannih.html";
            handSubscriptionUrl["biznesa_piedavajums"] = "/ru/biznes/tarifi/individualnie_tarifi.html";
            handSubscriptionUrl["biznesa_piedavajums_modemiem"] = "/ru/biznes/internet/internet_postoplatnij.html";
        }
        //translations
        local_leasing = "в рассрочку на ";
        local_subscription = "с подключением на";
        local_months = "месяца";
        local_startupPayment = "первый взнос";
        local_selectCity = "Выберите страну";
        local_selectRegion = "Выберите регион";

        local_searchResultsFound = "Meklēšanas rezultāti: atrasti";
        local_searchResultsPhones = "telefoni";
    }
    else
    { //latvian (as default) constants
        if (global_type == "consumer")
        {
            phonePage = "/telefoni.html";
            devicePage = "/internets/modemi_un_datori.html";
            newsPage = "/jaunumi.html";
            newsPageID = "30710328-fce9-4e46-9921-82bda28e623c";
            isBusiness = "false";
            
            handleToURL["tele2_wap"] = "/internets.html";
            handleToURL["videozvans"] = "/pakalpojumi/vel/videozvans.html";
            handleToURL["iszinas"] = "/pakalpojumi/vel/sms_pakalpojumi.html";
            handleToURL["zinas"] = "/zinas_telefona.html";
            handleToURL["muzika"] = "/muzika.html";
            handleToURL["sports"] = "/sports.html";
            handleToURL["mani_kontakti"] = "/mk.html";
            handleToURL["speles"] = "/spelu_klubs.html";
            handleToURL["e_pasts"] = "/e_pasts_telefona.html";
            handleToURL["internets_telefona"] = "/internets.html";
            
            handSubscriptionUrl["savejie"] = "/tarifi/savejie.html";
            handSubscriptionUrl["brivais1"] = "/tarifi/brivais.html";
            handSubscriptionUrl["brivais3"] = "/tarifi/brivais.html";
            handSubscriptionUrl["brivais6"] = "/tarifi/brivais.html";
            handSubscriptionUrl["brivais10"] = "/tarifi/brivais.html";
            handSubscriptionUrl["brivais14"] = "/tarifi/brivais.html";
            handSubscriptionUrl["brivais18"] = "/tarifi/brivais.html";
            handSubscriptionUrl["meteorits"] = "/tarifi/meteorits.html";
            handSubscriptionUrl["ekonomiskais"] = "/cenas_internetam.html";
            handSubscriptionUrl["klasiskais"] = "/cenas_internetam.html";
            handSubscriptionUrl["minimalais"] = "/cenas_internetam.html";
            handSubscriptionUrl["biznesa_piedavajums"] = "/biznesam/tarifi/individualie_tarifi.html";
            handSubscriptionUrl["biznesa_piedavajums_modemiem"] = "/biznesam/internets/pecapmaksas_internets.html";
            handSubscriptionUrl["zz_interneta_komplekts"] = "/internets/prieksapmaksas_internets.html";
        }
        else 
        {
            phonePage = "/biznesam/telefoni.html";
            devicePage = "/biznesam/internets/modems.html";
            newsPage = "/biznesam/jaunumi.html";
            newsPageID = "30135d21-6746-45d2-9cf2-37cf47ac42e6";
            isBusiness = "true";
            
            handleToURL["tele2_wap"] = "/biznesam/internets_telefona.html";
            handleToURL["videozvans"] = "/biznesam/pakalpojumi/vel/videozvans.html";
            handleToURL["iszinas"] = "/biznesam/pakalpojumi/vel/sms_pakalpojumi.html";
            handleToURL["zinas"] = "/biznesam/zinas_telefona.html";
            handleToURL["muzika"] = "/biznesam/muzika.html";
            handleToURL["sports"] = "/biznesam/sports.html";
            handleToURL["mani_kontakti"] = "/biznesam/mani_kontakti.html";
            handleToURL["speles"] = "/biznesam/spelu_klubs.html";
            handleToURL["e_pasts"] = "/biznesam/epasts_telefona.html";
            handleToURL["internets_telefona"] = "/biznesam/internets_telefona.html";
            
            handSubscriptionUrl["savejie"] = "/biznesam/tarifi/savejie.html";
            handSubscriptionUrl["brivais1"] = "/biznesam/tarifi/brivais.html";
            handSubscriptionUrl["brivais3"] = "/biznesam/tarifi/brivais.html";
            handSubscriptionUrl["brivais6"] = "/biznesam/tarifi/brivais.html";
            handSubscriptionUrl["brivais10"] = "/biznesam/tarifi/brivais.html";
            handSubscriptionUrl["brivais14"] = "/biznesam/tarifi/brivais.html";
            handSubscriptionUrl["brivais18"] = "/biznesam/tarifi/brivais.html";
            handSubscriptionUrl["meteorits"] = "#";
            handSubscriptionUrl["ekonomiskais"] = "/biznesam/cenas_internetam.html";
            handSubscriptionUrl["klasiskais"] = "/biznesam/cenas_internetam.html";
            handSubscriptionUrl["minimalais"] = "/biznesam/cenas_internetam.html";
            handSubscriptionUrl["biznesa_piedavajums"] = "/biznesam/tarifi/individualie_tarifi.html";
            handSubscriptionUrl["biznesa_piedavajums_modemiem"] = "/biznesam/internets/pecapmaksas_internets.html";
        }
        //translations
        local_leasing = "nomaksa uz";
        local_subscription = "ar pieslēgumu uz";
        local_months = "mēnešiem";
        local_startupPayment = "Pirmā iemaksa";
        local_selectCity = "Izvēlieties valsti";
        local_selectRegion = "Izvēlieties reģionu";
        local_searchResultsFound = "Meklēšanas rezultāti: atrasti";
        local_searchResultsPhones = "telefoni";
    }
    $("a.iframe").each(function (i) {
        if ($(this).attr("id") == parseFloat($(this).attr("id"))) {
            fHeight = $(this).attr("id");
            $(this).fancybox( {
                'frameHeight': fHeight
            }
            );
        } else if ($(this).hasClass("smsWind")) {
            $(this).fancybox( {
                'frameHeight': 420, 'frameWidth': 400
            }
            );
        }
        else if ($(this).hasClass("mmsSend"))
        {
            $(this).fancybox({'frameWidth': 360});
        }
        else {
            $(this).fancybox();
        }
    }
    );
    if (location.href.indexOf("#") != -1) {
        calledItem = location.href.substr(location.href.indexOf("#"));
        var $tabs = $('#tabBox').tabs();
        $tabs.tabs('select', calledItem);
    }
    $("#tabBox").bind("tabsselect", function(event, ui) {
        /*window.location.hash = ui.tab.hash;
        buggy on IE7 - suspend
        */
    }
    );

    /*
     * Bloger quiz
     */
    var serialized = 'a1;a2;a3;a4';
    $(".sort").sortable({
        update : function () {
            var order = $('.sort').sortable('toArray');
            serialized = order.join(";");
            $('input#order').attr('value', serialized);
        }
    });
    $('form#theblogform').submit(function(){
        a2 = $('#mb .jquery-checkbox-checked').parents('label').find('input:radio').attr('id');
        q1t = $('#bquiz input#q1t').attr('value');
        a3 = '';
        a4 = $('#mbmonth .jquery-checkbox-checked').parents('label').find('input:radio').attr('id');
        $('#internet input:checked').each(function() {
            a3 += $(this).attr('id')+';';
        });
        var strLen = a3.length;
        a3 = a3.slice(0,strLen-1);
        a5 = $('#q5').attr('value');
        a6 = $('#q6').attr('value');
        var params = {
            q1: $('input#order').attr('value'),
            q1t: q1t,
            q2: a2,
            q3: a3,
            q4: a4,
            q5: a5,
            q6: a6,
            redirect: $('#bquiz input.redirect').attr('value')
        };
        $.ajax({
            type: 'GET',
            url: 'http://old.zeltazivtina.lv/t2_blog/in.php',
            data: params,
            success: function() {
                window.location = $('.redirect').attr('value');
              }
        });
        return false;
    });
    $('#mbmonth label, #mbmonth input').bind('click', function(){
        that = showHide5thAnswer($(this));
        setTimeout('that', 10);
    });
    function showHide5thAnswer(that) {
        setTimeout('w = $(\'#mbmonth .jquery-checkbox-checked\').parents(\'label\').text();', 10);
        
        if (that.attr('class') == 'showhide5') {
            $('#question5').fadeOut();
            $('#maxpayment').empty();
        }
        else {
            $('#question5').fadeIn();
            $('#maxpayment').empty();
            setTimeout('$(\'#maxpayment\').empty().append(\'(\'+w+\')\')', 100);
            
            setTimeout('Cufon.replace(\'#maxpayment\', { fontFamily: \'rockwell\' }); $(\'#maxpayment\').show();', 115);
        }
    }
    if ($.fn.checkbox) {
        if (!$.browser.msie || ($.browser.msie && parseInt($.browser.version) > 6)) {
        $('#bquiz input:radio').checkbox({
                empty: '/system_images/empty.png',
                cls: 'jquery-checkbox'
            });
        }
    }
    
    /*
     * Adverts page
     */
    
    (function($)
        {
            $.fn.getAd = function(e)
            {
                e.preventDefault(e);
                if ($(this).attr('rel') == 'video')
                {
                    $('#video').empty().append('<div id="vidShow" />');
                    $(swfobject.embedSWF("/flash/player-licensed.swf", "vidShow", "470", "320", "9.0.0", false, {file:$(this).attr('href'), lightcolor:'888888', dock:'false', autostart:'true', stretching: 'fill'}, {allowfullscreen: 'true', allowscriptaccess: 'always', wmode: 'opaque'}, false));
                }
                else if ($(this).attr('rel') == 'image')
                {
                    $('#video').empty().html("");
                    $('#video').append('<image src="'+$(this).attr('href')+'" />');
                    
                }
                $('.videoBox h3').empty().text($(this).parent().find('strong span').html());
                $('.videoBox span').empty().html($(this).parent().find('span.hidden').html());
                Cufon.replace('.videoBox h3', { fontFamily: 'rockwell' });
                changeHash($(this));
                //return this;
            };
        }
    )(jQuery);
    function changeHash(that)
    {
        hash = that.parent().attr('id');
        hash = hash.replace( /^#/, '' );
        var node = $( '#' + hash );
        if ( node.length ) {
            node.attr( 'id', '' );
        }
        document.location.hash = hash;
        if ( node.length ) {
            node.attr( 'id', hash );
        }
    }
    $('.advertisements .article a.btnSmallRoundArrow16').bind("click", $(this).getAd);
    if (location.href.indexOf("#") != -1 && $('.advertisements').length != 0) {
        $(location.href.substr(location.href.indexOf("#"))+' a').click();
        $('html, body').animate({scrollTop:0}, 0);
    }
    else
    {
        $('.advertisements:first .article a.btnSmallRoundArrow16:first').click();
        $('html, body').animate({scrollTop:0}, 0);
    }
    // dropdown menu
    if ($("a").is('.navigationSubMenuItem' + newsPageID)) {
        $('.navigationDropDownBottom').before('<div class="navigationDropDownContent navigationSubMenuItem'+ newsPageID +'">');
    // dynamic list
        if (global_lang == "ru")
        {
            $('div.navigationSubMenuItem'+ newsPageID).append('<a href="'+newsPage+'?cat=zinas" class="navigationDropDownOption">Новости</a>');
        }
        else
        {
            $('div.navigationSubMenuItem'+ newsPageID).append('<a href="'+newsPage+'?cat=zinas" class="navigationDropDownOption">Ziņas</a>');
        }
        if (global_lang == "ru")
        {
            $('div.navigationSubMenuItem'+ newsPageID).append('<a href="'+newsPage+'?cat=akcijas_piedavajumi" class="navigationDropDownOption">Акции</a>');
        }
        else
        {
            $('div.navigationSubMenuItem'+ newsPageID).append('<a href="'+newsPage+'?cat=akcijas_piedavajumi" class="navigationDropDownOption">Akcijas piedāvājumi</a>');
        }
        if (global_lang == "ru")
        {
            $('div.navigationSubMenuItem'+ newsPageID).append('<a href="'+newsPage+'?cat=jaunie_pakalpojumi" class="navigationDropDownOption">Новые услуги</a>');
        }
        else
        {
            $('div.navigationSubMenuItem'+ newsPageID).append('<a href="'+newsPage+'?cat=jaunie_pakalpojumi" class="navigationDropDownOption">Jaunie pakalpojumi</a>');
        }
        if (global_lang == "ru")
        {
            $('div.navigationSubMenuItem'+ newsPageID).append('<a href="'+newsPage+'?cat=pasakumi" class="navigationDropDownOption">Мероприятия</a>');
        }
        else
        {
            $('div.navigationSubMenuItem'+ newsPageID).append('<a href="'+newsPage+'?cat=pasakumi" class="navigationDropDownOption">Pasākumi</a>');
        }
        if (global_lang == "ru")
        {
            $('div.navigationSubMenuItem'+ newsPageID).append('<a href="'+newsPage+'?cat=wap_portala" class="navigationDropDownOption">Интернет в телефоне</a>');
        }
        else
        {
            $('div.navigationSubMenuItem'+ newsPageID).append('<a href="'+newsPage+'?cat=wap_portala" class="navigationDropDownOption">WAP portālā</a>');
        }
    // end dynamic list
    }
    var closeDropDownTimeOut;
    var closeDropDownWaitCount = 0;
    var closeDropDownWaitCountMax = 8;
    var delay = 100;
    var cS = {
        isHoveringSomething: 0, isHoveringDropDown: 1, isHoveringNothing: 2
    }
    ;
    var cursorStatus = cS.isHoveringNothing;
    $('.navigationSubMenu a').hover(function() {
        cursorStatus = cS.isHoveringSomething;
        if ($("." + $.trim($(this).attr("class").replace(/\active/g, '')) + ":last a").size() != 0) {
            openDropDown(this);
        }
    }
    , function() {
        cursorStatus = cS.isHoveringNothing;
        closeDropDown();
    }
    );
    $('.navigationDropDown').hover(function() {
        cursorStatus = cS.isHoveringSomething;
    }
    , function() {
        cursorStatus = cS.isHoveringNothing;
        closeDropDown();
    }
    );
    var openDropDown = function(obj) {
        var dropDown = $('.navigationDropDown');
        if ($('.navigation').offset().left > 0)
                    var newLeft = $(obj).offset().left - $('.navigation').offset().left - 10 + 'px'; else
                    var newLeft = $(obj).offset().left - $('.navigationBusinessWrapper').offset().left - 10 + 'px';
        if (dropDown.css('top') != '117px' || dropDown.css('left') != newLeft) {
            var arr = $(obj).attr('class').split(' '), foundClass;
            for (var i = 0; i < arr.length; i++) {
                if (arr[i].match('navigationSubMenuItem') == 'navigationSubMenuItem') {
                    foundClass = arr[i];
                    break;
                }
            }
            $('.navigationDropDownContent:visible').hide();
            $('.' + foundClass + ':last').show();
            dropDown.queue([]).stop()
                        .css( {
                'left': newLeft, 'top': '-' + $('.navigationDropDown').height() + 'px'
            }
            )
                        .animate( {
                top: '117px'
            }
            , 300, 'easeOutExpo');
        }
    };
    var closeDropDown = function() {
        if (cursorStatus != cS.isHoveringSomething) {
            clearTimeout(closeDropDownTimeOut);
            if (closeDropDownWaitCount >= closeDropDownWaitCountMax) {
                closeDropDownWaitCount = 0;
                closeDropDownDefinitely();
            } else if (closeDropDownWaitCount > 0) {
                closeDropDownWaitCount++;
                closeDropDownTimeOut = setTimeout(closeDropDown, delay);
            } else {
                closeDropDownWaitCount++;
                closeDropDownTimeOut = setTimeout(closeDropDown, delay);
            }
        }
    };
    var closeDropDownDefinitely = function() {
        $('.navigationDropDown').queue([]).stop().animate( {
            top: '-' + $('.navigationDropDown').height() + 'px'
        }
        , 300, 'easeInExpo');
    };
});
function bindFancyBox() {
    if (window.console && window.console.firebug) console.log('bindFancyBox');
    $("a[rel*=iframe]").not("a:hasRev").each(function (i)
    {
        if ($(this).attr("id") == parseFloat($(this).attr("id")))
        {
            fHeight = $(this).attr("id");
            $(this).addClass("iframe").fancybox({'frameHeight': fHeight});
        }
        else
        {
        $(this).addClass("iframe").fancybox();
        }
    });
    $("a[rel*=lightbox]").not("a:hasRev").each(function (i)
    {
        if ($(this).attr("id") == parseFloat($(this).attr("id")))
        {
            fHeight = $(this).attr("id");
            $(this).addClass("lightbox").fancybox({'frameHeight': fHeight});
        }
        else
        {
            $(this).addClass("lightbox").fancybox();
        }
    });
    $("a.iframe").each(function (i)
    {
        if ($(this).attr("id") == parseFloat($(this).attr("id")))
        {
            fHeight = $(this).attr("id");
            $(this).fancybox({'frameHeight': fHeight});
        }
        else if ($(this).hasClass("smsWind"))
        {
            $(this).fancybox({'frameHeight': 420, 'frameWidth': 400});
        }
        else if ($(this).hasClass("mmsSend"))
        {
            $(this).fancybox({'frameWidth': 360});
        }
        else
        {
            $(this).fancybox();
        }
    });
    $("a.iframedMap").each(function (i)
    {
        $(this).fancybox( {
            'frameHeight': 635, 'frameWidth': 750
        });
    });
}
function theRotator()
{
    if ($('#rotator ul li').length > 1)
    {
        if (window.console && window.console.firebug) console.log('theRotator');
        $('.staticFill').css({'position':'static','top':'0','width':'auto','height':'225px'});
        if($.browser.msie)
        {
            $('div#rotator ul li, div#rotator ul li img').css({'display': 'none'});
            $('div#rotator ul li:first, div#rotator ul li:first img').css({'display': 'block'});
        }
        else
        {
            $('div#rotator ul li').css({opacity: 0.0});
            $('div#rotator ul li:first').css({opacity: 1.0});
        }
        setInterval('rotate()',6000);
    }
}
function rotate()
{    
    var current = ($('div#rotator ul li.show') ? $('div#rotator ul li.show') : $('div#rotator ul li:first'));
    var next = ((current.next().length) ? ((current.next().hasClass('show')) ? $('div#rotator ul li:first') : current.next()) : $('div#rotator ul li:first'));    
    if($.browser.msie) //msie 6/7 and even 8 - they just can't handle png fade-in/fade-outs nicely
    {
        next.addClass('show').css('display','block').find('img').css('display','block');
        current.removeClass('show').css('display','none').find('img').css('display','none');
    }
    else
    {
        next.css({opacity: 0.0}).addClass('show').animate({opacity: 1.0}, 1000);
        current.animate({opacity: 0.0}, 1000).removeClass('show');
    }
};
ratesList = "0";
var priceType = new Array();
function jsonp_callback(data)
/*
    handles jsonp_callback received data
    templating varies by received data type
*/
{
    if (data.type == "rss" && data.data[0].type == "1")
    {
        n = 0;
        nextDiv = 0;
        totalCount = Math.min(5, Math.floor(data.data.length / 6)) * 6;
        for (var subi = 0; subi < totalCount; subi++)
        {
            if (n % 3 == 1)
            {
                curClass = "pushBoxCenter";
            }
            else
            {
                curClass = "pushBoxOuter";
            }
            if (data.data[subi].data.image)
            {
                currImage = data.data[subi].data.image;
            }
            else
            {
                currImage = "http://wap.txl.lv/upload/rss/407/WEBnots.jpg";
            }
            if (nextDiv % 6 == 0)
            {
                $('.rssMusic .vertical .items').append('<div class="page"></div>');
                $('.rssMusic .navi').append('<a href=""></a>');
            }
            if ($('.rssMusic').length != 0)
            {
                $(".rssMusic .vertical .items").remove(".clear");
                $(".rssMusic .vertical .items div.page:last").append('<div class="'+ curClass +'"><h4><a href="' + global_appserver+global_lang+"/mobile/send_resource/"+ data.data[subi].id +'"  class="iframe smsWind" rel="iframe">'+data.data[subi].data.title+'</a></h4><img src="'+currImage+'" style="left: 55px; bottom: 14px; width: 128px;" /><a title="Btn" href="' + global_appserver+global_lang+"/mobile/send_resource/"+ data.data[subi].id +'" class="btnSmallRoundArrow iframe smsWind" rel="iframe" /></div>');
            }
            n++;
            nextDiv++;
        }
        $(".rss .navi a").live("click", function(e){
            e.preventDefault(e);
        });
        if ($('.rssMusic').length != 0)
        {
            Cufon.replace('.rssMusic h4[class!=noCufon]', { fontFamily: 'rockwell' });
            $(".rssMusic div.scrollable").scrollable({vertical: false, size: 1, speed: 600, keyboard: false, easing: 'easeOutCirc', clickable: false, interval: 10000, loop: true });
        }
        bindFancyBox();
    }
    else if (data.type == "rss" && data.data[0].type == "2")
    {
        n = 0;
        nextDiv = 0;
        totalCount = Math.min(5, Math.floor(data.data.length / 6)) * 6;
        for (var subi = 0; subi < totalCount; subi++)
        {
            if (n % 3 == 1)
            {
                curClass = "pushBoxCenter";
            }
            else
            {
                curClass = "pushBoxOuter";
            }
            if (nextDiv % 6 == 0)
            {
                $('.rssGames .vertical .items').append('<div class="page"></div>');
                $('.rssGames .navi').append('<a href=""></a>');
            }
            if ($('.rssGames').length != 0)
            {
                $(".rssGames .vertical .items").remove(".clear");
                $(".rssGames .vertical .items div.page:last").append('<div class="'+ curClass +'"><h4><a href="'+global_appserver+global_lang+'/mobile/send_game/'+ data.data[subi].data.id +'" class="iframe smsWind" rel="iframe">'+ data.data[subi].data.title +'</a></h4><p style="width: 90px; text-align: left;">'+ data.data[subi].data.description +'</p><img src="'+ data.data[subi].data.image +'" style="left: 120px; bottom: 14px; width: 100px;" /><a title="Btn" href="'+global_appserver+global_lang+'/mobile/send_game/'+ data.data[subi].data.id +'" class="btnSmallRoundArrow iframe smsWind" rel="iframe" /></div>');
            }
            n++;
            nextDiv++;
        }
        $(".rss .navi a").live("click", function(e){
            e.preventDefault(e);
        });
        if ($('.rssGames').length != 0)
        {
            Cufon.replace('.rssGames h4[class!=noCufon]', { fontFamily: 'rockwell' });
            $(".rssGames div.scrollable").scrollable({vertical: false, size: 1, speed: 600, keyboard: false, easing: 'easeOutCirc', clickable: false, interval: 10000, loop: true });
        }
        bindFancyBox();
    }
    else if (data.type == "rss" && data.data[0].type == "3")
    {
        n = 0;
        nextDiv = 0;
        totalCount = Math.min(5, Math.floor(data.data.length / 6)) * 6;
        for (var subi = 0; subi < totalCount; subi++)
        {
            if (n % 3 == 1)
            {
                curClass = "pushBoxCenter";
            }
            else
            {
                curClass = "pushBoxOuter";
            }
            if (nextDiv % 6 == 0)
            {
                $('.rssVideo .vertical .items').append('<div class="page"></div>');
                $('.rssVideo .navi').append('<a href=""></a>');
            }
            if ($('.rssVideo').length != 0)
            {
                $(".rssVideo .vertical .items").remove(".clear");
                $(".rssVideo .vertical .items div.page:last").append('<div class="'+ curClass +'"><h4><a href="' + global_appserver+global_lang+'/mobile/send_resource/'+data.data[subi].id+'" class="smsWind" rel="iframe">'+data.data[subi].data.title+'</a></h4><img src="'+data.data[subi].data.image+'" style="left: 105px; bottom: 14px; position: absolute;" /><a title="Btn" href="' + global_appserver+global_lang+'/mobile/send_resource/'+data.data[subi].id+'" class="btnSmallRoundArrow smsWind" rel="iframe"/></div>');
            }
            n++;
            nextDiv++;
        }
        $(".rss .navi a").live("click", function(e){
            e.preventDefault(e);
        });
        if ($('.rssVideo').length != 0)
        {
            Cufon.replace('.rssVideo h4[class!=noCufon]', { fontFamily: 'rockwell' });
            $(".rssVideo div.scrollable").scrollable({vertical: false, size: 1, speed: 600, keyboard: false, easing: 'easeOutCirc', clickable: false, interval: 10000, loop: true });
        }
        bindFancyBox();
    }
    else if (data.type == "rss" && data.data[0].type == "4")
    {
        n = 0;
        nextDiv = 0;
        totalCount = Math.min(5, Math.floor(data.data.length / 6)) * 6;
        for (var subi = 0; subi < totalCount; subi++)
        {
            if (n % 3 == 1)
            {
                curClass = "pushBoxCenter";
            }
            else
            {
                curClass = "pushBoxOuter";
            }
            if (nextDiv % 6 == 0)
            {
                $('.rssSports .vertical .items').append('<div class="page"></div>');
                $('.rssSports .navi').append('<a href=""></a>');
            }
            if ($('.rssSports').length != 0)
            {
                $(".rssSports .vertical .items").remove(".clear");
                $(".rssSports .vertical .items div.page:last").append('<div class="'+ curClass +'"><h4><a href="' + global_appserver+global_lang+'/mobile/send_resource/'+data.data[subi].id+'" class="smsWind" rel="iframe">'+data.data[subi].data.title+'</a></h4><img src="'+data.data[subi].data.image+'" style="left: 65px; bottom: 14px; position: absolute;" /><a title="Btn" href="' + global_appserver+global_lang+'/mobile/send_resource/'+data.data[subi].id+'" class="btnSmallRoundArrow smsWind" rel="iframe"/></div>');
            }
            n++;
            nextDiv++;
        }
        $(".rss .navi a").live("click", function(e){
            e.preventDefault(e);
        });
        if ($('.rssSports').length != 0)
        {
            Cufon.replace('.rssSports h4[class!=noCufon]', { fontFamily: 'rockwell' });
            $(".rssSports div.scrollable").scrollable({vertical: false, size: 1, speed: 600, keyboard: false, easing: 'easeOutCirc', clickable: false, interval: 10000, loop: true });
        }
        bindFancyBox();
    }
    if (data.type  == 'link_list')
    {
        n = 0;
        for (var subi = 0; subi < data.data.length; subi++)
        {
            if (n % 3 == 1) 
            {
                curClass = "pushBoxCenter";
            }
            else
            {
                curClass = "pushBoxOuter";
            }
            n++;
            $(".rssLinks").remove(".clear").append('<div class="'+ curClass +'"><h4><a href="' + global_appserver+global_lang+'/mobile/send_link/'+data.data[subi].id+'" class="smsWind" rel="iframe">'+data.data[subi].title+'</a></h4><p style="position: absolute; font-size: 11px; text-align: left; line-height: 0.9em;">'+data.data[subi].description+'</p><img src="'+data.data[subi].image+'" style="bottom: -5px;" /><a title="Btn" href="' + global_appserver+global_lang+'/mobile/send_link/'+data.data[subi].id+'" class="btnSmallRoundArrow smsWind" rel="iframe"/></div>');
        }
        $(".rss .navi a").live("click", function(e){
            e.preventDefault(e);
        });
        Cufon.replace('.rssLinks h4[class!=noCufon]', { fontFamily: 'rockwell' });
        bindFancyBox();
    }
    if (data.type  == 'portal_link_list')
    {
        n = 0;
        for (var subi = 0; subi < data.data.length; subi++)
        {
            if (n % 3 == 1) 
            {
                curClass = "pushBoxCenter";
            }
            else
            {
                curClass = "pushBoxOuter";
            }
            n++;
            $(".portalLinks").remove(".clear").append('<div class="'+ curClass +'"><h4><a href="' + global_appserver+global_lang+'/mobile/send_link/'+data.data[subi].id+'" class="smsWind" rel="iframe">'+data.data[subi].title+'</a></h4><p style="position: absolute; font-size: 11px; text-align: left; line-height: 0.9em; top: 20px;">'+data.data[subi].description+'</p><img src="'+data.data[subi].image+'" style="bottom: -5px;" /><a title="Btn" href="' + global_appserver+global_lang+'/mobile/send_link/'+data.data[subi].id+'" class="btnSmallRoundArrow smsWind" rel="iframe"/></div>');
        }
        $(".rss .navi a").live("click", function(e){
            e.preventDefault(e);
        });
        Cufon.replace('.portalLinks h4[class!=noCufon]', { fontFamily: 'rockwell' });
        bindFancyBox();
    }
    if (data.type == "random") //random phonelist
    {
        $("#random_loading").fadeOut();
        for (i = 0; i < data.data.length; i++)
        {
            $("#random_phones").append("<div><img src=\"" + data.data[i].pic.replace(/\small/g, 'medium') + "\" alt=\"\" class=\"productImage\"><div class=\"rightArea\"><h3 class=\"noCufon\">" + data.data[i].manufacturer + "</h3><p>" + data.data[i].title + "</p><span class=\"price\">" + data.data[i].price + " Ls</span></div><a href=\"" + phonePage + "?m=" + escape(data.data[i].manufacturer) + "&amp;model=" + escape(data.data[i].title) + "\" class=\"btnMoreSmall\"></a></div>\n");
        }
    }
    if (data.type == "features") //features/manufacturers (used for search)
    {
        $("#manufacturers_loading").fadeOut();
        u = 0;
        sip = 0;
        su = 0;
        ssip = 0;
        pu = 0;
        psip = 0;
        for (i = 0; i < data.data.manufacturers.length; i++)
        {
            if (u % 6 == 0)
            {
                $(".searchFilterBoxCol#manufacturers").append("<div class=\"sfbcCol\"></div>\n");
                sip++;
            }
            $(".searchFilterBoxCol#manufacturers .sfbcCol:eq(" + sip + ")").append("<label><input type=\"checkbox\" value=\"" + data.data.manufacturers[i].id + "\" />" + data.data.manufacturers[i].value + "</label><br />\n");
            u++;
        }
        for (i = 0; i < data.data.styles.length; i++)
        {
            if (su % 6 == 0)
            {
                $(".searchFilterBoxCol#styles").append("<div class=\"sfbcCol\"></div>\n");
                ssip++;
            }
            $(".searchFilterBoxCol#styles .sfbcCol:eq(" + ssip + ")").append("<label><input type=\"checkbox\" value=\"" + data.data.styles[i].id + "\" />" + data.data.styles[i].value + "</label><br />\n");
            su++;
        }
        for (i = 0; i < data.data.properties.length; i++)
        {
            if (pu % 6 == 0)
            {
                $(".searchFilterBoxCol#properties").append("<div class=\"sfbcCol\"></div>\n");
                psip++;
            }
            $(".searchFilterBoxCol#properties .sfbcCol:eq(" + psip + ")").append("<label><input type=\"checkbox\" value=\"" + data.data.properties[i].id + "\" />" + data.data.properties[i].value + "</label><br />\n");
            pu++;
        }
        if ($.fn.checkbox)
        {
            if (!$.browser.msie || ($.browser.msie && parseInt($.browser.version) > 6))
            {
                $('input:checkbox').checkbox({empty: '/system_images/empty.png'});
            }
        }
        $(".searchFilterBoxCol#manufacturers .sfbcCol:first, .searchFilterBoxCol#styles .sfbcCol:first, .searchFilterBoxCol#properties .sfbcCol:first").remove();
        if ($(".searchFilterBoxCol#styles .sfbcCol").size() == 1)
        {
            $(".searchFilterBoxCol#styles .sfbcCol").css("width","98%");
        }
    }
    if (data.type == "pricetypes")
    {
        for (i = 0; i < data.data.rates.length; i++)
        {
            ratesList = ratesList + ","+data.data.rates[i].id;
            priceType[data.data.rates[i].id.toString()] = data.data.rates[i].value.toString();
        }
        $(document).getPhoneData(
        {
            get: 'bundle',
            random: 'true',
            featured: 'true',
            callback: 'bphonehome',
            image_type: 'rate',
            subsidy: ratesList
        }
        );
    }
    if (data.type == "search") //search response
    {
        $("#manufacturers_loading").fadeOut();
        $("#filteredResultContainer .gridBoxContent").empty();
        $("h4.gridBoxTopHeading").empty();
        for (i = 0; i < data.data.length; i++)
        {
            $("#filteredResultContainer .gridBoxContent").append("<div class=\"gridBoxItem\"><img src=\"" + data.data[i].pic.replace(/medium/g, 'semilarge') + "\" class=\"phone\" alt=\"\" /><div class=\"bubble\"><span class=\"price\">"+data.data[i].price+" Ls</span></div><h4 class=\"productTitle\">" + data.data[i].manufacturer + "<br />" + data.data[i].title + "</h4><p class=\"description\">" + data.data[i].overview + "</p><a href=\"" + phonePage + "?m=" + escape(data.data[i].manufacturer) + "&amp;model=" + escape(data.data[i].title) + "\" class=\"more\"></a></div>\n");
        }
        $("h4.gridBoxTopHeading").append(local_searchResultsFound + " " + data.data.length + " " + local_searchResultsPhones);
        Cufon.replace('.gridBox h4[class!=noCufon], .gridBox span.price', { fontFamily: 'rockwell' });
    }
    if (data.type == "generic") //generic phone page
    {
        isItOdd = 1; //alternatively, we could use tr:odd, but there were glitches with Opera
        
        $("#t1131 h1:first").append(data.data.manufacturer);
        $("#t1131 h2:first").append(data.data.title);
        $("#t1131 p:first").append(data.data.overview);
        $("#tabBox .textLeft").prepend(data.data.functions.replace(/<\/?font[^>]*?>/g, '')); //regex rules
        for (i = 0; i < data.data.properties.length; i++)
        {
            $("#t1131 #specifikacija ul#specs").append("<li><strong>" + data.data.properties[i].title + "</strong>: " + data.data.properties[i].value + "</li>\n");
        }
        for (i = 0; i < data.data.pricing.length; i++)
        {
            if (isItOdd % 2 == 1)
            {
                alternateRow = " class=\"selected\"";
            }
            else
            {
                alternateRow = "";
            }
            monthlyPrice = data.data.pricing[i].monthly;
            startupPrice = data.data.pricing[i].startup;
            bindTime = "";
            bindText = "";
            monthlyText = "";
            startupText = "";
            priceComment = "";
            if (data.data.pricing[i].leasing_length != "")
            {
                bindTime = data.data.pricing[i].leasing_length;
            }
            else
            {
                bindTime = data.data.pricing[i].binding_length;
            }
            bindTime = bindTime.slice(0, -1);
            if (data.data.pricing[i].price_type == "leasing")
            {
                bindText = local_leasing + " " + bindTime + " " + local_months;
            }
            else if (data.data.pricing[i].price_type == "subsidised")
            {
                bindText = local_subscription + " " + bindTime + " " + local_months;
            }
            if (monthlyPrice == "0.00")
            {
                monthlyText = "-";
            }
            else
            {
                monthlyText = data.data.pricing[i].monthly;
            }
            if (startupPrice == "0.00")
            {
                startupText = "";
            }
            else
            {
                startupText = local_startupPayment + ": " + data.data.pricing[i].startup + " Ls";
            }
            if (data.data.pricing[i].comment != "")
            {
                priceComment = "<br />\n" + data.data.pricing[i].comment;
            }
            $("#t1131 #cena table#prices tbody").append("\n      <tr"+ alternateRow +">\n        <td class=\"stName\">\n          " + data.data.pricing[i].title + "\n        </td>\n        <td>\n          " + data.data.pricing[i].startup + "\n        </td>\n        <td>\n          " + bindText + "\n        </td>\n        <td>\n          " + monthlyText + "\n        </td>\n      </tr>\n");
            isItOdd++;
        }
        //$("#t1131 #cena table#prices tbody tr:odd").addClass("selected");
        $("#t1131 .topRightArea .preview").append("<img src=\"" + data.data.imagePath + "large/" + data.data.images[0] + "\" alt=\"" + data.data.manufacturer + " " + data.data.title + "\" />\n");
        if (data.data.images.length > 3)
        {
            totalImages = 3;
        }
        else if (data.data.images.length <= 1)
        {
            totalImages = 0;
        }
        else
        {
            totalImages = data.data.images.length;
        }
        for (i = 0; i < totalImages; i++)
        {
            $("#t1131 .topRightArea ul.thumbs").append("<li><img class=\"noPngFix\" src=\"" + data.data.imagePath + "icon/" + data.data.images[i] + "\" /></li>\n");
        }
        if (totalImages != 0) $("#t1131 .topRightArea ul.thumbs li:first").addClass("selected").append("<span class=\"arrow\"></span>");
        Cufon.refresh('h1[class!=noCufon], h2[class!=noCufon], h3[class!=noCufon], h4[class!=noCufon], h5[class!=noCufon]', { fontFamily: 'rockwell' });
        if (totalImages != 0) $(bindImageToggler);
        for (i = 0; i < Math.min(4, data.data.services.length); i++)
        {
            $("#t1131 .topLeftArea .subscriptions").append("<a href=\"" + handleToURL[data.data.services[i].handle] + "\" title=\"" + data.data.services[i].title + "\"><img src=\"" + data.data.services[i].pic + "\" alt=\"" + data.data.services[i].title + "\" /></a>");
        }
        $("#t1131 #tabBox .items").addClass(data.data.cheapest.handle);
        $("#t1131 #tabBox .items").append("<div><img class=\"box\" src=\"http://apps.tele2.lv" + data.data.cheapest.pic + "\" alt=\"" + data.data.cheapest.title + "\" /><div class=\"bubble\">" + data.data.cheapest.title + "<br /><span class=\"price\">" + data.data.cheapest.startup.replace(/.00/g, '') + " Ls</span></div><p>" + data.data.cheapest.comment + "</p><a class=\"btnMore\" href=\""+handSubscriptionUrl[data.data.cheapest.handle]+"\">Vair�?k</a></div>\n");
        Cufon.replace('.bubble', {fontFamily: 'rockwell'});
    }
    
/*    if (data.type == "bphone") //bundle phones carousel
    {
    
        for (i = 0; i < data.data.length; i++)
        {
                if (data.data[i].rate_title !== undefined)
                {
                $("#bphones").append("<div><img src=\"" + data.data[i].pic + "\" alt=\"\" class=\"productImage\"><div class=\"rightArea\"><h3 class=\"noCufon\">" + data.data[i].rate_title + "</h3><span class=\"price\">" + data.data[i].price + " Ls</span></div><a href=\"" + phonePage + "?m=" + escape(data.data[i].manufacturer) + "&amp;model=" + escape(data.data[i].title) + "\" class=\"btnMoreSmall\"></a></div>\n");
                }
                else
                {
                $("#bphones").append("<div><img src=\"" + data.data[i].pic + "\" alt=\"\" class=\"productImage\"><div class=\"rightArea\"><h3 class=\"noCufon\">" + data.data[i].manufacturer + "</h3><p>" + data.data[i].title + "</p><span class=\"price\">" + data.data[i].price + " Ls</span></div><a href=\"" + phonePage + "?m=" + escape(data.data[i].manufacturer) + "&amp;model=" + escape(data.data[i].title) + "\" class=\"btnMoreSmall\"></a></div>\n");
                }
        //    $("#bphones").append("<div><img src=\"" + data.data[i].pic + "\" alt=\"\" class=\"productImage\"><div class=\"rightArea\"><h3 class=\"noCufon\">" + data.data[i].manufacturer + "</h3><p>" + data.data[i].title + "</p><span class=\"price\">" + data.data[i].price + " Ls</span></div><a href=\"" + phonePage + "?m=" + escape(data.data[i].manufacturer) + "&amp;model=" + escape(data.data[i].title) + "\" class=\"btnMoreSmall\"></a></div>\n");
            fixShowIE6();
        }
    
    }*/
    if (data.type == "bphone") //bundle phones carousel
    {
        if (global_type == 'business')
        {
            for (i = 0; i < data.data.length; i++)
            {
                $("#bphones").append("<div><img src=\"" + data.data[i].pic + "\" alt=\"\" class=\"productImage\"><div class=\"rightArea\"><h3 class=\"noCufon\">" + data.data[i].rate_title + "</h3><p>" + data.data[i].manufacturer + " " + data.data[i].title + "</p></div><a href=\"" + handSubscriptionUrl[data.data[i].handle] + "\" class=\"btnMoreSmall\"></a></div>\n");
                fixShowIE6();
            }
        }
        else
        {
            for (i = 0; i < data.data.length; i++)
            {
                $("#bphones").append("<div><img src=\"" + data.data[i].pic + "\" alt=\"\" class=\"productImage\"><div class=\"rightArea\"><h3 class=\"noCufon\">" + data.data[i].manufacturer + "</h3><p>" + data.data[i].title + "</p><span class=\"price\">" + data.data[i].price + " Ls</span></div><a href=\"" + phonePage + "?m=" + escape(data.data[i].manufacturer) + "&amp;model=" + escape(data.data[i].title) + "\" class=\"btnMoreSmall\"></a></div>\n");
                fixShowIE6();
            }        
        }
    
    }
    if (data.type == "bphone2rate")
    {
        for (i = 0; i < data.data.length; i++)
        {
            $("#bphones").append("<div><img src=\"" + data.data[i].pic + "\" alt=\"\" class=\"productImage\"><div class=\"rightArea\"><h3 class=\"noCufon\">" + data.data[i].rate_title + "</h3><span class=\"price\">" + data.data[i].price + " Ls</span></div><a href=\"" + handSubscriptionUrl[data.data[i].handle] + "\" class=\"btnMoreSmall\"></a></div>\n");
            fixShowIE6();
        }
    }
    if (data.type == "bphonehome") //bundle phones carousel (first page)
    {
        for (i = 0; i < data.data.length; i++)
        {
            $("#scrollBundles div.items").append("<div><img class=\"box\" src=\"" + data.data[i].pic.replace(/small/g, 'medium') + "\" alt=\"\"><p class=\"productTitle\">" + data.data[i].manufacturer + " " + data.data[i].title + "</p><p class=\"text\">" + priceType[data.data[i].pricetype_id] + "</p><p class=\"text\"><strong>" + data.data[i].price + " Ls</strong></p><a href=\"" + phonePage + "?m=" + escape(data.data[i].manufacturer) + "&amp;model=" + escape(data.data[i].title) + "\" class=\"btnMoreSmall\"></a></div>\n");
        }
        fixShowIE6();
        if ($.browser.msie && parseInt($.browser.version) <= 6) DD_belatedPNG.fix('.items .box');
    }
    if (data.type == "randomhome") //random phones carousel (first page)
    {
        for (i = 0; i < data.data.length; i++)
        {
            $("#scrollPhones div.items").append("<div><img src=\"" + data.data[i].pic + "\" alt=\"\" class=\"phone\"><p class=\"productTitle\">" + data.data[i].manufacturer + "<br />" + data.data[i].title + "</p><p class=\"price\">" + data.data[i].price + " Ls</p><a href=\"" + phonePage + "?m=" + escape(data.data[i].manufacturer) + "&amp;model=" + escape(data.data[i].title) + "\" class=\"btnMoreSmall\"></a></a></div>\n");
        }
        if (window.console && window.console.firebug) console.info('Karuselis: telefoni - pirm�? lapa');
        if ($.browser.msie && parseInt($.browser.version) <= 6)
        {
            DD_belatedPNG.fix('.items .phone');
        }
    }
    if (data.type == "random_boxxy") //is a meme
    {
        for (i = 0; i < Math.min(4, data.data.length); i++)
        {
            $(".subscriptions").append("<a href=\"" + phonePage + "?m=" + escape(data.data[i].manufacturer) + "&amp;model=" + escape(data.data[i].title) + "\"><img src=\"" + data.data[i].pic.replace(/small/g, 'small') + "\" width=\"50\" /></a>\n");
        }
    }
    if (data.type == "list_pc") //devices carousel
    {
        for (i = 0; i < data.data.length; i++)
        {
            $("#scrollPcs div.items").append("<div><img src=\"" + data.data[i].pic.replace(/small/g, 'medium') + "\" alt=\"\" class=\"productImage\"><div class=\"rightArea\"><h3 class=\"noCufon\">" + data.data[i].title + "</h3><p>" + data.data[i].overview + "</p><span class=\"price\">" + data.data[i].price + " Ls</span></div><a class=\"btnMoreSmall\" href=\"" + devicePage + "?m=" + escape(data.data[i].manufacturer) + "&amp;model=" + escape(data.data[i].title) + "\">Vair?k</a></div>\n");
        }
    }
    if (data.type == "random_sidebar")
    {
        for (i = 0; i < Math.min(4, data.data.length); i++)
        {
            $(".productRight #productScroll div.items").append("<div><img src=\"" + data.data[i].pic.replace(/small/g, 'semilarge') + "\" alt=\"\" class=\"box\"><div class=\"bubble\">" + data.data[i].manufacturer + "<br />" + data.data[i].title + "<br /><span class=\"price\">" + data.data[i].price.replace(/.00/g, '') + " Ls</span></div><p class=\"text\">" + data.data[i].overview + "</p><a href=\"" + phonePage + "?m=" + escape(data.data[i].manufacturer) + "&amp;model=" + escape(data.data[i].title) + "\" class=\"btnMore\"></a></div>\n");
        }
        Cufon.replace('.bubble', {fontFamily: 'rockwell'});
        $('#productScroll').scrollable(
        {
            size: 1,
            easing: 'easeOutCirc',
            speed: 1000,
            keyboard: false,
            clickable: false,
            interval: 10000,
            loop: true
        }
        );
    }
    if (data.type == "random_sidebar_device")  //random sidebar devices
    {
        for (i = 0; i < Math.min(4, data.data.length); i++)
        {
            $(".productRight #productScroll div.items").append("<div><img src=\"" + data.data[i].pic.replace(/small/g, 'semilarge') + "\" alt=\"\" class=\"box\"><div class=\"bubble\">" + data.data[i].title + "<br /><span class=\"price\">" + data.data[i].price.replace(/.00/g, '') + " Ls</span></div><p class=\"text\">" + data.data[i].overview + "</p><a href=\"" + devicePage + "?m=" + escape(data.data[i].manufacturer) + "&amp;model=" + escape(data.data[i].title) + "\" class=\"btnMore\"></a></div>\n");
        }
        Cufon.replace('.bubble', { fontFamily: 'rockwell' });
        $('#productScroll').scrollable(
        {
            size: 1,
            easing: 'easeOutCirc',
            speed: 1000,
            keyboard: false,
            clickable: false,
            interval: 10000,    
            loop: true
        }
        );
    }
    /*$(".items div").css("cursor","pointer");
    $(".items div").live("click", function(){
        window.location = $(this).find("a").attr("href");
    });
    $(".items div").mouseover(function(){
        $(this).find("a").css('backgroundPosition','bottom');
    }).mouseout(function(){
        $(this).find("a").css('backgroundPosition','top');
    });*/
}
(function($)
{
    $.fn.setupTabs = function(settings)
    {
    if (window.console && window.console.firebug) console.log('setupTabs');
        $('#tabBox').tabs(
        {
            collapsible: false,
            selected: 0,
            show: function()
            {
                Cufon.replace('.genericTabs .top h5', { fontFamily: 'rockwell' });
                Cufon.replace('.genericTabs .top .ui-tabs-selected h5', { fontFamily: 'rockwell' });
                fixShowIE6();
            }
        }
        );
        return this;
    };
}
)(jQuery);
(function($)
{
    $.fn.getPhoneData = function(settings)
    {
        var config =
        {
            'server'        : global_appserver,
            'get'           : 'list',
            'request'       : 'generic',
            'callback'      : 'generic',
            'image_type'    : 'default',
            'random'        : '0',
            'subsidy'       : '',
            'computer'      : '',
            'features'      : '',
            'featured'      : '',
            'model'         : '',
            'manufacturer'  : ''
        };
        var request =
        {
            'subsidy'       : '&subsidy=',
            'computer'      : '&computer=',
            'features'      : '&features=',
            'featured'      : '&featured=',
            'model'         : '&model=',
            'manufacturer'  : '&m='
        };
        var getType = 0;
        switch (settings.get)
        {
            case 'list'       : getType = 'phone_list';
            break;
            case 'features'   : getType = 'classificator';
            break;
            case 'search'     : getType = 'phones_search';
            break;
            case 'phone'      : getType = 'phone';
            break;
            case 'bundle'     : getType = 'bundle';
            break;
            default           : getType = 'phone_list'
        }
        var settings = $.extend({}, config, settings);
        var request = $.extend({}, request, request);
        if (!settings.subsidy) request.subsidy = '';
        if (!settings.computer) request.computer = '';
        if (!settings.features) request.features = '';
        if (!settings.featured) request.featured = '';
        if (!settings.model) request.model = '';
        if (!settings.manufacturer) request.manufacturer = '';
        if (window.console && window.console.firebug) console.log('$.getPhoneData:\n\tsettings.get: ' + settings.get + '\n\tsettings.request: ' + settings.request + '\n\tsettings.callback: ' + settings.callback + '\n\tsettings.random: ' + settings.random + '\n\tsettings.subsidy: ' + settings.subsidy + '\n\tsettings.computer: ' + settings.computer + '\n\tsettings.features: ' + settings.features + '\n\tsettings.featured: ' + settings.featured + '\n\tsettings.model: ' + settings.model + '\n\tsettings.manufacturer: ' + settings.manufacturer);
        $.getJSON(settings.server + global_lang + "/phones/" + getType + "?request_type=" + settings.callback + request.subsidy + settings.subsidy + request.computer + settings.computer + request.model + settings.model + request.manufacturer + settings.manufacturer + request.features + settings.features + request.featured + settings.featured + "&randomize=" + settings.random + "&type=" + global_type + "&image_type=" + settings.image_type + "&jsoncallback=?", function (){});
        this.each(function()
        {
            $('.nextPage, .prevPage').click(function()
            {
                return false;
            }
            );
        }
        );
        return this;
    };
    $(".items div").bind("click", function(){
        window.location = $(this).find("a").attr("href");
    });
}
)(jQuery);
(function($)
{
    $.fn.getRSS = function(settings)
    {
        var config =
        {
            'server'        : global_appserver,
            'type'          : '',
            'limit'         : '6'
        };
        var settings = $.extend({}, config, settings);
        $.getJSON(settings.server + global_lang + "/feeds/feed?feed_type=" + settings.type + "&limit=" + settings.limit + "&jsoncallback=?", function () {});
        this.each(function()
        {
            $('.nextPage, .prevPage').click(function() {
                return false;
            }
            );
        }
        );
        return this;
    };
}
)(jQuery);
(function($)
{
    $.fn.getLinks = function(settings)
    {
        var config =
        {
            'server'        : global_appserver,
            'type'          : 1
        };
        var settings = $.extend({}, config, settings);
        $.getJSON(settings.server + global_lang + "/mobile/link_list?type=" + settings.type + "&jsoncallback=?", function () {});
        this.each(function()
        {
            $('.nextPage, .prevPage').click(function() {
                return false;
            }
            );
        }
        );
        return this;
    };
}
)(jQuery);
/* - Search globals - */
collectedStyles = "";
collectedManufacturer = "";
collectedProperties = "";
strLen = 0;
(function($)
{
    $.fn.callJsonSearchResults = function(settings)
    {
        var config =
        {
            'server'        : global_appserver
        }
        ;
        var settings = $.extend({}, config, settings);
        collectedStyles = "";
        collectedManufacturer = "";
        collectedProperties = "";
        strLen = 0;
        $("#manufacturers .jquery-checkbox-checked").parent().find("input").each(function (i)
        {
            collectedManufacturer = $(this).attr("value") + "," + collectedManufacturer;
        }
        );
        $("#styles .jquery-checkbox-checked").parent().find("input").each(function (i)
        {
            collectedStyles = $(this).attr("value") + "," + collectedStyles;
        }
        );
        $("#properties .jquery-checkbox-checked").parent().find("input").each(function (i)
        {
            collectedProperties = $(this).attr("value") + "," + collectedProperties;
        }
        );
        strLen = collectedManufacturer.length;
        collectedManufacturer = collectedManufacturer.slice(0,strLen-1);
        strLen = collectedStyles.length;
        collectedStyles = collectedStyles.slice(0,strLen-1);
        strLen = collectedProperties.length;
        collectedProperties = collectedProperties.slice(0,strLen-1);
        $.getJSON(settings.server + global_lang + "/phones/phones_search?request_type=search&style=" + collectedStyles + "&manufacturer=" + collectedManufacturer + "&properties=" + collectedProperties + "&type=" + global_type + "&jsoncallback=?",function () {});
    };
}
)(jQuery);
(function($)
{
    $.fn.doScroll = function(params) // usage: $(document).doScroll({on: '.genericCarousel', by: '.genericScrollable', size: 3});
    {
        if (window.console && window.console.firebug) console.log('doScroll');
        if (!params.on)
        {
            on = ".genericCarousel";
        }
        else
        {
            on = params.on;
        }
        if (!params.by)
        {
            by = ".genericScrollable";
        }
        else
        {
            by = params.by;
        }
        if (!params.size)
        {
            size = 3;
        }
        else
        {
            size = params.size;
        }
        if (!params.loop)
        {
            loop = false;
        }
        else
        {
            loop = true;
        }
        $(on + " .nextPage, " + on + " .prevPage").click(function()
        {
            return false;
        }
        );
        $do = on + " " + by;
        $($do).scrollable(
        {
            size: size,
            prevPage: '.prevPage',
            nextPage: '.nextPage',
            easing: 'easeOutCirc', // global
            speed: 1000,           // 
            keyboard: false,       // 
            clickable: false,      // 
            loop: loop,            // 
            onSeek: fixSeekIE6     //
        }
        );
    };
}
)(jQuery);
(function($)
{
    $.fn.showTarificationTable = function(params)
    {
        countTable = 0;
        $("#gettable .timeTable").each(function (i)
        {
            $(".serviceSelect:last").after("<div class=\"serviceSelect citySelect\"><select><option>" + local_selectCity + "</option></select></div>");
            $("#gettable .timeTable:eq("+ countTable +") td.stName").each(function (i)
            {
                $(".serviceSelect:last select").append("<option>"+ $(this).text() +"</option>");
            }
            );
            countTable++;
            if (countTable == $("#gettable .timeTable").size())
            {
                $(".citySelect select").selectBox(
                {
                    'callOnLoad': function()
                    {
                        if ($.browser.msie && parseInt($.browser.version) <= 6)
                        {
                            DD_belatedPNG.fix('.sb-btn, .sb-top');
                        }
                    },
                        'callBack': function()
                        {
                            if ($.browser.msie && parseInt($.browser.version) <= 6)
                            {
                                DD_belatedPNG.fix('.sb-list , .sb-slideBottom');
                            }
                        }
                }
                );
                $(".citySelect .sb-top-wrap").hide();
                $("#gettable table").hide();
                $(".sb-slide").css("overflow","visible");
                $(".sb-disp:first").text(local_selectRegion);
            }
            $(".rightColumn, .genericTabs, .rightColumn h2, .genericCarousel").css("position","relative");
            $(".genericTabs ").css("z-index","10");
            $(".rightColumn h2").css("z-index","2");
            $(".genericCarousel").css("z-index","1");
        }
        );
        getCityList = 0;
        $(".regionSelect ul.sb-list li").bind("click", function()
        {
            $("#gettable table").hide();
            if (!($("ul.sb-list li").index(this) == "0"))
            {
                getCityList = $("ul.sb-list li").index(this) - 1;
                $(".citySelect .sb-top-wrap").css("display","none");
                $(".citySelect .sb-top-wrap:eq(" + getCityList + ")").fadeIn("fast");
                $("#gettable table:eq(" + getCityList + ")").fadeIn("fast");
                $("#gettable table:eq(" + getCityList + ") tbody tr").show();
                $("#gettable table tbody tr:odd").addClass("selected");
                $(".sb-disp:last").text(local_selectCity);
            }
            else
            {
                $(".citySelect .sb-top-wrap").css("display","none");
                $("#gettable table").hide();
            }
        }
        );
        $(".citySelect ul.sb-list li").click(function()
        {
            $("#gettable table").hide();
            currTable = $("#" + $(this).parent().attr("id") + " li").index(this) -1;
            if (currTable == "-1")
            {
                $("#gettable table").hide();
                $("#gettable table:eq(" + getCityList + ")").show();
                $("#gettable table:eq(" + getCityList + ") tr").show();
                $("#gettable table:eq(" + getCityList + ") tbody tr").show();
                $("#gettable table tbody tr:odd").addClass("selected");
            }
            else
            {
                $("#gettable table").hide();
                $("#gettable table:eq(" + getCityList + ")").show();
                $("#gettable table:eq(" + getCityList + ") tbody tr").hide();
                $("#gettable table:eq(" + getCityList + ") tbody tr:eq("+ currTable +")").show();
                $("#gettable table:eq(" + getCityList + ") tbody tr.selected").removeClass("selected");
            }
        }
        );
    };
}
)(jQuery);
//general, all-page scripts (mostly)
$(document).ready(function() {
/*    $(".items div").css("cursor","pointer");
    $(".items div").live("click", function(){
        window.location = $(this).find("a").attr("href");
    });
    $(".items div").mouseover(function(){
        $(this).find("a").css('backgroundPosition','bottom');
    }).mouseout(function(){
        $(this).find("a").css('backgroundPosition','top');
    });*/
    $(".items div").bind("click", function(e) {
        $("#manufacturers_loading").fadeIn("fast");
    }
    );
    $.expr[":"].hasRev = function(obj) {
        var $this = $(obj);
        return ($this.attr("rev") != "");
    }
    ;
    //some bindings
    rebindControls();
    bindFancyBox();
    doArticlePaging();
    revsToRedirects();
    function rebindControls() {
        Cufon.refresh('h1[class!=noCufon], h2[class!=noCufon], h3[class!=noCufon], h4[class!=noCufon], h5[class!=noCufon]', {
            fontFamily: 'rockwell',
            forceHitArea: 'true'
        });
        $(".shadowedTabs .ui-tabs-nav h5 a").css('position','relative');
        $(".shadowedTabs .ui-tabs-nav h5 a").bind("click", loadTab);
    }
    function loadTab(loadTab) {
        if (window.console && window.console.firebug) console.log('Palaista f-cija loadTab');
        $(".mainContentPadded").slideUp("fast");
        if (!($.browser.msie && parseInt($.browser.version) <= 8)) {
            $(".mainContent").animate( {
                height: "200px",
                        opacity: 0.7
            }
            , 300 );
        } else {
            $(".mainContent").animate( {
                height: "200px"
            }
            , 300 );
        }
        $(".mainContent").append("<div id=\"loading\" style=\"display: none;\"></div>").fadeIn("slow");
        $("#loading").fadeIn("slow");
        $(".mainContent").ajaxStop(function() {
            $("#loading").fadeOut("fast").remove();
        }
        );
        $.ajax( {
            url: $(this).attr("href"),
                  cache: true,
                  dataType: "html",
                  success: function(loadedContent) {
                if (window.console && window.console.firebug) console.log('Ajax success');
                $("div.mainContentPadded").hide();
                loadedContent = loadedContent.replace(/<head[^>]*>([\s\S]*?)<\/head>/gi, '');
                $('<div id="letsParse" style="display: none;">'+ loadedContent +"</div>").insertAfter(".mainContent");
                $(".mainContentPadded:first").html($("#letsParse .mainContentPadded").html());
                $("#letsParse").remove();
                if (!($.browser.msie && parseInt($.browser.version) <= 8)) {
                    $("div.mainContent, div.mainContentPadded").animate( {
                        height: "100%",
                                  opacity: 1.0,
                                  queue: false
                    }, 700 );
                } else {
                    $("div.mainContent, div.mainContentPadded").animate( {
                        height: "100%",
                                  queue: false
                    }, 700 );
                }
                Cufon.refresh('h1[class!=noCufon], h2[class!=noCufon], h3[class!=noCufon], h4[class!=noCufon], h5[class!=noCufon]', {
                    fontFamily: 'rockwell',
                    forceHitArea: 'true'
                }
                );
                fixShowIE6();
                rebindControls();
                bindFancyBox();
                doArticlePaging();
                revsToRedirects();
            }
        }
        );
        loadTab.preventDefault(loadTab);
    }
    if ($.browser.msie && parseInt($.browser.version) <= 6) {
        // ie6...
        $("img[src$='png']").each(function() {
            if (!$(this).hasClass('noPngFix')) {
                DD_belatedPNG.fixPng(this);
            }
        }
        );
        $('div, span, a, input, li, ul').filter(function() {
            if ($(this).css('backgroundImage').match('.png') == '.png')
                            return true; else
                            return false;
        }
        ).not('#topPlaceholder').each(function() {
            DD_belatedPNG.fixPng(this);
        }
        );
        $('.navigationSearchSubmit, .footerSubmit input').hover(function() {
            $(this).css('background-position', 'left bottom !important');
        }
        , function() {
            $(this).css('background-position', 'left top !important');
        }
        );
        // Fix init scrollable prevPage
        var prevPage = $('.prevPage');
        if (prevPage.length > 0) {
            prevPage.css('background-position', 'bottom');
            prevPage.attr('style', prevPage.attr('style').replace(/background-position.*m;/i, ''));
        }
    }
    Cufon.replace('.footer h4, .navigationLeftMenu span.top a, .t1000Carousel .menu a', {
        fontFamily: 'rockwell', hover: true
    }
    );
    Cufon.replace('.navigationSubMenu a', {
        fontFamily: 'rockwell', hover: true
    }
    );
    Cufon.replace('h1[class!=noCufon], h2[class!=noCufon], h3[class!=noCufon], h4[class!=noCufon], h5[class!=noCufon]', {
        fontFamily: 'rockwell'
    }
    );
    Cufon.replace('h3.nobold, h4.nobold', {
        fontFamily: 'rockwell'
    }
    );
    Cufon.replace('.size1, .size2, .size3, .size4, .size5, .size6, .size7', {
        fontFamily: 'rockwell', hover: true
    }
    );
    String.prototype.trim = function() {
        return this.replace(/^\s+|\s+$/g, '');
    }
    // text boxes and textfields
    $("input[type!='submit'], textarea").focus(function() {
        if (this.value == this.defaultValue)
                    this.value = '';
    }
    ).blur(function() {
        if (this.value.trim() == '')
                    this.value = this.defaultValue;
    }
    );
    // select boxes
    $('select[class!=noSelect]').selectBox( {
        'callOnLoad': function() {
            if ($.browser.msie && parseInt($.browser.version) <= 6) {
                DD_belatedPNG.fix('.sb-btn, .sb-top');
            }
        }
        ,
                'callBack': function() {
            if ($.browser.msie && parseInt($.browser.version) <= 6) {
                DD_belatedPNG.fix('.sb-list , .sb-slideBottom');
            }
        }
    }
    );
    // checkboxes and radio buttons
    if ($.fn.checkbox) {
        // disable for IE6 
        if (!$.browser.msie || ($.browser.msie && parseInt($.browser.version) > 6)) {
            $('input:checkbox').checkbox( {
                empty: '/system_images/empty.png'
            }
            );
        }
    }
    $('.navigationDropDownContent:visible').hide();
    Cufon.replace('.shadowedTabs .panelWrapper h5', {
        fontFamily: 'rockwell'
    }
    );
    Cufon.replace('.shadowedTabs .panelWrapper .ui-tabs-selected h5', {
        fontFamily: 'rockwell'
    }
    );
    fixShowIE6();
}
);
function revsToRedirects() {
    $("a.btnSmallRoundArrow16:hasRev").each(function (i) { $(this).attr("href", $(this).attr("rev")).removeAttr("rev");    });
}
function doArticlePaging() {
    if ($(".article").size() > 5) {
        var articleCount = 1;
        var pageCount = 1;
        $(".article").each(function (i) {
            if (articleCount == 1) {
                $(".ui-tabs-panel").append("<div class=\"pages\" id=\"page-" + pageCount +"\"></div>");
            }
            $("#page-" + pageCount).append($(this)).append($("hr:first"));
            if (articleCount == 5) {
                articleCount = 1;
                pageCount++;
            } else {
                articleCount++;
            }
        }
        );
        $(".pages:not(:first)").hide();
        $(".pages:first").show();
        $(".ui-tabs-panel").append("<ul class=\"paging\"></ul>");
        pageLinkCount = 1;
        $(".pages").each(function (i) {
            $(".ui-tabs-panel ul.paging").append("<li><a href=\"#page-" + pageLinkCount + "\" rel=\"page-" + pageLinkCount + "\">" + pageLinkCount + "</a></li>");
            pageLinkCount++;
        }
        );
        $(".ui-tabs-panel ul.paging li:first").addClass("active");
        $(".ui-tabs-panel ul.paging").prepend("<li><a class=\"btnSmallRoundArrowLeft16\" href=\"#\">Previous</a></li>");
        $(".ui-tabs-panel ul.paging").append("<li><a class=\"btnSmallRoundArrowRight16\" href=\"#\">Next</a></li>");
        $("ul.paging li a:not(:first):not(:last)").bind("click", function(e) {
            $("ul.paging li.active").removeClass("active");
            $(this).parent().addClass("active");
            $(".pages:visible").hide();
            curHash = $("ul.paging li.active a").attr("href");
            $(curHash).show();
            e.preventDefault(e);
        }
        );
        function getPageNumber(testString) {
            var regex = /\d+/;
            if(regex.test(testString))
            {
                var match = testString.match(regex);
                match = parseFloat(match); 
                return match;
            }
        }
        $("ul.paging .btnSmallRoundArrowLeft16").bind("click", function(e) {
            curHash = $("ul.paging li.active a").attr("href");
            if (getPageNumber(curHash) != '1') {
                $("ul.paging li.active").prev().addClass("active");
                $("ul.paging li.active:last").removeClass("active");
                $(".pages:visible").hide();
                nextPage = getPageNumber(curHash)-1;
                $('#page-'+nextPage).show();
            }
            e.preventDefault(e);
        }
        );
        $("ul.paging .btnSmallRoundArrowRight16").bind("click", function(e) {
            curHash = $("ul.paging li.active a").attr("href");
            totalPages = $(".pages").length;
            if (getPageNumber(curHash) != totalPages) {
                $("ul.paging li.active").next().addClass("active");
                $("ul.paging li.active:first").removeClass("active");
                $(".pages:visible").hide();
                nextPage = getPageNumber(curHash)+1;
                $('#page-'+nextPage).show();
            }
            e.preventDefault(e);
        }
        );
    }
}
var fixSeekIE6 = function() {
    if ($.browser.msie && parseInt($.browser.version) <= 6) {
        if (this.getRoot().parent().find('.prevPage').length > 0) {
            var prevPage = this.getRoot().parent().find('.prevPage');
            var nextPage = this.getRoot().parent().find('.nextPage');
        } else if (this.getRoot().parent().parent().find('.prevPage').length > 0) {
            var prevPage = this.getRoot().parent().parent().find('.prevPage');
            var nextPage = this.getRoot().parent().parent().find('.nextPage');
        } else if (this.getRoot().find('.prevPage').length > 0) {
            var prevPage = this.getRoot().find('.prevPage');
            var nextPage = this.getRoot().find('.nextPage');
        } else
        return true;
        // if active page is on the right - enable prevPage btn
        if (this.getPageIndex() > 0) {
            prevPage.css('background-position', 'top');
            prevPage.attr('style', prevPage.attr('style').replace(/background-position.*p;/i, ''));
        } else {
            // if active page is first page - disable prevPage btn
            prevPage.css('background-position', 'bottom');
            prevPage.attr('style', prevPage.attr('style').replace(/background-position.*m;/i, ''));
        }
        // if it's the last page - disable nextPage btn
        if (this.getPageIndex() == this.getPageAmount() - 1) {
            nextPage.css('background-position', 'bottom');
            nextPage.attr('style', nextPage.attr('style').replace(/background-position.*m;/i, ''));
        } else {
            // else, enable nextPage btn
            nextPage.css('background-position', 'top');
            nextPage.attr('style', nextPage.attr('style').replace(/background-position.*p;/i, ''));
        }
    }
};
var fixShowIE6 = function() {
    if ($.browser.msie && parseInt($.browser.version) <= 6) {
        $('.genericTabs > shape').hide();
        $('.genericTabs > shape:first').show().next().show();
        $('.genericTabs .content:visible, .genericTabs .contentNoPadding:visible').prev().show().prev().show();
        DD_belatedPNG.fix('.btnSmallRoundArrow16, .ui-tabs-selected h5, .items .productImage, .btnMoreSmall, .btnBuySmall, .preview img');
        fixStretch = 0;
        $(".removeFromLayout").each(function() {
            if ($(this).width() > 161) {
                fixBy = $(this).width() - 161;
                $(this).find(".stretch").css("width",fixBy+"px").css("border","1px solid #fff").css("border","none");
            }
        }
        );
    }
    $(".shadowedTabs .ui-tabs-nav h5 a").css('position','relative');
};
/*
    template specific scripts
    generally, I discourage everyone, to make javascript-dependent templates.
    use functions, for god's sake.
*/
var T100 = function() {
    $('.smallGenericCarousel .nextPage, .smallGenericCarousel .prevPage').click(function() {
        return false;
    }
    );
    $('.smallGenericCarousel .scrollPhones').scrollable( {
        size: 5,
                prevPage: '.prevPage',
                nextPage: '.nextPage',
                easing: 'easeOutCirc',
                speed: 1000,
                keyboard: false,
                clickable: false,
                onSeek: fixSeekIE6
    }
    );
    $('#accordion100 .header').click(function() {
        var that = $(this);
        var thatCH = that.children('.arrow');
        that.next().slideToggle('fast');
        if(thatCH.hasClass('openContainer')) {
            thatCH.removeClass('openContainer');
        } else {
            thatCH.addClass('openContainer');
        }
        return false;
    }
    );
    /*   Carousel phone fix   */
    $('.expandBox').hide();
    var swi = false, memEle = false,leftOut = false, isCorner = false;
    var lastEle = $('#t100 .smallGenericCarousel .genericScrollable .items .products');
    if(lastEle.length<=5) {
        $('.nextPage, .prevPage').hide()
    }
    var eleNr = (lastEle.length - 2);
    $('#t100 .smallGenericCarousel .genericScrollable .items div').click(function() {
        var that = $(this);
        $('.expandBox').hide();
        var thatExpobox = that.children('.expandBox');
        var hitNow = lastEle.index(this);
        //alert(hitNow);
        var theArr = [3,4,8,9,13,14,18,19,23,24,28,29,33,34,38,39,43,44], theArrNr = $.inArray(hitNow,theArr);
        isCorner = (theArrNr == -1)? false:true;
        if(that.width() < 180 && swi === false) {
            if(hitNow > eleNr || isCorner) {
                var item = $('.items');
                var itemOff = item.position().left;
                item.animate( {
                    'left':(itemOff - 135)+'px'
                }
                ,300);
                leftOut = true;
            }
            that.animate( {
                'width':'250px'
            }
            ,300);
            thatExpobox.show();
            swi = true;
            memEle = that;
        } else if(that.width() < 180 && swi === true) {
            if(leftOut) {
                var item = $('.items');
                var itemOff = item.position().left;
                item.animate( {
                    'left':(itemOff + 135)+'px'
                }
                ,300);
                leftOut = false;
            }
            memEle.animate( {
                'width':'116px'
            }
            ,300,function() {
                that.animate( {
                    'width':'250px'
                }
                ,300);
                if(hitNow > eleNr || isCorner) {
                    var item = $('.items');
                    var itemOff = item.position().left;
                    item.animate( {
                        'left':(itemOff - 135)+'px'
                    }
                    ,300);
                    leftOut = true;
                }
                thatExpobox.show();
            }
            );
            memEle = that;
            swi = true;
        } else if(that.width() > 180 && swi === true) {
            if(leftOut) {
                var item = $('.items');
                var itemOff = item.position().left;
                item.animate( {
                    'left':(itemOff + 135)+'px'
                }
                ,300);
                leftOut = false;
            }
            that.animate( {
                'width':'116px'
            }
            ,300,function() {
            }
            );
            swi = false;
        }
    }
    );
};
var T1000 = function() {
    /* Scroll start */
    var scrolls = {
        Phones: 4, Subscriptions: 3, Bundles: 3
    }
    ;
    var scrollNumber = 1;
    var timeout = 5000;
    var isClicked = false;
    $.each(scrolls, function(key, value) {
        $('.t1000Carousel .menu a[href=#' + key.toLowerCase() + ']').click(function() {
            showScroll(key);
            if (key == 'Phones') {
                scrollNumber = 1;
            } else if (key == 'Subscriptions') {
                scrollNumber = 2;
            } else if (key == 'Bundles') {
                scrollNumber = 3;
            }
            return false;
        }
        );
        $('.t1000Carousel #scroll' + key).scrollable( {
            size: value,
                        prevPage: '#' + key.toLowerCase() + ' .prevPage',
                        nextPage: '#' + key.toLowerCase() + ' .nextPage',
                        easing: 'easeOutCirc',
                        speed: 1000,
                        keyboard: false,
                        clickable: false,
                        onSeek: fixSeekIE6
        }
        );
        var itemsLength = $('.t1000Carousel #scroll' + key + ' .items > *').length;
        if (itemsLength <= value) {
            $('#' + key.toLowerCase() + ' .prevPage, #' + key.toLowerCase() + ' .nextPage').addClass('disabled');
        }
    }
    );
    var showScroll = function(scroll) {
        $('.menu ul li').removeClass('selected');
        if ($.browser.msie && parseInt($.browser.version) <= 6) {
            $('.menu ul li[class!=selected] a').css('background-position', '-9999px');
        }
        $('.t1000Carousel .menu a[href=#' + scroll.toLowerCase() + ']').parent('h5').parent('li').addClass('selected');
        if ($.browser.msie && parseInt($.browser.version) <= 6) {
            $('.menu ul a[href=#' + scroll.toLowerCase() + ']').css('background-position', 'left');
        }
        $(".t1000Carousel .scroll").children().hide();
        $('#' + scroll.toLowerCase()).show();
        Cufon.replace('h5[class!=noCufon]', {
            fontFamily: 'rockwell'
        }
        );
    }
    $('.t1000Carousel').hover(function() {
        clearTimeout(hoverCarousel);
    }
    , function() {
        if (isClicked != true) {
            clearTimeout(hoverCarousel);
            hoverCarousel = setTimeout(rollCarousel, timeout);
        }
    }
    );
    $('.menu ul li a').click(function() {
        hoverCarousel = '';
        clearTimeout(hoverCarousel);
        isClicked = true;
    }
    );
    var rollCarousel = function() {
        switch (scrollNumber) {
            case 0:
                            showScroll('Phones');
            break;
            case 1:
                            showScroll('Subscriptions');
            break;
            case 2:
                            showScroll('Bundles');
            break;
            default:
                            return false;
            break;
        }
        scrollNumber = scrollNumber + 1;
        if (scrollNumber == 3) {
            scrollNumber = 0;
        }
        clearTimeout(hoverCarousel);
        hoverCarousel = setTimeout(rollCarousel, timeout);
    }
    ;
    var hoverCarousel = setTimeout(rollCarousel, timeout);
    /* Scroll end */
    /* Plus Start */
    $('#plus .items div a ').tooltip( {
        'calling': function() {
            Cufon.replace('.tooltipTitle', {
                fontFamily: 'rockwell'
            }
            );
            if ($.browser.msie && parseInt($.browser.version) <= 6) {
                DD_belatedPNG.fix('.tooltipTop,.tooltipFoot');
            }
        }
        ,
                'delayIn': 120,
                'title': true,
                'y': -36,
                'yPop': 10,
                'yOut': 60
    }
    );
    $('#plus').scrollable( {
        size: 7,
                prevPage: '.t1000CarouselPlus .prevPage',
                nextPage: '.t1000CarouselPlus .nextPage',
                easing: 'easeOutCirc',
                speed: 1000,
                keyboard: false,
                clickable: false,
                onSeek: fixSeekIE6
    }
    );
    /* Plus End */
    $("#plus .items div a").click(function () {
        window.location = $(this).attr("href");
    }
    );
};
var T1000b = function() {
    /* Scroll start */
    var scrolls = {
        Phones: 4, Subscriptions: 3
    }
    ;
    var scrollNumber = 1;
    var timeout = 5000;
    var isClicked = false;
    $.each(scrolls, function(key, value) {
        $('.t1000Carousel .menu a[href=#' + key.toLowerCase() + ']').click(function() {
            showScroll(key);
            if (key == 'Phones') {
                scrollNumber = 1;
            } else if (key == 'Subscriptions') {
                scrollNumber = 2;
            }
            return false;
        }
        );
        $('.t1000Carousel #scroll' + key).scrollable( {
            size: value,
                        prevPage: '#' + key.toLowerCase() + ' .prevPage',
                        nextPage: '#' + key.toLowerCase() + ' .nextPage',
                        easing: 'easeOutCirc',
                        speed: 1000,
                        keyboard: false,
                        clickable: false,
                        onSeek: fixSeekIE6
        }
        );
        var itemsLength = $('.t1000Carousel #scroll' + key + ' .items > *').length;
        if (itemsLength <= value) {
            $('#' + key.toLowerCase() + ' .prevPage, #' + key.toLowerCase() + ' .nextPage').addClass('disabled');
        }
    }
    );
    var showScroll = function(scroll) {
        $('.menu ul li').removeClass('selected');
        if ($.browser.msie && parseInt($.browser.version) <= 6) {
            $('.menu ul li[class!=selected] a').css('background-position', '-9999px');
        }
        $('.t1000Carousel .menu a[href=#' + scroll.toLowerCase() + ']').parent('h5').parent('li').addClass('selected');
        if ($.browser.msie && parseInt($.browser.version) <= 6) {
            $('.menu ul a[href=#' + scroll.toLowerCase() + ']').css('background-position', 'left');
        }
        $(".t1000Carousel .scroll").children().hide();
        $('#' + scroll.toLowerCase()).show();
        Cufon.replace('h5[class!=noCufon]', {
            fontFamily: 'rockwell'
        }
        );
    }
    $('.t1000Carousel').hover(function() {
        clearTimeout(hoverCarousel);
    }
    , function() {
        if (isClicked != true) {
            clearTimeout(hoverCarousel);
            hoverCarousel = setTimeout(rollCarousel, timeout);
        }
    }
    );
    $('.menu ul li a').click(function() {
        hoverCarousel = '';
        clearTimeout(hoverCarousel);
        isClicked = true;
    }
    );
    var rollCarousel = function() {
        switch (scrollNumber) {
            case 0:
                            showScroll('Phones');
            break;
            case 1:
                            showScroll('Subscriptions');
            break;
            default:
                            return false;
            break;
        }
        scrollNumber = scrollNumber + 1;
        if (scrollNumber == 2) {
            scrollNumber = 0;
        }
        clearTimeout(hoverCarousel);
        hoverCarousel = setTimeout(rollCarousel, timeout);
    }
    ;
    var hoverCarousel = setTimeout(rollCarousel, timeout);
    /* Scroll end */
    /* Plus Start */
    $('#plus .items div a ').tooltip( {
        'calling': function() {
            Cufon.replace('.tooltipTitle', {
                fontFamily: 'rockwell'
            }
            );
            if ($.browser.msie && parseInt($.browser.version) <= 6) {
                DD_belatedPNG.fix('.tooltipTop,.tooltipFoot');
            }
        }
        ,
                'delayIn': 120,
                'title': true,
                'y': -36,
                'yPop': 10,
                'yOut': 60
    }
    );
    $('#plus').scrollable( {
        size: 7,
                prevPage: '.t1000CarouselPlus .prevPage',
                nextPage: '.t1000CarouselPlus .nextPage',
                easing: 'easeOutCirc',
                speed: 1000,
                keyboard: false,
                clickable: false,
                onSeek: fixSeekIE6
    }
    );
    /* Plus End */
    $("#plus .items div a").click(function () {
        window.location = $(this).attr("href");
    }
    );
};
var T1100 = function() {
    $('.genericCarousel .nextPage, .genericCarousel .prevPage').click(function() {
        return false;
    }
    );
    $('.genericCarousel .scrollSubscriptions, .genericCarousel .scrollPlusServices ').scrollable( {
        size: 3,
                prevPage: '.prevPage',
                nextPage: '.nextPage',
                easing: 'easeOutCirc',
                speed: 1000,
                keyboard: false,
                clickable: false,
                onSeek: fixSeekIE6
    }
    );
    $('.genericCarousel .scrollPhones').scrollable( {
        size: 4,
                prevPage: '.prevPage',
                nextPage: '.nextPage',
                easing: 'easeOutCirc',
                speed: 1000,
                keyboard: false,
                clickable: false,
                onSeek: fixSeekIE6
    }
    );
};
var T1110 = function() {
    $('.genericCarousel .nextPage, .genericCarousel .prevPage').click(function() {
        return false;
    }
    );
    $('.genericCarousel .genericScrollable').scrollable( {
        size: 3,
                prevPage: '.prevPage',
                nextPage: '.nextPage',
                easing: 'easeOutCirc',
                speed: 1000,
                keyboard: false,
                clickable: false,
                onSeek: fixSeekIE6
    }
    );
};
var T1111 = function() {
    $('.genericCarousel .nextPage, .genericCarousel .prevPage').click(function() {
        return false;
    }
    );
    $('.genericCarousel .genericScrollable').scrollable( {
        size: 3,
                prevPage: '.prevPage',
                nextPage: '.nextPage',
                easing: 'easeOutCirc',
                speed: 1000,
                keyboard: false,
                clickable: false,
                onSeek: fixSeekIE6
    }
    );
};
var T11111 = function() {
    $('.genericCarousel .nextPage, .genericCarousel .prevPage').click(function() {
        return false;
    }
    );
    $('.genericCarousel .genericScrollable').scrollable( {
        size: 3,
                prevPage: '.prevPage',
                nextPage: '.nextPage',
                easing: 'easeOutCirc',
                speed: 1000,
                keyboard: false,
                clickable: false,
                onSeek: fixSeekIE6
    }
    );
    $('#tabBox').tabs( {
        collapsible: false,
                selected: 0,
                show: function() {
            Cufon.replace('.genericTabs .top h5', {
                fontFamily: 'rockwell'
            }
            );
            Cufon.replace('.genericTabs .top .ui-tabs-selected h5', {
                fontFamily: 'rockwell'
            }
            );
            fixShowIE6();
        }
    }
    );
    $('#productScroll').scrollable( {
        size: 1,
                easing: 'easeOutCirc',
                speed: 1000,
                keyboard: false,
                clickable: false,
                interval: 10000,
                loop: true
    }
    );
    if ($('#productScroll .items div').size() <= 1) {
        $('.navi').hide();
    }
};
var T1150 = function() {
    $('.genericCarousel .nextPage, .genericCarousel .prevPage').click(function() {
        return false;
    }
    );
    $(' .genericCarousel .scrollPlusServices,.genericCarousel .scrollPlusServicesBig').scrollable( {
        size: 3,
                prevPage: ' .prevPage',
                nextPage: ' .nextPage',
                easing: 'easeOutCirc',
                speed: 1000,
                keyboard: false,
                clickable: false,
                onSeek: fixSeekIE6
    }
    );
    $('#tabBox').tabs( {
        collapsible: false,
                selected: 0,
                show: function() {
            Cufon.replace('.genericTabs .top h5', {
                fontFamily: 'rockwell'
            }
            );
            Cufon.replace('.genericTabs .top .ui-tabs-selected h5', {
                fontFamily: 'rockwell'
            }
            );
            fixShowIE6();
        }
    }
    );
};
var T1200 = function() {
    $('.genericCarousel .nextPage, .genericCarousel .prevPage').click(function() {
        return false;
    }
    );
    $('.genericCarousel .scrollSubscriptions, .genericCarousel .scrollPlusServices, .genericCarousel .scrollHardware').scrollable( {
        size: 3,
                prevPage: ' .prevPage',
                nextPage: '.nextPage',
                easing: 'easeOutCirc',
                speed: 1000,
                keyboard: false,
                clickable: false,
                onSeek: fixSeekIE6
    }
    );
};
var T1210 = function() {
    $('.genericCarousel .nextPage, .genericCarousel .prevPage').click(function() {
        return false;
    }
    );
    $('.genericCarousel .genericScrollable').scrollable( {
        size: 3,
                prevPage: '.prevPage',
                nextPage: '.nextPage',
                easing: 'easeOutCirc',
                speed: 1000,
                keyboard: false,
                clickable: false,
                onSeek: fixSeekIE6
    }
    );
};
var T1120 = function() {
    $('.genericCarousel .nextPage, .genericCarousel .prevPage').click(function() {
        return false;
    }
    );
    $('.genericCarousel .scrollPhones').scrollable( {
        size: 4,
                prevPage: '.prevPage',
                nextPage: '.nextPage',
                easing: 'easeOutCirc',
                speed: 1000,
                keyboard: false,
                clickable: false,
                onSeek: fixSeekIE6
    }
    );
    $('#showFilteredSelection').click(function() {
        setTimeout("$('#filteredResultContainer').slideDown()", 1000);
        return false;
    }
    );
};
var T1130 = function() {
    T1120();
};
var T2000 = function() {
    T1000();
};
var T3000 = function() {
    $('.header').click(function() {
        var that = $(this);
        var thatCH = that.children('.arrow');
        that.next().slideToggle('fast');
        if (thatCH.hasClass('.openContainer')) {
            thatCH.removeClass('openContainer');
        } else {
            thatCH.addClass('openContainer');
        }
        return false;
    }
    );
};
var T3100 = function() {
    $("#t3100 dl dt a").click(function() {
        $(this).closest("dl").children().removeClass("active");
        $(this).parent().next().andSelf().addClass("active");
        return false;
    }
    );
    $('.shadowedTabs').tabs( {
        collapsible: false,
                selected: 0,
                show: function() {
            Cufon.replace('.shadowedTabs .panelWrapper h5', {
                fontFamily: 'rockwell'
            }
            );
            Cufon.replace('.shadowedTabs .panelWrapper .ui-tabs-selected h5', {
                fontFamily: 'rockwell'
            }
            );
            fixShowIE6();
        }
    }
    );
};
var T21111 = function() {
    $('.genericCarousel .nextPage, .genericCarousel .prevPage').click(function() {
        return false;
    }
    );
    $('.genericCarousel .genericScrollable').scrollable( {
        size: 3,
                prevPage: '.prevPage',
                nextPage: '.nextPage',
                easing: 'easeOutCirc',
                speed: 1000,
                keyboard: false,
                clickable: false,
                onSeek: fixSeekIE6
    }
    );
    $('#tabBox').tabs( {
        collapsible: false,
                selected: 0,
                show: function() {
            Cufon.replace('.genericTabs .top h5', {
                fontFamily: 'rockwell'
            }
            );
            Cufon.replace('.genericTabs .top .ui-tabs-selected h5', {
                fontFamily: 'rockwell'
            }
            );
            fixShowIE6();
        }
    }
    );
    $('#productScroll').scrollable( {
        size: 1,
                easing: 'easeOutCirc',
                speed: 1000,
                keyboard: false,
                clickable: false,
                interval: 10000,
                loop: true
    }
    );
    if ($('#productScroll .items div').size() <= 1) {
        $('.navi').hide();
    }
};
var bindImageToggler = function() {
    $("ul.thumbs li").click(function() {
        var obj = $(this);
        if(!obj.hasClass('selected')) {
            obj.parent().find('li').removeClass('selected');
            obj.parent().find('span').remove();
            if ($.browser.msie && parseInt($.browser.version) <= 8) {
                if($.browser.msie && parseInt($.browser.version) <= 6) {
                    obj.parent().find('shape').remove();
                    var source = obj.find('img').attr('src');
                    obj.parent().prev().find('shape').remove().find('img').remove();
                    obj.parent().prev().append('<img class=\"preview\" src=\"' + source.replace(/icon/i, "large") + '" alt=\"\" />');
                    DD_belatedPNG.fix('.preview, .thumbs span');
                } else {
                    obj.parent().prev('div').find('img').attr('src', obj.find('img').attr('src').replace(/icon/i, "large"));
                }
            } else {
                $("div.preview").find('img').fadeTo(400, 0.1, function() {
                    obj.parent().prev('div').find('img').attr('src', obj.find('img').attr('src').replace(/icon/i, "large")).fadeTo(400, 1);
                }
                );
            }
            obj.addClass('selected');
            obj.find('img').after('<span></span>');
        }
    }
    );
};
var bindSimpleImageToggler = function() {
    $("ul.thumbs li").click(function() {
        var obj = $(this);
        if(!obj.hasClass('selected')) {
            obj.parent().find('li').removeClass('selected');
            obj.parent().find('span').remove();
            if ($.browser.msie && parseInt($.browser.version) <= 8) {
                if($.browser.msie && parseInt($.browser.version) <= 6) {
                    obj.parent().find('shape').remove();
                    var source = obj.find('img').attr('src');
                    obj.parent().prev().find('shape').remove().find('img').remove();
                    obj.parent().prev().append('<img class=\"preview\" src=\"' + source + '" alt=\"\" />');
                    DD_belatedPNG.fix('.preview, .thumbs span');
                } else {
                    obj.parent().prev('div').find('img').attr('src', obj.find('img').attr('src'));
                }
            } else {
                $("div.preview").find('img').fadeTo(400, 0.1, function() {
                    obj.parent().prev('div').find('img').attr('src', obj.find('img').attr('src')).fadeTo(400, 1);
                }
                );
            }
            obj.addClass('selected');
            obj.find('img').after('<span></span>');
        }
    }
    );
};
var T1131 = function() {
    $('.genericCarousel .nextPage, .genericCarousel .prevPage').click(function() {
        return false;
    }
    );
    $('.genericCarousel .genericScrollable').scrollable( {
        size: 4,
                prevPage: '.prevPage',
                nextPage: '.nextPage',
                easing: 'easeOutCirc',
                speed: 1000,
                keyboard: false,
                clickable: false,
                onSeek: fixSeekIE6
    }
    );
    $('#tabBox').tabs( {
        collapsible: false,
                selected: 0,
                show: function() {
            Cufon.replace('.genericTabs .top h5', {
                fontFamily: 'rockwell'
            }
            );
            Cufon.replace('.genericTabs .top .ui-tabs-selected h5', {
                fontFamily: 'rockwell'
            }
            );
            fixShowIE6();
        }
    }
    );
    $('#productScroll').scrollable( {
        size: 1,
                easing: 'easeOutCirc',
                speed: 1000,
                keyboard: false,
                clickable: false,
                interval: 10000,
                loop: true
    }
    );
    if ($('#productScroll .items div').size() <= 1) {
        $('.navi').hide();
    }
};
var T3000cs = function() {
    $("#t3000cs dl dt a").click(function() {
        $(this).closest("dl").children().removeClass("active");
        $(this).parent().next().andSelf().addClass("active");
        return false;
    }
    );
    $('.shadowedTabs').tabs( {
        collapsible: false,
                selected: 0,
                show: function() {
            Cufon.replace('.shadowedTabs .panelWrapper h5', {
                fontFamily: 'rockwell'
            }
            );
            Cufon.replace('.shadowedTabs .panelWrapper .ui-tabs-selected h5', {
                fontFamily: 'rockwell'
            }
            );
            fixShowIE6();
        }
    }
    );
};
 
 function gvl(elem){
        if(document.getElementById(elem).value.length < 1)
              return false;
  return true;
 }
 var sent = false;
 function send(){
   if (sent == true) {
    alert('Lūdzu uzgaidiet, dati jau tiek sūtīti!');
   } else {
         if(!gvl("gift")){
                 alert("Lūdzu, izvēlaties dāvanu!");
                 return false;
         }
         if((!gvl("giftAddress") && document.getElementById('gift').value != '6') || (!gvl("enterprise") && document.getElementById('gift').value == '6') || !gvl("person") || !gvl("number") || !gvl("enterprise2") || !gvl("person2") || !gvl("number2") || !gvl("city")){
                 alert("Lūdzu, aizpildiet visus obligātos laukus!");
                 return false;
         }
         document.getElementById("f_atved").submit();
         sent = true;
   }
     return false;
 }
 $("#g1, #g2, #g3, #g4, #g5, #g6, #g7, #g8, #g9, #g10").css("cursor","pointer");
 function gift(num){
        $("#g1, #g2, #g3, #g4, #g5, #g6, #g7, #g8, #g9, #g10").css("fontWeight","normal");
        $(".gift .bubblez").removeAttr("id");
        $("#g" + num).prev('.bubblez').attr('id','selected');
        $("#g" + num).css("fontWeight","bold");
    document.getElementById('gift').value = num;
        if(num == 6){
     $("#field1").css("display","block");
          } else {
     $("#field1").css("display","none");
        }
 }