if(!MyPointsParams){ //alert("create MyPoints Object"); var MyPointsParams = {}; } MyPointsParams['holidayOptions'] = new Object(); MyPointsParams['holidayOptions']['pricerange'] = [['Gifts under $50','price_range_0_49'],['Gifts $50 to $99','price_range_50_99'],['Gifts $100 to $249','price_range_100_249'],['Gifts $250 to $499','price_range_250_499'],['Gifts over $500','price_range_500_9999']]; MyPointsParams['holidayOptions']['filter'] = []; MyPointsParams['holidayOptions']['q'] = []; MyPointsParams['holidayOptions']['price'] = ''; MyPointsParams['holidayOptions']['hattr'] = ''; MyPointsParams['holidayOptions']['category']= []; function GetGifts(e){ var ele = Event.element(e); var pvalue = ''; var p; if($('selectAPriceRange').value!='null'){ pvalue = $('selectAPriceRange').value }else{ pvalue = 'price_range_0_49'; } MyPointsParams['holidayOptions']['pricerange'].each(function(item,index){ if(pvalue==item[1]){ if(MyPointsParams['holidayOptions']['filter'][index]!='null'&&MyPointsParams['holidayOptions']['filter'].length>0){ if(MyPointsParams['holidayOptions']['filter'][index]){ $('a_dattr').value = pvalue+','+MyPointsParams['holidayOptions']['filter'][index]; }else{ $('a_dattr').value = pvalue; } }else{ $('a_dattr').value = pvalue; } if(MyPointsParams['holidayOptions']['category'][index]!='null'&&MyPointsParams['holidayOptions']['category'].length>0){ $('a_categoryId').value = MyPointsParams['holidayOptions']['category'][index]; }else{ $('a_categoryId').value = MyPointsParams['holidayOptions']['category'][0]; } if(MyPointsParams['holidayOptions']['q'][index]!='null'&&MyPointsParams['holidayOptions']['q'].length>0){ $('a_q').value = MyPointsParams['holidayOptions']['q'][index]; }else{ $('a_q').value = ''; } } }); $('a_hattr').value = MyPointsParams['holidayOptions']['hattr']; MyPointsParams['holidayOptions']['price'] = pvalue; if($('a_categoryId').value=='undefined'){ $('a_categoryId').value = '41186'; $('a_dattr').value = 'gf_occasion_christmas,price_range_0_49'; } if($('a_q').value=='undefined'||$('a_q').value==''){ $('a_q').remove(); } $('getgiftsform').submit(); } function SetPrice(target,v){ var stopis = false; target.childElements().each(function(item,index){ if(index!=0){ item.remove(); } }) var stopexp = eval('/'+v+'/'+'gi'); MyPointsParams['holidayOptions']['pricerange'].each(function(item,index){ if(stopis==false){ var newOption = document.createElement('option'); newOption.innerHTML = item[0]; newOption.value = item[1]; target.appendChild(newOption); (item[1].match(stopexp)!=null)?stopis=true:null; }; }); } function SetGet(e){ var ele = Event.element(e); var p = $(ele).value.evalJSON(); if(p.pro){ MyPointsParams['holidayOptions']['hattr'] = p.pro; } if(p.cat!='null'){ //$('selectAPriceRange').disabled=''; SetPrice($('selectAPriceRange'),p.lim); }else{ //$('selectAPriceRange').disabled='disabled'; $('selectAPriceRange').childElements().each(function(item,index){ if(index!=0){ item.remove(); } }) } MyPointsParams['holidayOptions']['filter']=p.attr; MyPointsParams['holidayOptions']['category']=p.cat; MyPointsParams['holidayOptions']['q']=p.q; } function HolidayBind(e){ Event.observe($('selectACategory'),'change',SetGet,false); Event.observe($('getgifts'),'click',GetGifts,false); } function GoAllMerch(){ var href = '/emp/u/allBrands.vm'; window.open(href,'_blank',""); } Event.observe(window,'load',HolidayBind,false);