var gbl_pageName="";var gbl_CommentsFlag=false;function viewTEList(pageName){if(gbl_isUserSignedId){gbl_pageName=pageName;renderview("loadpage",'');SendRequest("TExpertSearch.php",'get','TESearchPage');}else{if(itineraryItemsArrGlobal.length){if(gblItineraryAction=="Add"){itineraryModal('itinerary');}}else{showSignInPage();}}}function TEList(){var Country=document.TExpertSearchList.Country.value;var City=document.TExpertSearchList.City.value;var Region=document.TExpertSearchList.Region.value;var array={'Country':Country,'City':City,'Region':Region,'RequestType':'TravelExpertList'};formData=ued_encode(array);SendRequest("TExpertList.php?Country="+Country+"&City="+City+"&Region="+Region+"&itineraryId="+gbl_ItineraryId+"&startingLocType="+gbl_startingLocationType,'post','displayserviceproviderlist');}function travelerInfo(itineraryID){var startLocation;var airportCityName;var arriveDate;var departDate;var startTime;var endTime;var numOfTravelers;var group;var planningPrio;var transportPrio;var currency;startLocation=document.frmdisplaypanel1.rdoAirPort1.checked;if(startLocation==false){startLocation="Airport";airportCityName=document.frmdisplaypanel.drpAirport.value;arriveDate=document.frmdisplaypanel.arrivaldate.value;departDate=document.frmdisplaypanel.departuredate.value;startTime=document.frmdisplaypanel.starttime.value;endTime=document.frmdisplaypanel.endtime.value;arriveAirportType=document.frmdisplaypanel.rdo_arrival_airporttype.checked;if(arriveAirportType==false){arriveAirportType=0;}else{arriveAirportType=1;}departAirportType=document.frmdisplaypanel.rdo_departure_airporttype.checked;if(departAirportType==false){departAirportType=0;}else{departAirportType=1;}numOfTravelers=document.frmdisplaypanel.txtTravelerCount.value;group=document.frmdisplaypanel.Group.value;planningPrio=document.frmdisplaypanel.itemFilter.value;transportPrio=document.frmdisplaypanel.Transportation.value;currency=document.frmdisplaypanel.currency.value;}else{startLocation="City";airportCityName=document.frmdisplaypanel2.drpCity.value;arriveDate=document.frmdisplaypanel2.arrivaldate.value;departDate=document.frmdisplaypanel2.departuredate.value;startTime=document.frmdisplaypanel2.starttime.value;endTime=document.frmdisplaypanel2.endtime.value;arriveAirportType=-1;departAirportType=-1;numOfTravelers=document.frmdisplaypanel2.txtTravelerCount.value;group=document.frmdisplaypanel2.Group.value;planningPrio=document.frmdisplaypanel2.itemFilter.value;transportPrio=document.frmdisplaypanel2.Transportation.value;currency=document.frmdisplaypanel2.currency.value;}var arr={'startLocation':startLocation,'airportCityName':airportCityName,'arriveDate':arriveDate,'departDate':departDate,'startTime':startTime,'endTime':endTime,'arriveAirportType':arriveAirportType,'departAirportType':departAirportType,'numOfTravelers':numOfTravelers,'group':group,'planningPrio':planningPrio,'transportPrio':transportPrio,'currency':currency,'itineraryID':itineraryID,'RequestType':'TravelerInfo'};formData=ued_encode(arr);SendRequest("saveInformation.php",'post','travlerInfo');}function saveItineraryComments(userAction,status,type){var frmObj=document.frmitinerary;var Id=gbl_ItineraryId;var txtRejectComments='';document.getElementById('mainBody').scrollTop=0;showLoadingImages();if(isBidUser==false&&gbl_showComments==false){if(bValidate(frmObj.txtComment,"AlphaWithSpace","True","Comments")==false){return false;}if(bValidate(frmObj.txtEmail,"Email","True","Email Address")==false){return false;}if(bValidate(frmObj.txtName,"AlphaWithSpace","false","Name")==false){return false;}var action='Comments';var name=frmObj.txtName.value;var email=frmObj.txtEmail.value;var comments=frmObj.txtComment.value;var sysDate=new Date();var array={'action':action,'Id':Id,'name':name,'email':email,'comments':comments,'date':sysDate,'type':type};}if(gbl_showComments==true){var SP=frmObj.SP.value;var userComments=new Array();var userDay=new Array();try{userComments[-1]=0;userDay[-1]=0;}catch(err){}var objTxtComment=document.getElementsByTagName('textarea');objRegExp=new RegExp(sAlphaNumWithHyphenUnderScoreExp,'gi');for(var i=0;i<objTxtComment.length;i++){if(objTxtComment[i].name!='txtComment'&&objTxtComment[i].name!='SPRejectCommentTraveler'&&objTxtComment[i].name!='SPRejectCommentForSP'){userComments[i]=objTxtComment[i].value;userDay[i]=objTxtComment[i].name;}}var rdoObj=frmObj.rdoAcceptReject;if(rdoObj){if(rdoObj[1].checked){status='Reject';txtRejectComments=frmObj.SPRejectCommentForSP.value;}else if(rdoObj[0].checked){status='Accept';txtRejectComments='';}else{alert("Please select your action");return false;}}if(type==1){status='Accept';}gblBidRequestFrm='Itinerary';var array={'action':userAction,'status':status,'SPID':SP,'Id':Id,'rejectComments':txtRejectComments,'comments':[userComments],'TripDay':[userDay],'type':type};formData=ued_encode(array);SendRequest("/itinararyAuction/addComment",'post','getBidResult');}else{var userComments=new Array();var amount=0;var userDay=new Array();try{userComments[-1]=0;userDay[-1]=0;}catch(err){}var objTxtComment=document.getElementsByTagName('textarea');for(var i=0;i<objTxtComment.length;i++){if(objTxtComment[i].name!="SPRejectComment"&&objTxtComment[i].name!=""&&objTxtComment[i].name!='SPRejectCommentTraveler'&&objTxtComment[i].name!='SPRejectCommentForSP'){if(objTxtComment[i].name!='txtComment'){userComments[userComments.length]=objTxtComment[i].value;userDay[userDay.length]=objTxtComment[i].name;}}}if(document.frmitinerary.ImageName!=null){var sFileName=document.frmitinerary.ImageName.value;if(sFileName!=""){if(!checkDOCPDFFileExtension(document.frmitinerary.ImageName)){return false;}var sFileNameArr=sFileName.split("\\");sFileName=sFileNameArr[sFileNameArr.length-1];}if(document.frmitinerary.chkAddDelFile&&document.frmitinerary.chkAddDelFile.checked){sFileName="";}else if(sFileName==""&&document.frmitinerary.hidFileName!=null){sFileName=document.frmitinerary.hidFileName.value;}}else{if(document.frmitinerary.hidFileName!=null){var sFileName=document.frmitinerary.hidFileName.value;}else{var sFileName="";}}if(document.frmitinerary.txtAmount!=null){var amount=document.frmitinerary.txtAmount.value;if(bValidate(document.frmitinerary.txtAmount,"AlphaNumericWithSpaceDot","False","Amount")==false){return false;}}else{var amount=0;}if(userAction=="add"){var action='AddSPComments';}else{var action='UpdateSPComments';}var rdoObj=document.frmitinerary.rdoAcceptReject;var txtRejectComments='';if(rdoObj){if(rdoObj[1].checked){status='Reject';txtRejectComments=document.frmitinerary.SPRejectCommentTraveler.value;}else if(rdoObj[0].checked){status='Accept';txtRejectComments='';}else{alert("Please select your action");return false;}}else{status='Update';txtRejectComments='';}if(type==1){status='Accept';}var SP=frmObj.SP.value;document.forms[0].submit;gblBidRequestFrm='Itinerary';var array={'action':action,'amount':amount,'FileName':sFileName,'status':status,'rejectComments':txtRejectComments,'Id':Id,'SP':SP,'comments':[userComments],'type':type,'TripDay':[userDay]};}formData=ued_encode(array);if(action=='Comments'){SendRequest("/itinarary/addComment",'post','getBidResult');}if(action=='AddSPComments'||action=='UpdateSPComments'){SendRequest("/itinararyAuction/addComment",'post','getBidResult');}}function setOptionsForTE(obj,opt1,opt2,opt3,opt4,itineraryID){if(obj.checked==true){if(itineraryID==0){document.getElementById(opt1).disabled=false;document.getElementById(opt2).disabled=true;}else{document.getElementById(opt1).disabled=true;document.getElementById(opt2).disabled=false;}document.getElementById(opt4).checked=true;}if(obj.checked==false){document.getElementById(opt1).disabled=true;document.getElementById(opt2).disabled=true;document.getElementById(opt1).checked=false;document.getElementById(opt2).checked=false;document.getElementById(opt3).style.display='none';}}function setTeReviewStatusForIt(opt1,opt2){document.getElementById(opt1).checked=false;document.getElementById(opt2).style.display='none';}function setTeSuggestStatusForIt(opt1,opt2){document.getElementById(opt1).checked=false;document.getElementById(opt2).style.display='block';}function CLSAllTEForIt(id,name,email,option,comments,UUID){this.id=id;this.name=name;this.email=email;this.option=option;this.comments=comments;this.UUID=UUID;}function getAllTEForIt(itineraryId,userID,travelerID){var array={'action':'TExpertActivities','itineraryId':itineraryId,'userID':userID,'travelerID':travelerID,'type':'TravelExperts'};formData=ued_encode(array);SendRequest("/itinarary/TE/TExpertActivities",'post','getBidResult');}function viewSPList(itineraryId){var array={'ID':itineraryId};formData=ued_encode(array);SendRequest("BidItinerary.php",'get','BidItineraryDetails');SendRequest("/itineraryAuction/"+itineraryId+"/getSPList",'get','ItinerarySPList');}function bidItinerary(){var objForm=document.frmBidItinerary;var spChkList=objForm.chkSPList;var txtEmailIds=objForm.txtEmailList;var spList="";var cnt=0;var EmailId=new Array();var EmailName=new Array();try{EmailId[0]="";EmailName[0]="";EmailId[-1]=0;EmailName[-1]=0;}catch(err){}if(txtEmailIds&&txtEmailIds.value!=""){txtEmailIds.value=txtEmailIds.value.replace(/\n/g,'');var startIndex=0;var emailexp=/^[\s]*[a-z][a-z_0-9\-\.]*[a-z|0-9]@[a-z|0-9][a-z_0-9\-\.]*[a-z|0-9]\.[a-z]{2,3}[\s]*$/i;var UserNameexp=/^[\s]*[a-z_0-9 \'\s]*[\s]*$/i;var emailCnt=1;if(txtEmailIds.value.indexOf(",")==-1){if((txtEmailIds.value.indexOf("<")!=-1&&txtEmailIds.value.indexOf(">")==-1)||(txtEmailIds.value.indexOf(">")==-1&&txtEmailIds.value.indexOf("<")!=-1)){alert("Invalid email format");txtEmailIds.setSelectionRange(0,txtEmailIds.value.length);txtEmailIds.focus();return false;}else if(txtEmailIds.value.indexOf("<")!=-1&&txtEmailIds.value.indexOf(">")!=-1){EmailName[emailCnt]=txtEmailIds.value.split("<")[0];EmailId[emailCnt]=txtEmailIds.value.split("<")[1].replace(">","");if(emailexp.test(EmailId[emailCnt])==false||UserNameexp.test(EmailName[emailCnt])==false){alert("Please check that each email is entered in the correct format and separate each email with a comma");txtEmailIds.setSelectionRange(0,txtEmailIds.value.length);txtEmailIds.focus();return false;}emailCnt++;}else{EmailName[emailCnt]="User";EmailId[emailCnt]=txtEmailIds.value;if(emailexp.test(EmailId[emailCnt])==false){alert("Please check that each email is entered in the correct format and separate each email with a comma");txtEmailIds.setSelectionRange(0,txtEmailIds.value.length);txtEmailIds.focus();return false;}}}else{var separator=",";var emailList=txtEmailIds.value.split(separator);for(var loopCnt=0;loopCnt<emailList.length;loopCnt++){if((emailList[loopCnt].indexOf("<")!=-1&&emailList[loopCnt].indexOf(">")==-1)||(emailList[loopCnt].indexOf(">")==-1&&emailList[loopCnt].indexOf("<")!=-1)){alert("Invalid email format");StartIndex=txtEmailIds.value.search(emailList[loopCnt]);txtEmailIds.setSelectionRange(StartIndex,StartIndex+emailList[loopCnt].length);txtEmailIds.focus();return false;}else if(emailList[loopCnt].indexOf("<")!=-1&&emailList[loopCnt].indexOf(">")!=-1){EmailName[emailCnt]=emailList[loopCnt].split("<")[0];if(EmailName[emailCnt]==""){EmailName[emailCnt]="User";}EmailId[emailCnt]=emailList[loopCnt].split("<")[1].replace(">","");if(emailexp.test(EmailId[emailCnt])==false||UserNameexp.test(EmailName[emailCnt])==false){alert("Please check that each email is entered in the correct format and separate each email with a comma");StartIndex=txtEmailIds.value.search(EmailName[emailCnt]);if(StartIndex==-1){StartIndex=txtEmailIds.value.search(EmailId[emailCnt]);}txtEmailIds.setSelectionRange(StartIndex,StartIndex+(emailList[loopCnt].length));txtEmailIds.focus();return false;}emailCnt++;}else{var emailID=trim(emailList[loopCnt]," ");EmailName[emailCnt]="User";EmailId[emailCnt]=emailID.replace(/\n/g,'');if(EmailId[emailCnt]==""){alert("Please give email address");txtEmailIds.focus();return false;}if(emailexp.test(EmailId[emailCnt])==false){alert("Please check that each email is entered in the correct format and separate each email with a comma");StartIndex=txtEmailIds.value.search(EmailId[emailCnt]);txtEmailIds.setSelectionRange(StartIndex,StartIndex+(emailList[loopCnt].length));txtEmailIds.focus();return false;}emailCnt++;}}}}if(spChkList){if(!spChkList.length&&spChkList.checked){spList=spChkList.value;}else{for(var i=0;i<spChkList.length;i++){if(spChkList[i].checked){spList=(spList=="")?spChkList[i].value:spList+","+spChkList[i].value;cnt++;}spStatus=spChkList[i].id.split("~")[0];spDelete=spChkList[i].id.split("~")[1];if(spChkList[i].disabled&&!spStatus.match("Reject")&&spDelete!=1){cnt++;}var spID=spChkList[i].value;var validDayCnt=document.getElementById(spID).value;if(validDayCnt>auctionDayValidatity){cnt--;}}}if(spList==""&&EmailId.length==0){alert("Please select service provider first");return false;}if(cnt>5){alert("You can select max 5 service providers only");return false;}}if(EmailId.length==0&&spList==""){alert("Please select service provider first");return false;}var ID,bidType;if(gblBidRequestFrm=='Budget'){ID=gbl_BudgetId;bidType=2;}else{ID=gbl_ItineraryId;bidType=1;}objForm.SendBid.disabled=true;gblAdminBidItinerary=false;if(EmailId.length>0){var array={'itineraryId':ID,'BidType':bidType,'spList':spList,'EmailName':[EmailName],'EmailId':[EmailId]};}else{var array={'itineraryId':ID,'BidType':bidType,'spList':spList};}showLoadingImages();formData=ued_encode(array);SendRequest("/itinerary/BidItinerary",'post','sendItineraryForBid');}function saveBudgetComments(userAction){var frmObj=document.frmBudget;var txtRejectComments='';var Id=frmObj.budgetId.value;var amount=frmObj.txtBidAmount.value;var userComments=frmObj.txtBidComments.value;if(frmObj.ImageName!=null){var sFileName=frmObj.ImageName.value;if(sFileName!=""){if(!checkDOCPDFFileExtension(frmObj.ImageName)){return false;}var sFileNameArr=sFileName.split("\\");sFileName=sFileNameArr[sFileNameArr.length-1];}if(frmObj.chkAddDelFile&&frmObj.chkAddDelFile.checked){sFileName="";}else if(sFileName==""&&frmObj.hidFileName!=null){sFileName=frmObj.hidFileName.value;}}else{var sFileName=frmObj.hidFileName.value;}var action=userAction;if(!userAction){action="AddBudgetBid";}else{action="UpdateBudgetBid";}var spID=frmObj.hidSPID.value;var bidStatus=frmObj.hidstatus.value;var rdoObj=frmObj.rdoAcceptReject;if(rdoObj){if(rdoObj[1].checked){status='Reject';txtRejectComments=frmObj.SPRejectComment.value;}else if(rdoObj[0].checked){status='Accept';txtRejectComments='';}else{alert("Please select your action");return false;}}else{status='Update';txtRejectComments=frmObj.SPRejectComment.value;}if(userComments==''){alert("Please provide your comments");frmObj.txtBidComments.focus();return false;}if(bValidate(frmObj.txtBidAmount,"AlphaNumericWithSpaceDot","False","Amount")==false){return false;}document.getElementById('mainBody').scrollTop=0;showLoadingImages();document.forms[0].submit;var array={'action':action,'amount':amount,'status':status,'FileName':sFileName,'rejectComments':txtRejectComments,'Id':Id,'comments':userComments,'spID':spID,'bidStatus':bidStatus};formData=ued_encode(array);SendRequest('/itinerary/BidPreference',"post","getBidResult");}function saveTEItinerary(itineraryId){isMakeCopyItineary=true;EditItineraryDetails(itineraryId);}function saveComments(userBudgetId){var Id,action;if(document.frmitinerary){var frmObj=document.frmitinerary;var Id=gbl_arrMyItinerary[0].id;var action='saveItineraryComments';}else if(document.frmBudget){var frmObj=document.frmBudget;var Id=userBudgetId;var action='saveBudgetComments';var user_action=document.frmBudget.user_action.value;var UUID=document.frmBudget.userUUID.value;var user_name=document.frmBudget.user_name.value;var user_email=document.frmBudget.user_email.value;var city_name=document.frmBudget.city.value;}if(bValidate(frmObj.txtEmail,"Email","True","Email Address")==false){return false;}document.getElementById('mainBody').scrollTop=0;showLoadingImages();var name=frmObj.txtName.value;var email=frmObj.txtEmail.value;if(frmObj.txtComment!=null){var comments=frmObj.txtComment.value;}else{var comments=frmObj.dayComment.value;}var sysDate=new Date();if(document.frmitinerary){var array={'action':action,'Id':Id,'name':name,'email':email,'comments':comments,'date':sysDate};}else if(document.frmBudget){var array={'action':action,'user_action':user_action,'UUID':UUID,'Id':Id,'name':name,'user_name':user_name,'user_email':user_email,'user_action':user_action,'city':city_name,'email':email,'comments':comments,'date':sysDate};}formData=ued_encode(array);if(document.getElementById('mainBody')){document.getElementById('mainBody').scrollTop=0;}if(action=='saveItineraryComments'){SendRequest("/itinerary/addComment",'post','saveItinerary');}else{SendRequest("/budget/addComment",'post','saveItinerary');}}function emailMyBudget(){var isLoginUser=false;sign_out=document.getElementById("SignUp");if(sign_out.innerHTML.toLowerCase()=="sign out"){isLoginUser=true;}if(!isLoginUser||gbl_BudgetId==0){alert("Please save budget details first.")}else{if(gbl_BudgetId==0||gbl_BudgetId==-1){alert('Please create budget for the city.');return false;}var objOverlay,iframeObj;objOverlay=document.getElementById("AB_overlay");document.getElementById("overlayABFrame").style.display="";document.getElementById("iteneraryRegistrationDiv").style.display="none";iframeObj=document.getElementById("itineraryLoginFrame");iframeObj.src=DIRECTORYSTRUCTUREPATH+"Email.php?pageValue=2";objOverlay.style.visibility=(objOverlay.style.visibility=="visible")?"hidden":"visible";if(objOverlay.style.visibility=="hidden"){objOverlay.style.height="90%";objOverlay.style.width="95%";}else{objOverlay.style.height=document.body.scrollHeight;objOverlay.style.width=document.body.scrollWidth;}var overlayInner=document.getElementById("overlayABInner");document.getElementById("overlayABInner").style.display="";if(isIE){overlayInner.style.height="350px";}else{overlayInner.style.height="350px";}}}function sendEmailBudget(txtEmailIds,txtMessage){if(txtEmailIds.value==""){alert("Please give email address");return false;}else{if(bValidate(txtEmailIds,"Email","True","AuthorName")==false){return false;}if(bValidate(txtMessage,"AlphaWithSpace","True","Headline")==false){return false;}regionId=document.budgetPlannerfrm.Region.value;cityId=document.budgetPlannerfrm.City.value;arival_date=document.budgetPlannerfrm.arival_date.value;var array={'cityid':cityId,'regionId':regionId,'arivalDate':arival_date,'emailTo':txtEmailIds.value,'emailMessage':txtMessage.value};formData=ued_encode(array);SendRequest("budgetEmail.php",'post','saveUserBudget');};}function FindToursAttractions(){var tourAttObj=document.getElementsByName('toursAttraction');var tourAttVal="";for(i=0;i<tourAttObj.length;i++){if(tourAttObj[i].checked){tourAttVal=tourAttObj[i].value;break;}}if(tourAttVal==1){showLoadingImages();SendRequest('tourattraction.php?action=create','get','displayAttractionTour');}else if(tourAttVal==4){var src=document.getElementById('WordlistNonInteresting');var dest=document.getElementById('WordlistInteresting');var uAddedDest=document.getElementById('WordlistUserAdded');var noneInterestingWordList="",interestingWordList="";for(var count=0;count<src.options.length;count++){option=src.options[count];if(noneInterestingWordList==""){noneInterestingWordList=option.value;}else{noneInterestingWordList=noneInterestingWordList+"-,-"+option.value;}}for(var count=0;count<dest.options.length;count++){option=dest.options[count];if(interestingWordList==""){interestingWordList=option.value;}else{interestingWordList=interestingWordList+"-,-"+option.value;}}var array={'noneInteresting':noneInterestingWordList,'interesting':interestingWordList,'userAddedWordList':uAddedDest.value};formData=ued_encode(array);showLoadingImages();SendRequest('tourattraction.php?action=update','post','displayAttractionTour');}else if(tourAttVal==2){showLoadingImages();SendRequest('/AttractionTours/1','get','displayAttractionTour');}else if(tourAttVal==3){showLoadingImages();SendRequest('/AttractionTours/2','get','displayAttractionTour');}else{alert("Please select action");}}function listbox_moveacross(sourceID,destID){var src=document.getElementById(sourceID);var dest=document.getElementById(destID);for(var count=0;count<src.options.length;count++){if(src.options[count].selected==true){var option=src.options[count];var newOption=document.createElement("option");newOption.value=option.value;newOption.text=option.text;newOption.selected=true;try{dest.add(newOption,null);src.remove(count,null);}catch(error){dest.add(newOption);src.remove(count);}count--;}}}function addNonInterestingWord(){var uWordObj=document.getElementById('userAddedWord');var dest=document.getElementById('WordlistNonInteresting');var uAddedDest=document.getElementById('WordlistUserAdded');var isWordExists=false;for(var count=0;count<dest.options.length;count++){var option=dest.options[count];if(option.value.toLowerCase().match(uWordObj.value.toLowerCase())){isWordExists=true;break;}}if(!isWordExists){var newOption=document.createElement("option");newOption.value=uWordObj.value;newOption.text=uWordObj.value;newOption.selected=true;try{dest.add(newOption,null);}catch(error){dest.add(newOption);}if(uAddedDest.value==""){uAddedDest.value=uWordObj.value;}else{uAddedDest.value=uAddedDest.value+"-,-"+uWordObj.value;}uWordObj.value="";}else{alert("Words is already in list");uWordObj.value="";uWordObj.focus();return;}}