
var ClientSave={validateLogin:function(obj)
{obj.value=obj.value.toLowerCase();}}
var client_new_texts;var ClientNew_status=true;var ClientNew_firma=false;var ClientNew_adres=true;var ClientNewMandatoryMail=false;var ClientNewMandatoryPhone=false;var ClientSender=new Array();var RemoveAddresLink;var ClientNew={switchDiVDeliveryAddres:function()
{document.getElementById("selectDeliveryAddress").style.display="none";document.getElementById("selectDeliveryAddress2").style.display="block";},switchDeliveryAddres:function(id,obj)
{var IdAddress=id;if(IdAddress){document.getElementById('delivery_id').value=IdAddress;document.getElementById("selectDeliveryAddress").innerHTML=obj.firstChild.innerHTML;document.getElementById("selectDeliveryAddress2").style.display="none";document.getElementById("selectDeliveryAddress").style.display="block";document.getElementById('additional_firstname').value=document.getElementById('cda_'+IdAddress+'_firstname').innerHTML;document.getElementById('additional_lastname').value=document.getElementById('cda_'+IdAddress+'_lastname').innerHTML;document.getElementById('additional_city').value=document.getElementById('cda_'+IdAddress+'_city').innerHTML;document.getElementById('additional_additional').value=document.getElementById('cda_'+IdAddress+'_additional').innerHTML;document.getElementById('additional_street').value=document.getElementById('cda_'+IdAddress+'_street').innerHTML;document.getElementById('additional_zipcode').value=document.getElementById('cda_'+IdAddress+'_zipcode').innerHTML;document.getElementById('additional_phone').value=document.getElementById('cda_'+IdAddress+'_phone').innerHTML;if(document.getElementById('additional_region')&&document.getElementById('additional_region').options){for(i=0;i<document.getElementById('additional_region').options.length;i++){if(document.getElementById('additional_region').options[i].value==document.getElementById('cda_'+IdAddress+'_region_id').innerHTML){document.getElementById('additional_region').selectedIndex=i;break;}}}
if(document.getElementById('cda_'+IdAddress+'_removable').innerHTML=='yes'){document.getElementById('delete_delivery_address').style.display='';RemoveAddresLink=document.getElementById('cda_'+IdAddress+'_removelink').innerHTML;}else{document.getElementById('delete_delivery_address').style.display='none';RemoveAddresLink='';}}else{document.getElementById('delete_delivery_address').style.display='none';RemoveAddresLink='';document.getElementById('additional_firstname').value='';document.getElementById('additional_lastname').value='';document.getElementById('additional_city').value='';document.getElementById('additional_additional').value='';document.getElementById('additional_street').value='';document.getElementById('additional_zipcode').value='';document.getElementById('additional_phone').value='';}
if(document.getElementById('cda_'+IdAddress+'_editable').innerHTML=='no'){document.getElementById('additional_firstname').disabled='disabled';document.getElementById('additional_lastname').disabled='disabled';document.getElementById('additional_city').disabled='disabled';document.getElementById('additional_additional').disabled='disabled';document.getElementById('additional_street').disabled='disabled';document.getElementById('additional_zipcode').disabled='disabled';document.getElementById('additional_phone').disabled='disabled';document.getElementById('additional_region').disabled='disabled';}else{document.getElementById('additional_firstname').disabled='';document.getElementById('additional_lastname').disabled='';document.getElementById('additional_city').disabled='';document.getElementById('additional_additional').disabled='';document.getElementById('additional_street').disabled='';document.getElementById('additional_zipcode').disabled='';document.getElementById('additional_phone').disabled='';document.getElementById('additional_region').disabled='';}},removeDeliveryAddress:function()
{if(RemoveAddresLink){if(confirm("Czy na pewno chcesz usunąć ten adres dostawy?")){IAI_Ajax.Request('ajax/client-new.php?removeAddres=true','address='+document.getElementById('delivery_id').value,{onSuccess:'ClientNew.deleteAddress'});}}},newDeliveryAddress:function()
{document.getElementById('delivery_id').value='';document.getElementById('selectDeliveryAddress').style.display='none';document.getElementById('selectDeliveryAddress2').style.display='none';document.getElementById('additional_address_list_txt').style.display='none';document.getElementById('delete_delivery_address').style.display='none';document.getElementById('newDeliveryAddress').style.display='none';document.getElementById('saveDeliveryAddress').style.display='block';RemoveAddresLink='';document.getElementById('additional_firstname').value='';document.getElementById('additional_lastname').value='';document.getElementById('additional_city').value='';document.getElementById('additional_additional').value='';document.getElementById('additional_street').value='';document.getElementById('additional_zipcode').value='';document.getElementById('additional_phone').value='';document.getElementById('additional_firstname').disabled='';document.getElementById('additional_lastname').disabled='';document.getElementById('additional_city').disabled='';document.getElementById('additional_additional').disabled='';document.getElementById('additional_street').disabled='';document.getElementById('additional_zipcode').disabled='';document.getElementById('additional_phone').disabled='';document.getElementById('additional_region').disabled='';},deleteAddress:function(x)
{try{var response=eval('('+x+')');}catch(e){return false;}
xr=response;document.getElementById('delivery_list_id_'+response.remove).style.display="none";ClientNew.switchDeliveryAddres(response.selected,document.getElementById('delivery_list_id_'+response.selected));},copyDeliveryAddres:function()
{if(document.getElementById('deliver_to_billingaddr').checked){document.getElementById('delivery_additional').value=ClientNew_firma?document.getElementById('client_firm').value:'';document.getElementById('delivery_firstname').value=document.getElementById('client_firstname').value;document.getElementById('delivery_lastname').value=document.getElementById('client_lastname').value;document.getElementById('delivery_zipcode').value=document.getElementById('client_zipcode').value;document.getElementById('delivery_street').value=document.getElementById('client_street').value;document.getElementById('delivery_city').value=document.getElementById('client_city').value;document.getElementById('delivery_phone').value=document.getElementById('client_phone').value;document.getElementById('box_4').className='n56203_box_idle';document.getElementById('delivery_additional').disabled='disabled';document.getElementById('delivery_firstname').disabled='disabled';document.getElementById('delivery_lastname').disabled='disabled';document.getElementById('delivery_zipcode').disabled='disabled';document.getElementById('delivery_street').disabled='disabled';document.getElementById('delivery_city').disabled='disabled';if(document.getElementById('delivery_region')){document.getElementById('delivery_region').value=document.getElementById('client_region').value;document.getElementById('delivery_region').disabled='disabled';}}else{document.getElementById('box_4').className='n56203_box';document.getElementById('delivery_additional').disabled='';document.getElementById('delivery_firstname').disabled='';document.getElementById('delivery_lastname').disabled='';document.getElementById('delivery_zipcode').disabled='';document.getElementById('delivery_street').disabled='';document.getElementById('delivery_city').disabled='';document.getElementById('delivery_phone').disabled='';document.getElementById('delivery_additional_img_off').style.display=document.getElementById('client_firm_img_off').style.display;document.getElementById('delivery_additional_img_on').style.display=document.getElementById('client_firm_img_on').style.display;document.getElementById('delivery_firstname_img_off').style.display=document.getElementById('client_firstname_img_off').style.display;document.getElementById('delivery_firstname_img_on').style.display=document.getElementById('client_firstname_img_on').style.display;document.getElementById('delivery_lastname_img_off').style.display=document.getElementById('client_lastname_img_off').style.display;document.getElementById('delivery_lastname_img_on').style.display=document.getElementById('client_lastname_img_on').style.display;document.getElementById('delivery_zipcode_img_off').style.display=document.getElementById('client_zipcode_img_off').style.display;document.getElementById('delivery_zipcode_img_on').style.display=document.getElementById('client_zipcode_img_on').style.display;document.getElementById('delivery_street_img_off').style.display=document.getElementById('client_street_img_off').style.display;document.getElementById('delivery_street_img_on').style.display=document.getElementById('client_street_img_on').style.display;document.getElementById('delivery_city_img_off').style.display=document.getElementById('client_city_img_off').style.display;document.getElementById('delivery_city_img_on').style.display=document.getElementById('client_city_img_on').style.display;document.getElementById('delivery_phone_img_off').style.display=document.getElementById('client_phone_img_off').style.display;document.getElementById('delivery_phone_img_on').style.display=document.getElementById('client_phone_img_on').style.display;if(document.getElementById('delivery_region')){document.getElementById('delivery_region').disabled='';}}},use_vat:function(){if(document.getElementById('firm_data2').checked){var idr=document.getElementById('client_region').value;if(countryVatArray[idr]=='n'){document.getElementById('vat_ue').style.display='';}else{document.getElementById('vat_ue').style.display='none';}}else{document.getElementById('vat_ue').style.display='none';}},check_inp:function(idd,name,delay){if(document.getElementById(idd)){idd=document.getElementById(idd);}
ClientNew.use_vat();var value=idd.value;if(ClientSender[name]>5){ClientSender[name]=1;if(name=='client_zipcode'){IAI_Ajax.Request('ajax/client-new.php?validAjax=true','client_zipcode='+value+'&client_region='+document.getElementById('client_region').value,{onSuccess:'ClientNew.info',arg:idd.id});}else if(name=='delivery_zipcode'){IAI_Ajax.Request('ajax/client-new.php?validAjax=true','delivery_zipcode='+value+'&delivery_region='+document.getElementById('delivery_region').value,{onSuccess:'ClientNew.info',arg:idd.id});}else if(name=='additional_zipcode'){IAI_Ajax.Request('ajax/client-new.php?validAjax=true','additional_zipcode='+value+'&additional_region='+document.getElementById('additional_region').value,{onSuccess:'ClientNew.info',arg:idd.id});}else if(name=='client_region'){ClientNew.check_inp(document.getElementById('client_zipcode'),'client_zipcode');}else if(name=='delivery_region'){ClientNew.check_inp(document.getElementById('delivery_zipcode'),'delivery_zipcode');}else if(name=='additional_region'){ClientNew.check_inp(document.getElementById('additional_zipcode'),'additional_zipcode');}else if(name=='client_password'){IAI_Ajax.Request('ajax/client-new.php?validAjax=true','client_password='+value+'&client_login='+document.getElementById('client_login').value,{onSuccess:'ClientNew.info',arg:idd.id});}else if(name=='repeat_password'){IAI_Ajax.Request('ajax/client-new.php?validAjax=true','repeat_password='+value+'&client_password='+document.getElementById('client_password').value,{onSuccess:'ClientNew.info',arg:idd.id});}else{if(value){IAI_Ajax.Request('ajax/client-new.php?validAjax=true',name+'='+value,{onSuccess:'ClientNew.info',arg:idd.id});}else{ClientNew.error(idd.id,0);document.getElementById(idd.id+'_img_off').style.display="none";document.getElementById(idd.id+'_img_on').style.display="none";}}}else{if(delay){if(ClientSender[name]>1){ClientSender[name]++;delay++;}else{return false;}}else{if(ClientSender[name]>2){ClientSender[name]=2;return false;}else{ClientSender[name]=2;delay=1;}}
setTimeout('ClientNew.check_inp("'+idd.id+'", "'+name+'", "'+delay+'")',100);}
if(name=='client_login'){document.getElementById('client_login').value=document.getElementById('client_login').value.toLowerCase();}
if(document.getElementById('deliver_to_billingaddr')){if(document.getElementById('deliver_to_billingaddr').checked){ClientNew.copyDeliveryAddres();}}},info:function(x,obj){try{var response=eval('('+x+')');}catch(e){return false;}
xr=response;if(response.errno==0){new ClientNew.error(obj,0);}else{if(response.message.error_code){document.getElementById(obj+'_help').innerHTML='<div>'+clientNewErrorCode[response.message.error_code]+'</div>';}
new ClientNew.error(obj,1);}},button:function(num){if(num==0&&document.getElementById('terms_agree').checked){document.getElementById('submit_register').className='act';}else{document.getElementById('submit_register').className='idle';}},submitform:function(){ClientNew_status=true;if(!document.getElementById("client_firstname").value){ClientNew_status=false;}
if(!document.getElementById("client_lastname").value){ClientNew_status=false;}
if(!document.getElementById("client_city").value){ClientNew_status=false;}
if(!document.getElementById("client_zipcode").value){ClientNew_status=false;}
if(!document.getElementById("client_street").value){ClientNew_status=false;}
if(document.getElementById("firm_data2")){if(document.getElementById("firm_data2").checked&&(!document.getElementById("client_firm").value||!document.getElementById("client_nip").value)){ClientNew_status=false;}}
if(document.getElementById("client_login")){if(!document.getElementById("client_login").value){ClientNew_status=false;}}
if(document.getElementById("client_password")){if(!document.getElementById("client_password").value||!document.getElementById("repeat_password").value){ClientNew_status=false;}}
if(document.getElementById("deliver_to_billingaddr")){if(!document.getElementById("deliver_to_billingaddr").checked){if((!document.getElementById("delivery_firstname").value||!document.getElementById("delivery_lastname").value)&&!document.getElementById("delivery_additional").value){ClientNew_status=false;}
if(!document.getElementById("delivery_zipcode").value){ClientNew_status=false;}
if(!document.getElementById("delivery_street").value){ClientNew_status=false;}
if(!document.getElementById("delivery_city").value){ClientNew_status=false;}}}
if(ClientNewMandatoryPhone){if(!document.getElementById('client_phone').value){ClientNew_status=false;}
if(document.getElementById('additional_phone')){if((!document.getElementById('additional_phone').value)&&!document.getElementById('additional_phone').disabled){ClientNew_status=false;}}else if(document.getElementById('delivery_phone')){if((!document.getElementById('delivery_phone').value)&&!document.getElementById('delivery_phone').disabled){ClientNew_status=false;}}}
if(ClientNewMandatoryMail){if(!document.getElementById('client_email').value){ClientNew_status=false;}}
if(document.getElementById('terms_agree')){if((!document.getElementById('terms_agree').checked)&&document.getElementById('terms_agree').type!='hidden'){ClientNew_status=false;}}
if(ClientNew_status==true){if(document.getElementById("button_alert")){document.getElementById("button_alert").style.display="none";}
return true;}else{if(document.getElementById("button_alert")){document.getElementById("button_alert").style.display="block";setTimeout('ClientNew.AlertOff()',5000);}
return false;}
if(document.getElementById('vat_ue').style.display!='none'&&!document.getElementById('vat_company').checked){document.getElementById("button_alert").style.display="block";setTimeout('ClientNew.AlertOff()',5000);return false;}},ramka:function(){if(!document.getElementById('terms_agree').checked){document.getElementById('terms_agree_box').className='ramka_ON';}else{document.getElementById('terms_agree_box').className='ramka_OFF';}},AlertOff:function(){document.getElementById("button_alert").style.display="none";},copy_adres:function(type){var CopyData=false;if(document.getElementById("firm_data")){CopyData=document.getElementById("firm_data").checked;}
if(CopyData&&type==1){document.getElementById('client_firstname').value=document.getElementById('client_firstname_copy').value;document.getElementById('client_firstname_img_off').style.display=document.getElementById('client_firstname_copy_img_off').style.display;document.getElementById('client_firstname_img_on').style.display=document.getElementById('client_firstname_copy_img_on').style.display;document.getElementById('client_lastname').value=document.getElementById('client_lastname_copy').value;document.getElementById('client_lastname_img_off').style.display=document.getElementById('client_lastname_copy_img_off').style.display;document.getElementById('client_lastname_img_on').style.display=document.getElementById('client_lastname_copy_img_on').style.display;}else if(type==2){document.getElementById('client_firstname_copy').value=document.getElementById('client_firstname').value;document.getElementById('client_firstname_copy_img_off').style.display=document.getElementById('client_firstname_img_off').style.display;document.getElementById('client_firstname_copy_img_on').style.display=document.getElementById('client_firstname_img_on').style.display;document.getElementById('client_lastname_copy').value=document.getElementById('client_lastname').value;document.getElementById('client_lastname_copy_img_off').style.display=document.getElementById('client_lastname_img_off').style.display;document.getElementById('client_lastname_copy_img_on').style.display=document.getElementById('client_lastname_img_on').style.display;}},error:function(idd,err){if(err==1){document.getElementById(idd+'_img_off').style.display="block";document.getElementById(idd+'_img_on').style.display="none";if(document.getElementById(idd+'_help')){document.getElementById(idd+'_help').style.display="block";ClientNew.hide_info_help(idd,10);}
return false;}else{document.getElementById(idd+'_img_off').style.display="none";document.getElementById(idd+'_img_on').style.display="block";if(document.getElementById(idd+'_help')){document.getElementById(idd+'_help').style.display="none";ClientNew.hide_info_help(idd,10);}
return false;}},hide_info_help:function(idd,licznik){if(licznik>1){setTimeout("ClientNew.hide_info_help('"+idd+"', '"+(licznik-1)+"');",1000);}else if(document.getElementById(idd+'_help')){document.getElementById(idd+'_help').style.display="none";}}}
var xr;function agree(){if(document.getElementById('terms_agree').checked&&ClientNew_status==true){document.getElementById('submit_register').className='act';}else{document.getElementById('submit_register').className='idle';}}
function clientnew_firm(){ClientNew.use_vat();if(document.getElementById('firm_data').checked){ClientNew_firma=false;document.getElementById('client_firm_div').style.display='none';document.getElementById('box_3_header').innerHTML=client_new_txt2;document.getElementById('box_1_header').innerHTML=client_new_txt3;if(document.getElementById('send_to')){document.getElementById('send_to').innerHTML=client_new_txt1;}
document.getElementById('client_firstname_copy_txt').className='';document.getElementById('client_firstname_copy').className='';document.getElementById('client_lastname_copy_txt').className='';document.getElementById('client_lastname_copy').className='';}else{ClientNew_firma=true;document.getElementById('client_firm_div').style.display='block';document.getElementById('box_3_header').innerHTML=client_new_txt2b;document.getElementById('box_1_header').innerHTML=client_new_txt3b;if(document.getElementById('send_to')){document.getElementById('send_to').innerHTML=client_new_txt1b;}
document.getElementById('client_firstname_copy_txt').className='hidden';document.getElementById('client_firstname_copy').className='hidden';document.getElementById('client_lastname_copy_txt').className='hidden';document.getElementById('client_lastname_copy').className='hidden';}}
function orderpayment(id){document.getElementById('idle_payment').style.display='none';allDivs=document.getElementsByTagName("div");for(i=0;i<allDivs.length;i++){if((/^newpayment_form_/).test(allDivs[i].id)==true){allDivs[i].style.display='none';}}
if(document.getElementById('newpayment_form_'+id)){document.getElementById('newpayment_form_'+id).style.display='block';}}
function menu_categories_toggle(id,id_up){if(document.getElementById(id).style.display=='block'){document.getElementById(id).style.display='none';}else{document.getElementById(id).style.display='block';}}
function menu_highlight(id){if(document.getElementById(id).className=='menu_categories_cat_sub_first')
{document.getElementById(id).className='menu_categories_cat_sub_first_active';return false;}
if(document.getElementById(id).className=='menu_categories_cat_sub_last')
{document.getElementById(id).className='menu_categories_cat_sub_last_active';return false;}
if(document.getElementById(id).className=='menu_categories_cat_sub')
{document.getElementById(id).className='menu_categories_cat_sub_active';return false;}
if(document.getElementById(id).className=='menu_categories_cat_sub_first_active')
{document.getElementById(id).className='menu_categories_cat_sub_first';return false;}
if(document.getElementById(id).className=='menu_categories_cat_sub_last_active')
{document.getElementById(id).className='menu_categories_cat_sub_last';return false;}
if(document.getElementById(id).className=='menu_categories_cat_sub_active')
{document.getElementById(id).className='menu_categories_cat_sub';return false;}}
function order1_shop_payformdiv(show)
{if(show){if(document.getElementById('payform_div')){document.getElementById('payform_div').style.display='block';}}else{if(document.getElementById('payform_div')){document.getElementById('payform_div').style.display='none';}
document.getElementById('payform_id').selectedIndex=0;allDivs=document.getElementsByTagName("div");for(i=0;i<allDivs.length;i++){if((/^newpayment_form_/).test(allDivs[i].id)==true){allDivs[i].style.display='none';}}}}
function order1_shop_payformdiv_advance(time,calendar,prepaid,advance)
{if(advance==1){if(document.getElementById('payform_div_label_advance')){document.getElementById('payform_div_label_advance').style.display='block';}
if(document.getElementById('payform_div_label_order')){document.getElementById('payform_div_label_order').style.display='none';}}else{if(document.getElementById('payform_div_label_advance')){document.getElementById('payform_div_label_advance').style.display='none';}
if(document.getElementById('payform_div_label_order')){document.getElementById('payform_div_label_order').style.display='block';}}
if((prepaid||advance==1)&&(document.getElementsByName('payform_id').length>1)){document.getElementById('payform_div').style.display='block';}else{if(document.getElementById('payform_div')){document.getElementById('payform_div').style.display='none';}
allDivs=document.getElementsByTagName("div");for(i=0;i<allDivs.length;i++){if((/^newpayment_form_/).test(allDivs[i].id)==true){allDivs[i].style.display='none';}}}
OrderCalendar.changeDeliveryTime(time,calendar);}
function order1_show_comment(coment)
{if(coment){document.getElementById('order1_coment_background').style.display='block';document.getElementById('order1_coment_text').innerHTML=coment;}else{document.getElementById('order1_coment_background').style.display='none';}}
function order1_changepayform()
{selVal=document.getElementById('payform_id').value;allDivs=document.getElementsByTagName("div");for(i=0;i<allDivs.length;i++){if((/^newpayment_form_/).test(allDivs[i].id)==true){allDivs[i].style.display='none';}}
if(document.getElementById('newpayment_form_'+selVal)){document.getElementById('newpayment_form_'+selVal).style.display='block';}}
function cEl(t,p,h){p.appendChild(t=document.createElement(t));if(h){t.innerHTML=h;}
return t;}
var startDay;var tmpStartDay;var selectMonth2=1;var selectYear2=1;function write_words()
{}
var OrderCalendar={start:{},changeDeliveryTime:function(time,type){startD1=OrderCalendar.start.D1+time;startM1=OrderCalendar.start.M1;startY1=OrderCalendar.start.Y1;OrderCalendar.type=type;do{var days=getCountDayOfMonth(startY1,startM1);if(startD1>days){startD1-=days;startM1+=1;if(startM1>12){startM1=1;startY1+=1;}}}while(startD1>days);var date=new Date();date.setDate(startD1);date.setMonth(startM1-1);var tmp1=date.setYear(startY1);var tmpWeek=date.getDay();date.setDate(selectDay);date.setMonth(selectMonth-1);var tmp2=date.setYear(selectYear);if(tmp2<tmp1){selectMonth=startM1;selectDay=startD1;selectYear=startY1;selectWeek=tmpWeek;}
if(type=='n'||type==''){document.getElementById("order1_calendar").style.display='none';document.getElementById("calendar_select_date").value='';}else{distroyCalendar();setTimeout("printCalendar();",0);document.getElementById("order1_calendar").style.display='block';if(type=='t'){document.getElementById('hours_range_div').style.display='block';}else{document.getElementById('hours_range_div').style.display='none';}}},selectRange:function(obj){document.getElementById("calendar_select_hour").value=obj.value;}}
function distroyCalendar()
{while(document.getElementById('calendar_m2').firstChild.childNodes.length>1){document.getElementById('calendar_m2').firstChild.removeChild(document.getElementById('calendar_m2').firstChild.lastChild);}
while(document.getElementById('calendar_m1').firstChild.childNodes.length>1){document.getElementById('calendar_m1').firstChild.removeChild(document.getElementById('calendar_m1').firstChild.lastChild);}}
function printMonth(year,month,firstDay,m)
{var licznik=1;var dzient=1;var wiersz=0;var i=1;var date=new Date();date.setDate(1);date.setMonth(month-1);date.setYear(year);firstDay=date.getDay();if(firstDay==0){firstDay=7;}
var liczbaDni=getCountDayOfMonth(year,month);while(licznik){dzient=dzient+1
if(dzient>7){dzient=1;}
if(licznik%7==1){w=cEl('tr',document.getElementById('calendar_'+m).firstChild);wiersz=wiersz+1;}
td=cEl('td',w);if(licznik<firstDay&&wiersz==1){td.className='null';}else{td.id="calendar_"+year+"_"+month+"_"+i;td.innerHTML='<span>'+i+'</span>';if((month==startM1&&startY1==year&&i<startD1)||Holidays[i+"_"+month+"_"+year]==1){document.getElementById("calendar_"+year+"_"+month+"_"+i).className="n55494_deactive";}else{document.getElementById("calendar_"+year+"_"+month+"_"+i).onclick=function(x){var id=this.id.split('_');selectDate('cos',id[3],id[2],id[1],licznik%7);};}
i=i+1;}
if(i>liczbaDni){break;}
licznik=licznik+1;}}
function printCalendar()
{var wiersz=0;var i=1;var dzient=1;document.getElementById('name_month_1').innerHTML=monthArr[parseInt(selectMonth)];document.getElementById('name_month_2').innerHTML=monthArr[(parseInt(selectMonth)+1)%12];printMonth(parseInt(selectYear),parseInt(selectMonth),'',"m1");var m_tmp=parseInt(selectMonth)+1;var y_tmp=parseInt(selectYear);if(m_tmp==13){m_tmp=1;y_tmp=y_tmp+1;}
printMonth(y_tmp,m_tmp,'',"m2");activeCalendar();}
function changeMonth(action)
{document.getElementById("loader").style.display="block";if(action=="minus"){if(selectYear2==startY1&&startM1==selectMonth2){activeCalendar();return;}else{distroyCalendar();printMonth(selectYear2,selectMonth2,startDay,"m2");selectMonth2=selectMonth2-1;if(selectMonth2==0){selectMonth2=12;selectYear2=selectYear2-1;}
startDay=startDay-(getCountDayOfMonth(selectYear2,selectMonth2)%7);if(startDay<=0){startDay=startDay+7;}
printMonth(selectYear2,selectMonth2,startDay,"m1");}}else{if((selectYear2>startY1&&(startM1-6)<(selectMonth2))||(selectYear2==startY1&&(startM1+6)<selectMonth2)){activeCalendar();return;}
distroyCalendar();startDay=startDay+(getCountDayOfMonth(selectYear2,selectMonth2)%7);if(startDay>7){startDay=startDay-7;}
selectMonth2=selectMonth2+1;if(selectMonth2==13){selectMonth2=1;selectYear2=selectYear2+1;}
printMonth(selectYear2,selectMonth2,startDay,"m1");var m_tmp=selectMonth2+1;var y_tmp=selectYear2;if(m_tmp==13){m_tmp=1;y_tmp=y_tmp+1;}
var startDay2=startDay+(getCountDayOfMonth(selectYear2,selectMonth2)%7);if(startDay2>7){startDay2=startDay2-7;}
printMonth(y_tmp,m_tmp,startDay2,"m2");}
document.getElementById('name_month_1').innerHTML=monthArr[selectMonth2];var tmpM=selectMonth2+1;if(tmpM==13){tmpM=1;}
document.getElementById('name_month_2').innerHTML=monthArr[tmpM];activeCalendar();}
function activeCalendar()
{if(document.getElementById("calendar_"+selectYear+"_"+selectMonth+"_"+selectDay)){document.getElementById("calendar_"+selectYear+"_"+selectMonth+"_"+selectDay).className="n55494_active";}
document.getElementById("name_day").innerHTML=daysArr[selectWeek]+", "+selectDay+" "+monthArr2[selectMonth]+" "+selectYear;document.getElementById("loader").style.display="none";if(document.getElementById("calendar_select_date")){document.getElementById("calendar_select_date").value=selectYear+"-"+selectMonth+"-"+selectDay;}
if(OrderCalendar.type=='t'){if(OrderCalendar.start.D1==selectDay&&OrderCalendar.start.M1==selectMonth){document.getElementById("hours_range1").disabled=SelectTime>=11?true:false;document.getElementById("hours_range2").disabled=SelectTime>=13?true:false;document.getElementById("hours_range3").disabled=SelectTime>=15?true:false;document.getElementById("hours_range4").disabled=SelectTime>=17?true:false;document.getElementById("hours_range5").disabled=SelectTime>=19?true:false;}else{document.getElementById("hours_range1").disabled=false;document.getElementById("hours_range2").disabled=false;document.getElementById("hours_range3").disabled=false;document.getElementById("hours_range4").disabled=false;document.getElementById("hours_range5").disabled=false;}}}
function selectDate(cos,day,month,year,week){document.getElementById("loader").style.display="block";if(document.getElementById("calendar_"+selectYear+"_"+selectMonth+"_"+selectDay)){document.getElementById("calendar_"+selectYear+"_"+selectMonth+"_"+selectDay).className='';}
selectDay=day;selectMonth=month;selectWeek=week;selectYear=year;activeCalendar();}
function getCountDayOfMonth(year,month)
{switch(month){case 1:return 31;break;case 2:if(year%4==0){return 29;}else{return 28;}break;case 3:return 31;break;case 4:return 30;break;case 5:return 31;break;case 6:return 30;break;case 7:return 31;break;case 8:return 31;break;case 9:return 30;break;case 10:return 31;break;case 11:return 30;break;case 12:return 31;break;}}
var txt_dzis=" today.";var txt_jutro=" tomorrow.";var txt_za=" within ";var txt_dni=" days.";function numbercheck(number)
{if(!isNaN(parseFloat(number)))
{if(number.match("^[1-9]{1}[0-9]{0,9}$")||number==''){return number;}else
{number=number.substring(0,number.length-1);return number;}}
else
{return"";}}
function ADD_ALL_SEARCH(thid)
{var idek=thid.id.replace("srch_amount_","");thid.value=numbercheck(thid.value);var netto=document.getElementById('srch_netto_'+idek);var brutto=document.getElementById('srch_brutto_'+idek);var netto_value=parseFloat(netto.innerHTML);var brutto_value=parseFloat(brutto.innerHTML);var sum_down=document.getElementById('sum_down');var sum_up=document.getElementById('sum_up');var sum_down2=document.getElementById('sum_down2');var sum_up2=document.getElementById('sum_up2');sum_down.value=0;sum_up.value=0;sum_down2.value=0;sum_up2.value=0;var elems=document.getElementsByTagName('input');for(i=0;i<elems.length;i++)
{if(elems[i].name=='quantity')
{if(!isNaN(parseFloat(elems[i].value)))
{sum_up.value=parseFloat(elems[i].value)*netto_value+parseFloat(sum_up.value);sum_up2.value=parseFloat(elems[i].value)*brutto_value+parseFloat(sum_up2.value);sum_down.value=parseFloat(elems[i].value)*netto_value+parseFloat(sum_down.value);sum_down2.value=parseFloat(elems[i].value)*brutto_value+parseFloat(sum_down2.value);}}}
sum_up.value=roundNumber(sum_up.value,2);sum_down.value=roundNumber(sum_down.value,2);sum_up2.value=roundNumber(sum_up2.value,2);sum_down2.value=roundNumber(sum_down2.value,2);}
function roundNumber(number,flag){var rnum=number;if(flag==0)var rlength=0;if(flag!=0)var rlength=flag;if(rnum>8191&&rnum<10485){rnum=rnum-5000;var newnumber=Math.round(rnum*Math.pow(10,rlength))/Math.pow(10,rlength);newnumber=newnumber+5000;}else{var newnumber=Math.round(rnum*Math.pow(10,rlength))/Math.pow(10,rlength);}
return newnumber;}
function add2basket()
{var a2b=document.getElementById('adding_to_basket');a2b.innerHTML='';var flaga_submit=false;var elems=document.getElementsByTagName('input');for(i=0;i<elems.length;i++)
{if(elems[i].name=='quantity')
{if(!isNaN(parseFloat(elems[i].value))&&parseFloat(elems[i].value)!=0){var idek=elems[i].id.replace("srch_amount_","");var size;if(document.getElementById('srch_size_'+idek))
{size=document.getElementById('srch_size_'+idek).value;}
if(isNaN(size))size='uniw';addElement(parseFloat(elems[i].value),size,document.getElementById('srch_product_'+idek).value);flaga_submit=true;}}}
if(flaga_submit==true)
{document.getElementById('adding_to_basket').submit();}
else
{return false;}}
function addElement(wartosc,size,product){var ni=document.getElementById('adding_to_basket');var newinput=document.createElement('input');var newinput2=document.createElement('input');var newinput3=document.createElement('input');newinput.setAttribute('type','product');newinput2.setAttribute('type','quantity');newinput3.setAttribute('type','size');newinput.setAttribute('name','product[]');newinput2.setAttribute('name','quantity[]');newinput3.setAttribute('name','size[]');newinput.setAttribute('type','hidden');newinput2.setAttribute('type','hidden');newinput3.setAttribute('type','hidden');newinput.value=product;newinput2.value=wartosc;newinput3.value=size;ni.appendChild(newinput);ni.appendChild(newinput2);ni.appendChild(newinput3);}
function SwitchSize(id,id2)
{var srhprice;var srhprice_net;var srhstatus;var srhstatus_txt;var srhstatus_gfx;var sdays;srhprice=arSearchSizes[id][0];srhprice_net=arSearchSizes[id][1];srhstatus=arSearchSizes[id][2];srhstatus_txt=arSearchSizes[id][3];srhstatus_gfx=arSearchSizes[id][4];sdays=arSearchSizes[id][5];document.getElementById('av_img'+id2).src=srhstatus_gfx;document.getElementById('av_txt'+id2).innerHTML=srhstatus_txt;if((srhstatus=='disable')&&(sdays!='')){if(sdays=='0'){document.getElementById('av_txt'+id2).innerHTML=srhstatus_txt+' '+txt_dzis;}
else if(days=='1'){document.getElementById('av_txt'+id2).innerHTML=srhstatus_txt+' '+txt_jutro;}
else{document.getElementById('av_txt'+id2).innerHTML=srhstatus_txt+txt_za+sdays+txt_dni;}}
document.getElementById('av_netprice'+id2).innerHTML=srhprice_net;document.getElementById('av_price'+id2).innerHTML=srhprice;}
function basketedit_q(el){if(document.getElementById(el)){var objRegExp=/(^-?dd*$)/;var txt=document.getElementById(el).value;if(objRegExp.test(txt)){return true;}else{alert("Please, provide the correct value");}}
return false;}
var search_txt_maksymalnie="You can add max.: ";function viewGroupEdit(group_id,item_id)
{element=document.getElementById('div_group_edit');element.style.display='block';document.getElementById('group_'+group_id).style.display='block';document.getElementById('item_'+item_id).style.display='block';}
var product_id=0;var size_id=0;var price=0;function baskQuantity()
{sel_sz=document.getElementById('select_sizes_'+product_id);div_nr_n=document.getElementById('div_num_'+product_id+'_'+size_id);div_nr_b=document.getElementById('div_num_'+product_id+'_'+sel_sz.value);sel_nr_n=document.getElementById('select_num_'+product_id+'_'+size_id);sel_nr_b=document.getElementById('select_num_'+product_id+'_'+sel_sz.value);div_nr_n.style.display='none';div_nr_b.style.display='block';sel_nr_n.disabled=true;sel_nr_b.disabled=false;size_id=sel_sz.value;div_pr=document.getElementById('div_price');inp_pr=document.getElementById('price_'+product_id+'_'+sel_sz.value);inp_cr=document.getElementById('cur_sign');if(inp_pr.value!=''){div_pr.innerHTML=inp_pr.value+inp_cr.value;}else{div_pr.innerHTML=inp_pr.value;}}
function hideGroupEdit()
{element=document.getElementById('div_group_edit');element.style.display='none';}
function basket_isNumeric(id,precision){var elem=document.getElementById(id);if(precision>0){if(elem.value.match("^[0-9]{1,9}[.,]{0,1}[0-9]{0,"+precision+"}$")||elem.value==''){elem.value=elem.value.replace(',','.');return true;}else{elem.value=elem.value.substring(0,elem.value.length-1);return false;}}
if(precision==0){if(elem.value.match("^[1-9]{1}[0-9]{0,9}$")||elem.value==''){return true;}else{elem.value=elem.value.substring(0,elem.value.length-1);return false;}}}
var Alertek={alert_cover:'',Start:function(txt)
{var cloudID=document.getElementById('alert_cover');if(txt){cloudID.innerHTML=txt;var coors;coors=Alertek.FindPos();cloudID.style.display="block";cloudID.style.opacity="0";cloudID.style.filter="alpha(Opacity=0)";cloudID.style.position="absolute";cloudID.style.zIndex="1000";Alertek.X=40;Alertek.Top=coors[1]-cloudID.clientHeight-Alertek.X-1;Alertek.I=0;if((coors[1]-cloudID.clientHeight)<0)
{Alertek.X=10;Alertek.Top=coors[1]+id.clientHeight+Alertek.X;}
cloudID.style.top=Alertek.Top+'px';var cloudLeft=document.body.clientWidth;if(cloudLeft<(cloudID.clientWidth+coors[0]))
{cloudID.style.left=coors[0]-cloudID.clientWidth+id.clientWidth+'px';}
else
{cloudID.style.left=coors[0]+'px';}
clearInterval(Alertek.Time);clearTimeout(Alertek.Time2);clearInterval(Alertek.Time3);Alertek.Attribute=0;Alertek.Time=setInterval("Alertek.Move()",40);Alertek.Time2=setTimeout("Alertek.End()",3000);}else{return false;}},End:function()
{var cloudID=document.getElementById('alert_cover');var coors;coors=Alertek.FindPos();Alertek.X=40;if((coors[1]-cloudID.clientHeight)<0)
{Alertek.X=10;}
Alertek.Top=coors[1]-cloudID.clientHeight;Alertek.I=100;clearInterval(Alertek.Time);clearTimeout(Alertek.Time2);clearInterval(Alertek.Time3);Alertek.Attribute=1;Alertek.Time=setInterval("Alertek.Move()",40);},Move:function()
{var cloudID=document.getElementById('alert_cover');if(Alertek.Attribute==0){Alertek.Top=Math.round(Alertek.Top)+(Alertek.X/2);}
if(Alertek.Attribute==1){Alertek.Top=Math.round(Alertek.Top)-(Alertek.X/2);}
Alertek.X=Math.round(Alertek.X/2);if(Alertek.Attribute==0){Alertek.I=Alertek.I+15;}
if(Alertek.Attribute==1){Alertek.I=Alertek.I-15;}
cloudID.style.top=Alertek.Top+'px';if(Alertek.I<100){cloudID.style.opacity="0."+Alertek.I;cloudID.style.filter="alpha(Opacity="+Alertek.I+")";}else{cloudID.style.opacity="1";cloudID.style.filter="alpha(Opacity=100)";}
if(Alertek.X==1){if(Alertek.Attribute==0){Alertek.Time3=setInterval("Alertek.MoveAlways()",1);cloudID.style.opacity="1";cloudID.style.filter="alpha(Opacity=100)";}else if(Alertek.Attribute==1){cloudID.style.opacity="0";cloudID.style.filter="alpha(Opacity=0)";cloudID.style.display="none";}
clearInterval(Alertek.Time);}},MoveAlways:function()
{var coors;coors=Alertek.FindPos();document.getElementById('alert_cover').style.top=coors[1]-document.getElementById('alert_cover').clientHeight+'px';},FindPos:function()
{var cloudID=document.getElementById('alert_cover');var curleft=ns6?((Popup.pageSizes()[2]/2)-(cloudID.clientWidth/2))+"px":((Popup.pageSizes()[2]/2)-(cloudID.clientWidth/2));var curtop=Alertek.pageHeight();return[curleft,curtop];},Time:0,Time2:0,Time3:0,Top:0,X:0,I:0,Attribute:0,getScrollXY:function(){var scrOfX=0,scrOfY=0;if(typeof(window.pageYOffset)=='number'){scrOfY=window.pageYOffset;scrOfX=window.pageXOffset;}else if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){scrOfY=document.body.scrollTop;scrOfX=document.body.scrollLeft;}else if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){scrOfY=document.documentElement.scrollTop;scrOfX=document.documentElement.scrollLeft;}
return scrOfY;},pageHeight:function(){var _docHeight=self.innerHeight||(document.documentElement.clientHeight||document.body.clientHeight);var heighter=(_docHeight/2)+Alertek.getScrollXY();return heighter;},show_alert:function(txt){Alertek.Start(txt);},hide_alert:function(){Alertek.End();}}
var SearchJS={number_up:function(idek,amount)
{amount=Math.abs(amount);var idek=document.getElementById(idek);if(isNaN(parseInt(idek.value)))idek.value=0;if(idek.value>=parseInt(amount)&&isFinite(amount)&&amount!='-1')
{Alertek.show_alert(search_txt_maksymalnie+amount);if(document.getElementById(idek))document.getElementById(idek).value=amount;return false;}
else
{idek.value=parseInt(idek.value)+1;}},numbercheck:function(number,amount){amount=Math.abs(amount);if(amount=='')
{amount=GlobalAmount;}
if(!isNaN(parseFloat(number)))
{if(number.match("^[0-9]{1}[0-9]{0,9}$")||number==''){if(number<=parseInt(amount)||amount==-1)
{return number;}
else
{Alertek.show_alert(search_txt_maksymalnie+amount);return amount;}}
else
{number=number.substring(0,number.length-1);return number;}}
else
{return"";}},number_down:function(idek,amount)
{amount=Math.abs(amount);var idek=document.getElementById(idek);if(isNaN(parseInt(idek.value)))idek.value=0;if(idek.value>1)
{idek.value=parseInt(idek.value)-1;}}}
function client_addresses_list_confirmdelete(){return confirm('Are you sure you want to delete the selected delivery address?');}
var client_new_txt1='Wysyłka na adres zamawiającego';var client_new_txt1b='Wysyłka na adres z faktury';var client_new_txt2='Adres zamawiającego';var client_new_txt2b='Dane do faktury';var client_new_txt3='Dane kontaktowe';var client_new_txt3b='Dane kontaktowe';var ClientNew_status=true;var ClientNew_firma=false;var ClientNew_adres=true;var ClientNewMandatoryMail=false;var ClientNewMandatoryPhone=false;var ClientSender=new Array();var ClientNewWholesale={use_vat:function(){var idr=document.getElementById('client_region').value;if(countryVatArray[idr]=='n'){document.getElementById('vat_ue').style.display='';}else{document.getElementById('vat_ue').style.display='none';}},check_inp:function(idd,name,delay){if(document.getElementById(idd)){idd=document.getElementById(idd);}
ClientNewWholesale.use_vat();var value=idd.value;if(ClientSender[name]>5){ClientSender[name]=1;if(name=='client_zipcode'){IAI_Ajax.Request('ajax/client-new.php?validAjax=true','client_zipcode='+value+'&client_region='+document.getElementById('client_region').value,{onSuccess:'ClientNewWholesale.info',arg:idd.id});}else if(name=='delivery_zipcode'){IAI_Ajax.Request('ajax/client-new.php?validAjax=true','delivery_zipcode='+value+'&delivery_region='+document.getElementById('delivery_region').value,{onSuccess:'ClientNewWholesale.info',arg:idd.id});}else if(name=='client_region'){ClientNewWholesale.check_inp(document.getElementById('client_zipcode'),'client_zipcode');}else if(name=='delivery_region'){ClientNewWholesale.check_inp(document.getElementById('delivery_zipcode'),'delivery_zipcode');}else if(name=='client_password'){IAI_Ajax.Request('ajax/client-new.php?validAjax=true','client_password='+value+'&client_login='+document.getElementById('client_login').value,{onSuccess:'ClientNewWholesale.info',arg:idd.id});}else if(name=='repeat_password'){IAI_Ajax.Request('ajax/client-new.php?validAjax=true','repeat_password='+value+'&client_password='+document.getElementById('client_password').value,{onSuccess:'ClientNewWholesale.info',arg:idd.id});}else{if(value){IAI_Ajax.Request('ajax/client-new.php?validAjax=true',name+'='+value,{onSuccess:'ClientNewWholesale.info',arg:idd.id});}else{ClientNewWholesale.error(idd.id,0);document.getElementById(idd.id+'_img_off').style.display="none";document.getElementById(idd.id+'_img_on').style.display="none";}}}else{if(delay){if(ClientSender[name]>1){ClientSender[name]++;delay++;}else{return false;}}else{if(ClientSender[name]>2){ClientSender[name]=2;return false;}else{ClientSender[name]=2;delay=1;}}
setTimeout('ClientNewWholesale.check_inp("'+idd.id+'", "'+name+'", "'+delay+'")',100);}
if(name=='client_login'){document.getElementById('client_login').value=document.getElementById('client_login').value.toLowerCase();}
if(document.getElementById('deliver_to_billingaddr')){if(document.getElementById('deliver_to_billingaddr').checked){ClientNewWholesale.deliveryaddr();}}},info:function(x,obj){try{var response=eval('('+x+')');}catch(e){return false;}
xr=response;if(response.errno==0){new ClientNewWholesale.error(obj,0);}else{if(response.message.error_code){ClNew.g(obj+'_help').innerHTML='<div>'+clientNewErrorCode[response.message.error_code]+'</div>';}
new ClientNewWholesale.error(obj,1);}},button:function(num){if(num==0&&document.getElementById('terms_agree').checked){if(document.getElementById('submit_register')){document.getElementById('submit_register').className='act';}
if(document.getElementById('submit_noregister')){document.getElementById('submit_noregister').className='act';}}else{if(document.getElementById('submit_register')){document.getElementById('submit_register').className='idle';}
if(document.getElementById('submit_noregister')){document.getElementById('submit_noregister').className='idle';}}},submitform:function(){ClientNew_status=true;if(!document.getElementById("client_firstname").value){ClientNew_status=false;}
if(!document.getElementById("client_lastname").value){ClientNew_status=false;}
if(!document.getElementById("client_email").value){ClientNew_status=false;}
if(!document.getElementById("client_city").value){ClientNew_status=false;}
if(!document.getElementById("client_zipcode").value){ClientNew_status=false;}
if(!document.getElementById("client_street").value){ClientNew_status=false;}
if(document.getElementById("firm_data2")){if(document.getElementById("firm_data2").checked&&!document.getElementById("client_firm").value&&!document.getElementById("client_nip").value){ClientNew_status=false;}}
if(document.getElementById("client_login")){if(!document.getElementById("client_login").value){ClientNew_status=false;}}
if(document.getElementById("client_password")){if(!document.getElementById("client_password").value||!document.getElementById("repeat_password").value){ClientNew_status=false;}}
if(document.getElementById("deliver_to_billingaddr")){if(!document.getElementById("deliver_to_billingaddr").checked){if((!document.getElementById("delivery_firstname").value||!document.getElementById("delivery_lastname").value)&&!document.getElementById("delivery_additional").value){ClientNew_status=false;}
if(!document.getElementById("delivery_zipcode").value){ClientNew_status=false;}
if(!document.getElementById("delivery_street").value){ClientNew_status=false;}
if(!document.getElementById("delivery_city").value){ClientNew_status=false;}}}
if(ClientNewMandatoryPhone){if(!document.getElementById('client_phone').value){ClientNew_status=false;}
if(document.getElementById('additional_phone')){if((!document.getElementById('additional_phone').value)&&!document.getElementById('additional_phone').disabled){ClientNew_status=false;}}else if(document.getElementById('delivery_phone')){if((!document.getElementById('delivery_phone').value)&&!document.getElementById('delivery_phone').disabled){ClientNew_status=false;}}}
if(ClientNewMandatoryMail){if(!document.getElementById('client_email').value){ClientNew_status=false;}}
if(document.getElementById('terms_agree')){if((!document.getElementById('terms_agree').checked)&&document.getElementById('terms_agree').type!='hidden'){ClientNew_status=false;}}
if(ClientNew_status==true){if(document.getElementById("button_alert")){document.getElementById("button_alert").style.display="none";}
return true;}else{if(document.getElementById("button_alert")){document.getElementById("button_alert").style.display="block";setTimeout('ClientNewWholesale.AlertOff()',5000);}
return false;}
if(document.getElementById('vat_ue').style.display!='none'&&!document.getElementById('vat_company').checked){document.getElementById("button_alert").style.display="block";setTimeout('ClientNew.AlertOff()',5000);return false;}},ramka:function(){if(!document.getElementById('terms_agree').checked){document.getElementById('terms_agree_box').className='ramka_ON';}else{document.getElementById('terms_agree_box').className='ramka_OFF';}},AlertOff:function(){document.getElementById("button_alert").style.display="none";},deliveryaddr:function(){if(document.getElementById('deliver_to_billingaddr').checked){document.getElementById('delivery_additional').value=document.getElementById('client_firm').value;document.getElementById('delivery_firstname').value=document.getElementById('client_firstname').value;document.getElementById('delivery_lastname').value=document.getElementById('client_lastname').value;document.getElementById('delivery_zipcode').value=document.getElementById('client_zipcode').value;document.getElementById('delivery_street').value=document.getElementById('client_street').value;document.getElementById('delivery_city').value=document.getElementById('client_city').value;if(document.getElementById('delivery_region')&&document.getElementById('client_region')){document.getElementById('delivery_region').value=document.getElementById('client_region').value;}
document.getElementById('delivery_phone').value=document.getElementById('client_phone').value;document.getElementById('box_4').className='n56315_box_idle';document.getElementById('delivery_additional').disabled='disabled';document.getElementById('delivery_firstname').disabled='disabled';document.getElementById('delivery_lastname').disabled='disabled';document.getElementById('delivery_zipcode').disabled='disabled';document.getElementById('delivery_street').disabled='disabled';document.getElementById('delivery_city').disabled='disabled';document.getElementById('delivery_region').disabled='disabled';document.getElementById('delivery_phone').disabled='disabled';}else{document.getElementById('box_4').className='n56315_box';document.getElementById('delivery_additional').disabled='';document.getElementById('delivery_firstname').disabled='';document.getElementById('delivery_lastname').disabled='';document.getElementById('delivery_zipcode').disabled='';document.getElementById('delivery_street').disabled='';document.getElementById('delivery_city').disabled='';document.getElementById('delivery_phone').disabled='';if(document.getElementById('delivery_region')){document.getElementById('delivery_region').disabled='';}}},error:function(idd,err){if(err==1){document.getElementById(idd+'_img_off').style.display="block";document.getElementById(idd+'_img_on').style.display="none";if(document.getElementById(idd+'_help')){document.getElementById(idd+'_help').style.display="block";ClientNewWholesale.hide_info_help(idd,10);}}else{document.getElementById(idd+'_img_off').style.display="none";document.getElementById(idd+'_img_on').style.display="block";if(document.getElementById(idd+'_help')){document.getElementById(idd+'_help').style.display="none";}}
return false;},hide_info_help:function(idd,i){if(i>1){setTimeout("ClientNewWholesale. hide_info_help('"+idd+"', '"+(i-1)+"');","1000");}else{document.getElementById(idd+'_help').style.display="none";}}}
var xr;function SwitchSizePr(id,id2)
{var prjprice;var prjprice_net;var prjstatus;var prjstatus_txt;var prjstatus_gfx;var prjdays;prjprice=arProjectorSizes[id][0];prjprice_net=arProjectorSizes[id][1];prjstatus=arProjectorSizes[id][2];prjstatus_txt=arProjectorSizes[id][3];prjstatus_gfx=arProjectorSizes[id][4];prjdays=arProjectorSizes[id][5];document.getElementById('av_img').src=prjstatus_gfx;document.getElementById('av_txt').innerHTML=prjstatus_txt;if((prjstatus=='disable')&&(prjdays!='')){if(prjdays=='0'){document.getElementById('av_txt'+id2).innerHTML=prjstatus_txt+' '+txt_dzis;}
else if(days=='1'){document.getElementById('av_txt'+id2).innerHTML=prjstatus_txt+' '+txt_jutro;}
else{document.getElementById('av_txt'+id2).innerHTML=prjstatus_txt+txt_za+prjdays+txt_dni;}}
document.getElementById('av_netprice').innerHTML=prjprice_net;document.getElementById('av_price').innerHTML=prjprice;}
var components=new Array("component_projector_associated","component_projector_incategory","component_projector_ordered","component_projector_askforproduct","component_projector_opinions","component_projector_addopinions","component_projector_suggestproduct","component_projector_longdescription","component_projector_dictionary","component_projector_sizes","component_projector_associated_series","component_projector_warranty");function hider(button,id_comp)
{for(i=0;i<components.length;i++){if(document.getElementById('btn_'+components[i])){document.getElementById('btn_'+components[i]).className='off_btn';}}
button.className='on_btn';for(i=0;i<components.length;i++){if(document.getElementById(components[i])){document.getElementById(components[i]).style.display='none';}}
document.getElementById(id_comp).style.display='block';}
function show_hover(id){if(document.getElementById(id))document.getElementById(id).style.display='block';}
function showButtons()
{var i=0;for(i=0;i<components.length;i++){if(document.getElementById(components[i])){if(document.getElementById('btn_'+components[i])){document.getElementById('btn_'+components[i]).style.display='block';}
if(document.getElementById(components[i]).offsetWidth!='0'&&components[i]!='component_projector_addopinions'){document.getElementById('btn_'+components[i]).className='on_btn';}}}
setTimeout("showButtons()",1000);}
showButtons();var ns6=document.getElementById&&!document.all;var ie=document.all;var html=document.getElementsByTagName("html");var Popup={url:'http://'+location.host,link:'',width:0,height:0,loaded:0,show:function(link,x,y){Popup.link=link;Popup.width=x;Popup.height=y;Popup.loaded=1;if(document.getElementById('big_photo')){document.getElementById('big_photo').style.display="none";document.getElementById('big_photo').src=Popup.link;document.getElementById('big_photo2').src=Popup.link;}
if(basecount<2||!basecount){document.getElementById('popup_next_prev').style.visibility="hidden";}
var edit=document.getElementById('show_popup_photo_sub');edit.style.width=parseInt(x)+"px";edit.style.height=parseInt(y)+"px";if(!ns6){Popup.hideSelects(1);}
Popup.creatLayers();},reload:function(){if(Popup.loaded){Popup.resize(Popup.link,Popup.width,Popup.height);}},next_img:function(){Popup.link=document.getElementById('big_photo').src;if(Popup.link.indexOf(Popup.url)!='-1')Popup.link=Popup.link.substr(Popup.url.length+1,Popup.link.length);for(n=1;n<=basecount;n++)
{if(Popup_enclosures[n][0]==Popup.link){n++;if(n<=basecount){Popup.resize(Popup_enclosures[n][0],Popup_enclosures[n][1],Popup_enclosures[n][2]);Popup.link=Popup_enclosures[n][0];return false;}
else
{Popup.resize(Popup_enclosures[1][0],Popup_enclosures[1][1],Popup_enclosures[1][2]);Popup.link=Popup_enclosures[1][0];return false;}}}},prev_img:function(){Popup.link=document.getElementById('big_photo').src;if(Popup.link.indexOf(Popup.url)!='-1')Popup.link=Popup.link.substr(Popup.url.length+1,Popup.link.length);for(n=basecount;n<=basecount;n--)
{if(Popup_enclosures[n][0]==Popup.link){n--;if(n>=1){Popup.resize(Popup_enclosures[n][0],Popup_enclosures[n][1],Popup_enclosures[n][2]);Popup.link=Popup_enclosures[n][0];return false;}
else
{Popup.resize(Popup_enclosures[basecount][0],Popup_enclosures[basecount][1],Popup_enclosures[basecount][2]);Popup.link=Popup_enclosures[basecount][0];return false;}}}},resize:function(sciezka,width,height){document.getElementById('big_photo').style.display='none';var edit=document.getElementById('show_popup_photo_sub');var edit2=document.getElementById('show_popup_photo');document.getElementById('big_photo').src=sciezka;document.getElementById('big_photo2').src=sciezka;edit.style.width=parseInt(width)+"px";edit2.style.width=parseInt(width)+"px";edit.style.height=parseInt(height)+"px";edit2.style.left=ns6?(Popup.pageSizes()[2]-(edit2.clientWidth+10))/2+html[0].scrollLeft+"px":(Popup.pageSizes()[2]-(edit2.clientWidth+10))/2+"px";},hide:function(){var edit=document.getElementById('show_popup_photo');var edit_close=document.getElementById('show_popup_photo_close');var cover=document.getElementById('cover');edit.style.display="none";edit_close.style.display="none";cover.style.display="none";Popup.loaded=0;if(!ns6){Popup.hideSelects(0);}},cover:function(wartosc){var cover=document.getElementById('cover');ns6?cover.style.opacity='.'+wartosc:cover.style.filter="alpha(Opacity="+wartosc+")";if(window.opera){cover.style.opacity='.'+wartosc;}},creatLayers:function(){var edit=document.getElementById('show_popup_photo');var edit_close=document.getElementById('show_popup_photo_close');edit.style.position='absolute';edit.style.display="block";edit_close.style.display="block";edit.style.width=(Popup.width)+"px";edit.style.left=ns6?(Popup.pageSizes()[2]-(Popup.width+10))/2+html[0].scrollLeft+"px":(Popup.pageSizes()[2]-(Popup.width+10))/2+"px";var ver_brow=0;if(navigator.appVersion.indexOf("MSIE")!=-1){temp=navigator.appVersion.split("MSIE");ver_brow=parseFloat(temp[1]);if(ver_brow<7.0)
{edit.style.top=((((Popup.pageSizes()[3]-(Popup.height+10))/2)-100+document.body.scrollTop)<0)?"50px":(((Popup.pageSizes()[3]-(Popup.height+10))/2)-100+document.body.scrollTop+50)+"px";}
else
{edit.style.top=((((Popup.pageSizes()[3]-(Popup.height+10))/2)-100+html[0].scrollTop)<0)?"50px":(((Popup.pageSizes()[3]-(Popup.height+10))/2)-100+html[0].scrollTop+50)+"px";}}
else
{edit.style.top=((((Popup.pageSizes()[3]-(Popup.height+10))/2)-100+html[0].scrollTop)<0)?"50px":(((Popup.pageSizes()[3]-(Popup.height+10))/2)-100+html[0].scrollTop+50)+"px";}
edit.style.zIndex=1000;edit.style.Background='#FFFFFF';var cover=document.getElementById('cover');cover.style.display="block";cover.style.position="absolute";cover.style.zIndex=900;ns6?cover.style.opacity=.5:cover.style.filter="alpha(Opacity=50)";if(window.opera){cover.style.opacity=.5;}
cover.style.left="0px";cover.style.top="0px";offsetX=0;if(!ns6&&!window.opera){offsetX=20;}
cover.style.width=ns6?(Popup.pageSizes()[0]-16)+"px":Popup.pageSizes()[0]-offsetX+"px";cover.style.height=Popup.pageSizes()[1]+"px"},pageSizes:function(){var xScroll,yScroll;if(window.innerHeight&&window.scrollMaxY){xScroll=document.body.scrollWidth;yScroll=window.innerHeight+window.scrollMaxY;}else if(document.body.scrollHeight>document.body.offsetHeight){xScroll=document.body.scrollWidth;yScroll=document.body.scrollHeight;}else{xScroll=document.body.offsetWidth;yScroll=document.body.offsetHeight;}
var windowWidth,windowHeight;if(self.innerHeight){windowWidth=self.innerWidth;windowHeight=self.innerHeight;}else if(document.documentElement&&document.documentElement.clientHeight){windowWidth=document.documentElement.clientWidth;windowHeight=document.documentElement.clientHeight;}else if(document.body){windowWidth=document.body.clientWidth;windowHeight=document.body.clientHeight;}
if(yScroll<windowHeight){pageHeight=windowHeight;}else{pageHeight=yScroll;}
if(xScroll<windowWidth){pageWidth=windowWidth;}else{pageWidth=xScroll;}
arrayPageSize=new Array(pageWidth,pageHeight,windowWidth,windowHeight)
return arrayPageSize;},hideSelects:function(flag){var selects=document.getElementsByTagName('SELECT');if(flag==1){for(i=0;i<selects.length;i++){selects[i].style.display='none';}}else{for(i=0;i<selects.length;i++){selects[i].style.display='';}}}}
window.onresize=function(){if(Popup.loaded==1){Popup.reload();}}
var displayed='';function ImageRotate(id,id2)
{if(displayed==''){document.getElementById('img_1').style.display='none';}else{document.getElementById(displayed).style.display='none';}
document.getElementById(id).style.display='';displayed=id;var imglist=document.getElementById('photos_list');imglist=imglist.getElementsByTagName('img');i=0;while(i<imglist.length){imglist[i].className="miniatura";i++;}
id2.className="miniatura_on";}
var offsetfrommouse=[10,15];var timer;var idek;function truebody(){return(!window.opera&&document.compatMode&&document.compatMode!="BackCompat")?document.documentElement:document.body}
function hidetrail(){document.getElementById(idek).style.display="none";document.onmousemove="";document.getElementById(idek).style.left="-2000px";clearTimeout(timer);}
function showtrail(id){idek=id;if(isNaN(timer)){show();}
timer=setTimeout("show();",100);}
function show(){var docwidth=document.all?truebody().scrollLeft+truebody().clientWidth:pageXOffset+window.innerWidth-offsetfrommouse[0]
var docheight=document.all?Math.min(truebody().scrollHeight,truebody().clientHeight):Math.min(window.innerHeight)
document.onmousemove=followmouse;document.getElementById(idek).style.display="block";}
function followmouse(e){var xcoord=offsetfrommouse[0]
var ycoord=offsetfrommouse[1]
var docwidth=document.all?truebody().scrollLeft+truebody().clientWidth:pageXOffset+window.innerWidth-15
var docheight=document.all?Math.min(truebody().scrollHeight,truebody().clientHeight):Math.min(window.innerHeight)
if(typeof e!="undefined"){if(docwidth-e.pageX<2*offsetfrommouse[0]){xcoord=e.pageX-xcoord;}else{xcoord+=e.pageX;}
if(docheight-e.pageY<2*offsetfrommouse[1]){ycoord+=e.pageY-Math.max(0,(2*offsetfrommouse[1]+e.pageY-docheight-truebody().scrollTop));}else{ycoord+=e.pageY;}}else if(typeof window.event!="undefined"){if(docwidth-event.clientX<2*offsetfrommouse[0]){xcoord=event.clientX+truebody().scrollLeft-xcoord;}else{xcoord+=truebody().scrollLeft+event.clientX}
if(docheight-event.clientY<(2*offsetfrommouse[1])){ycoord+=event.clientY+truebody().scrollTop-Math.max(0,(2*offsetfrommouse[1]+event.clientY-docheight));}else{ycoord+=truebody().scrollTop+event.clientY;}}
document.getElementById(idek).style.left=xcoord+"px"
document.getElementById(idek).style.top=ycoord+"px"}
function askforproduct()
{if(document.getElementById("askforproduct_email")){if((/^[0-9a-zA-Z.\-_]+\@[0-9a-zA-Z.\-_]+\.[0-9a-zA-Z]+$/).test(document.getElementById("askforproduct_email").value)==false||document.getElementById("email").value.length==0){alert('Nie wpisałeś poprawnie adresu e-mail na który mielibyśmy wysłać Ci odpowiedź.');return false;}else{return true;}}}
function hideaskforproduct()
{if(document.getElementById('projector_askforproduct_table').style.display=='none'){document.getElementById('projector_askforproduct_table').style.display='block';}else{document.getElementById('projector_askforproduct_table').style.display='none';}}
var x;function showOpinion(id)
{element=document.getElementById(id);element.style.display='block';}
function hideOpinion(id)
{element=document.getElementById(id);element.style.display='none';}
function drop_down(id)
{document.getElementById(id).style.height='150px';}
function roll_back(id)
{document.getElementById(id).style.height='';}
var IAI_Ajax={cO:function()
{var r;try{r=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{r=new ActiveXObject("Microsoft.XMLHTTP");}catch(oc){r=null;}}
if(!r&&typeof XMLHttpRequest!="undefined"){r=new XMLHttpRequest();}
return r;},Request:function(url,pd,fun)
{var x;x=IAI_Ajax.cO();x.open("POST",url,true);x.setRequestHeader("Content-Type","application/x-www-form-urlencoded");x.setRequestHeader("Accept","text/javascript, text/html, application/xml, text/xml, */*");x.setRequestHeader("X-IAI-Version","1.0");x.onreadystatechange=function()
{if(x.readyState==4){if(x.status>=200&&x.status<300){if(fun){if(fun.onSuccess){if(fun.arg){eval(fun.onSuccess+'(\''+x.responseText+'\', \''+fun.arg+'\');');}else{eval(fun.onSuccess+'(\''+x.responseText+'\');');}}}}else{}}}
x.send(pd);delete x;}};var Searching_hideselectsArray=new Array();var ChangeDivPosition={};var ns=document.getElementById&&!document.all;function positiontip(e){ChangeDivPosition.pageX=(ns)?e.pageX:event.clientX+document.documentElement.scrollLeft;ChangeDivPosition.pageY=(ns)?e.pageY:event.clientY+document.documentElement.scrollTop;var obj=document.getElementById(ChangeDivPosition.id);if(obj){var x=ChangeDivPosition.marginLeft+(ChangeDivPosition.pageX-parseInt(ChangeDivPosition.startX));var y=ChangeDivPosition.marginTop+(ChangeDivPosition.pageY-parseInt(ChangeDivPosition.startY));if(x>ChangeDivPosition.maxX){x=ChangeDivPosition.maxX;}else if(x<0){x=0;}
if(y>ChangeDivPosition.maxY){y=ChangeDivPosition.maxY;}else if(y<0){y=0;}
var r=ChangeDivPosition.maxX;var PriceMax=document.getElementById('max_price_start').value;var PriceMin=document.getElementById('min_price_start').value;var price=parseInt(PriceMin)+parseInt((PriceMax-PriceMin)*x/r);if(obj.id=='s1'){var obj2=document.getElementById('s2');}else{var obj2=document.getElementById('s1');}
if(parseInt(obj2.style.marginLeft.replace('px',''))>x){if(PriceMin>=price){document.getElementById('pricelimitmin').value='';}else{document.getElementById('pricelimitmin').value=price;}
document.getElementById('min_price_text').innerHTML=price+'.00';}else{if(PriceMax<=price){document.getElementById('pricelimitmax').value='';}else{document.getElementById('pricelimitmax').value=price;}
document.getElementById('max_price_text').innerHTML=price+'.00';}
obj.style.marginLeft=x+'px';var left1=parseInt(obj2.style.marginLeft.replace('px',''));var left2=x;if(left2>left1){document.getElementById('s3').style.marginLeft=(left1+10)+'px';if((left2-left1-10)>0){document.getElementById('s3').style.width=(left2-left1-10)+'px';}else{document.getElementById('s3').style.width='0px';}}else{document.getElementById('s3').style.marginLeft=(left2+10)+'px';if((left1-left2-10)>0){document.getElementById('s3').style.width=(left1-left2-10)+'px';}else{document.getElementById('s3').style.width='0px';}}}}
function StartDrag(obj,contenerId){ChangeDivPosition.id=obj.id
ChangeDivPosition.startX=ChangeDivPosition.pageX;ChangeDivPosition.startY=ChangeDivPosition.pageY;ChangeDivPosition.wait=3;if(!obj.style.marginLeft){if(obj.offsetLeft){obj.style.marginLeft=obj.offsetLeft+'px';}else{obj.style.marginLeft='0px';}}
if(!obj.style.marginTop){if(obj.offsetTop){obj.style.marginTop=obj.offsetTop+'px';}else{obj.style.marginTop='0px';}}
if(!obj.style.width){if(obj.offsetWidth){obj.style.width=obj.offsetWidth+'px';}else{obj.style.width='0px';}}
ChangeDivPosition.marginLeft=parseInt(obj.style.marginLeft.replace('px',''));ChangeDivPosition.marginTop=parseInt(obj.style.marginTop.replace('px',''));var contener=document.getElementById(contenerId);if(!contener.style.width){if(contener.offsetWidth){contener.style.width=contener.offsetWidth+'px';}else{contener.style.width='0px';}}
if(!contener.style.height){if(contener.offsetHeight){contener.style.height=contener.offsetHeight+'px';}else{contener.style.height='0px';}}
ChangeDivPosition.maxX=parseInt(contener.style.width.replace('px',''))-parseInt(obj.style.width.replace('px',''));;ChangeDivPosition.maxY=parseInt(contener.style.height.replace('px',''))-parseInt(obj.style.height.replace('px',''));}
function StartDrag2(obj){if(ChangeDivPosition.id){ChangeDivPosition.wait=3;}}
function StopDrag(obj,wait){if(ChangeDivPosition.wait==3&&wait==2){ChangeDivPosition.wait=2;}
if(wait<1){ChangeDivPosition.id='';Searching.send('price');}else if(ChangeDivPosition.id&&ChangeDivPosition.wait!=3){setTimeout("StopDrag ('', '"+(wait-1)+"')",200);}}
var Searching={selectFields:{},highlightTextSelect:'',startPricePosition:function(contenerId)
{var contener=document.getElementById(contenerId);if(!contener.style.width){if(contener.offsetWidth){contener.style.width=contener.offsetWidth+'px';}else{contener.style.width=contener.currentStyle['width'];}}
if(!contener.style.height){if(contener.offsetHeight){contener.style.height=contener.offsetHeight+'px';}else{contener.style.height=contener.currentStyle['height'];}}
if(!document.getElementById('s2').style.width){if(document.getElementById('s2').offsetWidth){document.getElementById('s2').style.width=document.getElementById('s2').offsetWidth+'px';}else{document.getElementById('s2').style.width=document.getElementById('s2').currentStyle['width'];}}
var r=parseInt(contener.style.width.replace('px',''))-parseInt(document.getElementById('s2').style.width.replace('px',''));;var PriceMax=document.getElementById('max_price_start').value;var PriceMin=document.getElementById('min_price_start').value;var price=document.getElementById('pricelimitmin').value;document.getElementById('s1').style.marginLeft='0px';document.getElementById('s2').style.marginLeft=r+'px';document.getElementById('s3').style.marginLeft=10+'px';document.getElementById('s3').style.width=r+'px';},send:function()
{var name=arguments[0];if(name=='traits'&&arguments[1]){name=name+'['+arguments[1]+']';}
if(name=='text'){setTimeout("document.getElementById('find-text').style.display = 'none';",500);}
Searching.selectFields[name]=1;document.getElementById('searchingPreloader2').style.display='';var txt='';var active=true;for(nameTmp in Searching.selectFields){var form=document.getElementsByName(nameTmp);if(nameTmp=='price'){if(active){txt=txt+'&pricelimitmin='+document.getElementById('pricelimitmin').value;txt=txt+'&pricelimitmax='+document.getElementById('pricelimitmax').value;}}else if(nameTmp=='date'){if(active){txt=txt+'&day='+document.getElementById('date_d').value;txt=txt+'&month='+document.getElementById('date_m').value;txt=txt+'&year='+document.getElementById('date_y').value;}}else if(form[0].type=='select-one'&&form[0].name){if(active){if(form[0].value){txt=txt+'&'+form[0].name+'='+form[0].value;}}else{form[0].selectedIndex=0;}}else if(form[0].type=='checkbox'){if(active){if(form[0].checked){txt=txt+'&'+form[0].name+'='+form[0].value;}}else{form[0].checked=false;}}else if(nameTmp=='text'){if(active){txt=txt+'&text='+document.getElementById('searching_text').value;}else{form[0].value='';}}else if(form[0].name&&form[0].value){if(active){txt=txt+'&'+form[0].name+'='+form[0].value;}else{form[0].value='';}}
if(name==nameTmp){active=false;}}
IAI_Ajax.Request('ajax/search.php?ajax=true&selectAll=t&change_name='+name+txt,'',{onSuccess:'Searching.prepareForms'});},prepareForms:function(x)
{document.getElementById('searchingPreloader2').style.display='none';try{var response=eval('('+x+')');}catch(e){return false;}
Searching.highlightTextSelect=0;var form=document.getElementById('searching_form').elements;if(response['countProducts']>0){document.getElementById('select_products_info').style.display='none';}else{document.getElementById('select_products_info').style.display='block';}
for(i=0;i<form.length;i++){var display=false;if(!form[i].name){display='hidden';if(form[i].id=='searching_category_1'&&!form[i].value){display=false;SearchingCategory2={};if(response['category']){display=true;for(j in response['category']){SearchingCategory2[j]=SearchingCategory[j];for(k in SearchingCategoryParents[j]){if(SearchingCategoryParents[j][k]){SearchingCategory2[SearchingCategoryParents[j][k]]=SearchingCategory[SearchingCategoryParents[j][k]];}}}
for(j=1;j<form[i].options.length;j++){if(form[i].options[j].value&&!SearchingCategory2[form[i].options[j].value]){form[i].options[j].style.display='none';}else if(form[i].options[j].value){form[i].options[j].style.display='';}}}}}else if(form[i].type=='select-one'){if(form[i].value){display=true;}else if(!response[form[i].name]||response[form[i].name].length<=2){display=false;}else if(response[form[i].name]){var tmpI=1;var copySelectId='copy_'+form[i].name;if(document.getElementById(copySelectId)){var countTmpOptions=form[i].options.length;for(j=1;j<countTmpOptions;j++){form[i].removeChild(form[i].options[1]);}
for(j=1;j<document.getElementById(copySelectId).options.length;j++){var optionTmp=document.getElementById(copySelectId).options[j];if(response[form[i].name][optionTmp.value]){display=true;var t=Searching.addOption(form[i]);t.id=optionTmp.id;t.value=optionTmp.value;t.textContent=optionTmp.textContent;t.text=optionTmp.text;tmpI++}}}
if(tmpI<=2){display=false;}}}else if(form[i].type=='checkbox'){display=true;if(!form[i].checked){if(!response[form[i].name]){display=false;}else if(response[form[i].name].length<2){display=false;}}}else{display=true;}
if(display=='hidden'){}else if(display==true){form[i].disabled='';}else{form[i].disabled='disabled';}}
if(response['day']&&response['month']&&response['year']&&response['change_name']!='date'){document.getElementById('date_d').value=response['day'];document.getElementById('date_m').value=response['month'];document.getElementById('date_y').value=response['year'];document.getElementById('date').value=response['year']+'-'+response['month']+'-'+response['day'];}
if(response['pricemin']&&response['pricemax']&&response['change_name']!='price'){var errorprice=0;for(nameTmp in Searching.selectFields){if(nameTmp=='price'){errorprice=1;}else if(response['change_name']==nameTmp&&errorprice==1){errorprice=2;}}
if(response['pricemin']==response['pricemax']){errorprice=2;}
if(errorprice!=2||(document.getElementById('pricelimitmax').value==document.getElementById('max_price_start').value&&document.getElementById('pricelimitmin').value==document.getElementById('min_price_start').value)){if(response['pricemin']!=response['pricemax']){document.getElementById('contener3').style.display='block';document.getElementById('contener4').style.display='none';document.getElementById('pricelimitmin').value=response['pricemin'];document.getElementById('pricelimitmax').value=response['pricemax'];document.getElementById('min_price_text').innerHTML=response['pricemin'];document.getElementById('max_price_text').innerHTML=response['pricemax'];document.getElementById('min_price_start').value=response['pricemin'];document.getElementById('max_price_start').value=response['pricemax'];Searching.startPricePosition('contener');}else{document.getElementById('contener3').style.display='none';document.getElementById('min_price_text_2').innerHTML=response['pricemax'];document.getElementById('contener4').style.display='block';}}}},findText:function(e)
{var txt=document.getElementById('searching_text').value;if(!e)e=window.event;var key=e.keyCode||e.which;if(key==38||key==40){if(document.getElementById('find-text-1-div')){if(!Searching.highlightTextSelect){Searching.highlightText(1);}else if(key==38&&document.getElementById('find-text-'+(Searching.highlightTextSelect-1)+'-div')){Searching.highlightText(Searching.highlightTextSelect-1);}else if(key==40&&document.getElementById('find-text-'+parseInt(Searching.highlightTextSelect+1)+'-div')){Searching.highlightText(Searching.highlightTextSelect+1);}}}else if(key==13&&Searching.highlightTextSelect){Searching.selectText(Searching.highlightTextSelect);}else{if(txt.length>1){$.getJSON("ajax/search-name.php?ajax=true&text="+txt,function(json){Searching.prepareFindText(json);});}}},checkEnter:function()
{if(Searching.highlightTextSelect){Searching.selectText(Searching.highlightTextSelect);return false;}else{return true;}},highlightText:function(i)
{if(Searching.highlightTextSelect){document.getElementById('find-text-'+Searching.highlightTextSelect+'-div').style.backgroundColor='';}
Searching.highlightTextSelect=i;document.getElementById('find-text-'+i+'-div').style.backgroundColor='#FFEEAA';},sendSubmit:function()
{Searching.highlightTextSelect='';document.getElementById('searching_form').submit();},prepareFindText:function(x)
{try{var response=x;}catch(e){return false;}
Searching.highlightTextSelect=0;var text='';var re=new RegExp(response.text.toLowerCase(),"gi");if(response.products_name.length>0){document.getElementById('select_products_info').style.display='none';document.getElementById('find-text').style.display='block';var j=response.products_name.length;for(var i=1;i<=j;i++){var tmpTxt=response.products_name[i-1];if(!response.products_name[i-1]){i--;j--;continue;}
text=text+'<div id="find-text-'+i+'-div" style="cursor: pointer;" onmouseover="Searching.highlightText(\''+i+'\');" onclick="Searching.selectText(\''+i+'\');"><input type="hidden" value="'+tmpTxt+'" id="find-text-'+i+'">'+tmpTxt.replace(re,'<b>$&</b>')+'</div>';}}else{document.getElementById('find-text').style.display='none';document.getElementById('select_products_info').style.display='block';}
document.getElementById("find-text").innerHTML=text;},selectText:function(id)
{document.getElementById('searching_text').value=document.getElementById('find-text-'+id).value;document.getElementById('find-text').style.display='none';Searching.highlightTextSelect='';document.getElementById('searching_form').submit();},changeSelectCategory:function(obj,number)
{var selectId=obj.value;if(selectId){document.getElementById('category').value=selectId;}else{if(number==1){document.getElementById('category').value='';}else if(number==2){document.getElementById('category').value=document.getElementById("searching_category_1").value;}else if(number==3){document.getElementById('category').value=document.getElementById("searching_category_2").value;}else{document.getElementById('category').value=document.getElementById("searching_category_3").value;}}
if(number<4){document.getElementById("searching_category_4").style.display="none";if(number<3){document.getElementById("searching_category_3").style.display="none";if(number<2){document.getElementById("searching_category_2").style.display="none";}}}
var idtmp="searching_category_"+(1+number);if(selectId){document.getElementById(idtmp).selectedIndex=0;var j=document.getElementById(idtmp).options.length;while(j>1){j--;document.getElementById(idtmp).removeChild(document.getElementById(idtmp).options[j]);}
var ile=0;for(k in SearchingCategory2[selectId]){k=parseInt(k);if(k>0){var t=Searching.addOption(document.getElementById(idtmp));t.id=SearchingCategory2[selectId][k]["id"];t.value=SearchingCategory2[selectId][k]["id"];t.textContent=SearchingCategory2[selectId][k]["name"];t.text=SearchingCategory2[selectId][k]["name"];ile++;}}
if(ile){document.getElementById("searching_category_2").style.display="";if(number<2){document.getElementById("searching_category_3").style.display="none";}else{document.getElementById("searching_category_3").style.display="";}
if(number<3){document.getElementById("searching_category_4").style.display="none";}else{document.getElementById("searching_category_4").style.display="";}}else{document.getElementById(idtmp).style.display="none";}}
Searching.send('category');},addOption:function(p)
{var t;p.appendChild(t=document.createElement('option'));return t;},hideCalendar:function()
{document.getElementById('calendar').innerHTML='';if(document.getElementById('calendar_frame')){document.getElementById('calendar_frame').parentNode.removeChild(document.getElementById('calendar_frame'));}
document.getElementById('calendar').style.display='none';},hideselects:function()
{for(i=0;i<Searching_hideselectsArray.length;i++)
{document.getElementById(Searching_hideselectsArray[i]).style.display='none';}}};function validateDate(obj)
{}
function Calendar(E,T){var i,j,tBody,Row,od,Do,d,dt,z=0,zeroAllowed=false;function cEl(t,p,h,cl){p.appendChild(t=document.createElement(t));if(h){t.innerHTML=h;}
if(cl){t.className=cl;}
return t;}
function cB(x,E,T){with(IaiCld){if(x==0){R--;}else if(x==1){R++;}else if(x==2){M--;if(M<0){M=11;R--;}}else if(x==3){M++;if(M>11){M=0;R++;}}
od=Date.UTC(R,M,1);Do=Date.UTC(R,M+1,1);}
draw(E,T);}
function draw(E,T)
{while(E.childNodes.length){E.removeChild(E.firstChild);}
table=cEl('table',E,'','calendar_table_header');table.cellSpacing="4";table.cellPadding="0";var tBody=cEl('tbody',table);tBody.onmouseup=function(){draw(E,T);}
tBody.onmousemove=function(){if(window.getSelection){window.getSelection().removeAllRanges();}
if(document.selection){document.selection.empty();}}
Row=cEl('tr',tBody);var tmp=cEl('td',Row,'','calendar_select_year_left').onmousedown=function(){cB(0,E,T);}
tmp.id='calendar_select_year_left';cEl('th',Row,IaiCld.R,'calendar_year');var tmp=cEl('td',Row,'','calendar_select_year_right').onmousedown=function(){cB(1,E,T);}
tmp.id='calendar_select_year_right';Row=cEl('tr',tBody);var tmp=cEl('td',Row,'','calendar_select_month_left').onmousedown=function(){cB(2,E,T);}
tmp.id='calendar_select_month_left';cEl('th',Row,IaiCld.month[IaiCld.M],'calendar_month');var tmp=cEl('td',Row,'','calendar_select_month_right').onmousedown=function(){cB(3,E,T);}
tmp.id='calendar_select_month_right';var R=IaiCld.R;var M=IaiCld.M;var selectY=document.getElementById(T.id+"_y").value;var selectM=document.getElementById(T.id+"_m").value-1;var selectD=document.getElementById(T.id+"_d").value;var table2=cEl('table',E,'','calendar_table');table2.cellSpacing="4";table2.cellPadding="0";tBody=cEl('tbody',table2);Row=cEl('tr',tBody);for(i=0;i<7;i++){cEl('th',Row,IaiCld.day[i],i==6?'calendar_days_sunday':'calendar_days');}
for(i=od;i<Do;i+=86400000){with(new Date(i)){d=getUTCDate();dt=getUTCDay();}
if(dt==1||i==od){Row=cEl('tr',tBody);}
if(dt!=1&&d==1){for(j=1;j<(dt?dt:7);j++){cEl('th',Row);}}
dt=cEl('td',Row,d);dt.onmousedown=function(x){x=+this.innerHTML;with(IaiCld){a=x;document.getElementById(T.id+"_y").value=R;document.getElementById(T.id+"_m").value=(x=M+1)<10?'0'+x:x;document.getElementById(T.id+"_d").value=a<10?'0'+a:a;document.getElementById(T.id).value=R+'-'+((x=M+1)<10?'0'+x:x)+'-'+(a<10?'0'+a:a);document.getElementById('calendar').innerHTML='';if(document.getElementById('calendar_frame')){document.getElementById('calendar_frame').parentNode.removeChild(document.getElementById('calendar_frame'));}
document.getElementById('calendar').style.display='none';Searching.send(T.id);}}
if(d==selectD&&M==selectM&&R==selectY){dt.id="calendar_checked_day";}else{dt.className="calendar_normal_day";}}
IaiCld.B=1;var valueT=0,valueL=0,cont=T;do{valueT+=cont.offsetTop||0;valueL+=cont.offsetLeft||0;cont=cont.offsetParent;}while(cont);valueL+=T.offsetWidth+2;var mh=!!(window.attachEvent&&!window.opera)?172:151;if((valueT+mh)>document.body.offsetHeight){valueT=document.body.offsetHeight-mh;}
E.style.display='block';}
if((arguments.length>=3)&&arguments[2]){zeroAllowed=true;}
with(IaiCld){core=T.id;R=document.getElementById(core+"_y").value;M=document.getElementById(core+"_m").value-1;D.setFullYear(R,M,document.getElementById(core+"_d").value);if((R<=0)&&(M<=-1)){M=new Date().getMonth();R=new Date().getFullYear();}
od=Date.UTC(R,M,1);Do=Date.UTC(R,M+1,1);var frame;document.getElementById("calendar").parentNode.appendChild(frame=document.createElement('iframe'));frame.id='calendar_frame';}
draw(document.getElementById("calendar"),T);document.getElementById('calendar').style.display='block';}
IaiCld={day:new Array('pn','wt','śr','cz','pt','s','n'),month:new Array('Styczeń','Luty','Marzec','Kwiecień','Maj','Czerwiec','Lipiec','Sierpień','Wrzesień','Październik','Listopad','Grudzień'),D:new Date(),M:new Date().getMonth(),R:new Date().getFullYear()}