function view_actmes(page,operation,prtp,spd,thint,fname,fprice){
 if(typeof(wactmes)=='object'&&!wactmes.closed)wactmes.focus();
 if(operation=='list_actmes')wactmes=window.open('info.php?page='+page+'&operation='+operation+'&city='+prtp+'&prtp='+spd,'wa','menubar=0,toolbar=0,status=1,location=0,resizable=1,scrollbars=1,Width=800,Height=600,left=187,top=85');
 else if(operation=='spd_actmes')wactmes=window.open('info.php?page='+page+'&operation='+operation+'&spd='+spd+'&prtp='+prtp,'wa','menubar=0,toolbar=0,status=1,location=0,resizable=1,scrollbars=1,Width=800,Height=600,left=187,top=85');
 else if(operation=='prtp_actmes')wactmes=window.open('info.php?page='+page+'&operation='+operation+'&spd='+spd+'&prtp='+prtp+'&thint='+thint+'&fname='+fname+'&fprice='+fprice,'wa','menubar=0,toolbar=0,status=1,location=0,resizable=1,scrollbars=1,Width=800,Height=600,left=187,top=85');
}

function view_mods(page,operation,mod,thint){
 if(typeof(wactmes)=='object'&&!wactmes.closed)wactmes.focus();
 wactmes=window.open('info.php?page='+page+'&operation='+operation+'&mod='+mod+'&thint='+thint,'wm','menubar=0,toolbar=0,status=1,location=0,resizable=1,scrollbars=1,Width=800,Height=600,left=187,top=85');
}

function view_seller(seller,page){
 if(typeof(wseller)=='object'&&!wseller.closed)wseller.focus();
 wseller=window.open('info.php?operation=seller&page='+page+'&seller='+seller,'ws','menubar=0,toolbar=0,status=1,location=0,resizable=1,scrollbars=1,Width=800,Height=600,left=175,top=95');
}

function view_worder(wid,page,types){
 if(typeof(worder)=='object'&&!worder.closed)worder.focus();
 worder=window.open('info.php?operation=order&page='+page+'&wid='+wid+'&types='+types,'wo','menubar=0,toolbar=0,status=1,location=0,resizable=1,scrollbars=1,Width=800,Height=600,left=175,top=95');
}

function view_invoice(seller,categorys,tp){
 if(tp==0)tps='this_';else if(tp==1)tps='next_';else if(tp==2)tps='add_';
 pch='';if(categorys!='')pch='info';
 if(typeof(winvoice)=='object'&&!winvoice.closed)winvoice.focus();
 winvoice=window.open(pch+'.php?operation='+tps+'invoice&seller='+seller+'&categorys='+categorys,'wi','menubar=0,toolbar=0,status=1,location=0,resizable=1,scrollbars=1,Width=800,Height=600,left=175,top=95');
}

function rfrss(page,seller,types,lnk){
 if(typeof(winvoice)=='object'&&!winvoice.closed)winvoice.focus();
 winvoice=window.open('info.php?operation='+types+'&page='+page+'&seller='+seller+'&lnk='+lnk,'wb','menubar=1,toolbar=0,status=1,location=0,resizable=1,scrollbars=1,left=0,top=0');
}

function setlogin(login){
 var tenYears=10*365*24*60*60*1000;
 var expDate=new Date();
 expDate.setTime(expDate.getTime()+tenYears);
 if(GetCookie('login')==null||(GetCookie('login')!=null&&GetCookie('login')!=login))SetCookie('login',login,expDate);
}

function getlogin(){
 if(GetCookie('login')!=null)document.ff_login.username.value=GetCookie('login');
}

function flogin(){
 if(!(document.ff_login.username.value)){alert('Введите логин');document.ff_login.username.focus();}
 else if(!(document.ff_login.passwd.value)){alert('Введите пароль');document.ff_login.passwd.focus();}
 else document.ff_login.submit();
}

function getidxs(){
 if(document.frm.email.value.length>0)document.frm.submit();
 else{alert('Укажите свой электронный адрес	');document.frm.email.focus();}
}

function go_limit(cls){
 document.formstr.slimit.value=cls;
 actions('find');
}

function go_limit_actmes(cls){
 document.formstr.slimit.value=cls;
 document.formstr.submit();
}

function go_prtp(){
 parent.dw.document.formstr.prtp.value=parent.up.document.formstr.prtp_am.options[parent.up.document.formstr.prtp_am.options.selectedIndex].value;
 parent.dw.document.formstr.slimit.value=1;
 parent.dw.document.formstr.submit();
}

function go_ct(){
 parent.dw.document.formstr.city.value=parent.up.document.formstr.ct_am.options[parent.up.document.formstr.ct_am.options.selectedIndex].value;
 parent.dw.document.formstr.slimit.value=1;
 parent.dw.document.formstr.submit();
}

function go_order(){
 if(document.formstr.nm.value==0){alert('Укажите: "Ваше Имя"');document.formstr.nm.focus();}
 else if(document.formstr.tel.value==0&&document.formstr.email.value==0){alert('Укажите: "Ваш Контактный Телефон" или "Ваш Контактный Электронный Адрес"');document.formstr.tel.focus();}
 else if(document.formstr.ct.options[document.formstr.ct.options.selectedIndex].value==0){alert('Укажите: "Город"');document.formstr.ct.focus();}
 else{document.formstr.operation.value='worder';document.formstr.submit();}
}

function go_mods(){
 parent.dw.document.formstr.mod.value=parent.dw.document.formstr.mod_0.options[parent.dw.document.formstr.mod_0.options.selectedIndex].value;
 if(parent.dw.document.formstr.mod_1.options[parent.dw.document.formstr.mod_1.options.selectedIndex].value!=0)parent.dw.document.formstr.mod.value+=','+parent.dw.document.formstr.mod_1.options[parent.dw.document.formstr.mod_1.options.selectedIndex].value;
 parent.dw.document.formstr.submit();
}

function go_reg(){
 if(document.rg.spd.value==0){alert('Укажите: "СПД"');document.rg.spd.focus();}
 else if(document.rg.ct.options[document.rg.ct.options.selectedIndex].value==0){alert('Укажите: "Город"');document.rg.ct.focus();}
 else if(document.rg.person.value==0){alert('Укажите: "Контактное Лицо"');document.rg.person.focus();}
 else if(document.rg.ppp.options[document.rg.ppp.options.selectedIndex].value==0){alert('Укажите: "Должность"');document.rg.ppp.focus();}
 else if(document.rg.email.value==0){alert('Укажите Ваш E-MAIL, он будет использоваться в качестве Вашего логина !!!');document.rg.email.focus();}
 else if(go_chkb()){alert('Отметьте Категории, товарные группы которых продаёт Ваша организация.	 ');}
 else if(document.rc.cat_add.value==0){alert('Перечислите через запятую не найденные в предыдущем списке Категории, товарные группы которых продаёт Ваша организация, либо просто напишите "Нет".');document.rg.cat_add.focus();}
 else{document.rg.cat_add.value=document.rc.cat_add.value;document.rg.operation.value='regspd';document.rg.submit();}
}

function go_edit(opertn){
 if(document.rg.spd_full.value==0){alert('Укажите: "СПД ( Юр.Назв. )"');document.rg.spd_full.focus();}
 else if(document.rg.spd.value==0){alert('Укажите: "СПД ( Коротк.Назв. )"');document.rg.spd.focus();}
 else if(document.rg.ur_mail_ind.value==0){alert('Укажите: "Почтовый Индекс"');document.rg.ur_mail_ind.focus();}
 else if(document.rg.ur_adres.value==0){alert('Укажите: "Юридический Адрес"');document.rg.ur_adres.focus();}
 else if(document.rg.edrpou.value==0){alert('Укажите: "Код ЄДРПОУ"');document.rg.edrpou.focus();}
 else if(document.rg.podatk.value==0){alert('Укажите: "Налоговый Номер"');document.rg.podatk.focus();}
 else if(document.rg.numbpodatkdoc.value==0){alert('Укажите: "Номер Налогового Свидетельства"');document.rg.numbpodatkdoc.focus();}
 else if(document.rg.ct.options[document.rg.ct.options.selectedIndex].value==0){alert('Укажите: "Город"');document.rg.ct.focus();}
 else if(document.rg.fakt_mail_ind.value==0){alert('Укажите: "Почтовый Индекс"');document.rg.fakt_mail_ind.focus();}
 else if(document.rg.fakt_adres.value==0){alert('Укажите: "Улицу"');document.rg.fakt_adres.focus();}
 else if(document.rg.house.value==0){alert('Укажите: "Номер Дома"');document.rg.house.focus();}
 else if(document.rg.floor.value==0){alert('Укажите: "Этаж"');document.rg.floor.focus();}
 else if(document.rg.office.value==0){alert('Укажите: "Номер Офиса"');document.rg.office.focus();}
 else if(document.rg.point_tel.value==0){alert('Укажите: "Телефон Вашей организации"');document.rg.point_tel.focus();}
 else if(document.rg.point_fax.value==0){alert('Укажите: "Факс Вашей организации"');document.rg.point_fax.focus();}
 else if(document.rg.point_person.value==0){alert('Укажите: "Контактное Лицо"');document.rg.point_person.focus();}
 else if(document.rg.ppp.options[document.rg.ppp.options.selectedIndex].value==0){alert('Укажите: "Должность"');document.rg.ppp.focus();}
 else if(document.rg.point_persons_email.value==0){alert('Укажите Ваш E-MAIL, он будет использоваться в качестве Вашего логина !!!');document.rg.point_persons_email.focus();}
 else if(document.rg.mob_tel.value==0){alert('Укажите Ваш: "Контактный Мобильный Телефон"');document.rg.mob_tel.focus();}
 else if(document.rg.point_persons_tel.value==0){alert('Укажите Ваш: "Контактный Телефон"');document.rg.point_persons_tel.focus();}
 else if(document.rg.point_persons_fax.value==0){alert('Укажите Ваш: "Факс"');document.rg.point_persons_fax.focus();}
 else{document.rg.operation.value=opertn;document.rg.submit();}
}

function go_idx(){
 if(document.formi.oldpass.value==0){alert('Укажите: "Старый пароль"');document.formi.oldpass.focus();}
 else if(document.formi.newpass.value==0){alert('Укажите: "Новый пароль"');document.formi.newpass.focus();}
 else if(document.formi.newpass2.value==0){alert('Укажите Новый пароль ещё раз: "Подтверждение нового пароля"');document.formi.newpass2.focus();}
 else if(document.formi.newpass.value!=document.formi.newpass2.value){alert('Введенные пароли не одинаковые');document.formi.newpass.focus();}
 else if(document.formi.newpass.value.length<6||document.formi.newpass.value.length>16){alert('Новый пароль должен содержать от 6 до 16 символов');document.formi.newpass.focus();}
 else document.formi.submit();
}

function setObj(x){
 var obj=eval("(parent.isNC)?((parent.isNC5)?document.getElementById('"+x+"').style:document."+x+"):document.all."+x+".style;");
 return obj;
}

function myobj(windowstatus){
 this.windowstatus=windowstatus;
}

function strsearch(str,strsear){
 var userfield=new String(str);
 if(userfield.search(strsear)=='-1')return false;
 else return true;
}

function strlen(str,maxstrlen){
 var userfield=new String(str);
 if(userfield.length>maxstrlen)return true;
 else return false;
}

function numbrs(str,par){
 var strr=new String(str);
 var numonly=new RegExp('[~#№$%^&-+=*/<>\'`",.:;!?()А-Яа-яЁёІіЇїЄєA-Za-z ]');
 var numtape=new RegExp('[~#№$%^&+=*/<>\'`",.:;!?()А-Яа-яЁёІіЇїЄєA-Za-z]');
 var notext=new RegExp('[~#№$%^&-+=*/<>\'`",:;!?()А-Яа-яЁёІіЇїЄєA-Za-z ]');
 if(par==0&&numtape.test(strr))return true;
 else if(par==1&&numonly.test(strr))return true;
 else if(par==2&&notext.test(strr))return true;
 else return false;
}

function condition_set_checkbox(frm_name,checkbox_name,count_values){checked=0;
 for(i=0;i<count_values;i++)if(eval('document.'+frm_name+'.'+checkbox_name+'_'+i+'.checked'))checked++;
 if(checked>0)return false;else if(checked==0)return true;
}

function actionn(type,cls,thint){
 switch(type){
  case'build':
   alert('В категории предложений не найдено.\n\nДля внесения своих предложений, пожалуйста, пройдите регистрацию.	 ');
   break;
  case'findfrm':
  case'view'://alert(type+' - '+cls+' - '+thint);
  document.formstrss.page.value=cls+'s';
  document.formstrss.thint.value=thint;
  if(thint!='view_int'&&thint!='modify_int'&&thint!='_mods'&&thint!='_actmess'&&thint!='a')document.formstrss.thpage.value=cls;
  case'logout':if(type=='logout')document.formstrss.ck.value='-';
  case'':if(type=='')document.formstrss.page.value='';
  case'usr_prfl':
  case'this_month':
  case'next_month':
  case'amplify_categorys':
  case'dtedit':
  case'tariffs':
  case'invpd':
  case'stats':
  case'stat':
  case'idx':
  case'noidx':
  case'regspd':
  case'helps':
  case'registration':
  case'recommendations':
  case'regulations':
  case'full_activate':
  case'full_accent':
  case'aratp':
  case'atp':
  case'accent':if(type=='accent')document.formstrss.page.value=cls;
  document.formstrss.operation.value=type;
  document.formstrss.submit();
 }
}

function GetCookie(name){
 var result=null;
 var myCookie=" "+document.cookie+";";
 var searchName=" "+name+"=";
 var startOfCookie=myCookie.indexOf(searchName);
 var endOfCookie;
 if(startOfCookie!=-1){
  startOfCookie+=searchName.length;
  endOfCookie=myCookie.indexOf(";",startOfCookie);
  result=unescape(myCookie.substring(startOfCookie,endOfCookie));
 }
 return result;
}

function SetCookie(name,value,expires,path,domain,secure){
 var expString=((expires==null)?"":(";expires="+expires.toGMTString()));
 var pathString=((path==null)?"":(";path="+path));
 var domainString=((domain==null)?"":(";domain="+domain));
 var secureString=((secure==true)?";secure":"");
 document.cookie=name+"="+escape(value)+expString+pathString+domainString+secureString;
}

function ClearCookie(name){
 var FiveDays=5*24*60*60*1000;
 var expDate=new Date();
 expDate.setTime(expDate.getTime()-FiveDays);
 document.cookie=name+"=ImOutOfHere;expires="+expDate.toGMTString();
}

function ClearAllCookie(){
 ClearCookie('maidenvisit');
 ClearCookie('pastvisit');
 ClearCookie('visit');
 ClearCookie('cpHours');
 ClearCookie('cpDate');
 ClearCookie('cpMonth');
 ClearCookie('cpYear');
 ClearCookie('login');
 ClearCookie('sid');
 ClearCookie('ckid');
 ClearCookie('ckidd');
 ClearCookie('atp');
 dates();
}

function dates(){
 var mv=new Date();
 var maidv=new Number(GetCookie("maidenvisit"));
 mv.setTime(maidv)
 var pv=new Date();
 var pasv=new Number(GetCookie("pastvisit"));
 pv.setTime(pasv);
 var ddd=new Number(GetCookie('ckidd'));var dddd=new Date();dddd.setTime(ddd);
 alert(mv+"  <-=->  Первое посещение\r\r"+pv+"  <-=->  Последнее посещение\n\n"+document.cookie+"\n\nskidd <-=-> "+dddd);
}

function ck(a){
 var tenYears=10*365*24*60*60*1000;
 var expDate=new Date();
 expDate.setTime(expDate.getTime()+tenYears);
 var visit=new Date();
 visitms=visit.getTime();
 if(GetCookie("cpDate")==null){
  SetCookie("maidenvisit",visitms,expDate);
  SetCookie("pastvisit",visitms,expDate);
  SetCookie("cpHours","1",expDate);
  SetCookie("cpDate","1",expDate);
  SetCookie("cpMonth","0",expDate);
  SetCookie("cpYear","0",expDate);
 }
 else{
  var pastvisitms=new Number(GetCookie("pastvisit"));
  var pastvisit=new Date();
  pastvisit.setTime(pastvisitms);
  if(visit.getHours()!=pastvisit.getHours()||visit.getDate()!=pastvisit.getDate()||visit.getMonth()!=pastvisit.getMonth()||visit.getFullYear()!=pastvisit.getFullYear()){
   SetCookie("pastvisit",visitms,expDate);
   var vHours=new Number(GetCookie('cpHours'));
   SetCookie("cpHours",vHours+1,expDate);
  }
  if(visit.getDate()!=pastvisit.getDate()||visit.getMonth()!=pastvisit.getMonth()||visit.getFullYear()!=pastvisit.getFullYear()){
   SetCookie("pastvisit",visitms,expDate);
   var vDate=new Number(GetCookie('cpDate'));
   SetCookie("cpDate",vDate+1,expDate);
  }
  if(visit.getMonth()!=pastvisit.getMonth()||visit.getFullYear()!=pastvisit.getFullYear()){
   SetCookie("pastvisit",visitms,expDate);
   var vMonth=new Number(GetCookie('cpMonth'));
   SetCookie("cpMonth",vMonth+1,expDate);
  }
  if(visit.getFullYear()!=pastvisit.getFullYear()){
   SetCookie("pastvisit",visitms,expDate);
   var vYear=new Number(GetCookie('cpYear'));
   SetCookie("cpYear",vYear+1,expDate);
  }
 }
 if(a&&GetCookie('ckid')!=null&&GetCookie('atp')==null){
  obj1=setObj('batp');
  obj1.visibility='visible';
 }
 return expDate;
}

function cks(sid){
 if(GetCookie("ckid")==null)par='ins';
 else if(GetCookie("ckid")!=null)par='upd'+'^'+GetCookie("ckid");
 if(sid>0)SetCookie("sid",sid,expDate);
 document.formstrss.ck.value=par+'^'+GetCookie("cpHours")+'^'+GetCookie("cpDate")+'^'+GetCookie("cpMonth")+'^'+GetCookie("cpYear")+'^'+GetCookie('sid')+'^'+navigator.cpuClass+'^'+navigator.platform+'^'+navigator.systemLanguage+'^'+navigator.language+'^'+navigator.appCodeName+'^'+navigator.appName+'^'+navigator.appVersion+'^'+parseFloat(navigator.appVersion)+'^'+navigator.appMinorVersion+'^'+navigator.userAgent+'^'+window.outerWidth+'x'+window.outerHeight+'^'+window.screenX+'x'+window.screenY;
}

function ckd(){
 var visit=new Date();
 visitms=visit.getTime();
 var ckidd=new Number(GetCookie('ckidd'));
 var Month=31*24*60*60*1000;
 if(visitms<ckidd+Month)return false;
 else return true;
}

function ff(n){
 if(GetCookie("fav")==null||n){
  window.external.AddFavorite("http://shop-service.kiev.ua/","S H O P - S E R V I C E");
  SetCookie("fav",0,expDate);
 }
}
