function checkLoadedValues(){ if (document.getElementById('fldTimeDep')){ ChangeTime(document.getElementById('fldTimeDep')); ChangeTime(document.getElementById('fldTimeArr')); HideShowBackData(); } } function ChangeTime(obj){ if (obj.value=='null') document.getElementById(obj.id+'Opt').disabled =true else document.getElementById(obj.id+'Opt').disabled =false } function showMoreCost(offer,request){ window.open('/pages/forms/cost.php?offer='+offer+'&request='+request,'sas', "height=300,width=520,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no"); } function showTerms(request){ window.open('/pages/forms/terms.php?request='+request,'sas', "height=300,width=520,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no"); } var x=0;y=0; function getY(obj){ if (obj){ y=y+obj.offsetTop getY(obj.offsetParent) }else return y } function getX(obj){ if (obj){ x=x+obj.offsetLeft getX(obj.offsetParent) }else return x } function showSelect(obj,keyValue,keycode){ if (obj.value.length>1){ txt=obj.name.replace('fldName','') if (keyCode==8 ){ if (obj.value.length>3){ oCurObj=obj document.all.smartboxBG.src='/pages/utils/searchTown.php?fld='+txt+'&txt='+obj.value.substring(0,+obj.value.length-1); }else{ clearSelection(); hideSelect(); } }else{ y=0; x=0; getY(obj) getX(obj) y+=obj.clientTop+obj.clientHeight x+=obj.clientLeft document.all.smartboxBG.style.display='block' document.all.smartboxBG.style.top=y document.all.smartboxBG.style.left=x document.all.smartboxBG.style.width=200//obj.clientWidth document.all.smartboxBG.style.width=300//obj.clientWidth oCurObj=obj //alert(keycode+keyValue) if (obj.name=='fldNameCompany') document.all.smartboxBG.src='/pages/utils/searchCompany.php?fld='+txt+'&txt='+obj.value+keyValue; else document.all.smartboxBG.src='/pages/utils/searchTown.php?fld='+txt+'&txt='+obj.value+keyValue; } } } var oCurObj=null; var oCurRow=null; var oCurRowNumber=0; function keyup(obj){ keyCode=window.event.keyCode //alert(keyCode) switch (keyCode){ case 39: case 37: return false; break; case 38: moveSelection(-1,obj) return false; break; case 40: moveSelection(1,obj) return false; break; case 27: clearSelection(); hideSelect(); break; case 8: clearSelection(); keyvalue='' showSelect(obj,keyvalue,keyCode); break; } } function moveSelection(step,obj){ //status=oCurObj if (oCurObj==null) return; if (oCurObj==obj){ wSmartboxBG=window.frames.smartboxBG oCurRowNumber=oCurRowNumber+step row=wSmartboxBG.document.all('divLink'+oCurRowNumber) oCurRow=row if (row==null) oCurRowNumber=oCurRowNumber-step else{ row.className='DivOver' wSmartboxBG.document.all('urlLink'+oCurRowNumber).style.textDecoration='none' rowPrev=wSmartboxBG.document.all('divLink'+(oCurRowNumber-step)) if (rowPrev!=null){ rowPrev.className='DivOut' wSmartboxBG.document.all('urlLink'+(oCurRowNumber-step)).style.textDecoration='underline' } } } } function clearSelection(){ oCurObj=null oCurRowNumber=0 } function keypressed(obj){ keyCode=window.event.keyCode //alert(keyCode) switch (keyCode){ case 13: oCurObj=null if (oCurRow!=null){ wSmartboxBG=window.frames.smartboxBG wSmartboxBG.document.all('urlLink'+oCurRowNumber).click(); clearSelection(); return false; } break; default: clearSelection(); keyvalue=String.fromCharCode(keyCode) showSelect(obj,keyvalue,keyCode); } } function hideSelect(){ if (document.elementFromPoint(window.event.x,window.event.y).id!='smartboxBG') document.all.smartboxBG.style.display='none'; } function showSelector(val){ window.open('/pages/forms/townSelect.php?name='+val+'&code='+document.all('fldCode'+val).value,'sas', "height=300,width=520,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no"); } function showPlane(val){ window.open('http://www.gofly.ru/pages/forms/plane.php?id='+val,null, "height=600,width=620,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no"); } function showPort(val){ window.open('http://www.gofly.ru/pages/forms/ports.php?id='+val,null, "height=600,width=620,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no"); } function showCompany(val){ window.open('http://www.gofly.ru/pages/forms/company.php?id='+val,null, "height=600,width=620,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no"); } function findTown(value, code){ opener.window.document.all('fldName'+document.all.fld.value).value=value opener.window.document.all('fldCode'+document.all.fld.value).value=code close() } function insertTowns(obj,val){ if (obj.value!=-1) window.frames("insertVals").location.href="/pages/utils/insertValues.php?cn="+obj+"&ct="+val } function insertTown(){ if (document.all.city.selectedIndex>-1){ opener.window.document.all('fldName'+document.all.fld.value).value=document.all.city.options[document.all.city.selectedIndex].text opener.window.document.all('fldCode'+document.all.fld.value).value=document.all.city.value window.close(); } } function insertDate(){ if (document.all.txt_dates.value!=''){ //alert(document.all.txt_dates.value); opener.window.document.all('fldDate'+document.all.fld.value).value=document.all.txt_dates.value // alert(document.all.txt_dates.value); opener.window.document.all('fldDate'+document.all.fld.value).click() window.close(); } } function HideShowBackData(){ var col=document.getElementsByTagName("DIV") if (document.all.isBack[1].checked) val='visible' else val='hidden' for (i=0;iOutDate) document.all(obj.name+'To').value=obj.value if (type==0) validateBack(obj) } function validateBack(obj){ sArr=obj.value.split('.') InDate=new Date(sArr[2],sArr[1]-1,sArr[0]) sArr=document.all('fldDateArr').value.split('.') OutDate=new Date(sArr[2],sArr[1]-1,sArr[0]) if (InDate>OutDate){ document.all('fldDateArr').value=obj.value document.all('fldDateArrTo').value=obj.value } } function showCalendar(val,mindate,flag){ if (mindate!=''){ mindate=document.all(mindate).value } if (flag==0 || document.all('fldDate'+val).value!='') value=document.all('fldDate'+val).value else value=document.all('fldDate'+val.replace('To','')).value window.open('http://www.gofly.ru/pages/forms/dateSelect.php?value='+value+'&name='+val+'&min='+escape(mindate),'sas', "height=180,width=250,scrollbars=no,status=no,toolbar=no,menubar=no,location=no"); } function validateAviaForm(){ flag=true; if (document.all.fldCodeDep.value==''){ document.all.TDCodeDep.innerHTML='
avia.validateform.townfrom'; flag=false; } else document.all.TDCodeDep.innerHTML=''; if (document.all.fldCodeArr.value==''){ document.all.TDCodeArr.innerHTML='
avia.validateform.townto'; flag=false; } else document.all.TDCodeDep.innerHTML=''; if (document.all.fldDateArr.value=='' || document.all.fldDateArrTo.value==''){ if (document.all.isBack[1].checked) { document.all.TDDateArr.innerHTML='
avia.validateform.dateback'; flag=false; } else{ document.all.TDDateArr.innerHTML=''; } } else{ document.all.TDDateArr.innerHTML=''; } if (document.all.fldDateDep.value=='' || document.all.fldDateDepTo.value==''){ document.all.TDDateDep.innerHTML='
avia.validateform.datefrom'; flag=false; } else document.all.TDDateDep.innerHTML=''; return flag } function validateRegForm() { flag=true; if (validate_english_text("login","Логин")!=''){ document.all.TDLogin.innerHTML='
common.validateform.required'; flag=false } else document.all.TDLogin.innerHTML=''; if (validate_english_text("pass","Логин")!=''){ document.all.TDPass.innerHTML='
common.validateform.required'; flag=false } else document.all.TDPass.innerHTML=''; if (validate_confirm("pass###pass1","Логин")!=''){ document.all.TDPass1.innerHTML='
common.validateform.passnoeequals'; flag=false } else document.all.TDPass1.innerHTML=''; if (validate_text("name","Логин")!=''){ document.all.TDName.innerHTML='
common.validateform.required'; flag=false } else document.all.TDName.innerHTML=''; if (validate_text("email","Логин")!=''){ document.all.TDEmail.innerHTML='
common.validateform.required'; flag=false } else if (validate_email("email","Логин")!=''){ document.all.TDEmail.innerHTML='
common.validateform.wrongemail'; flag=false } else document.all.TDEmail.innerHTML=''; re1 = /^\+\d+ \(\d+\) (\d)+$/; if (validate_text("phone","Логин")!=''){ document.all.TDPhone.innerHTML='
common.validateform.required'; flag=false } else if (validate_pattern("phone","Логин",re1)!=''){ document.all.TDPhone.innerHTML='
common.validateform.wrongphone'; flag=false } else document.all.TDEmail.innerHTML=''; //+validate_text("pass","Пароль")+validate_confirm("pass###pass1","Пароли не совпадают")+validate_text("name","Контактное лицо")+validate_email("email","Адрес электронной почты")+validate_text("email","Адрес электронной почты")+validate_text("phone","Телефон"); return flag; } function validate_text(name,string){ re = / /g; var msg msg='' if (document.all(name).value=="" || document.all(name).value.replace(re,'')=="") msg+="- "+string+"\n" return msg } function validate_english_text(name,string){ re = /([a-z]+[0-9]*[_]*)/g; var msg msg='' if (document.all(name).value=="" || document.all(name).value.replace(re,'')!="") msg+="- "+string+"\n" return msg } function validate_email(name,string){ re = / /g; var msg msg='' if ((document.all(name).value!="") && (document.all(name).value.indexOf("@",1)==-1 || document.all(name).value.indexOf(".",3)==-1)) msg+="- "+string+"\n" return msg } function validate_confirm(name,string){ re = / /g; var msg arr= name.split("###") msg='' if (document.all(arr[0]).value!=document.all(arr[1]).value) msg+="- "+string+"\n" return msg } function validate_number(name,string){ re = / /g; var msg msg='' if (document.all(name).value.replace(re,'')=="" || isNaN(document.all(name).value.replace(re,''))) msg+="- "+string+"\n" return msg } function validate_pattern(name,string,pattern){ var msg msg='' if (document.all(name).value.replace(pattern,'')!="") msg+="- "+string+"\n" return msg } function submitLoginForm(){ re = / /g; if (!(document.all.frmlogin.value=="" || document.all.frmlogin.value.replace(re,'')=="" || document.all.frmpass.value=="" || document.all.frmpass.value.replace(re,'')=="")) return true else return false } function submitForgonForm(){ re = / /g; if ((document.all.login.value!="" && document.all.login.value.replace(re,'')!="") || (document.all.email.value!="" && document.all.email.value.replace(re,'')!="")) return true else return false } function resetForm(formName){ oFrm=document.getElementById(formName) oFrm.reset(); }