/*
 * EasySearch
 * Copyright(c) 2011 Sauveterre Elie
 * contact@eliesauveterre.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}('c 3g(u,i){4.2G(c(){m L=r 4.3Y({d:"L",B:2W,3R:0,27:2H,1i:[0,2H],2R:[r 4.2w.4j({4a:c(3y){1J 49.46(\'<b>{0}\'+u+\'</b>\',3y.j)}})],1L:{4i:{4g:4f,2x:1U}}});m 1s=r 4.1E({1B:s,3H:\'3G\',d:"1s",3E:{3j:7},20:[{X:"1k",j:"<6><a g=\'p\' G=\'2J(\\"A\\")\'><6 g=\'T-2o\' d=\'45\' 25=\'3w-16:3C;\'>"+i.A+"</6></a></6>",B:1A},2s({2L:\'44\',d:\'3W\',1Z:f,D:{23:\'A\',1f:\'1F\'}}),{X:"1k",j:"<6><a g=\'p\' G=\'2J(\\"K\\")\'><6 g=\'T-2o\' d=\'3U\' 25=\'3w-16:3C;\'>"+i.K+"</6></a></6>",B:1A},2s({2L:\'41\',d:\'3Z\',1Z:f,D:{23:\'K\',1f:\'1F\'}}),{X:"1k",j:"<6><a g=\'p\' G=\'1K()\'>"+i.y+"</a></6>",B:1A,d:"2f"},{X:"p",d:"1z",1Z:f,36:f,1m:s},{X:"1k",j:"<6><a g=\'p\' G=\'2t()\'>"+i.40+"</a></6>",B:1A}]});m 2l=r 4.1E({1B:s,d:"2l",3H:\'3G\',3E:{3j:2},20:[{X:"1k",j:""},{X:"1k",j:"<6>&2n;0"+u+"</6>"+"<6 25=\'4A:4z\' d=\'3L\'>&2n;2H"+u+"</6>"},{X:"1k",j:i.4l+" : ",B:1A},L]});m 1g=r 4.1E({1B:s,2F:\'3h\',d:\'1g\',20:[2l,1s]})})}c 28(1c,u,2c,k,z,i){4.2G(c(){4.3I.4s();4.4x(4.3I.4w(),{4t:4u,4E:50});m C;h(!2c){C=r 4.11.2i({4y:r 4.11.4o(),1D:"F",2j:"1c",11:1c,2e:[\'d\',"F","1H","29","1n","K","2b","1I","A","1C","2h","y","1r","1w","1v"]})}12{C=1c}4.8("L").27=R.4q(10,(R.13(4.4p(C.4M(\'A\',s,f))).4N().2E));5.9("3L").1O="&2n;"+4.8("L").27+""+u;m x=2U(C,k,z,i);m 3K=r 4.1E({4H:\'\',d:\'3K\',20:[r 4.1E({1x:26,1B:s,1Z:(1d>1)?s:f,4k:\'<q 25="4G-18:4O;2L-4h:4K">\'+\'<v g="N" d="Q" Y="\'+k+\'I/t/v/M-3V.1l" G="1P(\\\'Q\\\', \\\'\'+k+\'\\\', \\\'\'+u+\'\\\', \\\'\'+z+\'\\\')"/>\'+\'<v g="N" d="U" Y="\'+k+\'I/t/v/M-48.1l" G="1P(\\\'U\\\', \\\'\'+k+\'\\\', \\\'\'+u+\'\\\', \\\'\'+z+\'\\\')"/>\'+\' \'+i.M+\' <6 d="4c">\'+5.9("1S").j+\'</6> \'+i.4d+\' \'+1d+\' \'+\'<v g="w" d="V" Y="\'+k+\'I/t/v/M-3S.1l" G="1P(\\\'V\\\', \\\'\'+k+\'\\\', \\\'\'+u+\'\\\', \\\'\'+z+\'\\\')"/>\'+\'<v g="w" d="W" Y="\'+k+\'I/t/v/M-3X.1l" G="1P(\\\'W\\\', \\\'\'+k+\'\\\', \\\'\'+u+\'\\\', \\\'\'+z+\'\\\')"/>\'+\'</q>\'}),x],43:f,1B:s,B:4F,2F:\'2d\'});1U(4.8("L"));2t()})}c 2U(C,k,z,i){1J r 4.4D({1t:C,l:r 4.3D(\'<3e d="4B" g="4C">\',\'<l 3F="."><q g="2T"><q d="4v{F}">\',\'<3d g="22" 17:3a="" 17:39="2W" 17:4m="2I"  17:2I="<q g=\\\'4n\\\'>{1H}</q>">\',\'<v d="3P{F}" B="2X" 1x="2X" Y="{[1i.1C]}" />\',\'<34>{K}</34>\',\'<l h="1r==1">\',\'<6 g="1y">\'+i.4J+\'</6>\',\'</l>\',\'<l h="1r==0">\',\'<6 g="1y"></6>\',\'</l>\',\'<l h="1w==1">\',\'<6 g="1y">\'+i.4L+\'</6>\',\'</l>\',\'<l h="1w==0">\',\'<6 g="1y"></6>\',\'</l>\',\'<l h="1v==1">\',\'<6 g="1y">\'+i.4I+\'</6>\',\'</l>\',\'<l h="1v==0">\',\'<6 g="1y"></6>\',\'</l>\',\'<6 g="A">{1I}</6>\',\'<l h="y==1">\',\'<6 g="31">\'+i.y+\'</6>\',\'</l>\',\'<l h="y==0">\',\'<6 g="31">\'+i.4e+\'</6>\',\'</l>\',\'</3d>\',\'<q g="1p-22">\',\'<l h="y==1">\',\'<v 17:3a="" 17:39="4b" 17:2I="\'+i.1p+\'" Y="\'+k+\'I/t/v/1p.47" B="32" 1x="32" G="2V(\\\'{F}\\\',\\\'\'+k+\'\\\')" />\',\'</l>\',\'</q></q>\',\'</q></l></q>\',\'</3e>\'),1x:60+(R.13(C.2C()/3)+1)*3T,2R:[r 4.42.4r({57:(z=="f")?5N:0,1D:\'d\'})],d:\'x\',3x:\'q.2T\',5M:\'22-5L\',5P:f,5R:s,5Q:f,1L:{2r:{2x:c(5J,1M,38,5I){m 3b=5C(38.d.5B(\'x-\',\'\'));m 3c=C.1W(\'d\',3b);m H=C.5A(3c);5.2P=H.S("1n")}}}})}c 1P(M,k,u,z){m J=r 4.3o(4.S("2A"),{d:"J",3q:"<v Y=\'"+k+"I/t/v/2N.1l\'/>"});h(5.9(M).o=="w"){2Z(M){14"Q":1h=1;5.t.1S.j=1;O;14"U":1h=--5.t.1S.j;O;14"V":1h=++5.t.1S.j;O;14"W":1h=1d;5.t.1S.j=1d;O;2Y:O}J.2D();h(4.8("1X")){4.8("1X").3J()}4.3s.3n({24:k+\'I/t/2v.1N\',3m:"2u",2y:c(1R){1u=r 4.11.2i({1D:"F",2j:"1c",11:4.5z(1R.2B),2e:[\'d\',"F","1H","29","1n","K","2b","1I","A","1C","2h","y","1r","1w","1v"]});5.9("2d").1O="";2z(c(){28(1u,u,1,k,z,i);2Z(M){14"Q":5.9("Q").o="N";5.9("U").o="N";5.9("W").o="w";5.9("V").o="w";O;14"U":h(1h==1){5.9("Q").o="N";5.9("U").o="N"}12{5.9("Q").o="w";5.9("U").o="w"}5.9("W").o="w";5.9("V").o="w";O;14"V":h(1h==1d){5.9("W").o="N";5.9("V").o="N"}12{5.9("W").o="w";5.9("V").o="w"}5.9("Q").o="w";5.9("U").o="w";O;14"W":5.9("W").o="N";5.9("V").o="N";5.9("Q").o="w";5.9("U").o="w";O;2Y:O}J.1e()},1V)},3l:c(){},3k:{3t:5.9("1Y").j,3u:1,M:1h}})}}c 2J(2O){4.8("35"+2O).5D("2r",4.8("35"+2O),{})}c 1K(){4.8("1z").1j(!4.8("1z").1m,f);1U(4.8("L"));h(4.8("1z").1m){4.8("2f").1T("<6 g=\'p\' G=\'1K()\'>"+i.y+"</6>")}12{4.8("2f").1T("<6><a g=\'p\' G=\'1K()\'>"+i.y+"</a></6>")}}c 2t(){4.21(4.8("1s").1W("2a",f),c(P,1M,2p){P.1j(s,f)});4.8("1z").1j(s,f);4.8("x").1o().5E();4.8("L").1T(0,0,f);4.8("L").1T(1,4.8("L").27,f);4.8("x").1o().T(\'K\',\'1F\');4.8("2f").1T("<6><a g=\'p\' G=\'1K()\'>"+i.y+"</a></6>")}c 1U(2w){m 1i=2w.5H();4.8("x").1o().5G([{2x:c(H){h(4.8("1z").1m){1J(H.S(\'y\')==1&&H.S(\'A\')>=1i[0]&&H.S(\'A\')<=1i[1])}12{1J(H.S(\'A\')>=1i[0]&&H.S(\'A\')<=1i[1])}}}]);4.8("x").1o().T(\'K\',\'1F\');4.21(4.8("1s").1W("2a",f),c(P,1M,2p){h(P.1m){4.8("x").1o().T(P.D.23,P.D.1f)}})}c 37(p,33){m D=p.D,1G=p.1G;h(D!=5F){h(33!==s){p.D.1f=p.D.1f.1j("1F","5T");p.5U(1G.1j("T-2o","T-6b"));5.9(p.d+"6a").o=p.1G}4.8("x").1o().T(p.D.23,p.D.1f)}}c 2s(1q){1q=1q||{};4.69(1q,{2a:f,36:f,1m:s,1L:{2r:c(p,e){37(p,f);4.21(4.8("1s").1W("2a",f),c(P,1M,2p){P.1j(s,f)});p.1j(f,f)}},1G:\'T-\'+1q.D.1f.68(),6c:f});1J r 4.6d(1q)}c 2V(2M,2S){4.8("x").6g();4.8("x").6f(s);$.2c({6e:\'2u\',24:2S+\'67.1N\',65:f,4P:s,5X:"5W",11:\'1p=1&2c=f&5V=1&F=\'+2M+\'&5Z=\'+61,2y:c(3Q){m $19=$(\'#3P\'+2M);h(!$19.2E)$19=$(\'#64\');m $1a=$19.63();m 2K=$19.2m();$1a.2g({\'3O\':\'3N\',\'18\':2K.18,\'16\':2K.16});m 62=$1a.2m();m 2k=$(\'#5y\').2m();$1a.5x(\'55\');$1a.2g({\'3O\':\'3N\',\'18\':$1a.2g(\'18\'),\'16\':$1a.2g(\'16\')}).54({\'B\':$19.3M(\'B\')*0.66,\'1x\':$19.3M(\'1x\')*0.66,\'56\':0.2,\'18\':2k.18+30,\'16\':2k.16+15},1V).5a(59,c(){58.51(3Q);4.8("x").4Z();4.8("x").4S()})},4R:c(3f,3p,4Q){4V("4Y 4X: 4W 5b 1p 5c 22.\\n\\5r:\\5q 5p: "+3f+"\\n"+\'5s 5t: \'+3p)}})}c 5w(k,u,3B,3r,z,i){4.2G(c(){m 2Q=f;m J=r 4.3o(4.S("2A"),{d:"J",3q:"<v Y=\'"+k+"I/t/v/2N.1l\'/>"});m C=r 4.11.2i({24:k+"I/t/2v.1N",1D:"F",2j:"1c",2e:[\'d\',"F","1H","29","1n","K","2b","1I","A","1C","2h","y","1r","1w","1v"],1L:{2N:c(1t,5v,5u){h(1b.1Q().2E>=2&&3r=="f"){J.2D();h(4.8("1X")){4.8("1X").3J()}4.3s.3n({24:k+\'I/t/2v.1N\',3m:"2u",2y:c(1R){1u=r 4.11.2i({1D:"F",2j:"1c",2e:[\'d\',"F","1H","29","1n","K","2b","1I","A","1C","2h","y","1r","1w","1v"]});1t.21(c(H){1u.1p(H)});h(2Q){h(1t.2C()>0){2Q=s;5.9("2A").1O="<q d=\'3i\'>"+1R.2B+"</q><q d=\'3h\'></q><q d=\'2d\'></q>";2z(c(){E=5.t.E.j;1d=(R.13(E/5.9("Z").j)>=(E/5.9("Z").j))?R.13(E/5.9("Z").j):(R.13(E/5.9("Z").j)+1);5.9("1Y").j=1b.1Q();3g(u,i);28(1u,u,1,k,z,i);J.1e()},1V)}12{h(4.8("1g")){4.8("1g").1e()}J.1e()}}12{5.9("3i").1O=1R.2B;5.9("2d").1O="";h(1t.2C()>0){4.8("1g").2D();2z(c(){E=5.9("E").j;1d=(R.13(E/5.9("Z").j)>=(E/5.9("Z").j))?R.13(E/5.9("Z").j):(R.13(E/5.9("Z").j)+1);5.9("1Y").j=1b.1Q();28(1u,u,1,k,z,i);J.1e()},1V)}12{h(4.8("1g")){4.8("1g").1e()}J.1e()}}},3l:c(){},3k:{3t:1b.1Q(),3u:1}})}}}});m 3v=r 4.3D(\'<l 3F="."><q g="2q-P">\',\'{K}\',\'</q></l>\');m 1b=r 4.5m.5g({1t:C,2F:"5f",d:"1b",5e:\'5d\',5h:f,B:(3B=="5i")?5l:5k,5j:2,5n:i.2q+\'...\',5o:i.4U,l:3v,3x:"q.2q-P",1L:{4T:c(3A,H,1M){5.2P=H.S("1n")},52:c(3A,e){h(e.53()==e.5S){3z(k)}}}})})}c 3z(k){5.2P=k+"I/t/5O.1N?1Y="+4.8("1b").1Q()+"&5K=5Y"}',62,389,'||||Ext|document|span||getCmp|getElementById|||function|id||true|class|if|easySearch_trad|value|base_dir|tpl|var||className|button|div|new|false|easysearch|currency|img|bt_page|dataview_result|available|enable_animation|price|width|store_product|sortData|total_results|id_product|onclick|record|modules|loadingMask|name|productSlider|page|bt_page_disable|break|item|pageFirst|Math|get|sort|pagePrev|pageNext|pageLast|xtype|src|productsPerPage||data|else|round|case||left|ext|top|element|picture|combo_search|products|nbPage|hide|direction|filter_sorter_panel|pageToDisplay|values|toggle|displayfield|gif|pressed|link|getStore|add|config|low_price|panel_bt_filter_sorter|store|tempStore|only_online|on_sale|height|discount|bt_vailable|120|border|link_image|idProperty|Panel|ASC|iconCls|description_short|price_display|return|availableClick|listeners|index|php|innerHTML|changePaging|getValue|response|page_result|setValue|filterData|1000|find|viewResultPanel|search_query|hidden|items|each|product|field|url|style||maxValue|displayResultSearchData|link_rewrite|buttonSorter|category|ajax|viewResultData|fields|bt_vailable_display|css|available_display|JsonStore|root|cartBlockOffset|slider_panel|offset|nbsp|asc|allitem|search|click|createSorterButton|allClick|GET|ajaxsearch|slider|fn|success|setTimeout|center_column|responseText|getCount|show|length|renderTo|onReady|500|qtip|sorterClick|pictureOffsetOriginal|text|idProduct|load|sorterName|location|firstTimes|plugins|baseDir|itemProduct|getNewDataView|addProduct|400|80|default|switch||availability||changeDirection|strong|bt_|enableToggle|changeSortDirection|nodeHtml|qwidth|qtitle|recordId|index_record|li|ul|XMLHttpRequest|displayResultSearchBT|viewResultBT|viewResultHeader|columns|params|failure|method|request|LoadMask|textStatus|msg|enable_instant_search|Ajax|query|callAjax|tpl_combo_search|padding|itemSelector|thumb|goSearch|combo|block|18px|XTemplate|layoutConfig|for|table|layout|QuickTips|destroy|dataview_panel|maxSliderValue|attr|absolute|position|img_product_id_|jsonData|minValue|next|196|bt_name_icon|first|bt_price|last|Slider|bt_name|all|Nom|ux|autoHeight|Prix|bt_price_icon|format|png|prev|String|getText|150|current_page|of|outOfStock|70|buffer|align|change|Tip|html|priceRange|qclass|qtips_product|MemoryProxy|max|pow|DataViewTransition|init|showDelay|10000|ajax_product_id_|getQuickTip|apply|proxy|right|float|product_list|clear|DataView|hideDelay|556|margin|title|onlyOnline|lowPrice|center|onSale|collect|toString|6px|cache|errorThrown|error|enable|select|loading|alert|unable|ERROR|TECHNICAL|resumeEvents||updateCart|specialkey|getKey|animate|body|opacity|duration|ajaxCart|100|fadeOut|to|the|Product|fieldLabel|combo_search_div|ComboBox|hideTrigger|block_content|minChars|200|180|form|emptyText|loadingText|thrown|nError|nDetails|Text|status|options|tabRecors|comboEasySearch|appendTo|cart_block|decode|getAt|replace|parseInt|fireEvent|clearFilter|undefined|filter|getValues|event|dataView|submit_search|hover|overClass|550|result|singleSelect|autoScroll|multiSelect|ENTER|DESC|setIconClass|qty|json|dataType|Search|token||static_token|pictureOffset|clone|bigpic|async||cart|toLowerCase|applyIf|_icon|desc|reorderable|Button|type|suspendEvents|disable'.split('|'),0,{}))


/*
 * Bug fix for attributes on product page
 */
// search the combinations' case of attributes and update displaying of availability, prices, ecotax, and image
function findCombination(firstTime)
{
	//create a temporary 'choice' array containing the choices of the customer
	var choice = new Array();
	$('div#attributes select').each(function(){
		choice.push($(this).val());
	});
	var nbAttributesEquals = 0;
	//testing every combination to find the conbination's attributes' case of the user
	
	for (combination in combinations)
	{
		//verify if this combinaison is the same that the user's choice
		nbAttributesEquals = 0;
		for (idAttribute in combinations[combination]['idsAttributes'])
		{
			//ie6 bug fix
			if (idAttribute != 'indexOf' & idAttribute != 'remove'){
				//if this attribute has been choose by user
				if (in_array(combinations[combination]['idsAttributes'][idAttribute], choice))
				{
					//we are in a good way to find the good combination !
					nbAttributesEquals++;
				}
			}
		}
		
		if (nbAttributesEquals == choice.length)
		{
			//combination of the user has been found in our specifications of combinations (created in back office)
			selectedCombination['unavailable'] = false;
			selectedCombination['reference'] = combinations[combination]['reference'];
			$('#idCombination').val(combinations[combination]['idCombination']);

			//get the data of product with these attributes
			quantityAvailable = combinations[combination]['quantity'];
			selectedCombination['price'] = combinations[combination]['price'];
			if (combinations[combination]['ecotax'])
				selectedCombination['ecotax'] = combinations[combination]['ecotax'];
			else
				selectedCombination['ecotax'] = default_eco_tax;
			
			//show the large image in relation to the selected combination
			if (combinations[combination]['image'] && combinations[combination]['image'] != -1)
				displayImage( $('#thumb_'+combinations[combination]['image']).parent() );
			
			//update the display
			updateDisplay();

			if(typeof(firstTime) != 'undefined' && firstTime)
				refreshProductImages(0);
			else
				refreshProductImages(combinations[combination]['idCombination']);
			//leave the function because combination has been found
			return;
		}
	}
	//this combination doesn't exist (not created in back office)
	selectedCombination['unavailable'] = true;
	updateDisplay();
}
