/**
 * --------------------------------------------------------------------
 * jQuery-Plugin "pngFix"
 * Version: 1.2, 09.03.2009
 * by Andreas Eberhard, andreas.eberhard@gmail.com
 *                      http://jquery.andreaseberhard.de/
 *
 * Copyright (c) 2007 Andreas Eberhard
 * Licensed under GPL (http://www.opensource.org/licenses/gpl-license.php)
 *
 * Changelog:
 *    09.03.2009 Version 1.2
 *    - Update for jQuery 1.3.x, removed @ from selectors
 *    11.09.2007 Version 1.1
 *    - removed noConflict
 *    - added png-support for input type=image
 *    - 01.08.2007 CSS background-image support extension added by Scott Jehl, scott@filamentgroup.com, http://www.filamentgroup.com
 *    31.05.2007 initial Version 1.0
 * --------------------------------------------------------------------
 * @example $(function(){$(document).pngFix();});
 * @desc Fixes all PNG's in the document on document.ready
 *
 * jQuery(function(){jQuery(document).pngFix();});
 * @desc Fixes all PNG's in the document on document.ready when using noConflict
 *
 * @example $(function(){$('div.examples').pngFix();});
 * @desc Fixes all PNG's within div with class examples
 *
 * @example $(function(){$('div.examples').pngFix( { blankgif:'ext.gif' } );});
 * @desc Fixes all PNG's within div with class examples, provides blank gif for input with png
 * --------------------------------------------------------------------
 */

(function($) {

jQuery.fn.pngFix = function(settings) {

	// Settings
	settings = jQuery.extend({
		blankgif: 'blank.gif'
	}, settings);

	var ie55 = (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) == 4 && navigator.appVersion.indexOf("MSIE 5.5") != -1);
	var ie6 = (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) == 4 && navigator.appVersion.indexOf("MSIE 6.0") != -1);

	if (jQuery.browser.msie && (ie55 || ie6)) {

		//fix images with png-source
		jQuery(this).find("img[src$=.png]").each(function() {

			jQuery(this).attr('width',jQuery(this).width());
			jQuery(this).attr('height',jQuery(this).height());

			var prevStyle = '';
			var strNewHTML = '';
			var imgId = (jQuery(this).attr('id')) ? 'id="' + jQuery(this).attr('id') + '" ' : '';
			var imgClass = (jQuery(this).attr('class')) ? 'class="' + jQuery(this).attr('class') + '" ' : '';
			var imgTitle = (jQuery(this).attr('title')) ? 'title="' + jQuery(this).attr('title') + '" ' : '';
			var imgAlt = (jQuery(this).attr('alt')) ? 'alt="' + jQuery(this).attr('alt') + '" ' : '';
			var imgAlign = (jQuery(this).attr('align')) ? 'float:' + jQuery(this).attr('align') + ';' : '';
			var imgHand = (jQuery(this).parent().attr('href')) ? 'cursor:hand;' : '';
			if (this.style.border) {
				prevStyle += 'border:'+this.style.border+';';
				this.style.border = '';
			}
			if (this.style.padding) {
				prevStyle += 'padding:'+this.style.padding+';';
				this.style.padding = '';
			}
			if (this.style.margin) {
				prevStyle += 'margin:'+this.style.margin+';';
				this.style.margin = '';
			}
			var imgStyle = (this.style.cssText);

			strNewHTML += '<span '+imgId+imgClass+imgTitle+imgAlt;
			strNewHTML += 'style="position:relative;white-space:pre-line;display:inline-block;background:transparent;'+imgAlign+imgHand;
			strNewHTML += 'width:' + jQuery(this).width() + 'px;' + 'height:' + jQuery(this).height() + 'px;';
			strNewHTML += 'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader' + '(src=\'' + jQuery(this).attr('src') + '\', sizingMethod=\'scale\');';
			strNewHTML += imgStyle+'"></span>';
			if (prevStyle != ''){
				strNewHTML = '<span style="position:relative;display:inline-block;'+prevStyle+imgHand+'width:' + jQuery(this).width() + 'px;' + 'height:' + jQuery(this).height() + 'px;'+'">' + strNewHTML + '</span>';
			}

			jQuery(this).hide();
			jQuery(this).after(strNewHTML);

		});

		// fix css background pngs
		jQuery(this).find("*").each(function(){
			var bgIMG = jQuery(this).css('background-image');
			if(bgIMG.indexOf(".png")!=-1){
				var iebg = bgIMG.split('url("')[1].split('")')[0];
				jQuery(this).css('background-image', 'none');
				jQuery(this).get(0).runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + iebg + "',sizingMethod='scale')";
			}
		});
		
		//fix input with png-source
		jQuery(this).find("input[src$=.png]").each(function() {
			var bgIMG = jQuery(this).attr('src');
			jQuery(this).get(0).runtimeStyle.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader' + '(src=\'' + bgIMG + '\', sizingMethod=\'scale\');';
   		jQuery(this).attr('src', settings.blankgif)
		});
	
	}
	
	return jQuery;

};

})(jQuery);/* Copyright 2008 MagicToolBox.com. To use this code on your own site, visit http://magictoolbox.com */
eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('q 1f=\'1S\';q W=5i.5j.2C();m(W.2w("2I")!=-1){1f=\'2I\'}U m(W.2w("1S")!=-1){1f=\'1S\'}U m(W.2w("44")!=-1){1f=\'44\'}U m(W.2w("9I")!=-1){1f=\'4J\'}q 42=1K 6A();v 3F$(1O){G C.9k(1O)};v 1H(F,63){m(F.4m){q y=F.4m[63];y=K(y)?y:\'1N\'}U m(1i.6O){q 4v=C.6P.6O(F,1a);q y=4v?4v[63]:1a}U{y=F.B[63];y=K(y)?y:\'1N\'}G y};v 5Z(e){m(e.8K){q r=e.8K();q 5F=0;q 5K=0;m(C.Z&&(C.Z.2P||C.Z.2O)){5K=C.Z.2O;5F=C.Z.2P}U m(C.1Q&&(C.1Q.2P||C.1Q.2O)){5K=C.1Q.2O;5F=C.1Q.2P}G{\'M\':r.M+5F,\'L\':r.L+5K,\'1b\':r.1b+5F,\'1u\':r.1u+5K}}}v 7k(e){q x=0;q y=0;m(1f==\'1S\'){y=e.3P;x=e.3V;m(C.Z&&(C.Z.2P||C.Z.2O)){y=e.3P+C.Z.2O;x=e.3V+C.Z.2P}U m(C.1Q&&(C.1Q.2P||C.1Q.2O)){y=e.3P+C.1Q.2O;x=e.3V+C.1Q.2P}}U{y=e.3P;x=e.3V;y+=1i.4j;x+=1i.4e}G{\'x\':x,\'y\':y}}v 7y(){G P};q 6R=v(){q 23=1Y;m(!23[1])23=[7,23[0]];1y(q 7u 6x 23[1])23[0][7u]=23[1][7u];G 23[0]};v 3h(2z,16,4L){m(1f==\'4J\'||1f==\'2I\'||1f==\'44\'){3z{2z.6U(16,4L,P)}3D(e){}}U m(1f==\'1S\'){2z.6h("4Y"+16,4L)}};v 7d(2z,16,4L){m(1f==\'4J\'||1f==\'2I\'||1f==\'44\'){2z.72(16,4L,P)}U m(1f==\'1S\'){2z.8u("4Y"+16,4L)}};v 7O(){q 3J=[];1y(q i=0;i<1Y.1e;i++)1y(q j=0;j<1Y[i].1e;j++)3J.3B(1Y[i][j]);G 3J};v 9n(7B,9G){3J=[];1y(q i=9G;i<7B.1e;i++)3J.3B(7B[i]);G 3J};v 3q(45,9m){q 23=9n(1Y,2);G v(){45[9m].4M(45,7O(23,1Y))}};v 4p(e){m(1f==\'4J\'||1f==\'44\'||1f==\'2I\'){e.7a=V;e.74();e.79()}U m(1f==\'1S\'){1i.16.7a=V}};v 24(8x,89,87,83,17){7.6Z=\'2.3\';7.4K=P;7.1I=3F$(8x);7.1d=3F$(89);7.X=3F$(87);7.1n=3F$(83);7.1E=0;7.17=17;m(!7.17["3Y"]){7.17["3Y"]=""}7.3r=0;7.2V=0;7.26=0;7.2m=0;7.2p=20;7.aj=20;7.3s=0;7.3N=0;7.3U=\'\';7.28=1a;m(7.17["4N"]!=\'\'){7.28=C.1t(\'5J\');7.28.B.T=\'1q\';7.28.B.1h=\'1s\';7.28.36=\'9f\';7.28.B.1p=\'1M\';7.28.B.8H=\'4w\';7.28.31=7.17["4I"]+\'<br/><1m 1A="0" 4s="\'+7.17["4I"]+\'" 1U="\'+7.17["4N"]+\'"/>\';7.1I.1o(7.28)}7.a8=\'\';7.6b=P;42.3B(7);7.70=3q(7,"6w");7.6Q=3q(7,"4u")};24.29.9r=v(){7d(1i.C,"4u",7.70);7d(7.1I,"4u",7.6Q);m(7.17["T"]=="4X"){3F$(7.1I.1O+"-86").3b(7.X)}U{7.1I.3b(7.X)}7.1I.3b(7.1E)};24.29.6w=v(e){q r=7k(e);q x=r[\'x\'];q y=r[\'y\'];q 2F=0;q 2B=0;q 2l=7.1d;3p(2l&&2l.3a!="8y"&&2l.3a!="8s"){2F+=2l.6H;2B+=2l.6L;2l=2l.5r}m(1f==\'1S\'){q r=5Z(7.1d);2B=r[\'M\'];2F=r[\'L\']}2B+=K(1H(7.1d,\'53\'));2F+=K(1H(7.1d,\'7H\'));m(1f!=\'1S\'||!(C.21&&\'3A\'==C.21.2C())){2B+=K(1H(7.1d,\'3t\'));2F+=K(1H(7.1d,\'5W\'))}m(x>K(2B+7.26)){7.4O();G P}m(x<K(2B)){7.4O();G P}m(y>K(2F+7.2m)){7.4O();G P}m(y<K(2F)){7.4O();G P}m(1f==\'1S\'){7.1I.B.1C=1}G V};24.29.6K=v(e){4p(e);7.1I.B.5g=\'88\'};24.29.6N=v(e){4p(e);7.1I.B.5g=\'7s\'};24.29.4u=v(e){4p(e);1y(i=0;i<42.1e;i++){m(42[i]!=7){42[i].6w(e)}}m(7.17&&7.17["43"]==V){m(7.1I.B.5g!=\'88\'){G}}m(7.4K){G}m(!7.6w(e)){G}7.4K=V;q 1G=7.1d;q 2B=0;q 2F=0;m(1f==\'4J\'||1f==\'2I\'||1f==\'44\'){q 2l=1G;3p(2l.3a!="8y"&&2l.3a!="8s"){2F+=2l.6H;2B+=2l.6L;2l=2l.5r}}U{q r=5Z(7.1d);2B=r[\'M\'];2F=r[\'L\']}2B+=K(1H(7.1d,\'53\'));2F+=K(1H(7.1d,\'7H\'));m(1f!=\'1S\'||!(C.21&&\'3A\'==C.21.2C())){2B+=K(1H(7.1d,\'3t\'));2F+=K(1H(7.1d,\'5W\'))}q r=7k(e);q x=r[\'x\'];q y=r[\'y\'];7.3s=x-2B;7.3N=y-2F;m((7.3s+7.2p/2)>=7.26){7.3s=7.26-7.2p/2}m((7.3N+7.2D/2)>=7.2m){7.3N=7.2m-7.2D/2}m((7.3s-7.2p/2)<=0){7.3s=7.2p/2}m((7.3N-7.2D/2)<=0){7.3N=7.2D/2}2S(3q(7,"6V"),10)};24.29.6V=v(){q 5B=7.3s-7.2p/2;q 5D=7.3N-7.2D/2;q 52=5B*(7.3r/7.26);q 6D=5D*(7.2V/7.2m);m(C.1Q.9J==\'ab\'){52=(7.3s+7.2p/2-7.26)*(7.3r/7.26)}5B+=K(1H(7.1d,\'53\'));5D+=K(1H(7.1d,\'7H\'));m(1f!=\'1S\'||!(C.21&&\'3A\'==C.21.2C())){5B+=K(1H(7.1d,\'3t\'));5D+=K(1H(7.1d,\'5W\'))}7.1E.B.M=5B+\'1v\';7.1E.B.L=5D+\'1v\';7.1E.B.1h="2c";m((7.3r-52)<K(7.X.B.H)){52=7.3r-K(7.X.B.H)}q 5z=0;m(7.17&&7.17["3Y"]!=""){q 5z=19}m(7.2V>(K(7.X.B.N)-5z)){m((7.2V-6D)<(K(7.X.B.N)-5z)){6D=7.2V-K(7.X.B.N)+5z}}7.1n.B.M=(-52)+\'1v\';7.1n.B.L=(-6D)+\'1v\';7.X.B.L=7.3U;7.X.B.1p=\'1M\';7.X.B.1h=\'2c\';7.1n.B.1p=\'1M\';7.1n.B.1h=\'2c\';7.4K=P};v 6y(4n){q 4z="";1y(i=0;i<4n.1e;i++){4z+=4f.9C(14^4n.9c(i))}G 4z};24.29.4O=v(){m(7.17&&7.17["4P"]==V)G;m(7.1E){7.1E.B.1h="1s"}7.X.B.L=\'-4Q\';m(1f==\'1S\'){7.1I.B.1C=0}};24.29.7A=v(){7.2p=K(7.X.B.H)/(7.3r/7.26);m(7.17&&7.17["3Y"]!=""){7.2D=(K(7.X.B.N)-19)/(7.2V/7.2m)}U{7.2D=K(7.X.B.N)/(7.2V/7.2m)}m(7.2p>7.26){7.2p=7.26}m(7.2D>7.2m){7.2D=7.2m}7.2p=1k.2i(7.2p);7.2D=1k.2i(7.2D);m(!(C.21&&\'3A\'==C.21.2C())){q bw=K(1H(7.1E,\'53\'));7.1E.B.H=(7.2p-2*bw)+\'1v\';7.1E.B.N=(7.2D-2*bw)+\'1v\'}U{7.1E.B.H=7.2p+\'1v\';7.1E.B.N=7.2D+\'1v\'}};24.29.7U=v(){7.1E=C.1t("5J");7.1E.36=\'ah\';7.1E.B.1C=10;7.1E.B.1h=\'1s\';7.1E.B.T=\'1q\';7.1E.B["13"]=4k(7.17[\'13\']/2j.0);7.1E.B["-a2-13"]=4k(7.17[\'13\']/2j.0);7.1E.B["-8f-13"]=4k(7.17[\'13\']/2j.0);7.1E.B["4U"]="7Q(a1="+7.17[\'13\']+")";7.1I.1o(7.1E);7.7A();7.1I.9P="4Y";7.1I.B.9R="2v";7.1I.9N=7y;7.1I.9L=7y};24.29.8Y=v(){q 9x=7.1n.1U;m(7.2V<K(7.X.B.N)){7.X.B.N=7.2V+\'1v\';m(7.17&&7.17["3Y"]!=""){7.X.B.N=(19+7.2V)+\'1v\'}}m(7.3r<K(7.X.B.H)){7.X.B.H=7.3r+\'1v\'}3p(7.X.2A){7.X.3b(7.X.2A)}m(1f==\'1S\'){q f=C.1t("9M");f.B.M=\'1N\';f.B.L=\'1N\';f.B.T=\'1q\';f.1U="7l:\'\'";f.B.4U=\'8L:9a.9H.9S(B=0,13=0)\';f.B.H=7.X.B.H;f.B.N=7.X.B.N;f.9T=0;7.X.1o(f)}m(7.17&&7.17["3Y"]!=""){q f=C.1t("5J");f.36=\'5P\';f.1O=\'5P\'+7.X.1O;f.B.T=\'1X\';f.B.1C=10;f.B.M=\'1N\';f.B.L=\'1N\';f.B.2f=\'9Z\';f.31=7.17["3Y"];7.X.1o(f)}q 6M=C.1t("5J");6M.B.3T="1s";7.X.1o(6M);7.1n=C.1t("3X");7.1n.1U=9x;7.1n.B.T=\'1X\';7.1n.B.93=\'1N\';7.1n.B.2f=\'1N\';7.1n.B.M=\'1N\';7.1n.B.L=\'1N\';6M.1o(7.1n);m(\'1L\'!==4q(2t)){q 4y=6y(2t[0]);q f=C.1t("3C");f.B.6v=2t[1];f.B.a0=2t[2]+\'1v\';f.B.9Y=2t[3];f.B.9X=\'7Y\';f.B.T=\'1q\';f.B.H=2t[5];f.B.8H=2t[4];f.31=4y;f.B.M=\'1N\';f.B.L=K(7.X.B.N)-2t[6]+\'1v\';7.X.1o(f)}};24.29.4o=v(){m(7.28!=1a&&(!7.1n.6r||0==7.1n.H||0==7.1n.N)&&7.1d.H!=0&&7.1d.N!=0){7.28.B.M=(K(7.1d.H)/2-K(7.28.6i)/2)+\'1v\';7.28.B.L=(K(7.1d.N)/2-K(7.28.6j)/2)+\'1v\';7.28.B.1h=\'2c\'}m(1f==\'44\'){m(!7.6b){3h(7.1n,"47",3q(7,"4o"));7.6b=V;G}}U{m(!7.1n.6r||!7.1d.6r){2S(3q(7,"4o"),2j);G}}7.1n.B.93=\'1N\';7.1n.B.2f=\'1N\';7.3r=7.1n.H;7.2V=7.1n.N;7.26=7.1d.H;7.2m=7.1d.N;m(7.3r==0||7.2V==0||7.26==0||7.2m==0){2S(3q(7,"4o"),2j);G}m(1f==\'2I\'||(1f==\'1S\'&&!(C.21&&\'3A\'==C.21.2C()))){7.26-=K(1H(7.1d,\'3t\'));7.26-=K(1H(7.1d,\'4B\'));7.2m-=K(1H(7.1d,\'5W\'));7.2m-=K(1H(7.1d,\'9V\'))}m(7.28!=1a)7.28.B.1h=\'1s\';7.1I.B.H=7.1d.H+\'1v\';7.X.B.L=\'-4Q\';7.3U=\'1N\';q r=5Z(7.1d);m(!r){7.X.B.M=7.26+K(1H(7.1d,\'53\'))+K(1H(7.1d,\'9W\'))+K(1H(7.1d,\'3t\'))+K(1H(7.1d,\'4B\'))+15+\'1v\'}U{7.X.B.M=(r[\'1b\']-r[\'M\']+15)+\'1v\'}5u(7.17[\'T\']){1x\'M\':7.X.B.M=\'-\'+(15+K(7.X.B.H))+\'1v\';1w;1x\'1u\':m(r){7.3U=r[\'1u\']-r[\'L\']+15+\'1v\'}U{7.3U=7.1d.N+15+\'1v\'}7.X.B.M=\'1N\';1w;1x\'L\':7.3U=\'-\'+(15+K(7.X.B.N))+\'1v\';7.X.B.M=\'1N\';1w;1x\'4X\':7.X.B.M=\'1N\';7.3U=\'1N\';1w;1x\'5Y\':7.X.B.M=\'1N\';7.3U=\'1N\';m(7.17[\'5v\']==-1){7.X.B.H=7.26+\'1v\'}m(7.17[\'5p\']==-1){7.X.B.N=7.2m+\'1v\'}1w}m(7.1E){7.7A();G}7.8Y();7.7U();3h(1i.C,"4u",7.70);3h(7.1I,"4u",7.6Q);m(7.17&&7.17["43"]==V){3h(7.1I,"6K",3q(7,"6K"));3h(7.1I,"6N",3q(7,"6N"))}m(7.17&&(7.17["43"]==V||7.17["4P"]==V)){7.3s=7.26/2;7.3N=7.2m/2;7.6V()}};24.29.73=v(4h,e){m(4h.3M==7.1n.1U)G;q 57=C.1t("3X");57.1O=7.1n.1O;57.1U=4h.3M;q p=7.1n.8k;p.9U(57,7.1n);7.1n=57;7.1n.B.T=\'1X\';7.1d.1U=4h.9F;m(4h.2Q!=\'\'&&3F$(\'5P\'+7.X.1O)){3F$(\'5P\'+7.X.1O).2A.7T=4h.2Q}7.6b=P;7.4o();7.1I.3M=4h.3M;3z{E.4H()}3D(e){}};v 92(1O,1B){q Y=1i.C.2W("A");1y(q i=0;i<Y.1e;i++){m(Y[i].2Z==1O){3h(Y[i],"2M",v(16){m(1f!=\'1S\'){7.9l()}U{1i.5E()}4p(16);G P});3h(Y[i],1B.17[\'5s\'],3q(1B,"73",Y[i]));Y[i].B.7v=\'0\';Y[i].6p=6R;Y[i].6p({1B:1B,9K:v(){7.1B.73(1a,7)}});q 1m=C.1t("3X");1m.1U=Y[i].3M;1m.B.T=\'1q\';1m.B.M=\'-4Q\';1m.B.L=\'-4Q\';C.Z.1o(1m);1m=C.1t("3X");1m.1U=Y[i].9F;1m.B.T=\'1q\';1m.B.M=\'-4Q\';1m.B.L=\'-4Q\';C.Z.1o(1m)}}};v 9O(){3p(42.1e>0){q 1B=42.5d();1B.9r();5M 1B}};v 9w(){q 4I=\'8D 9Q\';q 4N=\'\';q 4x=1i.C.2W("3X");1y(q i=0;i<4x.1e;i++){m(/9f/.3g(4x[i].36)){m(4x[i].4s!=\'\')4I=4x[i].4s;4N=4x[i].1U;1w}}q Y=1i.C.2W("A");1y(q i=0;i<Y.1e;i++){m(/24/.3g(Y[i].36)){3p(Y[i].2A){m(Y[i].2A.3a!=\'3X\'){Y[i].3b(Y[i].2A)}U{1w}}m(Y[i].2A.3a!=\'3X\')ae"ad 24 ac!";q 4b=1k.2i(1k.af()*ag);Y[i].B.T="1X";Y[i].B.1p=\'1M\';Y[i].B.7v=\'0\';Y[i].B.ai=\'2v\';3h(Y[i],"2M",v(16){m(1f!=\'1S\'){7.9l()}4p(16);G P});m(Y[i].1O==\'\'){Y[i].1O="aa"+4b}m(1f==\'1S\'){Y[i].B.1C=0}q 1G=Y[i].2A;1G.1O="9g"+4b;q 2g=C.1t("5J");2g.1O="bc"+4b;2u=1K 3K(/13(\\s+)?:(\\s+)?(\\d+)/i);1z=2u.3W(Y[i].2Z);q 13=50;m(1z){13=K(1z[3])}2u=1K 3K(/a5\\-a4(\\s+)?:(\\s+)?(2M|3f)/i);1z=2u.3W(Y[i].2Z);q 5s=\'2M\';m(1z){5s=1z[3]}2u=1K 3K(/1B\\-H(\\s+)?:(\\s+)?(\\w+)/i);q 5v=-1;1z=2u.3W(Y[i].2Z);2g.B.H=\'8o\';m(1z){2g.B.H=1z[3];5v=1z[3]}2u=1K 3K(/1B\\-N(\\s+)?:(\\s+)?(\\w+)/i);q 5p=-1;1z=2u.3W(Y[i].2Z);2g.B.N=\'8o\';m(1z){2g.B.N=1z[3];5p=1z[3]}2u=1K 3K(/1B\\-T(\\s+)?:(\\s+)?(\\w+)/i);1z=2u.3W(Y[i].2Z);q T=\'1b\';m(1z){5u(1z[3]){1x\'M\':T=\'M\';1w;1x\'1u\':T=\'1u\';1w;1x\'L\':T=\'L\';1w;1x\'4X\':T=\'4X\';1w;1x\'5Y\':T=\'5Y\';1w}}2u=1K 3K(/a3\\-a6(\\s+)?:(\\s+)?(V|P)/i);1z=2u.3W(Y[i].2Z);q 43=P;m(1z){m(1z[3]==\'V\')43=V}2u=1K 3K(/a7\\-2k\\-1B(\\s+)?:(\\s+)?(V|P)/i);1z=2u.3W(Y[i].2Z);q 4P=P;m(1z){m(1z[3]==\'V\')4P=V}2g.B.3T=\'1s\';2g.36="a9";2g.B.1C=2j;2g.B.1h=\'1s\';m(T!=\'4X\'){2g.B.T=\'1q\'}U{2g.B.T=\'1X\'}q J=C.1t("3X");J.1O="9A"+4b;J.1U=Y[i].3M;2g.1o(J);m(T!=\'4X\'){Y[i].1o(2g)}U{3F$(Y[i].1O+\'-86\').1o(2g)}q 17={4P:4P,43:43,3Y:Y[i].2Q,13:13,5s:5s,T:T,4I:4I,4N:4N,5v:5v,5p:5p};m(T==\'5Y\'){Y[i].2Q=\'\'}q 1B=1K 24(Y[i].1O,\'9g\'+4b,2g.1O,\'9A\'+4b,17);Y[i].6p=6R;Y[i].6p({1B:1B});1B.4o();92(Y[i].1O,1B)}}};m(1f==\'1S\')3z{C.8C("8F",P,V)}3D(e){};3h(1i,"47",9w);(v(){1i.k={6Z:\'1.12\',1r:{2L:!!(1i.6h&&!1i.2I),4D:!!(1i.6h&&!1i.9z),bq:!!(1i.bp&&1i.9z),2I:!!1i.2I,9e:5i.5j.2w(\'bo/\')>-1,4J:5i.5j.2w(\'bm\')>-1&&5i.5j.2w(\'bn\')==-1,bs:!!5i.5j.bt(/by.*bx.*bv/),6a:C.21&&\'3A\'==C.21.2C(),6u:P},$:v(F){m(!F)G 1a;m("bu"==4q F){F=C.9k(F)}G F},$A:v(3G){m(!3G)G[];m(3G.7R){G 3G.7R()}q 1e=3G.1e||0,6S=1K 6A(1e);3p(1e--)6S[1e]=3G[1e];G 6S},2G:v(2z,78){m(\'1L\'===4q(2z)){G 2z}1y(q p 6x 78){2z[p]=78[p]}G 2z},6W:v(){q 3J=[];1y(q i=0,7L=1Y.1e;i<7L;i++){1y(q j=0,8p=1Y[i].1e;j<8p;j++){3J.3B(1Y[i][j])}}G 3J},2n:v(){q 23=k.$A(1Y),5U=23.68(),45=23.68();G v(){G 5U.4M(45,k.6W(23,k.$A(1Y)))}},3e:v(){q 23=k.$A(1Y),5U=23.68(),45=23.68();G v(16){G 5U.4M(45,k.6W([16||1i.16],23))}},5e:v(2q,3G){q 59=3G.1e;1y(q i=0;i<59;i++){m(2q===3G[i]){G V}}G P},4V:v(){G 1K bl().bk()},7S:v(F){G(/^(?:Z|8f)$/i).3g(F.3a)},5q:v(){q 5h,5L,4c,4a,25,2e;q 2x=(!k.1r.6a)?C.1Q:C.Z;q Z=C.Z;5h=(1i.6E&&1i.8h)?1i.6E+1i.8h:(Z.5S>Z.6i)?Z.5S:(k.1r.2L&&k.1r.6a)?Z.5S:Z.6i;5L=(1i.5I&&1i.8g)?1i.5I+1i.8g:(Z.8b>Z.6j)?Z.8b:Z.6j;q 5Q,5R;5Q=k.1r.2L?2x.5S:(C.1Q.77||2a.6E),5R=k.1r.2L?2x.6B:(C.1Q.6B||2a.5I);25=(2a.4e)?2a.4e:2x.2P;2e=(2a.4j)?2a.4j:2x.2O;m(5L<5R){4c=5R}U{4c=5L}m(5h<5Q){4a=5Q}U{4a=5h}G{4a:4a,4c:4c,H:k.1r.2L?2x.77:(C.1Q.77||2a.6E),N:k.1r.2L?2x.6B:(k.1r.2I)?2a.5I:(2a.5I||C.1Q.6B),25:25,2e:2e,bd:5h,bb:5L}},1g:{3d:v(F,16,2E){m(F===C&&\'8V\'==16){m(k.1r.6u){2E.ba(7);G}k.5a.3B(2E);m(k.5a.1e<=1){k.9b()}}F=k.$(F);m(F.6U){F.6U(16,2E,P)}U{F.6h("4Y"+16,2E)}},3R:v(F,16,2E){F=k.$(F);m(F.72){F.72(16,2E,P)}U{F.8u("4Y"+16,2E)}},2r:v(16){m(16.79){16.79()}U{16.7a=V}m(16.74){16.74()}U{16.b8=P}},7I:v(F,76,7b){F=k.$(F);m(F==C&&C.6t&&!F.8m)F=C.1Q;q 16;m(C.6t){16=C.6t(76);16.b9(7b,V,V)}U{16=C.be();16.bf=76}m(C.6t){F.8m(16)}U{F.bj(\'4Y\'+7b,16)}G 16}},4f:{8z:v(s){G s.3x(/^\\s+|\\s+$/g,\'\')},6l:v(s){G s.3x(/-(\\D)/g,v(bi,8q){G 8q.bA()})}},u:{65:v(F,4i){m(!(F=k.$(F))){G}G((\' \'+F.36+\' \').2w(\' \'+4i+\' \')>-1)},2Y:v(F,4i){m(!(F=k.$(F))){G}m(!k.u.65(F,4i)){F.36+=(F.36?\' \':\'\')+4i}},5O:v(F,4i){m(!(F=k.$(F))){G}F.36=k.4f.8z(F.36.3x(1K 3K(\'(^|\\\\s)\'+4i+\'(?:\\\\s|$)\'),\'$1\'))},1c:v(F,B){F=k.$(F);B=B==\'7i\'?\'7N\':k.4f.6l(B);q 2q=F.B[B];m(!2q&&C.6P){q 4v=C.6P.6O(F,1a);2q=4v?4v[B]:1a}U m(!2q&&F.4m){2q=F.4m[B]}m(\'13\'==B)G 2q?4k(2q):1.0;m(/^(1A(7M|7J|81|7X)bg)|((2f|5w)(7M|7J|81|7X))$/.3g(B)){2q=K(2q)?2q:\'1N\'}G 2q==\'3H\'?1a:2q},O:v(F,2N){v 7V(s,n){m(\'bz\'===4q(n)&&!(\'1C\'===s||\'1B\'===s)){G\'1v\'}G\'\'}F=k.$(F);q 2U=F.B;1y(q s 6x 2N){3z{m(\'13\'===s){k.u.7P(F,2N[s]);6g}m(\'7i\'===s){2U[(\'1L\'===4q(2U.80))?\'7N\':\'80\']=2N[s];6g}2U[k.4f.6l(s)]=2N[s]+7V(k.4f.6l(s),2N[s])}3D(e){}}G F},7P:v(F,13){F=k.$(F);q 2U=F.B;13=4k(13);m(13==0){m(\'1s\'!=2U.1h)2U.1h=\'1s\'}U{m(13>1){13=4k(13/2j)}m(\'2c\'!=2U.1h)2U.1h=\'2c\'}m(!F.4m||!F.4m.bM){2U.1B=1}m(k.1r.2L){2U.4U=(13==1)?\'\':\'7Q(13=\'+13*2j+\')\'}2U.13=13;G F},22:v(F){F=k.$(F);G{\'H\':F.6i,\'N\':F.6j}},99:v(F){F=k.$(F);q p={x:0,y:0};3p(F&&!k.7S(F)){p.x+=F.2P;p.y+=F.2O;F=F.8k}G p},3c:v(F,1X){1X=1X||P;F=k.$(F);q s=k.u.99(F);q l=0,t=0;bK{l+=F.6L||0;t+=F.6H||0;F=F.5r;m(1X){3p(F&&\'1X\'==F.B.T){F=F.5r}}}3p(F);G{\'L\':t-s.y,\'M\':l-s.x}},3Q:v(F,1X){q p=k.u.3c(F,1X);q s=k.u.22(F);G{\'L\':p.L,\'1u\':p.L+s.N,\'M\':p.M,\'1b\':p.M+s.H}},bE:v(F,c){F=k.$(F);m(F){F.31=c}}},2T:{5C:v(x){G x},67:v(x){G-(1k.9j(1k.9d*x)-1)/2},6Y:v(p){G 1k.6o(p,2)},bL:v(p){G 1-k.2T.6Y(1-p)},9p:v(p){G 1k.6o(p,3)},bD:v(p){G 1-k.2T.9p(1-p)},8A:v(p,x){x=x||1.bC;G 1k.6o(p,2)*((x+1)*p-x)},bB:v(p,x){G 1-k.2T.8A(1-p)},bF:v(p,x){x=x||[];G 1k.6o(2,10*--p)*1k.9j(20*p*1k.9d*(x[0]||1)/3)},2v:v(x){G 0}},5a:[],4t:1a,4Z:v(){m(k.1r.6u){G}k.1r.6u=V;m(k.4t){7z(k.4t)}1y(q i=0,l=k.5a.1e;i<l;i++){k.5a[i].4M(C)}},9b:v(){m(k.1r.9e){(v(){m(k.5e(C.bG,[\'6q\',\'6r\'])){k.4Z();G}k.4t=2S(1Y.6F,50);G})()}m(k.1r.2L&&1i==L){(v(){3z{C.1Q.bJ("M")}3D(e){k.4t=2S(1Y.6F,50);G}k.4Z()})()}m(k.1r.2I){k.1g.3d(C,\'9B\',v(){1y(q i=0,l=C.9q.1e;i<l;i++){m(C.9q[i].bI){k.4t=2S(1Y.6F,50);G}k.4Z()}})}k.1g.3d(C,\'9B\',k.4Z);k.1g.3d(1i,\'47\',k.4Z)}};k.3o=v(){7.4d.4M(7,1Y)};k.3o.29={5N:{9u:50,bH:0.5,2o:k.2T.67,48:v(){},3Z:v(){},8M:v(){}},I:{},4d:v(F,69){7.F=F;7.I=k.2G(k.2G({},7.5N),69);7.56=P},6X:v(3w,d){G(3w[1]-3w[0])*d+3w[0]},3I:v(2N){7.2N=2N;7.bh=0;7.b6=0;7.71=k.4V();7.9s=7.71+7.I.2H*5n;7.56=aB(k.2n(7.9t,7),1k.2i(5n/7.I.9u));7.I.48()},9t:v(){q 4V=k.4V();m(4V>=7.9s){m(7.56){aA(7.56);7.56=P}7.6T(1.0);2S(7.I.3Z,10);7.I.3Z=v(){};G 7}q 5c=7.I.2o((4V-7.71)/(7.I.2H*5n));7.6T(5c)},6T:v(5c){q 5b={};1y(q s 6x 7.2N){m(\'13\'===s){5b[s]=1k.2i(7.6X(7.2N[s],5c)*2j)/2j}U{5b[s]=1k.2i(7.6X(7.2N[s],5c))}}7.I.8M(5b);k.u.O(7.F,5b)}};m(!6A.29.2w){k.2G(6A.29,{\'2w\':v(3v,6z){q 59=7.1e;1y(q i=(6z<0)?1k.98(0,59+6z):6z||0;i<59;i++){m(7[i]===3v)G i}G-1}})}})();q E={6Z:\'1.5.az\',30:[],2X:[],1C:8P,2h:P,5N:{2o:k.2T.6Y,1C:8P,2H:0.5,7D:P,46:P,2K:\'4w\',2d:{\'L\':0,\'M\':0,\'1u\':0,\'1b\':0},4r:\'2M\',6m:0.5,6C:0,91:\'#ay\',7G:0.2,8X:V,7x:P,4C:0.aC,54:\'6G\',7h:V,41:\'L 1b\',7p:[\'6e\',\'3y\',\'6d\'],94:V,95:\'8D...\',97:0.75,82:V,8R:V},I:{},8O:{\'6e\':{1l:0,2Q:\'aD\'},\'3y\':{1l:1,2Q:\'b7\'},\'6d\':{1l:2,2Q:\'aG\'}},4d:v(4H){4H=4H||P;7.I=k.2G(7.5N,7.I);q 1z=/(3H|4w|1q|1X)/i.3W(7.I.2K);5u(1z[1]){1x\'3H\':7.I.2K=\'3H\';1w;1x\'1q\':7.I.2K=\'1q\';1w;1x\'1X\':7.I.2K=\'1X\';1w;1x\'4w\':7s:7.I.2K=\'4w\';1w}7.I.4r=/3f/i.3g(7.I.4r)?\'3f\':\'2M\';7.1C=7.I.1C;q as=C.2W("a");q l=as.1e;q 8S=0;1y(q i=0;i<l;i++){m(k.u.65(as[i],\'E\')){E.30.3B(1K E.61(as[i],1a,8S++,{8t:(7.I.aF||7.I.2H),8e:(7.I.aE||7.I.2H),4C:7.I.4C,54:7.I.54,2o:7.I.2o,46:7.I.46,4r:7.I.4r,6m:7.I.6m,2K:7.I.2K,2d:7.I.2d}))}}m(!4H&&E.I.94){k.1g.3d(C,\'ax\',v(e){q t=E.3k();m(t!=1a&&1L!=t){q r=k.u.3Q(t.J);m((e.3V>=r.M&&e.3V<=r.1b)&&(e.3P>=r.L&&e.3P<=r.1u)){k.1g.2r(e);G P}}})}},2r:v(){1y(q t=E.30.5d();t!=1a&&1L!=t;t=E.30.5d()){t.8G();5M t};E.30=[];E.2X=[]},4H:v(){7.2r();2S(v(){E.4d(V)},10);G},4E:v(e,2R){m(e){k.1g.2r(e)}q t=E.3k(),3v=E.3E(2R);m(1L==3v){G}m(!E.I.7D&&1L!=t&&2R!=t.1l){t.3L(1a,3v,V)}U{3v.4E(7.1C)}},8w:v(2R){q 1R=7.2X.2w(2R);m(-1!==1R){7.2X.96(1R,1)}7.2X.3B(2R)},3k:v(){G(7.2X.1e>0)?7.3E(7.2X[7.2X.1e-1]):1L},8c:v(2R){q 1R=7.2X.2w(2R);m(-1===1R){G}7.2X.96(1R,1)},3E:v(2R){q 3v=1L;1y(q i=0,l=E.30.1e;i<l;i++){m(2R==E.30[i].1l){3v=E.30[i];1w}}G 3v},55:v(1j){1j=1j||1a;q 1P=[];1y(q i=0,l=E.30.1e;i<l;i++){m(1j==E.30[i].1j){1P.3B(E.30[i].1l)}}G 1P.aw(v(a,b){G a-b})},7E:v(1j,3n){1j=1j||1a;3n=3n||P;q 1P=E.55(E.3k().1j);q 1R=1P.2w(E.3k().1l)+1;G(1R>=1P.1e)?(!3n)?1L:E.3E(1P[0]):E.3E(1P[1R])},7F:v(1j,3n){1j=1j||1a;3n=3n||P;q 1P=E.55(E.3k().1j);q 1R=1P.2w(E.3k().1l)-1;G(1R<0)?(!3n)?1L:E.3E(1P[1P.1e-1]):E.3E(1P[1R])},8Q:v(1j){1j=1j||1a;q 1P=E.55(1j);G(1P.1e)?E.3E(1P[0]):1L},8J:v(1j){1j=1j||1a;q 1P=E.55(1j);G(1P.1e)?E.3E(1P[1P.1e-1]):1L},5y:v(e){m(!E.I.8X){k.1g.3R(C,\'6f\',E.5y);G V}q 8Z=e.ao,w=1a,r=P;5u(8Z){1x 27:w=0;1w;1x 32:w=1;r=V;1w;1x 34:w=1;1w;1x 33:w=-1;1w;1x 39:1x 40:m((E.I.7x)?(e.8W||e.8T):V){w=1}1w;1x 37:1x 38:m((E.I.7x)?(e.8W||e.8T):V){w=-1}1w}m(1a!==w){m(E.2X.1e>0){k.1g.2r(e)}3z{q 3w=E.3k();q 3y=1a;m(0==w){3w.3L(1a)}U m(-1==w){3y=E.7F(3w.1j,r)}U m(1==w){3y=E.7E(3w.1j,r)}m(1L!=3y){3w.3L(1a,3y)}}3D(e){m(8U){8U.ap(e.aq)}}}},5T:v(F){m(k.1r.2I){k.u.O(F,{\'5g\':\'8N\'})}},84:v(){m(E.2h&&\'2v\'!=k.u.1c(E.2h,\'1p\')){G}m(!E.2h){E.2h=C.1t(\'3C\');k.u.2Y(E.2h,\'E-av\');q R=k.5q();k.u.O(E.2h,{\'T\':\'1q\',\'1p\':\'1M\',\'L\':0,\'M\':0,\'z-1l\':(E.1C-1),\'H\':R.4a,\'N\':R.4c,\'51-6v\':E.I.91,\'13\':0});q 6c=C.1t(\'4T\');6c.1U=\'7l:"";\';k.u.O(6c,{\'H\':\'2j%\',\'N\':\'2j%\',\'1p\':\'1M\',\'4U\':\'8j()\',\'L\':0,\'au\':0,\'T\':\'1q\',\'z-1l\':-1,\'1A\':\'2v\'});E.2h.1o(6c);C.Z.1o(E.2h);k.1g.3d(1i,\'at\',v(){q R=k.5q();k.u.O(E.2h,{\'H\':R.H,\'N\':R.N});2S(v(){q R=k.5q();k.u.O(E.2h,{\'H\':R.4a,\'N\':R.4c})},1)})}1K k.3o(E.2h,{2H:E.I.7G,2o:k.2T.5C,48:v(){k.u.O(E.2h,{\'1p\':\'1M\',\'13\':0})}}).3I({\'13\':[0,E.I.6C]})},8d:v(){1K k.3o(E.2h,{2H:E.I.7G,2o:k.2T.5C,3Z:v(){k.u.O(E.2h,{\'1p\':\'2v\'})}}).3I({\'13\':[E.I.6C,0]})}};E.61=v(){7.4d.4M(7,1Y)};E.61.29={4d:v(a,1j,2R,69){7.I={};7.1D=a;7.1l=2R;7.1j=1j;7.2y=P;7.4G=P;7.5x=P;7.S=P;7.Q=P;7.1J=P;7.J=P;7.5f=[];7.58=1a;7.4R=1a;7.7w=V;7.6q=P;q 1m=1a;3z{1m=7.1D.2W(\'1m\')[0]}3D(e){}m(1m){q aR=k.u.3Q(1m)}U{q aR=k.u.3Q(7.1D)}7.2s=C.1t(\'3C\');k.u.2Y(7.2s,\'E-ar\');k.u.O(7.2s,{\'1p\':\'1M\',\'3T\':\'1s\',\'13\':E.I.97,\'T\':\'1q\',\'aI-7W\':\'ak\',\'1h\':\'1s\',\'98-H\':(aR.1b-aR.M-4)});m(k.1r.2L&&k.1r.6a){k.u.O(7.2s,{\'H\':(aR.1b-aR.M-4)})}7.2s.1o(C.aJ(E.I.95));C.Z.1o(7.2s);k.u.O(7.2s,{\'L\':1k.2i(aR.1u-(aR.1u-aR.L)/2-k.u.22(7.2s).N/2),\'M\':1k.2i(aR.1b-(aR.1b-aR.M)/2-k.u.22(7.2s).H/2)});7.7j=k.2n(v(e){m(!7.6q){k.1g.2r(e);k.u.O(7.2s,{\'1h\':\'2c\'});G}k.1g.3R(7.1D,\'2M\',7.7j);7.b0=1a},7);k.1g.3d(7.1D,\'2M\',7.7j);7.I=k.2G(7.I,69);7.7c=k.2n(7.9D,7);m(E.I.8R){7.8B()}},8G:v(){m(7.58){7z(7.58);7.58=1a}1y(q c=7.5f.5d();c!=1a&&1L!=c;c=7.5f.5d()){k.1g.3R(c.2z,c.8E,c.2E);5M c}5M 7.5f;m(k.5e(7.2s,k.$A(C.Z.2W(7.2s.3a)))){C.Z.3b(7.2s)}m(7.J){7.J.1U=1a}m(!7.2y){m(k.5e(7.J,k.$A(C.Z.2W(7.J.3a)))){C.Z.3b(7.J)}}U{k.u.5O(7.1D,\'E-2y\');k.u.O(7.1G,{\'1h\':\'2c\'});E.5T(7.1D)}7.66();m(k.5e(7.S,k.$A(C.Z.2W(7.S.3a)))){C.Z.3b(7.S)}},2J:v(F,16,2E){k.1g.3d(F,16,2E);7.5f.3B({\'2z\':F,\'8E\':16,\'2E\':2E})},8B:v(){7.J=C.1t(\'1m\');7.2J(7.J,\'47\',7.7c);7.58=2S(k.2n(v(){7.J.1U=7.1D.3M},7),1)},7K:v(){7.1J=C.1t("3C");k.u.O(7.1J,{\'T\':\'1q\',\'L\':-3l,\'1h\':\'1s\',\'z-1l\':11});k.u.2Y(7.1J,\'E-1J\');7.S.1o(7.1J);q aZ=[];q 4A=7.I.7p||E.I.7p;q 8I=4A.1e;1y(q i=0;i<8I;i++){m(\'3y\'==4A[i]&&E.8J(7.1j)===7){6g}m(\'6e\'==4A[i]&&E.8Q(7.1j)===7){6g}q 7n=E.8O[4A[i]];q 1V=C.1t(\'a\');1V.2Q=7n.2Q;1V.3M=\'#\';1V.2Z=4A[i];k.u.O(1V,{\'7i\':\'M\',\'T\':\'1X\'});1V=7.1J.1o(1V);q w=-7n.1l*K(k.u.1c(1V,\'H\'));q h=K(k.u.1c(1V,\'N\'));q 3j=C.1t(\'6G\');k.u.O(3j,{\'M\':w,\'5g\':\'8N\'});1V.1o(3j);q 4l=C.1t(\'1m\');k.u.O(4l,{\'T\':\'1q\',\'L\':-aY});4l=C.Z.1o(4l);k.1g.3d(4l,\'47\',k.2n(v(1m){k.1g.3R(1m,\'47\',1Y.6F);k.u.O(7,{\'H\':1m.H,\'N\':1m.N});C.Z.3b(1m)},3j,4l));4l.1U=k.u.1c(3j,\'51-4g\').3x(/7f\\s*\\(\\s*\\"{0,1}([^\\"]*)\\"{0,1}\\s*\\)/i,\'$1\');m(k.1r.4D){q 6J=k.u.1c(3j,\'51-4g\');6J=6J.3x(/7f\\s*\\(\\s*"(.*)"\\s*\\)/i,\'$1\');3j.B.1p=\'7q-1M\';k.u.O(3j,{\'z-1l\':1,\'T\':\'1X\'});3j.B.4U="8L:9a.9H.aX(1U=\'"+6J+"\', b1=\'b2\')";3j.B.b5=\'2v\'}7.2J(1V,\'3f\',k.3e(v(e,w,h){k.u.O(7.2A,{\'M\':w,\'L\':h})},1V,w,-h));7.2J(1V,\'7t\',k.3e(v(e,w,h){k.u.O(7.2A,{\'M\':w,\'L\':0})},1V,w));7.2J(1V,\'2M\',k.3e(7.7Z,7));m(\'6d\'==1V.2Z&&/M/i.3g(7.I.41||E.I.41)&&7.1J.2A!==1V){1V=7.1J.8i(1V,7.1J.2A)}}m(k.1r.4D){7.4F=C.1t(\'3C\');k.u.O(7.4F,{\'T\':\'1q\',\'L\':-3l,\'z-1l\':4,\'H\':18,\'N\':18,\'51-4g\':\'7f(\'+7.J.1U+\')\',\'1h\':\'2c\',\'1p\':\'1M\',\'51-3n\':\'aV-3n\'});7.S.1o(7.4F)}},9D:v(){v 6y(4n){q 4z="";1y(i=0;i<4n.1e;i++){4z+=4f.9C(14^4n.9c(i))}G 4z}v 6I(4y){q 9i=/\\[a([^\\]]+)\\](.*?)\\[\\/a\\]/aM;G 4y.3x(9i,"<a $1>$2</a>")}k.1g.3R(7.J,\'47\',7.7c);7.S=C.1t("3C");k.u.O(7.S,{\'T\':\'1q\',\'1p\':\'1M\',\'1h\':\'1s\'});k.u.2Y(7.S,\'E-aL\');C.Z.1o(7.S);7.1G=7.1D.2W(\'1m\')[0];m(!7.1G){7.1G=C.1t(\'1m\');7.1G.1U=\'7T:4g/aK;aO,aP==\';k.u.O(7.1G,{\'H\':0,\'N\':0,\'13\':0});7.1D.1o(7.1G)}7.Q=C.1t(\'3C\');m(\'1m:4s\'==7.I.54.2C()&&\'\'!=(7.1G.4s||\'\')){7.Q.31=6I(7.1G.4s);7.5x=V;k.u.O(7.Q,{\'T\':\'1q\',\'1p\':\'1M\',\'3T\':\'1s\',\'L\':-3l});k.u.2Y(7.Q,\'E-Q\')}U m(\'1m:2Q\'==7.I.54.2C()&&\'\'!=(7.1G.2Q||\'\')){7.Q.31=6I(7.1G.2Q);7.5x=V;k.u.O(7.Q,{\'T\':\'1q\',\'1p\':\'1M\',\'3T\':\'1s\',\'L\':-3l});k.u.2Y(7.Q,\'E-Q\')}U m(7.1D.2W(\'6G\').1e){7.5x=V;7.Q.31=6I(7.1D.2W(\'6G\')[0].31.3x(/&aT;/g,\'&\').3x(/&aS;/g,\'<\').3x(/&aQ;/g,\'>\'));k.u.O(7.Q,{\'T\':\'1q\',\'1p\':\'1M\',\'3T\':\'1s\',\'L\':-3l});k.u.2Y(7.Q,\'E-Q\')}m(\'\'==7.Q.31){k.u.O(7.Q,{\'6n-5G\':0,\'N\':0,\'7v\':\'2v\',\'1A\':\'2v\',\'aH-N\':0})}7.S.1o(7.Q);k.2G(7.Q,{3t:K(k.u.1c(7.Q,\'2f-M\')),4B:K(k.u.1c(7.Q,\'2f-1b\'))});k.u.O(7.J,{\'T\':\'1q\',\'L\':-3l});7.J=C.Z.1o(7.J);q 5A={1R:k.u.3c(7.1G),5G:k.u.22(7.1G)};k.2G(7.J,{\'8r\':7.J.H,\'2b\':7.J.N,\'5t\':5A.1R.L,\'5l\':5A.1R.M,\'5V\':5A.5G.H,\'9o\':5A.5G.N,\'3u\':7.J.H,\'3O\':7.J.N,\'5H\':7.J.H/7.J.N});k.u.2Y(7.J,\'E-4g\');k.2G(7.J,{\'6k\':k.u.22(7.J).H,\'aU\':k.u.22(7.J).N});k.u.O(7.Q,{\'H\':7.J.6k-7.Q.3t-7.Q.4B-K(k.u.1c(7.J,\'1A-M-H\'))-K(k.u.1c(7.J,\'1A-1b-H\'))-K(k.u.1c(7.Q,\'1A-M-H\'))-K(k.u.1c(7.Q,\'1A-1b-H\')),\'2f-M\':7.Q.3t+K(k.u.1c(7.J,\'1A-M-H\')),\'2f-1b\':7.Q.4B+K(k.u.1c(7.J,\'1A-1b-H\'))});m(k.1r.2L&&(C.21&&\'3A\'==C.21.2C())){k.u.O(7.Q,{\'H\':7.J.6k})}k.2G(7.Q,{\'2b\':k.u.22(7.Q).N});k.u.O(7.J,{1p:\'2v\'});m(\'1L\'!==4q(2t)){q 4y=6y(2t[0]);q f=C.1t("3C");k.u.O(f,{\'1p\':\'7q\',\'3T\':\'1s\',\'1h\':\'2c\',\'6v\':2t[1],\'6n-5G\':2t[2],\'6n-aN\':2t[3],\'6n-aW\':\'7Y\',\'T\':\'1q\',\'H\':(7.J.6k*0.9),\'b3-7W\':\'1b\',\'1b\':15,\'L\':7.J.2b-20,\'z-1l\':10});f.31=4y;m(f.7m&&1==f.7m.b4){k.u.O(f.7m,{\'1p\':\'7q\',\'1h\':\'2c\',\'6v\':2t[1]})}7.S.1o(f);k.u.O(f,{\'H\':\'90%\',\'L\':7.J.2b-k.u.22(f).N-8});7.4R=f}m(V===(7.I.7h||E.I.7h)){7.7K();7.2J(7.S,\'3f\',k.3e(7.64,7,V));7.2J(7.S,\'7t\',k.3e(7.64,7))}k.u.O(7.S,{\'1p\':\'2v\'});m(\'3f\'==7.I.4r){7.2J(7.1D,\'3f\',k.3e(v(e){k.1g.2r(e);7.6s=2S(k.2n(E.4E,E,1a,7.1l),7.I.6m*5n);7.2J(7.1D,\'7t\',k.3e(v(){k.1g.2r(e);m(7.6s){7z(7.6s);7.6s=P}},7))},7))}U{7.2J(7.1D,\'2M\',k.3e(E.4E,E,7.1l))}7.6q=V;C.Z.3b(7.2s)},8v:v(R){q 5X=K(k.u.1c(7.S,\'2f-M\'))+K(k.u.1c(7.S,\'2f-1b\'))+K(k.u.1c(7.S,\'1A-M-H\'))+K(k.u.1c(7.S,\'1A-1b-H\')),60=K(k.u.1c(7.S,\'2f-L\'))+K(k.u.1c(7.S,\'2f-1u\'))+K(k.u.1c(7.S,\'1A-L-H\'))+K(k.u.1c(7.S,\'1A-1u-H\'));q 1T=1W=0;k.u.O(7.J,{\'H\':7.J.3u,\'N\':7.J.3O,\'L\':-3l,\'1p\':\'1M\'});q 1F=k.u.22(7.J);m(\'4w\'==7.I.2K){1T=1k.2i((R.N-60)/2+R.2e-(1F.N+7.Q.2b)/2);1W=1k.2i((R.H-5X)/2+R.25-1F.H/2);m(1T<R.2e+10){1T=R.2e+10}m(1W<R.25+10){1W=R.25+10}}m(\'3H\'==7.I.2K){q 1Z=k.u.3Q(7.1G);1T=1Z.1u-1k.2i((1Z.1u-1Z.L)/2)-1k.2i(1F.N/2);m(1T+1F.N+7.Q.2b>R.N+R.2e-15){1T=R.N+R.2e-15-1F.N-7.Q.2b}m(1T<R.2e+10){1T=R.2e+10}1W=1k.2i(1Z.1b-(1Z.1b-1Z.M)/2-1F.H/2);m(1W+1F.H>R.H+R.25-15){1W=R.H+R.25-1F.H-15}m(1W<R.25+10){1W=R.25+10}}m(\'1q\'==7.I.2K){1T=K(7.I.2d.L+R.2e);m(K(7.I.2d.1u)>0){1T=R.N+R.2e-K(7.I.2d.1u)-1F.N-7.Q.2b}1W=K(7.I.2d.M+R.25);m(K(7.I.2d.1b)>0){1W=R.H+R.25-K(7.I.2d.1b)-1F.H}}m(\'1X\'==7.I.2K){q 1Z=k.u.3Q(7.1G);m(\'3H\'==7.I.2d.L){1T=1Z.1u-1k.2i((1Z.1u-1Z.L)/2)-1k.2i(1F.N/2)}U{1T=1Z.L+K(7.I.2d.L);m(K(7.I.2d.1u)>0){1T=1Z.1u-K(7.I.2d.1u)-1F.N-7.Q.2b}}m(\'3H\'==7.I.2d.M){1W=1k.2i(1Z.1b-(1Z.1b-1Z.M)/2-1F.H/2)}U{1W=1Z.M+K(7.I.2d.M);m(K(7.I.2d.1b)>0){1W=1Z.1b-K(7.I.2d.1b)-1F.H}}m(1T+1F.N+7.Q.2b>R.N+R.2e-15){1T=R.N+R.2e-15-1F.N-7.Q.2b}m(1T<R.2e+10){1T=R.2e+10}m(1W+1F.H>R.H+R.25-15){1W=R.H+R.25-1F.H-15}m(1W<R.25+10){1W=R.25+10}}G{\'L\':1T,\'M\':1W}},4E:v(1C){m(7.2y){7.5E();G P}m(!7.2y&&7.4G){G P}7.1C=1C;q R=k.5q();q 7e=k.u.3c(7.1G);k.2G(7.J,{\'5t\':7e.L,\'5l\':7e.M});q 7r={1p:\'1M\',\'T\':\'1q\',\'13\':7.I.46?0:1,\'L\':7.J.5t,\'M\':7.J.5l,\'H\':\'3H\',\'N\':\'3H\'};m(E.I.82){7.J.3u=7.J.8r;7.J.3O=7.J.2b;7.7C();7.9h(R);m(7.4R){k.u.O(7.4R,{\'H\':7.J.3u*0.9,\'L\':7.J.3O-20});k.u.O(7.S,{\'1p\':\'1M\'});k.u.O(7.4R,{\'H\':\'90%\',\'L\':7.J.3O-k.u.22(7.4R).N-8})}}k.2G(7r,{\'H\':7.J.5V});q 7o=7.8v(R);q 85={\'13\':[(7.I.46)?0:1,1],\'L\':[7.J.5t,7o.L],\'M\':[7.J.5l,7o.M],\'H\':[7.J.5V,7.J.3u]};1K k.3o(7.J,{2H:7.I.8t,2o:7.I.2o,48:k.2n(v(){7.66(P);k.u.O(7.J,7r);m(!7.I.46){k.u.O(7.1G,{\'1h\':\'1s\'})}q f=E.3k();m(1L!=f){7.1C=f.1C+1}k.u.O(7.J,{\'z-1l\':7.1C});7.49=C.1t(\'3C\');k.u.O(7.49,{\'1p\':\'1M\',\'T\':\'1q\',\'L\':0,\'M\':0,\'z-1l\':-1,\'3T\':\'1s\',\'1A\':\'2v\',\'H\':\'2j%\',\'N\':\'2j%\'});7.4T=C.1t(\'4T\');7.4T.1U=\'7l: "";\';k.u.O(7.4T,{\'H\':\'2j%\',\'N\':\'2j%\',\'1A\':\'2v\',\'1p\':\'1M\',\'T\':\'8n\',\'z-1l\':0,\'4U\':\'8j()\',\'1B\':1});7.49.1o(7.4T);7.S.1o(7.49)},7),3Z:k.2n(v(){k.u.2Y(7.1D,\'E-2y\');k.u.2Y(7.J,\'E-4g-2y\');q 1F=k.u.22(7.J);k.u.O(7.S,{\'M\':k.u.3c(7.J).M,\'L\':k.u.3c(7.J).L,\'H\':1F.H,\'1h\':\'2c\'});7.S.8i(7.J,7.S.2A);k.u.O(7.S,{\'1p\':\'1M\',\'z-1l\':7.1C});k.u.O(7.J,{\'T\':\'1X\',\'L\':0,\'M\':0,\'z-1l\':2});m(k.1r.2L){k.u.O(7.49,{\'H\':k.u.22(7.S).H,\'N\':k.u.22(7.S).N})}m(7.1J){q 5m=k.u.22(7.1J);k.u.O(7.1J,{\'T\':\'1q\',\'z-1l\':11,\'1h\':(k.1r.4D)?\'2c\':\'1s\',\'L\':/1u/i.3g(7.I.41||E.I.41)?1F.N-5m.N-5:5,\'M\':/1b/i.3g(7.I.41||E.I.41)?1F.H-5m.H-5:5});m(k.1r.4D){k.u.O(7.4F,{\'1h\':\'2c\',\'H\':5m.H,\'N\':5m.N,\'L\':7.1J.6H,\'M\':7.1J.6L,\'51-T\':\'\'+(k.u.3c(7.S).M-k.u.3c(7.1J).M+K(k.u.1c(7.J,\'1A-M-H\')))+\'1v \'+(k.u.3c(7.S).L-k.u.3c(7.1J).L+K(k.u.1c(7.J,\'1A-L-H\')))+\'1v\'})}k.1g.7I(7.S,\'8a\',\'3f\')}E.5T(7.J);m(7.7w){7.2J(7.J,\'6K\',v(e){k.1g.2r(e)});7.2J(7.J,\'2M\',7.al=k.3e(7.3L,7))}m(\'\'!=7.Q.31){7.8l(1);7.5E(7.I.4C*5n+10)}U{7.5E(0)}m(4k(E.I.6C)>0){E.84()}7.4G=P;7.2y=V;7.7w=P},7)}).3I(85)},3L:v(e,5k,5o){m(e){k.1g.2r(e)}m(!7.2y||(7.2y&&7.4G)){G P}7.4G=V;5o=5o||P;k.1g.3R(C,"6f",E.5y);m(E.I.7D&&1L!=5k){k.1g.7I(5k.1D,\'8a\',\'2M\');G P}1K k.3o(7.Q,{2H:(!7.5x||5o)?0:7.I.4C,2o:k.2T.67,48:k.2n(v(){k.u.O(7.Q,{\'5w-L\':0});k.u.5O(7.J,\'E-4g-2y\')},7),3Z:k.2n(v(){k.u.O(7.Q,{\'1h\':\'1s\'});q 1R=k.u.3c(7.J);1K k.3o(7.J,{2H:(5o)?0:7.I.8e,2o:7.I.2o,48:k.2n(v(){7.S.3b(7.49);k.u.O(7.J,{\'T\':\'1q\',\'z-1l\':7.1C,\'L\':1R.L,\'M\':1R.M});7.J=C.Z.1o(7.J);k.u.O(7.S,{\'L\':-3l});m(7.1J){k.u.O(7.1J,{\'M\':0})}},7),3Z:k.2n(v(){k.u.O(7.1G,{\'1h\':\'2c\'});k.u.O(7.J,{\'L\':-3l});k.u.5O(7.1D,\'E-2y\');k.u.O(7.1G,{\'1h\':\'2c\'});E.5T(7.1D);7.4G=P;7.2y=P;E.8c(7.1l);m(1L!=5k){E.4E(1a,5k.1l)}U m(E.2h){E.8d()}7.66()},7)}).3I({\'13\':[1,7.I.46?0:1],\'H\':[7.J.3u,7.J.5V],\'N\':[7.J.3O,7.J.9o],\'L\':[1R.L,7.J.5t],\'M\':[1R.M,7.J.5l]})},7)}).3I({\'5w-L\':[0,-7.Q.2b||0]})},5E:v(t){t=t||0;q f=E.3k();m(1L!=f){7.1C=f.1C+1;k.u.O(7.S,{\'z-1l\':7.1C})}E.8w(7.1l);2S(v(){k.1g.3R(C,"6f",E.5y);k.1g.3d(C,"6f",E.5y)},t)},8l:v(){1K k.3o(7.Q,{2H:7.I.4C,2o:k.2T.67,48:k.2n(v(){k.u.O(7.Q,{\'5w-L\':-7.Q.2b});k.u.O(7.Q,{\'1h\':\'2c\',\'T\':\'8n\'})},7),3Z:k.2n(v(){m(k.1r.2L){k.u.O(7.49,{\'H\':k.u.22(7.S).H,\'N\':k.u.22(7.S).N})}},7)}).3I({\'5w-L\':[-7.Q.2b,0]})},64:v(e,2k){m(e){k.1g.2r(e)}2k=2k||P;q 3i=k.u.3Q(7.S);q 2x=(C.21&&\'3A\'!=C.21.2C())?C.1Q:C.Z;q 4S=e.3V+K((2a.4e)?2a.4e:2x.2P);q 4W=e.3P+K((2a.4j)?2a.4j:2x.2O);q 3m=/3f/i.3g(e.9y);q 3S=k.u.1c(7.1J,\'1h\');m((!3m||\'1s\'!=3S)&&(4S>3i.M&&4S<3i.1b)&&(4W>3i.L&&4W<3i.1u)){G}m(3m&&\'1s\'!=3S&&!2k){G}m(!3m&&\'1s\'==3S){G}q 62=(2k||3m)?[0,1]:[1,0];1K k.3o(7.1J,{2H:0.3,2o:k.2T.5C}).3I({\'13\':62});G},7Z:v(e){q o=e.am||e.an;3p(o&&\'a\'!=o.3a.2C()){o=o.5r}q 7g=V;5u(o.2Z){1x\'6e\':7.3L(1a,E.7F(7.1j));1w;1x\'3y\':7.3L(1a,E.7E(7.1j));1w;1x\'6d\':7.3L(1a);1w;7s:7g=P}m(7g){k.1g.2r(e)}G P},66:v(2k){2k=(1L!==2k)?2k:V;m(k.u.65(7.1D,\'24\')){3z{m(2k){7.1D.1B.4K=P}U{7.1D.1B.4O();7.1D.1B.4K=V}}3D(e){}}},9h:v(R){q 5X=K(k.u.1c(7.S,\'2f-M\'))+K(k.u.1c(7.S,\'2f-1b\'))+K(k.u.1c(7.S,\'1A-M-H\'))+K(k.u.1c(7.S,\'1A-1b-H\')),60=K(k.u.1c(7.S,\'2f-L\'))+K(k.u.1c(7.S,\'2f-1u\'))+K(k.u.1c(7.S,\'1A-L-H\'))+K(k.u.1c(7.S,\'1A-1u-H\'));q x=1k.9E(7.J.3u,R.H-35-5X),y=1k.9E(7.J.3O,R.N-35-60-7.Q.2b);m(x/y>7.J.5H){x=y*7.J.5H}U m(x/y<7.J.5H){y=x/7.J.5H}7.J.3u=1k.9v(x);7.J.3O=1k.9v(y);7.7C()},7C:v(){k.u.O(7.Q,{\'H\':7.J.3u-7.Q.3t-7.Q.4B-K(k.u.1c(7.Q,\'1A-M-H\'))-K(k.u.1c(7.Q,\'1A-1b-H\'))});k.u.O(7.S,{\'L\':-3l,\'1p\':\'1M\'});k.2G(7.Q,{\'2b\':k.u.22(7.Q).N});k.u.O(7.S,{\'1p\':\'2v\'})}};m(k.1r.4D){E.61.29.64=v(e,2k){m(e){k.1g.2r(e)}2k=2k||P;q 3i=k.u.3Q(7.S);q 2x=(C.21&&\'3A\'!=C.21.2C())?C.1Q:C.Z;q 4S=e.3V+K((2a.4e)?2a.4e:2x.2P);q 4W=e.3P+K((2a.4j)?2a.4j:2x.2O);q 3m=/3f/i.3g(e.9y);q 3S=k.u.1c(7.4F,\'1h\');m((!3m||!(\'1s\'!=3S))&&(4S>3i.M&&4S<3i.1b)&&(4W>3i.L&&4W<3i.1u)){G}m(3m&&!(\'1s\'!=3S)&&!2k){G}m(!3m&&\'1s\'!=3S){G}q 62=(2k||3m)?[1,0]:[0,1];1K k.3o(7.4F,{2H:0.3,2o:k.2T.5C}).3I({\'13\':62});G};3z{C.8C(\'8F\',P,V)}3D(e){}}k.1g.3d(C,\'8V\',v(){E.4d()});',62,731,'|||||||this|||||||||||||MagicTools||if||||var||||Element|function||||||style|document||MagicThumb|el|return|width|options|bigImg|parseInt|top|left|height|setStyle|false|caption|ps|cont|position|else|true||bigImageCont|aels|body||||opacity|||event|settings|||null|right|getStyle|smallImage|length|MagicZoom_ua|Event|visibility|window|group|Math|index|img|bigImage|appendChild|display|absolute|browser|hidden|createElement|bottom|px|break|case|for|matches|border|zoom|zIndex|anchor|pup|imgSize|smallImg|MagicZoom_getStyle|smallImageCont|controlbar|new|undefined|block|0px|id|items|documentElement|pos|msie|destTop|src|cbA|destLeft|relative|arguments|sRect||compatMode|getSize|args|MagicZoom|scrollX|smallImageSizeX||loadingCont|prototype|self|fullHeight|visible|zoomPositionOffset|scrollY|padding|bigCont|bgFader|round|100|show|tag|smallImageSizeY|bind|transition|popupSizeX|val|stop|loader|gd56f7fsgd|re|none|indexOf|ieBody|zoomed|obj|firstChild|smallX|toLowerCase|popupSizeY|handler|smallY|extend|duration|opera|addEvent|zoomPosition|ie|click|styles|scrollTop|scrollLeft|title|idx|setTimeout|Transition|elStyle|bigImageSizeY|getElementsByTagName|activeIndexes|addClass|rel|thumbs|innerHTML|||||className||||tagName|removeChild|getPosition|add|bindAsEvent|mouseover|test|MagicZoom_addEventListener|rect|cbBgWrapper|getFocused|9999|ov|repeat|Render|while|MagicZoom_createMethodReference|bigImageSizeX|positionX|paddingLeft|displayWidth|item|ft|replace|next|try|backcompat|push|div|catch|getItem|MagicZoom_|arr|auto|start|result|RegExp|collapse|href|positionY|displayHeight|clientY|getRect|remove|vis|overflow|bigImageContStyleTop|clientX|exec|IMG|header|onComplete||controlbarPosition|MagicZoom_zooms|drag_mode|safari|object|keepThumbnail|load|onStart|overlap|pageWidth|rand|pageHeight|init|pageXOffset|String|image|ael|klass|pageYOffset|parseFloat|bgIMG|currentStyle|vc67|initZoom|MagicZoom_stopEventPropagation|typeof|zoomTrigger|alt|onDomReadyTimer|mousemove|css|center|iels|str|vc68|buttons|paddingRight|captionSlideDuration|ie6|expand|cbOverlay|rendering|refresh|loadingText|gecko|recalculating|listener|apply|loadingImg|hiderect|bigImage_always_visible|10000px|cr|eX|iframe|filter|now|eY|custom|on|onDomReady||background|perX|borderLeftWidth|captionSrc|getGroupItems|timer|newBigImage|initTimer|len|onDomReadyList|to_css|dx|pop|inArray|eventsCache|cursor|xScroll|navigator|userAgent|nextThumb|initLeft|cbSize|1000|hide|zoomHeight|getPageSize|offsetParent|thumb_change|initTop|switch|zoomWidth|margin|hasCaption|onKey|headerH|sd|pleft|linear|ptop|focus|wx|size|ratio|innerHeight|DIV|wy|yScroll|delete|defaults|removeClass|MagicZoomHeader|windowWidth|windowHeight|scrollWidth|fixCursor|__method|initWidth|paddingTop|padW|inner|MagicZoom_getBounds|padH|Item|op|styleProp|toggleControlBar|hasClass|toggleMZ|sin|shift|opt|backCompatMode|safariOnLoadStarted|frame|close|prev|keydown|continue|attachEvent|offsetWidth|offsetHeight|completeWidth|camelize|zoomTriggerDelay|font|pow|mzextend|loaded|complete|hoverTimer|createEvent|domLoaded|color|checkcoords|in|xgdf7fsgd56|from|Array|clientHeight|backgroundFadingOpacity|perY|innerWidth|callee|span|offsetTop|formatCaptionText|bgURL|mousedown|offsetLeft|ar1|mouseup|getComputedStyle|defaultView|mousemove_ref|MagicZoom_extendElement|results|render|addEventListener|showrect|concat|calc|quadIn|version|checkcoords_ref|startTime|removeEventListener|replaceZoom|preventDefault||evType|clientWidth|props|stopPropagation|cancelBubble|evName|onImgLoad|MagicZoom_removeEventListener|startPosition|url|stopEvent|controlbarEnable|float|preventClick|MagicZoom_getEventBounds|javascript|lastChild|cbBtn|destPos|controlbarButtons|inline|startProps|default|mouseout|property|outline|firstRun|useCtrlKey|MagicView_ia|clearTimeout|recalculatePopupDimensions|sequence|resizeCaption|allowMultipleImages|getNext|getPrev|backgroundFadingDuration|borderTopWidth|fire|Bottom|createControlBar|arglen|Top|cssFloat|MagicZoom_concat|setOpacity|alpha|toArray|isBody|data|initPopup|addpx|align|Right|Tahoma|onCBClick|styleFloat|Left|fitToScreen|bigImageId|fadeInBackground|effectProps|big|bigImageContId|move|smallImageId|MouseEvents|scrollHeight|unsetFocused|fadeOutBackground|collapseDuration|html|scrollMaxY|scrollMaxX|insertBefore|mask|parentNode|toggleCaption|dispatchEvent|static|300px|arrlen|m2|fullWidth|HTML|expandDuration|detachEvent|adjustPosition|setFocused|smallImageContId|BODY|trim|backIn|preload|execCommand|Loading|evt|BackgroundImageCache|destroy|textAlign|cbLength|getLast|getBoundingClientRect|progid|onBeforeRender|pointer|cbButtons|1001|getFirst|autoInit|thumbIndex|metaKey|console|domready|ctrlKey|allowKeyboard|initBigContainer|code||backgroundFadingColor|MagicZoom_findSelectors|borderWidth|disableContextMenu|loadingMsg|splice|loadingOpacity|max|getScrolls|DXImageTransform|bindDomReady|charCodeAt|PI|webkit|MagicZoomLoading|sim|resizeImage|pat|cos|getElementById|blur|methodName|MagicZoom_withoutFirst|initHeight|cubicIn|styleSheets|stopZoom|finishTime|loop|fps|ceil|MagicZoom_findZooms|bigimgsrc|type|XMLHttpRequest|bim|DOMContentLoaded|fromCharCode|prepare|min|rev|skip|Microsoft|mozilla|dir|selectThisZoom|oncontextmenu|IFRAME|onselectstart|MagicZoom_stopZooms|unselectable|Zoom|MozUserSelect|Alpha|frameBorder|replaceChild|paddingBottom|borderRightWidth|fontFamily|fontWeight|3px|fontSize|Opacity|moz|drag|change|thumb|mode|always|baseuri|MagicZoomBigImageCont|sc|rtl|invocation|Invalid|throw|random|1000000|MagicZoomPup|textDecoration|popupSizey|middle|collapseEvent|currentTarget|srcElement|keyCode|warn|description|loading||resize|lef|bgfader|sort|contextmenu|000000|04|clearInterval|setInterval|250|Previous|restoreDuration|zoomDuration|Close|line|vertical|createTextNode|gif|container|ig|weight|base64|R0lGODlhAQABAIAAACqk1AAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw|gt||lt|amp|completeHeight|no|family|AlphaImageLoader|999|icons|peventClick|sizingMethod|crop|text|nodeType|backgroundImage|curFrame|Next|returnValue|initEvent|call|viewHeight||viewWidth|createEventObject|eventType|Width|state|m1|fireEvent|getTime|Date|Gecko|KHTML|AppleWebKit|ActiveXObject|ie7||mobilesafari|match|string|Safari||Mobile|Apple|number|toUpperCase|backOut|618|cubicOut|update|elastic|readyState|duraton|disabled|doScroll|do|quadOut|hasLayout'.split('|'),0,{}));function bookmark(url,title){
  if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) {
  window.external.AddFavorite(url,title);
  } else if (navigator.appName == "Netscape") {
    window.sidebar.addPanel(title,url,"");
  } else {
    alert("Press CTRL-D (Netscape) or CTRL-T (Opera) to bookmark");
  }
  return false;
}function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}
/* LIST SORT */
function ListSort(list_id, order)
{
	var list_obj = document.getElementById(list_id);
	var list_featured_products = document.getElementById('list_featured_products');
	var list_more_products = document.getElementById('list_more_products');
	if(list_featured_products)
	{
		list_obj.removeChild(list_featured_products);
	}
	if(list_more_products)
	{
		list_obj.removeChild(list_more_products);
	}
	var list_items = list_obj.getElementsByTagName('li');
	var num_list_items = list_items.length;
    var alpha = [], numeric = [];
    var aIdx = 0, nIdx = 0;

  for (var i=0; i<num_list_items; i++)
	{

		if(list_items[i].parentNode.id == list_id)
		{
			var paras = list_items[i].getElementsByTagName('p');
			var num_paras = paras.length;
			for (k = 0; k < num_paras; k++)
			{
			  if(paras[k].className=='price')
				{
					var price = paras[k].innerHTML;
					var sale_pattern = '/<span class=\'price\'>.*/g';
					//if(price.match(sale_pattern)) alert('sale price');
				}

        if(paras[k].className=='fabric_weight')
				{
					var fabric_weight = paras[k].innerHTML;
					//then strip the grams g
					fabric_weight = fabric_weight.replace("g", "");
				}
			}

			var links = list_items[i].getElementsByTagName('a');
			var num_links = links.length;
      var best_seller = 0;
      var double_cuff = 0;
      var boys_sizes   = 0;
			for (k = 0; k < num_links; k++)
			{
        if(links[k].className=='best_seller pl')
				{
					best_seller = 1;
				}

        if(links[k].className=='double_cuff pl')
				{
					double_cuff = 1;
				}

        if(links[k].className=='boys_sizes pl')
				{
					boys_sizes = 1;
				}
			}

			var content = list_items[i].innerHTML;


			/*
			 * Split data into two separate arrays, one for numeric content and
			 * one for everything else (alphabetic). Store both the actual data
			 * that will be used for comparison by the sort algorithm (thus the need
			 * to parseFloat() the numeric data) as well as a reference to the
			 * element's parent row. The row reference will be used after the new
			 * order of content is determined in order to actually reorder the HTML
			 * table's rows.
			 */

			if(order.options[order.selectedIndex].value == 'default')
			{

				var num = list_items[i].id.replace("item_", "");
				 numeric[nIdx++] = {
				value: Number(num),
				original_content: content,
				item_id: list_items[i].id,
        classes: list_items[i].className,
        displaySetting: list_items[i].style.display
				 }

			}else if(order.options[order.selectedIndex].value == 'asc' || order.options[order.selectedIndex].value == 'desc')
			{

				var num = price.replace(/([^0-9\.])/g, "");
				  if (parseFloat(num) == num) {
					numeric[nIdx++] = {
						value: Number(num),
						original_content: content,
						item_id: list_items[i].id,
            classes: list_items[i].className,
        displaySetting: list_items[i].style.display
					}
				} else {
					alpha[aIdx++] = {
						value: price,
						original_content: content,
						item_id: list_items[i].id,
            classes: list_items[i].className,
        displaySetting: list_items[i].style.display
					}
				}
			}else if(order.options[order.selectedIndex].value == 'asc_fabric' || order.options[order.selectedIndex].value == 'desc_fabric')
			{

				var num = fabric_weight.replace(/([^0-9\.])/g, "");
				  if (parseFloat(num) == num) {
					numeric[nIdx++] = {
						value: Number(num),
						original_content: content,
						item_id: list_items[i].id,
            classes: list_items[i].className,
        displaySetting: list_items[i].style.display
					}
				} else {
					alpha[aIdx++] = {
						value: fabric_weight,
						original_content: content,
						item_id: list_items[i].id,
            classes: list_items[i].className,
        displaySetting: list_items[i].style.display
					}
				}
			}else if(order.options[order.selectedIndex].value == 'asc_best' || order.options[order.selectedIndex].value == 'desc_best')
			{

				var num = best_seller;
				  if (parseFloat(num) == num) {
					numeric[nIdx++] = {
						value: Number(num),
						original_content: content,
						item_id: list_items[i].id,
            classes: list_items[i].className,
        displaySetting: list_items[i].style.display
					}
				} else {
					alpha[aIdx++] = {
						value: best_seller,
						original_content: content,
						item_id: list_items[i].id,
            classes: list_items[i].className,
        displaySetting: list_items[i].style.display
					}
				}
			}else if(order.options[order.selectedIndex].value == 'asc_cuff' || order.options[order.selectedIndex].value == 'desc_cuff')
			{

				var num = double_cuff;
				  if (parseFloat(num) == num) {
					numeric[nIdx++] = {
						value: Number(num),
						original_content: content,
						item_id: list_items[i].id,
            classes: list_items[i].className,
        displaySetting: list_items[i].style.display
					}
				} else {
					alpha[aIdx++] = {
						value: double_cuff,
						original_content: content,
						item_id: list_items[i].id,
            classes: list_items[i].className,
        displaySetting: list_items[i].style.display
					}
				}
			}else if(order.options[order.selectedIndex].value == 'asc_boys' || order.options[order.selectedIndex].value == 'desc_boys')
			{

				var num = boys_sizes;
				  if (parseFloat(num) == num) {
					numeric[nIdx++] = {
						value: Number(num),
						original_content: content,
						item_id: list_items[i].id,
            classes: list_items[i].className,
        displaySetting: list_items[i].style.display
					}
				} else {
					alpha[aIdx++] = {
						value: boys_sizes,
						original_content: content,
						item_id: list_items[i].id,
            classes: list_items[i].className,
        displaySetting: list_items[i].style.display
					}
				}
			}

		}
    }
	list_obj.innerHTML = '';

    /*
     * Sort according to direction (ascending or descending)
     */
	if(order.options[order.selectedIndex].value == 'asc'
|| order.options[order.selectedIndex].value == 'asc_fabric'
|| order.options[order.selectedIndex].value == 'asc_best'
|| order.options[order.selectedIndex].value == 'asc_cuff'
|| order.options[order.selectedIndex].value == 'asc_boys'
)
	{
		var ordered_list = [], top, bottom;
        if(alpha) top = bubbleSort(numeric, 1);
        if(numeric) bottom = bubbleSort(alpha, 1);
	}else if(order.options[order.selectedIndex].value == 'desc'
|| order.options[order.selectedIndex].value == 'desc_fabric'
|| order.options[order.selectedIndex].value == 'desc_best'
|| order.options[order.selectedIndex].value == 'desc_cuff'
|| order.options[order.selectedIndex].value == 'desc_boys'
)
	{
		var ordered_list = [], top, bottom;
		if(alpha) top = bubbleSort(alpha, -1);
		if(numeric) bottom = bubbleSort(numeric, -1);
	}else
	{
		var ordered_list = [], top, bottom;
		if(alpha) top = bubbleSort(alpha, 1);
		if(numeric) bottom = bubbleSort(numeric, 1);
	}


	ordered_list = top.concat(bottom);
    for (var i=0; i<ordered_list.length; i++) {

		var new_li = document.createElement("li");
		new_li.innerHTML = ordered_list[i].original_content;
		new_li.setAttribute("id",ordered_list[i].item_id);
		new_li.setAttribute("class",ordered_list[i].classes);
    new_li.style.display = ordered_list[i].displaySetting;   
    list_obj.appendChild(new_li);
    }
}

function bubbleSort(arr, dir) {
    // Pre-calculate directional information
    var start, end;
    if (dir === 1) {
        start = 0;
        end = arr.length;
    } else if (dir === -1) {
        start = arr.length-1;
        end = -1;
    }

    // Bubble sort: http://en.wikipedia.org/wiki/Bubble_sort
    var unsorted = true;
    while (unsorted) {
        unsorted = false;
        for (var i=start; i!=end; i=i+dir) {
            if (arr[i+dir] && arr[i].value > arr[i+dir].value) {
                var a = arr[i];
                var b = arr[i+dir];
                var c = a;
                arr[i] = b;
                arr[i+dir] = c;
                unsorted = true;
            }
        }
    }
    return arr;
}function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function'){
		window.onload = func;
	}else {
		window.onload = function() {
			oldonload();
			func();
		}
	}
}function toggle_info_panel(state)
{
  var info_panel = document.getElementById("info_panel");
  if(info_panel)
  {
    if(state == 'on')
    {
      info_panel.style.display = 'none';
    }else
    {
      info_panel.style.display = 'block';
    }
  }
}/************ SUIT INFO AJAX ***********/
var g_has_recoloured = '';
var g_new_recoloured = '';
function refreshSuitInfo(optionId,clear)
{

	if(clear)
	{
		refreshSettings['size_title'] = 'size';

		refreshSettings['secondary_size'] = 'secondary_size';

		refreshSettings['colour'] = 'colour';
	}else
	{
		if(product_options['fixed_drop'] == 'y')
		{
			/* SIZE */
			if(product_options[optionId]['type']=='jacket_size')
			{
				refreshSettings['jacket_size'] = product_options[optionId]['url_title'];
				refreshSettings['trouser_size'] = product_options[optionId]['fixed_drop_trouser_url_title'];

				refreshSettings['size_title'] = refreshSettings['jacket_size']+'~'+refreshSettings['trouser_size'];
			}

			if(product_options[optionId]['type']=='trouser_size')
			{
				refreshSettings['trouser_size'] = product_options[optionId]['url_title'];
				refreshSettings['jacket_size'] = product_options[optionId]['fixed_drop_jacket_url_title'];

				refreshSettings['size_title'] = refreshSettings['jacket_size']+'~'+refreshSettings['trouser_size'];
			}

			/* SECONDARY SIZE */
			if(product_options[optionId]['type']=='jacket_secondary_size')
			{
				refreshSettings['jacket_secondary_size'] = product_options[optionId]['url_title'];
				refreshSettings['trouser_secondary_size'] = product_options[optionId]['fixed_drop_trouser_url_title'];

				refreshSettings['secondary_size'] = refreshSettings['jacket_secondary_size']+'~'+refreshSettings['trouser_secondary_size'];
			}

			if(product_options[optionId]['type']=='trouser_secondary_size')
			{
				refreshSettings['trouser_secondary_size'] = product_options[optionId]['url_title'];
				refreshSettings['jacket_secondary_size'] = product_options[optionId]['fixed_drop_jacket_url_title'];

				refreshSettings['secondary_size'] = refreshSettings['jacket_secondary_size']+'~'+refreshSettings['trouser_secondary_size'];
			}

			/* COLOUR */
			if(product_options[optionId]['type']=='jacket_colour')
			{
				refreshSettings['jacket_colour'] = product_options[optionId]['title'];
				refreshSettings['colour'] = product_options[optionId]['title']+'~'+product_options[optionId]['title'];
			}

			if(product_options[optionId]['type']=='trouser_colour')
			{
				refreshSettings['trouser_colour'] = product_options[optionId]['title'];
				refreshSettings['colour'] = product_options[optionId]['title']+'~'+product_options[optionId]['title'];
			}
		}else
		{
			/* SIZE */
			if(product_options[optionId]['type']=='jacket_size')
			{
				refreshSettings['jacket_size'] = product_options[optionId]['url_title'];
				if(refreshSettings['trouser_size'].length == 0)
				{
					refreshSettings['size_title'] = product_options[optionId]['url_title'];
				}else
				{
					refreshSettings['size_title'] = product_options[optionId]['url_title']+'~'+refreshSettings['trouser_size'];
				}
			}

			if(product_options[optionId]['type']=='trouser_size')
			{
				refreshSettings['trouser_size'] = product_options[optionId]['url_title'];
				if(refreshSettings['jacket_size'].length == 0)
				{
					refreshSettings['size_title'] = 'size~'+product_options[optionId]['url_title'];
				}else
				{
					refreshSettings['size_title'] = refreshSettings['jacket_size']+'~'+refreshSettings['trouser_size'];
				}
			}

			/* SECONDARY SIZE */
			if(product_options[optionId]['type']=='jacket_secondary_size')
			{
				refreshSettings['jacket_secondary_size'] = product_options[optionId]['url_title'];
				if(refreshSettings['trouser_secondary_size'].length == 0)
				{
					refreshSettings['secondary_size'] = product_options[optionId]['url_title'];
				}else
				{
					refreshSettings['secondary_size'] = product_options[optionId]['url_title']+'~'+refreshSettings['trouser_secondary_size'];
				}
			}

			if(product_options[optionId]['type']=='trouser_secondary_size')
			{
				refreshSettings['trouser_secondary_size'] = product_options[optionId]['url_title'];
				if(refreshSettings['jacket_secondary_size'].length == 0)
				{
					refreshSettings['secondary_size'] = 'secondary_size~'+product_options[optionId]['url_title'];
				}else
				{
					refreshSettings['secondary_size'] = refreshSettings['jacket_secondary_size']+'~'+refreshSettings['trouser_secondary_size'];
				}
			}

			/* COLOUR */
			if(product_options[optionId]['type']=='jacket_colour')
			{
				refreshSettings['jacket_colour'] = product_options[optionId]['title'];
				if(refreshSettings['trouser_colour'].length == 0)
				{
					refreshSettings['colour'] = product_options[optionId]['title'];
				}else
				{
					refreshSettings['colour'] = product_options[optionId]['title']+'~'+refreshSettings['trouser_colour'];
				}
			}

			if(product_options[optionId]['type']=='trouser_colour')
			{
				refreshSettings['trouser_colour'] = product_options[optionId]['title'];
				if(refreshSettings['jacket_colour'].length == 0)
				{
					refreshSettings['colour'] = 'colour~'+product_options[optionId]['title'];
				}else
				{
					refreshSettings['colour'] = refreshSettings['jacket_colour']+'~'+refreshSettings['trouser_colour'];
				}
			}
		}
	}

	var data = '';

	data+= 'category_id';
	data+= "=";
	data+= escape(refreshSettings['category_id']);
	data+= "&";

	data+= 'category';
	data+= "=";
	data+= escape(refreshSettings['category']);
	data+= "&";

	data+= 'style_id';
	data+= "=";
	data+= escape(refreshSettings['style_id']);
	data+= "&";

	data+= 'style';
	data+= "=";
	data+= escape(refreshSettings['style_title']);
	data+= "&";

	data+= 'brand_id';
	data+= "=";
	data+= escape(refreshSettings['brand_id']);
	data+= "&";

	data+= 'brand';
	data+= "=";
	data+= escape(refreshSettings['brand']);
	data+= "&";

	data+= 'size';
	data+= "=";
	data+= escape(refreshSettings['size_title']);
	data+= "&";

	data+= 'secondary_size';
	data+= "=";
	data+= escape(refreshSettings['secondary_size']);
	data+= "&";

	data+= 'colour';
	data+= "=";
	data+= escape(refreshSettings['colour']);
	data+= "&";

	data+= 'fabric_id';
	data+= "=";
	data+= escape(refreshSettings['fabric_id']);
	data+= "&";

	data+= 'fabric';
	data+= "=";
	data+= escape(refreshSettings['fabric']);
	data+= "&";

	data+= 'occasion_id';
	data+= "=";
	data+= escape(refreshSettings['occasion_id']);
	data+= "&";

	data+= 'occasion';
	data+= "=";
	data+= escape(refreshSettings['occasion']);
	data+= "&";

	data+= 'sale';
	data+= "=";
	data+= escape(refreshSettings['sale']);
	data+= "&";

	data+= 'suit_type_id';
	data+= "=";
	data+= escape(refreshSettings['suit_type_id']);
	data+= "&";

	data+= 'suit_type';
	data+= "=";
	data+= escape(refreshSettings['suit_type']);
	data+= "&";

	data+= 'trouser_type_id';
	data+= "=";
	data+= escape(refreshSettings['trouser_type_id']);
	data+= "&";

	data+= 'trouser_type';
	data+= "=";
	data+= escape(refreshSettings['trouser_type']);
	data+= "&";

	data+= 'suit_id';
	data+= "=";
	data+= escape(refreshSettings['suit_id']);
	data+= "&";

	var rand = Math.random(9999);
	var pars = data + 'rand=' + rand;

  g_has_recoloured = '';
	if(optionId != '0')
	{
		if(product_options[optionId]['type']=='jacket_colour' || product_options[optionId]['type']=='trouser_colour')
		{
			if(product_options[optionId]['has_recoloured'] == 'y')
			{
				g_has_recoloured = 'y';
				g_new_recoloured = product_options[optionId]['filename'];
			}else
      {
        g_has_recoloured = 'n';
      }
		}
	}

  $('*').css('cursor','wait');

  $.get(suitsMenConstants['url_path']+'/lib/ajax_suit_info_json.php',pars, function(newData)
  {
	/*
    var pattern = /~info~(.*)~endinfo~/gim;
    var results = newData.match(pattern);
    var info_content = RegExp.$1;

    pattern = /~purchase~(.*)~endpurchase~/gim;
    results = newData.match(pattern);
    var purchase_content = RegExp.$1;
	*/
	var info_content = newData.info;
	var purchase_content = newData.purchase;

    var selections_panel = document.getElementById('selections_panel');
    selections_panel.innerHTML = info_content;

    var purchase_panel = document.getElementById('purchase_panel');
    purchase_panel.innerHTML = purchase_content;



    if(g_has_recoloured == 'y')
    {
      change_main_image(g_new_recoloured);
    }else if(g_has_recoloured == 'n')
    {
      change_main_image('colour_photo_coming_soon');
    }

	$('a.product_option').bind('click',function(e){
		e.preventDefault();
		refreshSuitInfo(this.id);

	});

	$('a.clear_selections').bind('click',function(e){
		e.preventDefault();
		refreshSuitInfo('0',true);

	});

    $('*').css('cursor','auto');

    /*brown input buttons*/
    $(':input.button').mouseover(function() {$(this).css({backgroundPosition: '0px 0px'})});
    $(':input.button').mouseout(function() {$(this).css({backgroundPosition: '0px -33px'})});

	/* clear any qtips left on the screen when ajax was grabbed */
	$('.qtip.qtip-suitsmen').remove();

	//now init qtip for new content added by ajax
	$('.button_list li[title],.button_list a[title],.colour_list span[title],.colour_list a[title]').qtip({
	style: {name: 'suitsmen'},
	position:{
		corner:{
			target:'topMiddle',
			tooltip:'bottomMiddle'
		},
		adjust:{y:2}
		}
	});

    $('.best_seller').pngFix();
    $('.boys_sizes').pngFix();
    $('.special_offer_small').pngFix();
	$('.best_seller_info').pngFix();

  	$('.nyroModal').nyroModal();

  },'json');



  //return false;
}

/************ PRDOCUT INFO AJAX ***********/

var g_has_recoloured = '';
var g_new_recoloured = '';
function refreshProductInfo(optionId,clear)
{

	if(clear)
	{
		refreshSettings['size_id'] = 0;
		refreshSettings['size'] = 'size';

		refreshSettings['secondary_size_id'] = 0;
		refreshSettings['secondary_size'] = 'secondary_size';

		refreshSettings['colour_id'] = 0;
		refreshSettings['colour'] = 'colour';
	}else
	{
		if(product_options[optionId]['type']=='size')
		{
			refreshSettings['size_id'] = product_options[optionId]['id'];
			refreshSettings['size'] = product_options[optionId]['url_title'];
		}
		if(product_options[optionId]['type']=='secondary_size')
		{
			refreshSettings['secondary_size_id'] = product_options[optionId]['id'];
			refreshSettings['secondary_size'] = product_options[optionId]['url_title'];
		}
		if(product_options[optionId]['type']=='colour')
		{
			refreshSettings['colour_id'] = product_options[optionId]['id'];
			refreshSettings['colour'] = product_options[optionId]['title'];
		}
	}

	var data = '';

	data+= 'category_id';
	data+= "=";
	data+= escape(refreshSettings['category_id']);
	data+= "&";

	data+= 'category';
	data+= "=";
	data+= escape(refreshSettings['category']);
	data+= "&";

	data+= 'style_id';
	data+= "=";
	data+= escape(refreshSettings['style_id']);
	data+= "&";

	data+= 'style';
	data+= "=";
	data+= escape(refreshSettings['style_title']);
	data+= "&";

	data+= 'brand_id';
	data+= "=";
	data+= escape(refreshSettings['brand_id']);
	data+= "&";

	data+= 'brand';
	data+= "=";
	data+= escape(refreshSettings['brand']);
	data+= "&";

	data+= 'size_id';
	data+= "=";
	data+= escape(refreshSettings['size_id']);
	data+= "&";

	data+= 'size';
	data+= "=";
	data+= escape(refreshSettings['size_title']);
	data+= "&";

	data+= 'secondary_size_id';
	data+= "=";
	data+= escape(refreshSettings['secondary_size_id']);
	data+= "&";

	data+= 'secondary_size';
	data+= "=";
	data+= escape(refreshSettings['secondary_size']);
	data+= "&";

	data+= 'colour_id';
	data+= "=";
	data+= escape(refreshSettings['colour_id']);
	data+= "&";

	data+= 'colour';
	data+= "=";
	data+= escape(refreshSettings['colour']);
	data+= "&";

	data+= 'fabric_id';
	data+= "=";
	data+= escape(refreshSettings['fabric_id']);
	data+= "&";

	data+= 'fabric';
	data+= "=";
	data+= escape(refreshSettings['fabric']);
	data+= "&";

	data+= 'occasion_id';
	data+= "=";
	data+= escape(refreshSettings['occasion_id']);
	data+= "&";

	data+= 'occasion';
	data+= "=";
	data+= escape(refreshSettings['occasion']);
	data+= "&";

	data+= 'sale';
	data+= "=";
	data+= escape(refreshSettings['sale']);
	data+= "&";

	data+= 'product_id';
	data+= "=";
	data+= escape(refreshSettings['product_id']);
	data+= "&";

	data+= 'so_id';
	data+= "=";
	data+= escape(refreshSettings['so_id']);
	data+= "&";

	var rand = Math.random(9999);
	var pars = data + 'rand=' + rand;

  g_has_recoloured = '';
	if(optionId != '0')
	{
		if(product_options[optionId]['type']=='colour')
		{
			if(product_options[optionId]['has_recoloured'] == 'y')
			{
				g_has_recoloured = 'y';
				g_new_recoloured = refreshSettings['product_id']+'-'+product_options[optionId]['id'];
      }else
      {
        g_has_recoloured = 'n';
      }     
		}
	}

  $('*').css('cursor','wait');

  $.get(suitsMenConstants['url_path']+'/lib/ajax_product_info_json.php',pars, function(newData)
  {

	/*
    var pattern = /~info~(.*)~endinfo~/gim;
    var results = newData.match(pattern);
    var info_content = RegExp.$1;

    pattern = /~purchase~(.*)~endpurchase~/gim;
    results = newData.match(pattern);
    var purchase_content = RegExp.$1;
	*/
	var info_content = newData.info;
	var purchase_content = newData.purchase;


    var selections_panel = document.getElementById('selections_panel');
    selections_panel.innerHTML = info_content;

    var purchase_panel = document.getElementById('purchase_panel');
    purchase_panel.innerHTML = purchase_content;

    if(g_has_recoloured == 'y')
    {
      change_main_image(g_new_recoloured);
    }else if(g_has_recoloured == 'n')
    {
      change_main_image('colour_photo_coming_soon');
    }

	$('a.product_option').bind('click',function(e){
		e.preventDefault();
		refreshProductInfo(this.id);

	});

	$('a.clear_selections').bind('click',function(e){
		e.preventDefault();
		refreshProductInfo('0',true);

	});

    $('*').css('cursor','auto');

    /*brown input buttons*/
    $(':input.button').mouseover(function() {$(this).css({backgroundPosition: '0px 0px'})});
    $(':input.button').mouseout(function() {$(this).css({backgroundPosition: '0px -33px'})});

	/* clear any qtips left on the screen when ajax was grabbed */
	$('.qtip.qtip-suitsmen').remove();

	//now init qtip for new content added by ajax

	$('.button_list li[title],.button_list a[title],.colour_list span[title],.colour_list a[title]').qtip({
	style: {name: 'suitsmen'},
	position:{
		corner:{
			target:'topMiddle',
			tooltip:'bottomMiddle'
		},
		adjust:{y:2}
		}
	});

   
    $('.best_seller').pngFix();
    $('.boys_sizes').pngFix();
    $('.special_offer_small').pngFix();
    $('.best_seller_info').pngFix();

	$('.nyroModal').nyroModal();



  },'json');



	//return false;
}/*************************************/
/******** jquery.jquery.scrollTo-min.js **********/
/*************************************/
/**
 * jQuery.ScrollTo - Easy element scrolling using jQuery.
 * Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
 * Dual licensed under MIT and GPL.
 * Date: 5/25/2009
 * @author Ariel Flesler
 * @version 1.4.2
 *
 * http://flesler.blogspot.com/2007/10/jqueryscrollto.html
 */
;(function(d){var k=d.scrollTo=function(a,i,e){d(window).scrollTo(a,i,e)};k.defaults={axis:'xy',duration:parseFloat(d.fn.jquery)>=1.3?0:1};k.window=function(a){return d(window)._scrollable()};d.fn._scrollable=function(){return this.map(function(){var a=this,i=!a.nodeName||d.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!i)return a;var e=(a.contentWindow||a).document||a.ownerDocument||a;return d.browser.safari||e.compatMode=='BackCompat'?e.body:e.documentElement})};d.fn.scrollTo=function(n,j,b){if(typeof j=='object'){b=j;j=0}if(typeof b=='function')b={onAfter:b};if(n=='max')n=9e9;b=d.extend({},k.defaults,b);j=j||b.speed||b.duration;b.queue=b.queue&&b.axis.length>1;if(b.queue)j/=2;b.offset=p(b.offset);b.over=p(b.over);return this._scrollable().each(function(){var q=this,r=d(q),f=n,s,g={},u=r.is('html,body');switch(typeof f){case'number':case'string':if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(f)){f=p(f);break}f=d(f,this);case'object':if(f.is||f.style)s=(f=d(f)).offset()}d.each(b.axis.split(''),function(a,i){var e=i=='x'?'Left':'Top',h=e.toLowerCase(),c='scroll'+e,l=q[c],m=k.max(q,i);if(s){g[c]=s[h]+(u?0:l-r.offset()[h]);if(b.margin){g[c]-=parseInt(f.css('margin'+e))||0;g[c]-=parseInt(f.css('border'+e+'Width'))||0}g[c]+=b.offset[h]||0;if(b.over[h])g[c]+=f[i=='x'?'width':'height']()*b.over[h]}else{var o=f[h];g[c]=o.slice&&o.slice(-1)=='%'?parseFloat(o)/100*m:o}if(/^\d+$/.test(g[c]))g[c]=g[c]<=0?0:Math.min(g[c],m);if(!a&&b.queue){if(l!=g[c])t(b.onAfterFirst);delete g[c]}});t(b.onAfter);function t(a){r.animate(g,j,b.easing,a&&function(){a.call(this,n,b)})}}).end()};k.max=function(a,i){var e=i=='x'?'Width':'Height',h='scroll'+e;if(!d(a).is('html,body'))return a[h]-d(a)[e.toLowerCase()]();var c='client'+e,l=a.ownerDocument.documentElement,m=a.ownerDocument.body;return Math.max(l[h],m[h])-Math.min(l[c],m[c])};function p(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery);

/*************************************/
/******* jQuery Easing v1.3 **********/
/*************************************/
/*
 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
 *
 * Uses the built in easing capabilities added In jQuery 1.1
 * to offer multiple easing options
 *
 * TERMS OF USE - jQuery Easing
 *
 * Open source under the BSD License.
 *
 * Copyright © 2008 George McGinley Smith
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without modification,
 * are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice, this list of
 * conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright notice, this list
 * of conditions and the following disclaimer in the documentation and/or other materials
 * provided with the distribution.
 *
 * Neither the name of the author nor the names of contributors may be used to endorse
 * or promote products derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 * OF THE POSSIBILITY OF SUCH DAMAGE.
 *
*/

// t: current time, b: begInnIng value, c: change In value, d: duration
jQuery.easing['jswing'] = jQuery.easing['swing'];

jQuery.extend( jQuery.easing,
{
	def: 'easeOutQuad',
	swing: function (x, t, b, c, d) {
		//alert(jQuery.easing.default);
		return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
	},
	easeInQuad: function (x, t, b, c, d) {
		return c*(t/=d)*t + b;
	},
	easeOutQuad: function (x, t, b, c, d) {
		return -c *(t/=d)*(t-2) + b;
	},
	easeInOutQuad: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t + b;
		return -c/2 * ((--t)*(t-2) - 1) + b;
	},
	easeInCubic: function (x, t, b, c, d) {
		return c*(t/=d)*t*t + b;
	},
	easeOutCubic: function (x, t, b, c, d) {
		return c*((t=t/d-1)*t*t + 1) + b;
	},
	easeInOutCubic: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t + b;
		return c/2*((t-=2)*t*t + 2) + b;
	},
	easeInQuart: function (x, t, b, c, d) {
		return c*(t/=d)*t*t*t + b;
	},
	easeOutQuart: function (x, t, b, c, d) {
		return -c * ((t=t/d-1)*t*t*t - 1) + b;
	},
	easeInOutQuart: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
		return -c/2 * ((t-=2)*t*t*t - 2) + b;
	},
	easeInQuint: function (x, t, b, c, d) {
		return c*(t/=d)*t*t*t*t + b;
	},
	easeOutQuint: function (x, t, b, c, d) {
		return c*((t=t/d-1)*t*t*t*t + 1) + b;
	},
	easeInOutQuint: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
		return c/2*((t-=2)*t*t*t*t + 2) + b;
	},
	easeInSine: function (x, t, b, c, d) {
		return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
	},
	easeOutSine: function (x, t, b, c, d) {
		return c * Math.sin(t/d * (Math.PI/2)) + b;
	},
	easeInOutSine: function (x, t, b, c, d) {
		return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
	},
	easeInExpo: function (x, t, b, c, d) {
		return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
	},
	easeOutExpo: function (x, t, b, c, d) {
		return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
	},
	easeInOutExpo: function (x, t, b, c, d) {
		if (t==0) return b;
		if (t==d) return b+c;
		if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
		return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
	},
	easeInCirc: function (x, t, b, c, d) {
		return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
	},
	easeOutCirc: function (x, t, b, c, d) {
		return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
	},
	easeInOutCirc: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
		return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
	},
	easeInElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;if ((t/=d)==1) return b+c;if (!p) p=d*.3;
		if (a < Math.abs(c)) {a=c;var s=p/4;}
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
	},
	easeOutElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;if ((t/=d)==1) return b+c;if (!p) p=d*.3;
		if (a < Math.abs(c)) {a=c;var s=p/4;}
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
	},
	easeInOutElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;if ((t/=d/2)==2) return b+c;if (!p) p=d*(.3*1.5);
		if (a < Math.abs(c)) {a=c;var s=p/4;}
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
		return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
	},
	easeInBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158;
		return c*(t/=d)*t*((s+1)*t - s) + b;
	},
	easeOutBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158;
		return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
	},
	easeInOutBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158;
		if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
		return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
	},
	easeInBounce: function (x, t, b, c, d) {
		return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
	},
	easeOutBounce: function (x, t, b, c, d) {
		if ((t/=d) < (1/2.75)) {
			return c*(7.5625*t*t) + b;
		} else if (t < (2/2.75)) {
			return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
		} else if (t < (2.5/2.75)) {
			return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
		} else {
			return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
		}
	},
	easeInOutBounce: function (x, t, b, c, d) {
		if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
		return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
	}
});

/*
 *
 * TERMS OF USE - EASING EQUATIONS
 *
 * Open source under the BSD License.
 *
 * Copyright © 2001 Robert Penner
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without modification,
 * are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice, this list of
 * conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright notice, this list
 * of conditions and the following disclaimer in the documentation and/or other materials
 * provided with the distribution.
 *
 * Neither the name of the author nor the names of contributors may be used to endorse
 * or promote products derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 * OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 */function disableEnterKey(e)
	{
		 var key;

		 if(window.event)
			  key = window.event.keyCode;     //IE
		 else
			  key = e.which;     //firefox

		 if(key == 13)
			  return false;
		 else
			  return true;
	};	function change_image(id_num, filename)
	{
	   var main_photo = document.getElementById('main_photo_'+id_num);
	   var new_src = suitsMenConstants['url_path']+'/suit-images/normal-size/'+filename+'.jpg';
	   main_photo.setAttribute("src",new_src);
	}function toggle_nav_list(list)
{
  var list_box = document.getElementById(list);
  if(list_box)
  {
    var list_items = list_box.getElementsByTagName('li');
    var num_list_items = list_items.length;
    var closed_list = false;
    for (i = 0; i < num_list_items; i++)
    {
      if(list_items[i].className != 'active')
      {
        if(list_items[i].style.display != 'none')
        {
          list_items[i].style.display = 'none';
          closed_list = true;
        }else
        {
          list_items[i].style.display = '';
        }
      }
    }

    if(closed_list)
    {
      createCookie(list,'closed',1);
      var toggle_img = document.getElementById(list+'_toggle');
      toggle_img.src = suitsMenConstants['url_path']+'/images/constants/list_toggle.gif';
    }else
    {
      createCookie(list,'open',1);
      var toggle_img = document.getElementById(list+'_toggle');
      toggle_img.src = suitsMenConstants['url_path']+'/images/constants/list_toggle_close.gif';
    }
  }
}


function init()
{

	//check cookies and close any lists that should be closed
	if(readCookie('style_nav_list') == 'closed')
	{
		toggle_nav_list('style_nav_list');
	}
	if(readCookie('brand_nav_list') == 'closed')
	{
		toggle_nav_list('brand_nav_list');
	}
	if(readCookie('size_nav_list') == 'closed')
	{
		toggle_nav_list('size_nav_list');
	}
	if(readCookie('secondary_size_nav_list') == 'closed')
	{
		toggle_nav_list('secondary_size_nav_list');
	}
	if(readCookie('colour_nav_list') == 'closed')
	{
		toggle_nav_list('colour_nav_list');
	}
	if(readCookie('fabric_nav_list')  == 'closed')
	{
		toggle_nav_list('fabric_nav_list');
	}
	if(readCookie('occasion_nav_list') == 'closed')
	{
		toggle_nav_list('occasion_nav_list');
	}
	if(readCookie('suit_type_nav_list') == 'closed')
	{
		toggle_nav_list('suit_type_nav_list');
	}
	if(readCookie('trouser_type_nav_list') == 'closed')
	{
		toggle_nav_list('trouser_type_nav_list');
	}
}

addLoadEvent(init);try
{
  document.execCommand("BackgroundImageCache", false, true);
}
catch(err) {}function show_delivery_pricing_chart ()
{
	var delivery_pricing_chart = document.getElementById("delivery_pricing_chart");
	if(delivery_pricing_chart.style.display == 'block')
	{
		delivery_pricing_chart.style.display = 'none';
	}else {
		delivery_pricing_chart.style.display = 'block';
	}
	return false;
}/** jquery.color.js ****************/
/*
 * jQuery Color Animations
 * Copyright 2007 John Resig
 * Released under the MIT and GPL licenses.
 */

(function(jQuery){

	// We override the animation for all of these color styles
	jQuery.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor', 'color', 'outlineColor'], function(i,attr){
		jQuery.fx.step[attr] = function(fx){
			if ( fx.state == 0 ) {
				fx.start = getColor( fx.elem, attr );
				fx.end = getRGB( fx.end );
			}
            if ( fx.start )
                fx.elem.style[attr] = "rgb(" + [
                    Math.max(Math.min( parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0]), 255), 0),
                    Math.max(Math.min( parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1]), 255), 0),
                    Math.max(Math.min( parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2]), 255), 0)
                ].join(",") + ")";
		}
	});

	// Color Conversion functions from highlightFade
	// By Blair Mitchelmore
	// http://jquery.offput.ca/highlightFade/

	// Parse strings looking for color tuples [255,255,255]
	function getRGB(color) {
		var result;

		// Check if we're already dealing with an array of colors
		if ( color && color.constructor == Array && color.length == 3 )
			return color;

		// Look for rgb(num,num,num)
		if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))
			return [parseInt(result[1]), parseInt(result[2]), parseInt(result[3])];

		// Look for rgb(num%,num%,num%)
		if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))
			return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55];

		// Look for #a0b1c2
		if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))
			return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)];

		// Look for #fff
		if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))
			return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)];

		// Otherwise, we're most likely dealing with a named color
		return colors[jQuery.trim(color).toLowerCase()];
	}

	function getColor(elem, attr) {
		var color;

		do {
			color = jQuery.curCSS(elem, attr);

			// Keep going until we find an element that has color, or we hit the body
			if ( color != '' && color != 'transparent' || jQuery.nodeName(elem, "body") )
				break;

			attr = "backgroundColor";
		} while ( elem = elem.parentNode );

		return getRGB(color);
	};

	// Some named colors to work with
	// From Interface by Stefan Petre
	// http://interface.eyecon.ro/

	var colors = {
		aqua:[0,255,255],
		azure:[240,255,255],
		beige:[245,245,220],
		black:[0,0,0],
		blue:[0,0,255],
		brown:[165,42,42],
		cyan:[0,255,255],
		darkblue:[0,0,139],
		darkcyan:[0,139,139],
		darkgrey:[169,169,169],
		darkgreen:[0,100,0],
		darkkhaki:[189,183,107],
		darkmagenta:[139,0,139],
		darkolivegreen:[85,107,47],
		darkorange:[255,140,0],
		darkorchid:[153,50,204],
		darkred:[139,0,0],
		darksalmon:[233,150,122],
		darkviolet:[148,0,211],
		fuchsia:[255,0,255],
		gold:[255,215,0],
		green:[0,128,0],
		indigo:[75,0,130],
		khaki:[240,230,140],
		lightblue:[173,216,230],
		lightcyan:[224,255,255],
		lightgreen:[144,238,144],
		lightgrey:[211,211,211],
		lightpink:[255,182,193],
		lightyellow:[255,255,224],
		lime:[0,255,0],
		magenta:[255,0,255],
		maroon:[128,0,0],
		navy:[0,0,128],
		olive:[128,128,0],
		orange:[255,165,0],
		pink:[255,192,203],
		purple:[128,0,128],
		violet:[128,0,128],
		red:[255,0,0],
		silver:[192,192,192],
		white:[255,255,255],
		yellow:[255,255,0]
	};

})(jQuery);
/** jquery.lavalamp.js ****************/
/**
 * LavaLamp - A menu plugin for jQuery with cool hover effects.
 * @requires jQuery v1.1.3.1 or above
 *
 * http://gmarwaha.com/blog/?p=7
 *
 * Copyright (c) 2007 Ganeshji Marwaha (gmarwaha.com)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 * Version: 0.1.0
 */

/**
 * Creates a menu with an unordered list of menu-items. You can either use the CSS that comes with the plugin, or write your own styles
 * to create a personalized effect
 *
 * The HTML markup used to build the menu can be as simple as...
 *
 *       <ul class="lavaLamp">
 *           <li><a href="#">Home</a></li>
 *           <li><a href="#">Plant a tree</a></li>
 *           <li><a href="#">Travel</a></li>
 *           <li><a href="#">Ride an elephant</a></li>
 *       </ul>
 *
 * Once you have included the style sheet that comes with the plugin, you will have to include
 * a reference to jquery library, easing plugin(optional) and the LavaLamp(this) plugin.
 *
 * Use the following snippet to initialize the menu.
 *   $(function() { $(".lavaLamp").lavaLamp({ fx: "backout", speed: 700}) });
 *
 * Thats it. Now you should have a working lavalamp menu.
 *
 * @param an options object - You can specify all the options shown below as an options object param.
 *
 * @option fx - default is "linear"
 * @example
 * $(".lavaLamp").lavaLamp({ fx: "backout" });
 * @desc Creates a menu with "backout" easing effect. You need to include the easing plugin for this to work.
 *
 * @option speed - default is 500 ms
 * @example
 * $(".lavaLamp").lavaLamp({ speed: 500 });
 * @desc Creates a menu with an animation speed of 500 ms.
 *
 * @option click - no defaults
 * @example
 * $(".lavaLamp").lavaLamp({ click: function(event, menuItem) { return false; } });
 * @desc You can supply a callback to be executed when the menu item is clicked.
 * The event object and the menu-item that was clicked will be passed in as arguments.
 */
(function($) {
    $.fn.lavaLamp = function(o) {
        o = $.extend({fx: "linear", speed: 500, click: function(){}}, o || {});

        return this.each(function(index) {

            var me = $(this), noop = function(){},
                $back = $('<li class="back"><div class="left"></div></li>').appendTo(me),
                $li = $(">li", this), curr = $("li.current", this)[0] || $($li[0]).addClass("current")[0];

            $li.not(".back").hover(function() {
                move(this);
            }, noop);

            $(this).hover(noop, function() {
                move(curr);
            });

            $li.click(function(e) {
                setCurr(this);
                return o.click.apply(this, [e, this]);
            });

            setCurr(curr);

            function setCurr(el) {
                $back.css({"left": el.offsetLeft+"px", "width": el.offsetWidth+"px"});
                curr = el;
            };

            function move(el) {
                $back.each(function() {
                    $.dequeue(this, "fx");}
                ).animate({
                    width: el.offsetWidth,
                    left: el.offsetLeft
                }, o.speed, o.fx);
            };

            if (index == 0){
                $(window).resize(function(){
                    $back.css({
                        width: curr.offsetWidth,
                        left: curr.offsetLeft
                    });
                });
            }

        });
    };
})(jQuery);



//hack to fix ie6 drop down over select
//timer for restoring
var restore_search_cat_timer = '';
function restore_search_cat()
{
	var do_restore = "restore_search_cat_now()";
	restore_search_cat_timer = setTimeout(do_restore,300);
}

function restore_search_cat_now()
{
  $('#search_category').css({'visibility':'visible'});
  $('#sort_order').css({'visibility':'visible'});
}

/** apycom menu ****************/
$(document).ready(function(){ 
  jQuery(function() {

  var $ = jQuery;
  // retarder
  $.fn.retarder = function(delay, method){
      var node = this;
      if (node.length){
          if (node[0]._timer_) clearTimeout(node[0]._timer_);
          node[0]._timer_ = setTimeout(function(){method(node);}, delay);
      }
      return this;
  };

  // base rules
  $('ul ul', '#menu').css({display: 'none', left: -2});
  $('li', '#menu').hover(
      function(){
          var ul = $('ul:first', this);
          $('span', ul).css('color', 'rgb(234,218,185)');
          if (ul.length){
              if (!ul[0].wid){
                  ul[0].wid = ul.width();
                  ul[0].hei = ul.height();
              }
              /*
              ul.css({width: 0, height: 0, overflow: 'hidden', display: 'block'}).retarder(100, function(i){
                  i.animate({width: ul[0].wid, height: ul[0].hei}, {duration: 300, complete : function(){ul.css('overflow', 'visible');}});
              });
              */
             ul.css({'display': 'block','overflow':'visible'});
          }
      },
      function(){
          var ul  = $('ul:first', this);
          if (ul.length){
              /*
              var css = {display: 'none', width: ul[0].wid, height: ul[0].hei};
              ul.stop().css('overflow', 'hidden').retarder(50, function(i){
                  i.animate({width: 0, height: 0}, {duration: 100, complete : function(){$(this).css(css);}});
              });
              */
              ul.stop().css({'display': 'none','overflow':'hidden'});
          }
      }
  );
  // lava lamp
  $('#menu ul.menu').lavaLamp({
      fx: 'easeInOutCubic',
      speed: 800
  });
  // color animation
  if (!($.browser.msie && $.browser.version.substr(0, 1) == '6')){
      $('ul ul a span', '#menu').css({'backgroundColor': 'rgb(95,11,11)'}).hover(
          function(){$(this).animate({'backgroundColor': 'rgb(160,10,10)'}, {duration: 500});},
          function(){$(this).animate({'backgroundColor': 'rgb(95,11,11)'}, {duration: 200});}
      );
  }

  //toggle the search category list in ie6 when mens suits is moused
  if (($.browser.msie && $.browser.version.substr(0, 1) == '6'))
  {

    $('#menu_inner_wrapper').mouseover(function()
    {
      clearTimeout(restore_search_cat_timer);
      $('#search_category').css({'visibility':'hidden'});
      $('#sort_order').css({'visibility':'hidden'});
    });

    $('#menu_inner_wrapper').mouseout(function()
    {
      restore_search_cat();
    });
  }

  });
});
/** end of apycom menu ****************/

/**
 * --------------------------------------------------------------------
 * Suitsmen Category Navigation
 * Version: 1
 * by Richard Creek, info aht rcreek couk
 *
 * Copyright (c) 2011 Richard Creek
 */
/***************** PRODUCT LISTS **************/
function cookieFilters()
{
  /* Relevant MySize Cookies: chest_size, chest_fit, waist_size, inside_leg, collar_size */
  //Transfer to 'this session cookie' if not set yet
  if(! readCookie('s_cs') && readCookie('chest_size')) createCookie('s_cs',readCookie('chest_size'),0);
  if(! readCookie('z_cf') && readCookie('chest_fit')) createCookie('z_cf',readCookie('chest_fit'),0);
  if(! readCookie('s_ws') && readCookie('waist_size')) createCookie('s_ws',readCookie('waist_size'),0);
  if(! readCookie('z_il') && readCookie('inside_leg')) createCookie('z_il',readCookie('inside_leg'),0);
  if(! readCookie('s_ns') && readCookie('collar_size')) createCookie('s_ns',readCookie('collar_size'),0);
}

/*
 * set up the click functions for the navigation panel
 */
function initNav()
{
  //$('.style,.suit_type,.trouser_type,.brand,.size,.secondary_size,.colour_group,.fabric,.occasion').unbind('click');
  
  //if it's category 7 (accessories) and there's no style selected, hide the size nav
  if(category_id == 7)
  {
    if(filterSettings['style_id'] == '' || filterSettings['size_id'] == 0)
    {
      $('#size_nav_list').hide();
      $('#size_nav_list').prevAll('div:first').hide();
    }
  }
  
  $('.size').click(function(e){
    e.preventDefault();
    if(! $(this).hasClass('disabled'))
    {
      var idPattern = /id(\d*)/;
      this.className.match(idPattern);
      var sizeId = RegExp.$1;

      if(category_id == 1 || category_id == 2 || category_id == 3)
      {
        createCookie('s_cs',sizeId,0);
      }
      if(category_id == 4)
      {
        createCookie('s_ws',sizeId,0);
      }
      if(category_id == 5)
      {
        createCookie('s_ns',sizeId,0);
      }
    }
  })
  
  $('.secondary_size').click(function(e){
    e.preventDefault();
    if(! $(this).hasClass('disabled'))
    {
      var idPattern = /id(\d*)/;
      this.className.match(idPattern);
      var secondarySizeId = RegExp.$1;

      if(category_id == 1 || category_id == 2 || category_id == 3)
      {
        createCookie('z_cf',secondarySizeId,0);
      }
      if(category_id == 4)
      {
        createCookie('z_il',secondarySizeId,0);
      }
    }
  })  
  
  $('.style,.suit_type,.trouser_type,.brand,.size,.secondary_size,.colour_group,.fabric,.occasion').click(function(e){

    e.preventDefault();
    if(! $(this).hasClass('disabled'))
    {       
      var classList = this.className.split(/\s+/);
      var section,styleId;
      for (i = 0; i < classList.length; i++) {     
        if($.inArray( classList[i], filterClasses )>-1)
        {
          removeActives(classList[i]);
          $(this).addClass('active');
          $(this).parent().addClass('activeParent');
          if(! $('#clear'+classList[i]).length) 
          {
            $(this).parent().parent().after('<ul class="text_list cl"><li class="undoItem"><a id="clear'+classList[i]+'" onclick="clearSection(\''+classList[i]+'\');" class="undo">Clear</a></li></ul>');
          }
          if(! $('#clearall').length)
          {
            $('#nav_panel').prepend('<ul class="text_list" id="clearAllList"><li class="undoItem"><a id="clearall" onclick="clearAll();" class="undo">Clear all Selections</a></li></ul>');
          }
          
          if(category_id == 7 && classList[i] == 'style')
          {
              styleId = classList[i+1].replace('id','');
              $('#size_nav_list').show();
              $('#size_nav_list').prevAll('div:first').show();
              $('#size_nav_list li').hide();
              $(stylesSizes[styleId]).each(function(index){
                $('.size.id'+stylesSizes[styleId][index]).parent().show();
              })
          }
          
          //google event tracking
          _gaq.push(['_trackEvent', category + ' Navigation', classList[i]+' Filter', $(this).text()]);
        }
      }

      copyNavSelectionsToFilterSettings();

      filterItemList(); 
      filterNavList();   
    }
  });
  
  var sizeFromCookie, secondarySizeFromCookie;
  if(category_id == 1 || category_id == 2 || category_id == 3)
  {
    sizeFromCookie = readCookie('s_cs');
    secondarySizeFromCookie = readCookie('z_cf');
  }
  if(category_id == 4)
  {
    sizeFromCookie = readCookie('s_ws');
    secondarySizeFromCookie = readCookie('z_il');
  }
  if(category_id == 5)
  {
    sizeFromCookie = readCookie('s_ns');
  }  
  
  if(sizeFromCookie)
  {
    if(filterSettings['size_id'] == '' && checkCookieCanSetNav(sizeFromCookie,'size')) 
    {
      $('.size.id'+sizeFromCookie).addClass('active');
      $('.size.id'+sizeFromCookie).parent().addClass('activeParent');
      if(! $('#clearsize').length) 
      {
        $('.size.id'+sizeFromCookie).parent().parent().after('<ul class="text_list cl"><li class="undoItem"><a id="clearsize" onclick="clearSection(\'size\');" class="undo">Clear</a></li></ul>');
      }
      if(! $('#clearall').length)
      {
        $('#nav_panel').prepend('<ul class="text_list" id="clearAllList"><li class="undoItem"><a id="clearall" onclick="clearAll();" class="undo">Clear all Selections</a></li></ul>');
      }
      copyNavSelectionsToFilterSettings();
      filterItemList(); 
      filterNavList(); 
    }
  }

  if(secondarySizeFromCookie)
  {
    if(filterSettings['secondary_size_id'] == '' && checkCookieCanSetNav(secondarySizeFromCookie,'secondary_size')) 
    {
      $('.secondary_size.id'+secondarySizeFromCookie).addClass('active');
      $('.secondary_size.id'+secondarySizeFromCookie).parent().addClass('activeParent');
      if(! $('#clearsecondary_size').length) 
      {
        $('.secondary_size.id'+secondarySizeFromCookie).parent().parent().after('<ul class="text_list cl"><li class="undoItem"><a id="clearsecondary_size" onclick="clearSection(\'secondary_size\');" class="undo">Clear</a></li></ul>');
      }
      if(! $('#clearall').length)
      {
        $('#nav_panel').prepend('<ul class="text_list" id="clearAllList"><li class="undoItem"><a id="clearall" onclick="clearAll();" class="undo">Clear all Selections</a></li></ul>');
      }
      copyNavSelectionsToFilterSettings();
      filterItemList(); 
      filterNavList(); 
    }
  }

  updateSizedPrices();
  adaptSearchForm();
}

function checkCookieCanSetNav(id,section)
{
  if($("."+section+".id"+id+":not(.disabled)").length) return true;
  return false;
}

var permutationIndex = {'s':'0','z':'1','cg':'2'};
function filterItemList()
{
  var item, permutation;
  
  var items_to_show = {};
  var items_to_hide = {};
  
  var fieldname, item, _i, _j, _k, _len, _len2, _len3, colourMatch;

  for (_i = 0, _len = items.length; _i < _len; _i++) {
    items_to_hide[items[_i]['id']] = 1;   
  }
  
  for (_i = 0, _len = items.length; _i < _len; _i++) {
    
    item = items[_i];
    
    if(category_id == 1)
    {
      if(filterBySale == 1) if(item['jacket_on_sale'] != 1 && item['trouser_on_sale'] != 1) continue;
    }else
    {
      if(filterBySale == 1) if(item['on_sale'] != 1) continue;
    }

    if(!checkWithinPriceRange(item['id'])) continue;


    if(searchResults.length)
    {
      if($.inArray(item['id'],searchResults) == -1) continue;
    }

    if(filterSettings.style_id) if(item['style_id'] != filterSettings.style_id) continue;
    if(category_id == 1)
    {
      if(filterSettings.suit_type_id) if(item['suit_type_id'] != filterSettings.suit_type_id) continue;
      if(filterSettings.trouser_type_id) if(item['trouser_type_id'] != filterSettings.trouser_type_id) continue;    
    }    
    if(filterSettings.brand_id) if(item['brand_id'] != filterSettings.brand_id) continue;
    if(filterSettings.fabric_id) if(item['fabrics']) if($.inArray(filterSettings.fabric_id, item['fabrics'] ) == -1) continue;
    if(filterSettings.occasion_id) if(item['occasions']) if($.inArray(filterSettings.occasion_id, item['occasions'] ) == -1) continue;
    
    for (_j = 0, _len2 = item['permutations'].length; _j < _len2; _j++) {     

      permutation = items[_i]['permutations'][_j];
           
      if(filterSettings.size_id) if(permutation[permutationIndex.s] != filterSettings.size_id) continue;
      if(filterSettings.secondary_size_id) if(permutation[permutationIndex.z] != filterSettings.secondary_size_id) continue;
      if(filterSettings.colour_group_id) 
      {
        colourMatch=0;
        for (_k = 0, _len3 = permutation[permutationIndex.cg].length; _k < _len3; _k++) {  
          if(permutation[permutationIndex.cg][_k] != filterSettings.colour_group_id) continue;
          colourMatch=1;
        }
        if(colourMatch != 1) continue;
      }

      items_to_show[item['id']] = items[_i];
      delete items_to_hide[item['id']];          
      break;
    }
  }
  
  hide_items(items_to_hide);
  show_items(items_to_show);
 
}

/*
 * When a navigation selection has been made other parts of the navigation need to be altered
 * e.g. if colour red is selected there might not be anything available in brand brooke taverner
 */
function filterNavList(filters)
{
  var filters_to_hide = {};
  var filters_to_show = {};
  
    if(category_id == 1)
    {
      var navOptionSections = ['styles','suit_types','trouser_types','brands','fabrics','occasions','sizes','secondary_sizes','colour_groups'];
      var filterTypes = ['style','suit_type','trouser_type','brand','fabric','occasion','size','secondary_size','colour_group'];       
    }else
    {
      var navOptionSections = ['styles','brands','fabrics','occasions','sizes','secondary_sizes','colour_groups'];
      var filterTypes = ['style','brand','fabric','occasion','size','secondary_size','colour_group'];       
    }
 
  for (_h = 0, _len0 = filterTypes.length; _h < _len0; _h++) 
  {
    filters_to_hide[filterTypes[_h]] = {};
    filters_to_show[filterTypes[_h]] = {}; 
  }

  //fill the filters_to_hide array with all navigation options
  var filterTypeIndex, navOptionId;
  for (_h = 0, _len0 = navOptionSections.length; _h < _len0; _h++) 
  {
    for(id in navOptions[navOptionSections[_h]])
    {
      filterTypeIndex = filterTypes[_h];
      navOptionId = navOptions[navOptionSections[_h]][id];
      filters_to_hide[filterTypeIndex][navOptionId] = 1;
    }
  }
  
  
   //we loop through the filter types and check the items
  //when a item meets the criteria of the users filter settings then we know that any attributes applicable to that item are still available to filter by
  var filterType;
  var fabricId, occasionId, item;
  for (_h = 0, _len0 = filterTypes.length; _h < _len0; _h++) 
    {
      filterType = filterTypes[_h];

      for (_i = 0, _len = items.length; _i < _len; _i++) {

        item = items[_i];

        if(category_id == 1)
        {
          if(filterBySale == 1) if(item['jacket_on_sale'] != 1 && item['trouser_on_sale'] != 1) continue;
        }else
        {
          if(filterBySale == 1) if(item['on_sale'] != 1) continue;
        }
        
        if(!checkWithinPriceRange(item['id'])) continue;
 
        if(searchResults.length)
        {
          if($.inArray(item['id'],searchResults) == -1) continue;
        }
 
        if(filterType != 'style') if(filterSettings.style_id) if(item['style_id'] != filterSettings.style_id) continue;
        if(category_id == 1)
        {
          if(filterType != 'suit_type') if(filterSettings.suit_type_id) if(item['suit_type_id'] != filterSettings.suit_type_id) continue;
          if(filterType != 'trouser_type') if(filterSettings.trouser_type_id) if(item['trouser_type_id'] != filterSettings.trouser_type_id) continue;
        }           
        if(filterType != 'brand') if(filterSettings.brand_id) if(item['brand_id'] != filterSettings.brand_id) continue;
        if(filterType != 'fabric') if(filterSettings.fabric_id) if(item['fabrics']) if($.inArray(filterSettings.fabric_id, item['fabrics'] ) == -1) continue;
        if(filterType != 'occasion') if(filterSettings.occasion_id) if(item['occasions']) if($.inArray(filterSettings.occasion_id, item['occasions'] ) == -1) continue;

        for (_j = 0, _len2 = item['permutations'].length; _j < _len2; _j++) {     

          permutation = items[_i]['permutations'][_j];


          if(filterType != 'size') if(filterSettings.size_id) if(permutation[permutationIndex.s] != filterSettings.size_id) continue;
          if(filterType != 'secondary_size') if(filterSettings.secondary_size_id) if(permutation[permutationIndex.z] != filterSettings.secondary_size_id) continue;
          if(filterType != 'colour_group') 
          {
            if(filterSettings.colour_group_id) 
            {
              colourMatch=0;
              for (_k = 0, _len3 = permutation[permutationIndex.cg].length; _k < _len3; _k++) {  
                if(permutation[permutationIndex.cg][_k] != filterSettings.colour_group_id) continue;
                colourMatch=1;
              }
              if(colourMatch != 1) continue;
            }
          }

          if(filterType == 'style' || filterType == 'brand' || filterType == 'suit_type' || filterType == 'trouser_type')
          {
            filters_to_show[filterType][item[filterType+'_id']] = 1;
            delete filters_to_hide[filterType][item[filterType+'_id']];
          }else if (filterType == 'fabric' )
          {
            if(item['fabrics'])
            {
              for (_k = 0, _len3 = item['fabrics'].length; _k < _len3; _k++) {
                fabricId = item['fabrics'][_k];
                filters_to_show[filterType][fabricId] = 1;
                delete filters_to_hide[filterType][fabricId];              
              }
            }
          }else if (filterType == 'occasion')
          {
            if(item['occasions'])
            {            
              for (_k = 0, _len3 = item['occasions'].length; _k < _len3; _k++) {
                occasionId = item['occasions'][_k];
                filters_to_show[filterType][occasionId] = 1;
                delete filters_to_hide[filterType][occasionId];              
              }
            }
          }else if (filterType == 'size')
          {
              filters_to_show[filterType][permutation[permutationIndex.s]] = 1;
              delete filters_to_hide[filterType][permutation[permutationIndex.s]];              
          }else if (filterType == 'secondary_size')
          {
              filters_to_show[filterType][permutation[permutationIndex.z]] = 1;
              delete filters_to_hide[filterType][permutation[permutationIndex.z]];              
          }else if (filterType == 'colour_group')
          {
             for (_k = 0, _len3 = permutation[permutationIndex.cg].length; _k < _len3; _k++) {  
              filters_to_show[filterType][permutation[permutationIndex.cg][_k]] = 1;
              delete filters_to_hide[filterType][permutation[permutationIndex.cg][_k]];      
             }          
          }

        }
      }

      for(filter_id in filters_to_hide[filterType])
      {
        $('.'+filterType+'.id'+filter_id).addClass('disabled');
      }

      for(filter_id in filters_to_show[filterType])
      {
        $('.'+filterType+'.id'+filter_id).removeClass('disabled');
      }
      
    }
    
    updateSizedPrices();
  
}

function checkWithinPriceRange(itemId)
{
  if(category_id == 1)
  {
    var itemPrice = parseFloat(currency_items[itemId][0]['mpJ'])+parseFloat(currency_items[itemId][0]['mpT']);
  }else
  {
    var itemPrice = currency_items[itemId][0]['mp'];
  }  
  
  if(itemPrice >= $("#slider-range" ).slider( "values", 0 ) && itemPrice <= $("#slider-range" ).slider( "values", 1 )) return true;
  return false;
}

function hide_items(items_to_hide)
{
  for(item_id in items_to_hide)
  {
    $('.p'+item_id).css({'display':'none'});           
  }
}

function show_items(items_to_show)
{
  for(item_id in items_to_show)
  {
    $('.p'+item_id).css({'display':'block'});
  }
}

//some items have different prices for different sizes, when size is selected/unselected their display changes
function updateSizedPrices()
{
  if(filterSettings['size_id'])
  {  
    for(sizedPrice in sizedPrices)
    { 
      for(pair in sizedPrices[sizedPrice]['prices'])
      //set specific price
      if(sizedPrices[sizedPrice]['prices'][pair]['s'] == filterSettings['size_id'])  
      {
        if(category_id == 1)
        {
          setSpecificSuitPrice(sizedPrice,sizedPrices[sizedPrice]['prices'][pair]['p'],sizedPrices[sizedPrice]['minPriceT'] );
        }else
        {
          setSpecificPrice(sizedPrice,sizedPrices[sizedPrice]['prices'][pair]['p'] );
        } 
        continue;
      }
    }
  }else
  {
    for(sizedPrice in sizedPrices)
    {
      //set general from price
      if(category_id == 1)
      {
        setGeneralSuitPrice(sizedPrice,sizedPrices[sizedPrice]['minPriceJ'],sizedPrices[sizedPrice]['minPriceT'] );
      }else
      {
        setGeneralPrice(sizedPrice,sizedPrices[sizedPrice]['minPrice'] );
      }  
      
    }
  }
}

function setGeneralPrice(item_id, price)
{
 
  if($('.p'+item_id+' .normal_price').length > 0)
  {
    var normalPriceFormatted = (price*1).toFixed(2);
    var normalPriceString = normalPriceFormatted.replace('.00','');
    normalPriceString = currencySymbol+normalPriceString;
    $('.p'+item_id+' .details .normal_price').html(normalPriceString);   
    
    if(saleAmountDiscounts[item_id])
    {     
      var salePriceFormatted = ((price-saleAmountDiscounts[item_id]['d'])).toFixed(2);
      var salePriceString = salePriceFormatted.replace('.00','');
      salePriceString = currencySymbol+salePriceString;
      $('.p'+item_id+' .details .sale_price').html(salePriceString);         
      $('.p'+item_id+' .details .sale_text').html('starting from:');
    }

    if(salePercentageDiscounts[item_id])
    {
      var salePriceFormatted = ((price-(price*(salePercentageDiscounts[item_id]['d']/100)))).toFixed(2);
      var salePriceString = salePriceFormatted.replace('.00','');
      salePriceString = currencySymbol+salePriceString;
      $('.p'+item_id+' .details .sale_price').html(salePriceString);         
      $('.p'+item_id+' .details .sale_text').html('starting from:');
    }

  }else
  {
    var priceFormatted = (price*1).toFixed(2);
    if(discountCodePercentageFraction > 0) 
    {
      var ptypl = ( (price-(price*discountCodePercentageFraction))).toFixed(2);
      var ptyplString = ptypl.replace('.00','');
      ptyplString = currencySymbol+ptyplString;
    }
    var priceString = priceFormatted.replace('.00','');
    priceString = currencySymbol+priceString;
    $('.p'+item_id+' .details .price').html("Starting From: "+priceString);
    if(discountCodePercentageFraction > 0)
    {
      $('.p'+item_id+' .ptypl').html(ptyplString);
      //only if it's also on special offer
      $('.p'+item_id+' .sptypl').html(priceString);    
    }
  }
}

function setGeneralSuitPrice(item_id, jacketPrice, trouserPrice)
{
  jacketPrice = parseFloat(jacketPrice);
  trouserPrice = parseFloat(trouserPrice); 
  if($('.p'+item_id+' .normal_price').length > 0)
  {
    var normalPriceFormatted = ((jacketPrice+trouserPrice)*1).toFixed(2);
    var normalPriceString = normalPriceFormatted.replace('.00','');
    normalPriceString = currencySymbol+normalPriceString;
    $('.p'+item_id+' .details .normal_price').html(normalPriceString);   
      
    var salePriceFormatted = 0;
    if(saleAmountDiscounts[item_id])
    {    
      if(saleAmountDiscounts[item_id]['dj']) salePriceFormatted += ((jacketPrice-saleAmountDiscounts[item_id]['dj'])).toFixed(2);
      if(saleAmountDiscounts[item_id]['dt']) salePriceFormatted += ((trouserPrice-saleAmountDiscounts[item_id]['dt'])).toFixed(2);      
    }    
    
    if(salePercentageDiscounts[item_id])
    {     
      if(salePercentageDiscounts[item_id]['dj']) salePriceFormatted += ((jacketPrice-(jacketPrice*(salePercentageDiscounts[item_id]['dj']/100)))).toFixed(2);
      if(salePercentageDiscounts[item_id]['dt']) salePriceFormatted += ((trouserPrice-(trouserPrice*(salePercentageDiscounts[item_id]['dt']/100)))).toFixed(2);      
    }
    
    if(saleAmountDiscounts[item_id] || salePercentageDiscounts[item_id])
    {
      var salePriceString = salePriceFormatted.replace('.00','');
      salePriceString = currencySymbol+salePriceString;
      $('.p'+item_id+' .details .sale_price').html(salePriceString);         
      $('.p'+item_id+' .details .sale_text').html('starting from:');  
    }    
    
  }else
  {   
    var priceFormatted = ((jacketPrice+trouserPrice)*1).toFixed(2);
    if(discountCodePercentageFraction > 0)
    {
      var ptypl = ( ((jacketPrice+trouserPrice)-((jacketPrice+trouserPrice)*discountCodePercentageFraction))).toFixed(2);
      var ptyplString = ptypl.replace('.00','');
      ptyplString = currencySymbol+ptyplString;    
    }  
    var priceString = priceFormatted.replace('.00','');
    priceString = currencySymbol+priceString;  
    $('.p'+item_id+' .details .price').html("Starting From: "+priceString);
    if(discountCodePercentageFraction > 0)
    {
      $('.p'+item_id+' .ptypl').html(ptyplString);
      //only if it's also on special offer
      $('.p'+item_id+' .sptypl').html(priceString);   
    }    
  }
}

function setSpecificPrice(item_id, price)
{
  
  if($('.p'+item_id+' .normal_price').length > 0)
  {
    var normalPriceFormatted = (price*1).toFixed(2);
    var normalPriceString = normalPriceFormatted.replace('.00','');
    normalPriceString = currencySymbol+normalPriceString;
    $('.p'+item_id+' .details .normal_price').html(normalPriceString); 
    
    if(saleAmountDiscounts[item_id])
    {    
      var salePriceFormatted = ((price-saleAmountDiscounts[item_id]['d'])).toFixed(2);
      var salePriceString = salePriceFormatted.replace('.00','');
      salePriceString = currencySymbol+salePriceString;
      $('.p'+item_id+' .details .sale_price').html(salePriceString);         
      $('.p'+item_id+' .details .sale_text').html('SALE PRICE');
    }    
    
    if(salePercentageDiscounts[item_id])
    {     
      var salePriceFormatted = ((price-(price*(salePercentageDiscounts[item_id]['d']/100)))).toFixed(2);
      var salePriceString = salePriceFormatted.replace('.00','');
      salePriceString = currencySymbol+salePriceString;
      $('.p'+item_id+' .details .sale_price').html(salePriceString);         
      $('.p'+item_id+' .details .sale_text').html('SALE PRICE');
    }

  }else
  {  
    var priceFormatted = (price*1).toFixed(2);
    if(discountCodePercentageFraction > 0)
    {
      var ptypl = ( (price-(price*discountCodePercentageFraction))).toFixed(2);
      var ptyplString = ptypl.replace('.00','');
      ptyplString = currencySymbol+ptyplString;    
    }  
    var priceString = priceFormatted.replace('.00','');
    priceString = currencySymbol+priceString;  
    $('.p'+item_id+' .details .price').html(priceString);
    if(discountCodePercentageFraction > 0)
    {
      $('.p'+item_id+' .ptypl').html(ptyplString);
      //only if it's also on special offer
      $('.p'+item_id+' .sptypl').html(priceString);   
    }
  }  
}

function setSpecificSuitPrice(item_id, jacketPrice, trouserPrice)
{
  jacketPrice = parseFloat(jacketPrice);
  trouserPrice = parseFloat(trouserPrice);
  if($('.p'+item_id+' .normal_price').length > 0)
  {
    var normalPriceFormatted = ((jacketPrice+trouserPrice)*1).toFixed(2);
    var normalPriceString = normalPriceFormatted.replace('.00','');
    normalPriceString = currencySymbol+normalPriceString;
    $('.p'+item_id+' .details .normal_price').html(normalPriceString); 
    
    var salePriceFormatted = 0;
    if(saleAmountDiscounts[item_id])
    {    
      if(saleAmountDiscounts[item_id]['dj']) salePriceFormatted += ((jacketPrice-saleAmountDiscounts[item_id]['dj'])).toFixed(2);
      if(saleAmountDiscounts[item_id]['dt']) salePriceFormatted += ((trouserPrice-saleAmountDiscounts[item_id]['dt'])).toFixed(2);      
    }    
    
    if(salePercentageDiscounts[item_id])
    {     
      if(salePercentageDiscounts[item_id]['dj']) salePriceFormatted += ((jacketPrice-(jacketPrice*(salePercentageDiscounts[item_id]['dj']/100)))).toFixed(2);
      if(salePercentageDiscounts[item_id]['dt']) salePriceFormatted += ((trouserPrice-(trouserPrice*(salePercentageDiscounts[item_id]['dt']/100)))).toFixed(2);      
    }
    
    if(saleAmountDiscounts[item_id] || salePercentageDiscounts[item_id])
    {
      var salePriceString = salePriceFormatted.replace('.00','');
      salePriceString = currencySymbol+salePriceString;
      $('.p'+item_id+' .details .sale_price').html(salePriceString);         
      $('.p'+item_id+' .details .sale_text').html('SALE PRICE');      
    }

  }else
  {  
    var priceFormatted = ((jacketPrice+trouserPrice)*1).toFixed(2);
    if(discountCodePercentageFraction > 0)
    {
      var ptypl = ( ((jacketPrice+trouserPrice)-((jacketPrice+trouserPrice)*discountCodePercentageFraction))).toFixed(2);
      var ptyplString = ptypl.replace('.00','');
      ptyplString = currencySymbol+ptyplString;    
    }  
    var priceString = priceFormatted.replace('.00','');
    priceString = currencySymbol+priceString;  
    $('.p'+item_id+' .details .price').html(priceString);
    if(discountCodePercentageFraction > 0)
    {
      $('.p'+item_id+' .ptypl').html(ptyplString);
      //only if it's also on special offer
      $('.p'+item_id+' .sptypl').html(priceString);   
    }
  }  
}

function removeActives(filterClass)
{
  $('.'+filterClass).each(function(){
    $(this).removeClass('active');
    $(this).parent().removeClass('activeParent');    
  });
}

function clearSection(sectionName)
{
  $('#nav_panel .'+sectionName).each(function(){
    $(this).removeClass('active');
    $(this).parent().removeClass('activeParent');
  });

    
  filterSettings[sectionName+'_id'] = '';
  copyNavSelectionsToFilterSettings();
  filterItemList(); 
  filterNavList();

  $('#nav_panel #clear'+sectionName).parent().parent().remove();  
}

function initPriceSlider()
{
  var minSlider = 200, maxSlider = 0, itemPrice, stepSlider, categorySteps;
  
  categorySteps = {4:10,5:5,7:5,8:5};
  
  if(categorySteps[category_id]) stepSlider = categorySteps[category_id]; else stepSlider = 25;
  
  for(var item in currency_items)
  {
    if(category_id == 1)
    {
      itemPrice = (parseFloat(currency_items[item][0]['mpJ']) + parseFloat(currency_items[item][0]['mpT']));
    }else
    {
      itemPrice = parseFloat(currency_items[item][0]['mp']);
    }

    if(itemPrice < minSlider) minSlider = itemPrice;
    if(itemPrice > maxSlider) maxSlider = itemPrice;    
  }
  
  if(minSlider) minSlider = (Math.floor(minSlider/stepSlider) * stepSlider);
  if(maxSlider) maxSlider = (Math.ceil(maxSlider/stepSlider) * stepSlider);
  
  $( "#slider-range" ).slider({
    range: true,
    min: minSlider,
    max: maxSlider,
    values: [ minSlider, maxSlider ],
    step: stepSlider,
    slide: function( event, ui ) {
      $( "#filterPriceRange" ).html( currencySymbol + ui.values[ 0 ] + " - "+currencySymbol + ui.values[ 1 ] );
    }
  });
  
  $( "#slider-range" ).slider({
     stop: function(event, ui) { 
      copyNavSelectionsToFilterSettings();
      filterItemList(); 
      filterNavList();         
   }
  });
  
  $( "#filterPriceRange" ).html( currencySymbol + $( "#slider-range" ).slider( "values", 0 ) +
    " - " + currencySymbol + $( "#slider-range" ).slider( "values", 1 ) );
}

function clearSale()
{ 
  filterBySale = 0;
  $('#clearsale').remove();
  copyNavSelectionsToFilterSettings();
  filterItemList(); 
  filterNavList();
}

function clearSearch()
{ 
  searchResults = [];
  $('#search_keywords').val('');
  $('#clearsearch').remove();
  copyNavSelectionsToFilterSettings();
  filterItemList(); 
  filterNavList();
}

function clearAll()
{
  $('#nav_panel a').each(function(){
    $(this).removeClass('active');
    $(this).parent().removeClass('activeParent'); 
  });

  filterBySale = 0;
  $('#clearsale').remove();
  searchResults = [];
  $('#search_keywords').val('');
  $('#clearsearch').remove();
  
  for(filterSetting in filterSettings)
  {
    filterSettings[filterSetting] = '';
  }

  initPriceSlider();

  copyNavSelectionsToFilterSettings();
  filterItemList(); 
  filterNavList();

  $('#nav_panel .undoItem').parent().remove();
  $('#clearAllList').remove();  
}

/*
 * Transfer the active navigation selections to the filterSettings global object
 */
function copyNavSelectionsToFilterSettings()
{
  var pattern= /id(\d*)/
  
  $('#nav_panel .active').each(function(){
    var filterName = '';
    var id = '';

    var classList = this.className.split(/\s+/);
    for (i = 0; i < classList.length; i++) {
      if($.inArray( classList[i], filterClasses )>-1)
      {
        filterName = classList[i]+"_id";
      }else
      {
        var className = classList[i];
        if (className.match(pattern)) {
          id = RegExp.$1;
        }
      }
    }

    filterSettings[filterName] = id;

  });

}

function initItemLinks()
{
  $('.pl').click(function(e){
    e.preventDefault();
    
    var item_url = suitsMenConstants['url_path'] + '/' + category + '/';

    if(category_id == 1)
    {
      var sections = ['style','brand','size','secondary_size','colour_group','fabric','occasion','suit_type','trouser_type'];
    }else
    {
      var sections = ['style','brand','size','secondary_size','colour_group','fabric','occasion'];
    }


    var _i, _len, filter_id, filler_word, filter_section;
    
    for (_i = 0, _len = sections.length; _i < _len; _i++) {
      
      filter_id = sections[_i]+'_id';
      filler_word = sections[_i];
      if(filler_word == 'colour_group') filler_word = 'colour';
      filter_section = sections[_i]+'s';
    
      if(filterSettings[filter_id])
      {
        if(filter_section == 'suit_types')
        {
          item_url += filterBySale + '/';
        }
        item_url += navOptionsUrls[filter_section][filterSettings[filter_id]]  + '/';
      }else
      {
        if(filter_section == 'suit_types')
        {
          item_url += filterBySale + '/';
        }        
        item_url += filler_word + '/';
      }
    }
    
    //get the item id out of the original url
    var item = $(this).attr('href');
    var item_id_pattern = /\/(\d*)\/$/gim;
    var results = item.match(item_id_pattern);    
    
    
    //alert(item_url+RegExp.$1+'/');
    window.location = item_url+RegExp.$1+'/';
  });
}

function adaptSearchForm()
{
  $('#search_form').submit(function(){
  
    if($('#search_category').val() == category_id)
    { 

      var item_url = suitsMenConstants['url_path'] + '/' + category + '/';

      if(category_id == 1)
      {
        var sections = ['style','brand','size','secondary_size','colour_group','fabric','occasion','suit_type','trouser_type'];
      }else
      {
        var sections = ['style','brand','size','secondary_size','colour_group','fabric','occasion'];
      }

      var _i, _len, filter_id, filler_word, filter_section;

      for (_i = 0, _len = sections.length; _i < _len; _i++) {

        filter_id = sections[_i]+'_id';
        filler_word = sections[_i];
        if(filler_word == 'colour_group') filler_word = 'colour';
        filter_section = sections[_i]+'s';

        if(filterSettings[filter_id])
        {
          if(filter_section == 'suit_types')
          {
            item_url += filterBySale + '/';
          }
          item_url += navOptionsUrls[filter_section][filterSettings[filter_id]]  + '/';
        }else
        {
          if(filter_section == 'suit_types')
          {
            item_url += filterBySale + '/';
          }        
          item_url += filler_word + '/';
        }
      }

      var search_keywords_for_url = ''+$('#search_keywords').val();
      search_keywords_for_url = escape(search_keywords_for_url);
      search_keywords_for_url = search_keywords_for_url.replace('%20','+');
      window.location = item_url+"?search_keywords="+search_keywords_for_url;

      return false;
    }else
    {
      $('#search_style').val('style');
      $('#search_brand').val('brand');
      $('#search_size').val('size');
      $('#search_secondary_size').val('secondary_size');
      $('#search_colour_group').val('0');
      $('#search_fabric').val('fabric');
      $('#search_occasion').val('occasion');
      $('#search_sale').val('0');
      $('#search_suit_type').val('suit_type');
      $('#search_trouser_type').val('trouser_type');     
      return true;
    }
  });
}

function initFilterBreadcrumbs()
{
  if(filterBySale==1) if(!$('#clearsale').length) 
  {
    $('#filter_breadcrumbs').prepend('<a id="clearsale" onclick="clearSale();" class="clear_extra" href="#">Clear Filter By \'On Sale\'</a>');
  }
  
  if(searchResults.length) if(!$('#clearsearch').length) 
  {
    $('#filter_breadcrumbs').append('<a id="clearsearch" onclick="clearSearch();" class="clear_extra" href="#">Clear Search Filter</a>');
  }  
}

function convertNavNoLinks()
{
  $('#nav_panel .no_link span').each(function(){
    var liHtml = $(this).html();
    var url_pattern = /<!--(.*)-->(.*)$/gim;
    var results = liHtml.match(url_pattern);
    var classes = $(this).attr('class');
    var newLiHtml = "<a href='"+RegExp.$1+"' class='"+classes+" disabled' title=\""+RegExp.$2+"\" >"+RegExp.$2+"</a>";
    $(this).parent().removeClass('no_link');    
    $(this).parent().html(newLiHtml);
  });
  
  $('#nav_panel .no_link_colour span').each(function(){
    var liHtml = $(this).parent().html();
    var url_pattern = /<!--(.*)-->.*title=\"(.*)\"/gim;
    var results = liHtml.match(url_pattern);
    var classes = $(this).attr('class');
    var bgc = $(this).parent().css('backgroundColor');
    var newLiHtml = "<a href='"+RegExp.$1+"' class='"+classes+" disabled' title=\""+RegExp.$2+"\" style='background-color:"+bgc+";' > </a>";
    $(this).parent().removeClass('no_link_colour');    
    $(this).parent().html(newLiHtml);
  });  
  
}

function addMissingItems()
{
  var html = '', item;
  for (_i = 0, _len = items.length; _i < _len; _i++) 
  {
    item = items[_i];
    if($('.product_list .p'+item['id']).length) continue;
    
    html = buildItemHtml(item);
    $('.product_list').append(html);
  }
}

function buildItemHtml(item)
{

  var html = '';
  var currency_item = currency_items[item['id']][0];
  var itemLinkPath = suitsMenConstants['url_path']+"/"+category+"/"+item['id']+"/";
  
  html += '<li class="p'+item['id']+'" id="item_'+item['id']+'" style="display: none;">';

		if(item['fw'])
		{
			html += "<p title='Fabric Weight' class='fabric_weight'>"+item['fw']+"g</p>";
		}else
		{
			html += "<p class='fabric_weight' style='display:none;'>0g</p>";
		}

		html += "<div class='details'>";
		html += "<h2><a class='pl' href='"+itemLinkPath+"' title=\""+item['title']+"\">"+item['title']+"</a></h2>";
    html += currency_item['phtml'];
		html += "<p class='desc'>"+item['desc']+"</p>";
		html += "</div>";

    if(discountCodePercentageFraction > 0)
    {
      if(category_id == 1)
      {
        var minPrice = (currency_item['mpJ'] + currency_item['mpT']);
        minPrice = minPrice.replace('.00','');    
      }else
      {
        var minPrice = (currency_item['mp']);
        minPrice = minPrice.replace('.00','');    
      }  
  
      html += '<div class="ptybl"><br><span class="ptyl">Price to You</span><br><span class="ptypl">'+currencySymbol+(minPrice-(minPrice*discountCodePercentageFraction)).toFixed(2)+'</span></div>';
    }
    
		html += "<a class='photo pl' href='"+itemLinkPath+"'>";
		if(1)
		{
			html += "<img id='main_photo_"+item['id']+"' src='"+suitsMenConstants['url_path']+"/suit-images/normal-size/"+item['ut']+"-1.jpg' alt=\""+item['title'].replace('"','')+"\" width='166' height='249' />";
		}
		html += "</a>";


		var alt_images = '';
    var bits= new Array();
    var alts = new Array();
    var alt_positions= new Array();
    var alt_image_id = 0;
    var left_position = 0;
    var top_position = 0;
    var i;
    var sprite_filename;
    var alt_images;
    var special_feature_ids;
    var DOUBLE_CUFF_ID = '1';
    var BOYS_SIZES_ID = '2';
    var NEW_SPECIAL_FEATURE_ID = '4';
    
    if(item['spos'])
    {
      alts = item['spos'].split(',');

      for(i = 0; i <= 4; i++)
      {
        if(alts[i])
        {
          bits = alts[i].split('-');         
          alt_image_id = bits[0];
          left_position = bits[1];
          top_position = bits[2];
          alt_positions[alt_image_id] = new Array();
          alt_positions[alt_image_id]['left_position'] = left_position;
          alt_positions[alt_image_id]['top_position'] = top_position;  
        }
      }
      
      if(category_id == 1) sprite_filename = suitsMenConstants['url_path']+"/suit-images/thumbnail_sprites/jackets."+spriteFileTime+".jpg";
      else sprite_filename = suitsMenConstants['url_path']+"/suit-images/thumbnail_sprites/"+category+"."+spriteFileTime+".jpg";
      
      for (i = 2; i <= 4; i++) 
      {
        if(alt_positions[i])
        {
          alt_images += "<li><span onmouseover=\"change_image('"+item['id']+"','"+item['ut']+"-"+i+"');\" style='display:block; width:34px; height:51px; background-image: url("+sprite_filename+"); background-position: "+alt_positions[i]['left_position']+"px "+alt_positions[i]['top_position']+"px;'></span></li>";
        }
      }

      if(alt_images)
      {
        if(alt_positions[1])
        {
          alt_images += "<li><span onmouseover=\"change_image('"+item['id']+"','"+item['ut']+"-1');\" style='display:block; width:34px; height:51px; background-image: url("+sprite_filename+");background-position: "+alt_positions[1]['left_position']+"px "+alt_positions[1]['top_position']+"px;'></span></li>";   
        }
        html += "<ul class='alt_images'>";
        html += alt_images;
        html += "</ul>";
      }
    }

    if(item['bs'])
    {
      html += "<a class='best_seller pl' href='"+itemLinkPath+"'><img style='border:none;' src='"+suitsMenConstants['url_path']+"/images/icons/best_seller.png' width='74' height='82'/></a>";
    }else
    {
      if(item['sfi'])
      {
        special_feature_ids = item['sfi'].split(',');

        if($.inArray(NEW_SPECIAL_FEATURE_ID,special_feature_ids)>-1)
        {
          html += "<a class='new pl' href='"+itemLinkPath+"'><img style='border:none;' src='"+suitsMenConstants['url_path']+"/images/icons/new.png' width='52' height='55'/></a>";
        }
      }
    }


    if(item['sfi'])
    {
      special_feature_ids = item['sfi'].split(',');

      if($.inArray(DOUBLE_CUFF_ID,special_feature_ids)>-1)
      {
        html += "<a class='double_cuff pl' href='"+itemLinkPath+"'><img style='border:none;' src='"+suitsMenConstants['url_path']+"/images/icons/double_cuff.png' width='47' height='36'/></a>";
      }
    }

    if(item['bv'])
    {
      html += "<a class='boys_sizes pl' href='"+itemLinkPath+"'><img style='border:none;' src='"+suitsMenConstants['url_path']+"/images/icons/boys_sizes.png' width='82' height='48'/></a>";
    }else
    {
      //this will become obsolete when ruperts set up all the boys_version values
     if(item['sfi'])
      {
        special_feature_ids = item['sfi'].split(',');

        if($.inArray(BOYS_SIZES_ID,special_feature_ids)>-1)
        {
          html += "<a class='boys_sizes pl' href='"+itemLinkPath+"'><img style='border:none;' src='"+suitsMenConstants['url_path']+"/images/icons/boys_sizes.png' width='82' height='48'/></a>";
        }
      }     
    }

    if(item['sw'])
    {
       html += "<a class='has_swatches pl' href='"+itemLinkPath+"'><img style='border:none;' src='"+suitsMenConstants['url_path']+"/images/icons/has_swatches.png' width='186' height='30'/></a>";
    }

    if(item['sop'])
    {
      var special_offer_alt, special_offer_discount_text;
      special_offer_alt = item['ppt'].replace('{link-to-child}',  item['clt']);
      
      special_offer_alt = special_offer_alt.replace('&pound;','');
      special_offer_discount_text = '';
      if(item['spd'] > 0)
      {
        if(item['spd'] == 100)
        {
          special_offer_discount_text = 'FREE';
        }else
        {
          special_offer_discount_text = item['spd'] + " percent ";
        }
      }else
      {
        special_offer_discount_text = currency_items[item['id']][0]['sad'] + " pounds ";
      }
      
      if(special_offer_alt.match(/\{discount\}/))
      {
        special_offer_alt = special_offer_alt.replace('{discount}',  special_offer_discount_text);
      }else
      {
        special_offer_alt = special_offer_alt.replace('0 less','0 pounds less');
      }   
      html += "<a class='special_offer_small pl' href='"+itemLinkPath+"' title=\""+special_offer_alt+"\"><img style='border:none;' src='"+suitsMenConstants['url_path']+"/images/icons/special_offer_small.png' width='78' height='78'/></a>";
    }
	html += "</li>";   
  return html;
}
/***************** END PRODUCT LISTS **************/
