<!--
function openLnk(lnk){browser='ie';x=parent.screenTop;y=parent.screenLeft;if(typeof x=='undefined'){x=parent.screenX;browser="ns";}
if(typeof y=='undefined'){y=parent.screenY};if(browser=='ie')infoWindow=window.open(lnk,'','');if(browser=='ns')infoWindow=window.open(lnk,'','');}
function ShowPass(div)
{ShowDiv(div);centerDiv(div,'passwordID');}
function ShowDiv(wname){if(man=document.getElementById(wname)){man.style.display="block";}}
function CloseDiv(wname){if(man=document.getElementById(wname)){man.style.display="none";}}
function centerDiv(SWName,point){elm=document.getElementById(point);h=elm.offsetHeight;w=elm.offsetWidth;t=0;while(elm.parentNode){if(elm.nodeName!='TD')t+=elm.offsetTop;elm=elm.parentNode;}
elm=document.getElementById(SWName);h=Math.ceil((h-elm.offsetHeight));w=Math.ceil((w-elm.offsetWidth));elm.style.top=h+t;elm.style.left=w;}
function centerDiv02(SWName){var x=document.body.scrollLeft;var y=document.body.scrollTop;var x2=(window.innerWidth)?window.innerWidth:((document.all)?document.body.offsetWidth:null);var y2=(window.innerHeight)?window.innerHeight:((document.all)?document.body.offsetHeight:null);x=x+x2-(x2/2);y=y+y2-(y2/2);elm=document.getElementById(SWName);x=Math.ceil((x-elm.offsetWidth/2));y=Math.ceil((y-elm.offsetHeight/2));elm.style.left=x;elm.style.top=y;}
function SetPlace(name_of_point){men=document.all.item('sel_town');men.style.display='none';men=document.all.item('sel_region');men.style.display='none';men=document.all.item(name_of_point);men.style.display='inline';men=document.all.item('type_place');men.value=name_of_point;}
function InitSaler()
{men=document.all.item('sel_one');men.style.display='none';men=document.all.item('sel_list');men.style.display='none';men=document.all.item(sel_point_saler);men.style.display='inline';}
function SetSaler(name_of_point){men=document.all.item('sel_one');men.style.display='none';men=document.all.item('sel_list');men.style.display='none';men=document.all.item(name_of_point);men.style.display='inline';men=document.all.item('type_saler');men.value=name_of_point;}
function SetTyreWheel(){if(tyrewheel_point==1){men=document.all.item('tyre');men.style.display='inline';men=document.all.item('wheel');men.style.display='none';}
if(tyrewheel_point==2){men=document.all.item('tyre');men.style.display='none';men=document.all.item('wheel');men.style.display='inline';}}
function InitPlace()
{men=document.all.item('sel_town');men.style.display='none';men=document.all.item('sel_region');men.style.display='none';if(sel_point=='')sel_point='sel_town';men=document.all.item(sel_point);men.style.display='inline';}
function ChangeValue(name_val,name_div)
{if(men=document.all.item(name_val)){if(men.value.length==0||men.value==0){ShowDiv(name_div);}else{HideDiv(name_div);}}}
function ChangeFirm(name_frim,name_mark,def)
{if(men=document.all.item('div_mark_text')){men.style.display='none';}
if(men=document.all.item('div_mark_combo')){men.style.display='none';}
firm_id=document.all.item(name_frim);firm_id=firm_id.value;if(firm_id!='0'){if(men=document.all.item('div_mark_combo')){men.style.display='inline';}
if(men=document.all.item('div_mark_tuning')){men.style.display='inline';}
selected=false;}else{if(men=document.all.item('div_mark_text')){men.style.display='inline';}
if(men=document.all.item('div_mark_tuning')){men.style.display='none';}
selected=true;return;}
markOpt=document.all.item(name_mark);markOpt.length=0;if(def==1){markOpt[markOpt.length]=new Option('<не имеет значения>','0',false,false);markOpt[markOpt.length-1].selected=selected;markOpt[markOpt.length-1].defaultSelected=selected;}
markArray=markArrayStr.split('/');i=0;while(i<markArray.length){oneFirm=markArray[i].split(':');if(oneFirm[0]==firm_id){markPair=oneFirm[1].split(';');for(j=0;j<markPair.length;j++){var markList=markPair[j].split(',');if(markList[0]){markOpt[markOpt.length]=new Option(markList[1],markList[0],false,false);if(mark==markList[0]){markOpt[markOpt.length-1].selected=true;markOpt[markOpt.length-1].defaultSelected=true;}}}
i=markArray.length;}
i++;}}
function HideDiv(a)
{if(men=document.all.item(a)){men.style.display='none';}}
function IsValidEmail(data,need)
{var str='';var check=1;data+="";if(data.length==0&&need==1){str="\nВы не указали e-mail";check=0;check=str;return check;}
var comAt="@";if((data.length>0)&&(data.indexOf(comAt,0)==-1)){str="\nНе правильный e-mail";check=0;check=str;return check;}
var Point=".";if((data.length>0)&&(data.indexOf(Point,0)==-1)){str="\nНе правильный e-mail";check=0;check=str;return check;}
if((data.length<5)&&((data.length>0))){str="\nНе правильный e-mail";check=0;check=str;return check;}
if(check==0){check=str;}
return check;}
function openMyWindow(href,width,height){browser='ie';y=parent.screenTop;x=parent.screenLeft;if(typeof x=='undefined'){x=parent.screenX;browser="ns";}
if(typeof y=='undefined'){y=parent.screenY};leftt=50;topp=200;if(width>0&&height>0){dim='width='+width+',height='+height+',';}else{dim='width=795,height=450,';leftt=10;topp=10;}
if(browser=='ie')infoWindow=window.open(href,'',dim+'left='+leftt+',top='+topp+',scrollbars,dependent=yes,resizable=yes,status=yes');if(browser=='ns')infoWindow=window.open(href,'',dim+'left='+leftt+',top='+topp+',scrollbars,dependent=yes,resizable=yes,status=yes');}
function MyMail(mail){men=document.all.item('mail-to');men.value=mail;ShowDiv('mail',true);centerDiv02('mail');}
function MyMailToFriend(link){var men=$('mail-body');men.value='По мнению отправителя, Вас должна заинтересовать следущая ссылка:\n<a href="'+link+'">'+link+'</a>';ShowDiv('mail',true);centerDiv02('mail');}
function loadPlace(){place=document.search.f_town.options;place.length=0;if(saler_id==0){place[place.length]=new Option('<не имеет значения>',0,false,false);}
for(i=0;i<placeArray.length;i++){placeRec=placeArray[i].split(':');if(placeRec[3]>0)
caption=placeRec[2]+' ('+placeRec[3]+')';else
caption=placeRec[2];place[place.length]=new Option(caption,placeRec[1],false,false);if(placeRec[1]==selectedPlaceId){place[place.length-1].defaultSelected=true;place[place.length-1].selected=true;}}}
function loadSalerCombo(placeId){saler=document.search.f_saler_one.options;saler.length=0;if(saler_id==0){if(com_person!='person'){saler[saler.length]=new Option('<не имеет значения>',0,false,false);}
if(viewMode=='contract'){if(com_person=='person'||com_person=='any'){saler[saler.length]=new Option('барахолка, частные лица',-1,false,false);}}}
if(com_person!='person'){for(i=0;i<salerArray.length;i++){salerRec=salerArray[i].split(':');if(salerRec[3]==placeId||placeId==0){if(salerRec[4]>0){saler[saler.length]=new Option((i+1)+'. '+salerRec[2],salerRec[1],false,false);}else{saler[saler.length]=new Option((i+1)+'. '+salerRec[2],salerRec[1],false,false);}
if(salerRec[1]==selectedSalerId){saler[saler.length-1].selected=true;saler[saler.length-1].defaultSelected=true;}}}}}
function selectPlace(salerId){placeId=-1;selectedSalerId=salerId;if(selectedSalerId==-2)placeId=0;else{for(i=0;i<salerArray.length;i++){salerRec=salerArray[i].split(':');if(salerRec[1]==salerId){placeId=salerRec[3];}}}
if(placeId>-1){place=document.search.f_town.options;for(i=0;i<place.length;i++){if(place[i].value==placeId){place[i].selected=true;}}}}
function InitProfiPotter(th){if(men=document.all.item('h1_profi'))men.style.display='none';if(men=document.all.item('h1_potter'))men.style.display='none';if(men=document.all.item('button_profi'))men.style.display='none';if(men=document.all.item('button_potter'))men.style.display='none';if(men=document.all.item('parts_name01_profi'))men.style.display='none';if(men=document.all.item('parts_name01_potter'))men.style.display='none';if(men=document.all.item('parts_name01v_profi'))men.style.display='none';if(men=document.all.item('parts_name01v_potter'))men.style.display='none';if(men=document.all.item('parts_name02_profi'))men.style.display='none';if(men=document.all.item('parts_name02_potter'))men.style.display='none';if(men=document.all.item('parts_name02v_profi'))men.style.display='none';if(men=document.all.item('parts_name02v_potter'))men.style.display='none';if(men=document.all.item('marka_profi'))men.style.display='none';if(men=document.all.item('marka_potter'))men.style.display='none';if(men=document.all.item('model_profi'))men.style.display='none';if(men=document.all.item('model_potter'))men.style.display='none';if(th=='profi'){if(men=document.all.item('h1_profi'))men.style.display='inline';if(men=document.all.item('button_profi'))men.style.display='inline';if(men=document.all.item('parts_name01_profi'))men.style.display='inline';if(men=document.all.item('parts_name01v_profi'))men.style.display='inline';if(men=document.all.item('parts_name02_profi'))men.style.display='inline';if(men=document.all.item('parts_name02v_profi'))men.style.display='inline';if(men=document.all.item('marka_profi'))men.style.display='inline';if(men=document.all.item('model_profi'))men.style.display='inline';}else{if(men=document.all.item('h1_potter'))men.style.display='inline';if(men=document.all.item('button_potter'))men.style.display='inline';if(men=document.all.item('parts_name01_potter'))men.style.display='inline';if(men=document.all.item('parts_name01v_potter'))men.style.display='inline';if(men=document.all.item('parts_name02_potter'))men.style.display='inline';if(men=document.all.item('parts_name02v_potter'))men.style.display='inline';if(men=document.all.item('marka_potter'))men.style.display='inline';if(men=document.all.item('model_potter'))men.style.display='inline';}
profi_potter=th;men=document.all.item('type_profipotter');men.value=profi_potter;}
function loadGroup(){men=document.all.item('partGroup');group=men.options;group.length=0;if(add_form==1){group[group.length]=new Option('<выбрать>',0,false,false);}else{group[group.length]=new Option('<не имеет значения>',0,false,false);}
groupArray=groupStr.split(';');for(i=0;i<groupArray.length;i++){groupPair=groupArray[i].split(':');group[group.length]=new Option(groupPair[2],groupPair[1],false,false);if(groupPair[1]==selectedGroup){group[group.length-1].defaultSelected=true;group[group.length-1].selected=true;}}}
function loadParts(groupId){men=document.all.item('partCode');part=men.options;part.length=0;if(add_form==1){part[part.length]=new Option('<выбрать>',groupId,false,false);}else{part[part.length]=new Option('<не имеет значения>',groupId,false,false);}
for(i=0;i<partArray.length;i++){partPair=partArray[i].split(':');if(partPair[2].split('.')[0]==groupId){part[part.length]=new Option(partPair[3],partPair[2]+':'+partPair[1]+':'+partPair[4],false,false);if(partPair[2]+':'+partPair[1]+':'+partPair[4]==selectedPart){part[part.length-1].defaultSelected=true;part[part.length-1].selected=true;}}}}
function setClass(part){if(part==0||part=='0'){disableField(document.search.kuzov,'ENABLE');disableField(document.search.engine,'ENABLE');disableField(document.search.number,'ENABLE');return;}
if(viewMode=='contract'){if(part.length>3){cl=part.split(':')[2];}else{cl='xxxxxxxx';}
cl.charAt(0)!='-'?document.search.f_mark_potter.disabled=false:document.search.f_mark_potter.disabled=true;cl.charAt(1)!='-'?document.search.f_model_potter.disabled=false:document.search.f_model_potter.disabled=true;cl.charAt(2)!='-'?disableField(document.search.f_kuzovN,'ENABLE'):disableField(document.search.f_kuzovN,'DISABLE');cl.charAt(4)!='-'?disableField(document.search.f_engineN,'ENABLE'):disableField(document.search.f_engineN,'DISABLE');cl.charAt(3)!='-'?disableField(document.search.f_modelN,'ENABLE'):disableField(document.search.f_modelN,'DISABLE');if(cl.charAt(5)=='-'){document.search.f_F_R[0].disabled=true;document.search.f_F_R[1].disabled=true;document.search.f_F_R[2].disabled=true;}else{document.search.f_F_R[0].disabled=false;document.search.f_F_R[1].disabled=false;document.search.f_F_R[2].disabled=false;}
if(cl.charAt(6)=='-'){document.search.f_R_L[0].disabled=true;document.search.f_R_L[1].disabled=true;document.search.f_R_L[2].disabled=true;}else{document.search.f_R_L[0].disabled=false;document.search.f_R_L[1].disabled=false;document.search.f_R_L[2].disabled=false;}
if(cl.charAt(7)=='-'){document.search.f_U_D[0].disabled=true;document.search.f_U_D[1].disabled=true;document.search.f_U_D[2].disabled=true;}else{document.search.f_U_D[0].disabled=false;document.search.f_U_D[1].disabled=false;document.search.f_U_D[2].disabled=false;}}}
function disableField(field,op){if(op=='ENABLE'){field.disabled=false;field.style.backgroundColor='#FFFFFF';}
if(op=='DISABLE'){field.disabled=true;field.style.backgroundColor='#EEEEEE';}}
function loadMark(){mark=document.search.f_mark_potter.options;mark.length=0;mark[mark.length]=new Option('<не имеет значения>',0,false,false);markArray=markStr.split(';');for(i=0;i<markArray.length;i++){markPair=markArray[i].split(':');mark[mark.length]=new Option(markPair[2],markPair[1]+':'+markPair[2],false,false);if(markPair[1]+':'+markPair[2]==selectedMark){mark[mark.length-1].defaultSelected=true;mark[mark.length-1].selected=true;}}}
function loadModel(mark){if(mark==0){markId=0;}else{mark_a=mark.split(':');markId=mark_a[0];}
model=document.search.f_model_potter.options;model.length=0;model[model.length]=new Option('<не имеет значения>',0,false,false);modelArray=modelStr.split(';');for(i=0;i<modelArray.length;i++){modelPair=modelArray[i].split(':');if(modelPair[2]==markId){model[model.length]=new Option(modelPair[3],modelPair[3],false,false);if(modelPair[3]==selectedModel){model[model.length-1].defaultSelected=true;model[model.length-1].selected=true;}}}}
function onSubFormAddYellow(){var check,str_error;check=0;str_error='';if(document.forms['add'].f_name_of_firm.value==''){check=1;str_error+='\nВы не указали Имя фирмы.';}
if(document.forms['add'].f_mainservice.value==''){check=1;str_error+='\nВы не указали Основное направление.';}
if(document.forms['add'].f_maincontact.value==''){check=1;str_error+='\nВы не указали Главный контакт .';}
temp_str=IsValidEmail(document.forms['add'].f_contact_email.value,0);if(temp_str!=1){check=1;str_error+=temp_str;}
if(check==1)
{alert(str_error);}else
{document.forms['add'].submit();}}
function onSubFormAddTyre(){var check,str_error;check=0;str_error='';if(men=document.all.item('f_cont_name_main')){if(document.forms['add'].f_cont_name_main.value==''){check=1;str_error+='Вы не указали главный контакт.';}};if(men=document.all.item('f_cont_email')){temp_str=IsValidEmail(document.forms['add'].f_cont_email.value,0);if(temp_str!=1){check=1;str_error+=temp_str;}}
if(check==1)
{alert(str_error);}else
{document.forms['add'].submit();}}
function onSubFormAddWater()
{var check,str_error;check=0;str_error='';if(men=document.all.item('f_cont_name_main')){if(document.forms['add'].f_cont_name_main.value==''){check=1;str_error+='Вы не указали главный контакт.';}};if((document.forms['add'].f_volume.value<0)||(document.forms['add'].f_volume.value>100000)||(document.forms['add'].f_volume.value=='')){check=1;str_error+='\nОбъем не должен быть меньше 0.';}
if((document.forms['add'].f_pricein.value<-2)||(document.forms['add'].f_pricein.value=='')){check=1;str_error+='\nНеправильно указана цена.';}
var temp_str;if(men=document.all.item('f_cont_email')){temp_str=IsValidEmail(document.forms['add'].f_cont_email.value,0);if(temp_str!=1){check=1;str_error+=temp_str;}}
if(check==1)
{alert(str_error);}else
{document.forms['add'].submit();}}
function onSubFormAddWaterBuy()
{var check,str_error;check=0;str_error='';if(men=document.all.item('f_cont_name_main')){if(document.forms['add'].f_cont_name_main.value==''){check=1;str_error+='Вы не указали главный контакт.';}};var temp_str;if(men=document.all.item('f_cont_email')){temp_str=IsValidEmail(document.forms['add'].f_cont_email.value,0);if(temp_str!=1){check=1;str_error+=temp_str;}}
if(check==1)
{alert(str_error);}else
{document.forms['add'].submit();}}
function onSubFormAddMoto()
{var check,str_error;check=0;str_error='';if(men=document.all.item('f_cont_name_main')){if(document.forms['add'].f_cont_name_main.value==''){check=1;str_error+='Вы не указали главный контакт.';}};if((document.forms['add'].f_volume.value<0)||(document.forms['add'].f_volume.value>100000)||(document.forms['add'].f_volume.value=='')){check=1;str_error+='\nОбъем не должен быть меньше 0.';}
if((document.forms['add'].f_pricein.value<1)||(document.forms['add'].f_pricein.value=='')){check=1;str_error+='\nНеправильно указана цена.';}
var temp_str;if(men=document.all.item('f_cont_email')){temp_str=IsValidEmail(document.forms['add'].f_cont_email.value,0);if(temp_str!=1){check=1;str_error+=temp_str;}}
if(check==1)
{alert(str_error);}else
{document.forms['add'].submit();}}
function onSubFormAddMotoBuy()
{var check,str_error;check=0;str_error='';if(men=document.all.item('f_cont_name_main')){if(document.forms['add'].f_cont_name_main.value==''){check=1;str_error+='Вы не указали главный контакт.';}};var temp_str;if(men=document.all.item('f_cont_email')){temp_str=IsValidEmail(document.forms['add'].f_cont_email.value,0);if(temp_str!=1){check=1;str_error+=temp_str;}}
if(check==1)
{alert(str_error);}else
{document.forms['add'].submit();}}
function onSubFormAddAuto2Parts()
{var check,str_error;check=0;str_error='';if(men=document.all.item('f_cont_name_main')){if(document.forms['add'].f_cont_name_main.value==''){check=1;str_error+='Вы не указали главный контакт.';}};var temp_str;if(men=document.all.item('f_cont_email')){temp_str=IsValidEmail(document.forms['add'].f_cont_email.value,0);if(temp_str!=1){check=1;str_error+=temp_str;}}
if(check==1)
{alert(str_error);}else
{document.forms['add'].submit();}}
function onSubFormAddAuto2Half()
{var check,str_error;check=0;str_error='';if(men=document.all.item('f_cont_name_main')){if(document.forms['add'].f_cont_name_main.value==''){check=1;str_error+='Вы не указали главный контакт.';}};var temp_str;if(men=document.all.item('f_cont_email')){temp_str=IsValidEmail(document.forms['add'].f_cont_email.value,0);if(temp_str!=1){check=1;str_error+=temp_str;}}
if(check==1)
{alert(str_error);}else
{document.forms['add'].submit();}}
function onSubFormAddAuto2Constructor()
{var check,str_error;check=0;str_error='';if(men=document.all.item('f_cont_name_main')){if(document.forms['add'].f_cont_name_main.value==''){check=1;str_error+='Вы не указали главный контакт.';}};var temp_str;if(men=document.all.item('f_cont_email')){temp_str=IsValidEmail(document.forms['add'].f_cont_email.value,0);if(temp_str!=1){check=1;str_error+=temp_str;}}
if(check==1)
{alert(str_error);}else
{document.forms['add'].submit();}}
function onSubFormAddTuningGallery()
{var check,str_error;check=0;str_error='';if(men=document.all.item('f_cont_name_main')){if(document.forms['add'].f_cont_name_main.value==''){check=1;str_error+='Вы не указали главный контакт.';}};var temp_str;if(men=document.all.item('f_cont_email')){temp_str=IsValidEmail(document.forms['add'].f_cont_email.value,0);if(temp_str!=1){check=1;str_error+=temp_str;}}
if(check==1)
{alert(str_error);}else
{document.forms['add'].submit();}}
function onSubFormAddTuning()
{var check,str_error;check=0;str_error='';if(men=document.all.item('f_cont_name_main')){if(document.forms['add'].f_cont_name_main.value==''){check=1;str_error+='Вы не указали главный контакт.';}};if((document.forms['add'].f_price.value<0)||(document.forms['add'].f_price.value<-2)||(document.forms['add'].f_price.value=='')){check=1;str_error+='\nНеправильно указана цена (цена должна быть >= 0).';}
var temp_str;if(men=document.all.item('f_cont_email')){temp_str=IsValidEmail(document.forms['add'].f_cont_email.value,0);if(temp_str!=1){check=1;str_error+=temp_str;}}
if(check==1)
{alert(str_error);}else
{document.forms['add'].submit();}}
function onSubFormAddGoods()
{var check,str_error;check=0;str_error='';if(document.forms['add'].f_cont_name_main.value==''){check=1;str_error+='Вы не указали главный контакт.';}
var temp_str;temp_str=IsValidEmail(document.forms['add'].f_cont_email.value,0);if(temp_str!=1){check=1;str_error+=temp_str;}
if(check==1)
{alert(str_error);}else
{document.forms['add'].submit();}}
function onSubFormAddAuto()
{var check,str_error;check=0;str_error='';if(men=document.all.item('f_cont_name_main')){if(document.forms['add'].f_cont_name_main.value==''){check=1;str_error+='Вы не указали главный контакт.';}};if((document.forms['add'].f_volume.value<100)||(document.forms['add'].f_volume.value>100000)||(document.forms['add'].f_volume.value=='')){check=1;str_error+='\nОбъем должен быть от 100 и до 100 000.';}
if((document.forms['add'].f_price.value==0)||(document.forms['add'].f_price.value<-2)||(document.forms['add'].f_price.value=='')){check=1;str_error+='\nНеправильно указана цена.';}
var temp_str;if(men=document.all.item('f_cont_email')){temp_str=IsValidEmail(document.forms['add'].f_cont_email.value,0);if(temp_str!=1){check=1;str_error+=temp_str;}}
if(check==1)
{alert(str_error);}else
{document.forms['add'].submit();}}
function onDivisinSendReq()
{var check,str_error;check=0;str_error='';if(document.forms['senddiv'].f_name.value==''){check=1;str_error+='\nВы не указали свое имя.';}
if(document.forms['senddiv'].f_town.value==''){check=1;str_error+='\nВы не указали свой город.';}
if(document.forms['senddiv'].f_email.value==''){check=1;str_error+='\nУкажите свой e-mail.';}
if(document.forms['senddiv'].f_phone.value==''){check=1;str_error+='\nУкажите свой контактный телефон.';}
var temp_str;temp_str=IsValidEmail(document.forms['senddiv'].f_email.value,0);if(temp_str!=1){check=1;str_error+=temp_str;}
if(document.forms['senddiv'].f_note.value==''){check=1;str_error+='\nВы не написали запрос.';}
if(check==1)
{alert(str_error);}else
{document.forms['senddiv'].submit();}}
function onSubFormAddAutoBuy()
{var check,str_error;check=0;str_error='';if(men=document.all.item('f_cont_name_main')){if(document.forms['add'].f_cont_name_main.value==''){check=1;str_error+='Вы не указали главный контакт.';}};var temp_str;if(men=document.all.item('f_cont_email')){temp_str=IsValidEmail(document.forms['add'].f_cont_email.value,0);if(temp_str!=1){check=1;str_error+=temp_str;}}
if(check==1)
{alert(str_error);}else
{document.forms['add'].submit();}}
function onSubFormAddPower()
{var check,str_error;check=0;str_error='';if(men=document.all.item('f_cont_name_main')){if(document.forms['add'].f_cont_name_main.value==''){check=1;str_error+='Вы не указали главный контакт.';}};if((document.forms['add'].f_volume.value<0)||(document.forms['add'].f_volume.value>100000)||(document.forms['add'].f_volume.value=='')){check=1;str_error+='\nОбъем не должен быть меньше 0.';}
if((document.forms['add'].f_pricein.value==0)||(document.forms['add'].f_pricein.value<-2)||(document.forms['add'].f_pricein.value=='')){check=1;str_error+='\nНеправильно указана цена.';}
var temp_str;if(men=document.all.item('f_cont_email')){temp_str=IsValidEmail(document.forms['add'].f_cont_email.value,0);if(temp_str!=1){check=1;str_error+=temp_str;}}
if(check==1)
{alert(str_error);}else
{document.forms['add'].submit();}}
function onSubFormAddPowerParts()
{var check,str_error;check=0;str_error='';if(men=document.all.item('f_cont_name_main')){if(document.forms['add'].f_cont_name_main.value==''){check=1;str_error+='Вы не указали главный контакт.';}};if((document.forms['add'].f_pricein.value==0)||(document.forms['add'].f_pricein.value<-2)||(document.forms['add'].f_pricein.value=='')){check=1;str_error+='\nНеправильно указана цена.';}
var temp_str;if(men=document.all.item('f_cont_email')){temp_str=IsValidEmail(document.forms['add'].f_cont_email.value,0);if(temp_str!=1){check=1;str_error+=temp_str;}}
if(check==1)
{alert(str_error);}else
{document.forms['add'].submit();}}
function onSubFormAddPowerBuy()
{var check,str_error;check=0;str_error='';if(men=document.all.item('f_cont_name_main')){if(document.forms['add'].f_cont_name_main.value==''){check=1;str_error+='Вы не указали главный контакт.';}};var temp_str;if(men=document.all.item('f_cont_email')){temp_str=IsValidEmail(document.forms['add'].f_cont_email.value,0);if(temp_str!=1){check=1;str_error+=temp_str;}}
if(check==1)
{alert(str_error);}else
{document.forms['add'].submit();}}
function onSubFormAddParts()
{var check,str_error;check=0;str_error='';if(men=document.all.item('f_cont_name')){if(document.forms['add'].f_cont_name.value==''){check=1;str_error+='\nВы не указали "Наименование продавца".';}};if(men=document.all.item('f_cont_phone')){if(document.forms['add'].f_cont_phone.value==''){check=1;str_error+='\nВы не указали телефон.';}};if(men=document.all.item('f_place')){if(document.forms['add'].f_place.value==0){check=1;str_error+='\nВыберите Местонахождение.';}};if(document.forms['add'].pr_type.value=='add_parts'){if(document.forms['add'].partCode.value==''){check=1;str_error+='\nУкажите название запчасти, или введите свое название.';}}else{if(document.forms['add'].f_new_name_parts.value==''){check=1;str_error+='\nВведите свое название запчасти, или выберите из списка.';}}
if(document.forms['add'].f_marka.value==0){check=1;str_error+='\nВыберите Производителя.';}
if(document.forms['add'].f_model.value==''){check=1;str_error+='\nВы не указали модель.';}
var temp_str;if(check==1)
{alert(str_error);}else
{document.forms['add'].submit();}}
function InitNameOfSelect(th){if(men=document.all.item('new_name_01'))men.style.display='none';if(men=document.all.item('new_name_11'))men.style.display='none';if(men=document.all.item('new_name_02'))men.style.display='none';if(men=document.all.item('new_name_12'))men.style.display='none';if(men=document.all.item('new_name_03'))men.style.display='none';if(men=document.all.item('new_name_13'))men.style.display='none';if(th=='list'){if(men=document.all.item('new_name_01'))men.style.display='inline';if(men=document.all.item('new_name_02'))men.style.display='inline';if(men=document.all.item('new_name_03'))men.style.display='inline';if(men=document.all.item('pr_type')){str='add_parts';men.value=str;}}else{if(men=document.all.item('new_name_11'))men.style.display='inline';if(men=document.all.item('new_name_12'))men.style.display='inline';if(men=document.all.item('new_name_13'))men.style.display='inline';if(men=document.all.item('pr_type')){str='new_name_parts';men.value=str;}}};function SetTyre(tp){if(men=document.all.item('div_tyre'))men.style.display='none';if(men=document.all.item('div_wheel'))men.style.display='none';if(tp==1){if(men=document.all.item('div_tyre'))men.style.display='inline';}else if(tp==2){if(men=document.all.item('div_wheel'))men.style.display='inline';}else{if(men=document.all.item('div_tyre'))men.style.display='inline';if(men=document.all.item('div_wheel'))men.style.display='inline';}};function getCookieVal(offset){var endstr=document.cookie.indexOf(";",offset);if(endstr==-1)
endstr=document.cookie.length;return unescape(document.cookie.substring(offset,endstr));}
function GetCookie(name){var arg=name+"=";var alen=arg.length;var clen=document.cookie.length;var i=0;while(i<clen){var j=i+alen;if(document.cookie.substring(i,j)==arg)return getCookieVal(j);i=document.cookie.indexOf(" ",i)+1;if(i==0)break;}
return null;}
function SetCookie(name,value){var argv=SetCookie.arguments;var argc=SetCookie.arguments.length;var expires=(argc>2)?argv[2]:null;var path=(argc>3)?argv[3]:null;var domain=(argc>4)?argv[4]:null;var secure=(argc>5)?argv[5]:false;document.cookie=name+"="+escape(value)+
((expires==null)?"":("; expires="+expires.toGMTString()))+
((path==null)?"":("; path="+path))+
((domain==null)?"":("; domain="+domain))+
((secure==true)?"; secure":"");}
function DeleteCookie(name){var exp=new Date();exp.setTime(exp.getTime()-1);var cval=GetCookie(name);document.cookie=name+"="+cval+"; expires="+exp.toGMTString();}
function MinMaxT(point,act){var expDays=30;var exp=new Date();exp.setTime(exp.getTime()+(expDays*24*60*60*1000));if(men=document.all.item(point)){if(act=='show'){men.style.display='inline';}else if(act=='hide'){men.style.display='none';}else if(act=='none'){if(GetCookie(point+'_div')=='hide'){men.style.display='inline';SetCookie(point+'_div','show',exp);}else{men.style.display='none';SetCookie(point+'_div','hide',exp);}}}}
function ArrowUpDown(point,dir){if((men=document.all.item(point+'_img'))&&(point.length>0)){if(dir=='up'){men.src='http://www.japancar.ru/images/arrow.gif';}else{men.src='http://www.japancar.ru/images/arrow_down.gif';}}}
function MinMax(point,act){var expDays=30;var exp=new Date();exp.setTime(exp.getTime()+(expDays*24*60*60*1000));if(men=document.all.item(point)){if(act=='show'){men.style.display='inline';ArrowUpDown(point,'up');}else if(act=='hide'){men.style.display='none';ArrowUpDown(point,'down');}else if(act=='none'){if(GetCookie(point+'_div')=='hide'){men.style.display='inline';SetCookie(point+'_div','show',exp);ArrowUpDown(point,'up');}else{men.style.display='none';SetCookie(point+'_div','hide',exp);ArrowUpDown(point,'down');}}}}
div_index=['goods','autosalon','insur','tuning','moto','water','tyre','parts','yellow','auto','tour','signall','news','power','info','serviceauto','autoservice','autouslugi'];function GetMinMax(){var div_;for(i=0;i<div_index.length;i++){div_=div_index[i];if(GetCookie(div_+'_div')=='hide')
{MinMax(div_,'hide');}else{MinMax(div_,'show');}}}
function AddExtraPhotoField(photo_table)
{var pictable;if(pictable=document.getElementById(photo_table)){newrow=pictable.insertRow();var rowcount=pictable.rows.length;newcell=newrow.insertCell();newcell.innerHTML='<input type="file" size="6" value="" name="f_photo[]" style="width:95%">';}}
function NameDirect(val){if(men=document.all.item('f_name')){if(val!='0'){men.disabled=true;}else{men.disabled=false;}};}
function NameDirectClear(){if(men=document.all.item('f_name_dir')){men[0].selected=true;};}
function Name_List_Single(ob01,clause,ob02){if(men=document.all.item(ob01)){if(men.value!=clause){HideDiv(ob02);}else{ShowDiv(ob02);}}}