var padDigits=function(n,totalDigits){n=n.toString();var pd='';if(totalDigits>n.length)
for(var i=totalDigits-n.length;i>0;i--)
pd+='0';return pd+n.toString();}
function Calendar(resultInputId_,chooseDateOnclick_,dateFormatRegExp_,calendarDateSeparator_,multipleSelection_,dontCloseIt_){var currentMonth=null;var dates=new Array();var resultInputId=resultInputId_;var chooseDateOnclick=chooseDateOnclick_;var reFormat=dateFormatRegExp_;var calendarDateSeparator=calendarDateSeparator_;var multipleSelection=multipleSelection_;var dontCloseIt=dontCloseIt_;var isCalendarOpen=false;this.nGetFirstDay=function(nMonth,nYear){var dDate=new Date(nYear%100,--nMonth,0);var nFirstDay=dDate.getDay();if(nFirstDay==0)nFirstDay=7;return nFirstDay;};this.bCheckLeapYear=function(nYear){nYear=parseInt(nYear);if(nYear%4==0)
return(nYear%100!=0)?true:(nYear%400==0);return false;};this.nGetMonthDays=function(nMonth,nYear){var bLeapYear=this.bCheckLeapYear(nYear);if(nMonth==2)return bLeapYear?29:28;if((nMonth==4)||(nMonth==6)||(nMonth==9)||(nMonth==11))
return 30
else
return 31;};this.calDateValidation=function(sDate){if(reFormat.test(sDate)){var nDay=sDate.split(calendarDateSeparator)[0];var nMonth=sDate.split(calendarDateSeparator)[1];var nYear=sDate.split(calendarDateSeparator)[2];if(Number(nMonth)==0){nMonth='12';nYear=Number(nYear)-1;}
var dDate=new Date(nYear,nMonth-1,nDay);return((dDate.getMonth()+1==nMonth)&&(dDate.getDate()==nDay)&&(dDate.getFullYear()==nYear));}
return false;};this.sDMYtoDate=function(nDay,nMonth,nYear){var sDate=padDigits(nDay,2);sDate+=calendarDateSeparator+padDigits(nMonth,2);sDate+=calendarDateSeparator+nYear;return sDate;};this.nCorrectLastDay=function(nDay,nMonth,nYear){if(nDay>28){while(nDay>1&&!this.calDateValidation(this.sDMYtoDate(nDay,nMonth,nYear))){nDay--;}}
return nDay;};this.calMonthsDef=["January","February","March","April","May","June","July","August","September","October","November","December"];this.calDaysShortDef=["M","T","W","T","F","S","S"];this.createCalendar=function(){if(this.getCurrentMonth()==null){if(dates!=null&&dates.length>0){this.setCurrentMonth(new Date());this.getCurrentMonth().setDate(1);this.getCurrentMonth().setFullYear(dates[0].getFullYear());this.getCurrentMonth().setMonth(dates[0].getMonth());this.getCurrentMonth().setDate(dates[0].getDate());}else{this.setCurrentMonth(new Date());}}
if($('currentCalendarViewYear')!=null){$('currentCalendarViewYear').value=this.getCurrentMonth().getFullYear();}
var nDay=this.getCurrentMonth().getDate();var nMonth=this.getCurrentMonth().getMonth();var nYear=this.getCurrentMonth().getFullYear();var sMonths=(typeof(calMonths)=="undefined")?calMonthsDef:calMonths;var sDaysShort=(typeof(calDaysShort)=="undefined")?calDaysShortDef:calDaysShort;var refresh="document.getElementById('calendar_"+resultInputId+"').style.display = 'none';document.getElementById('calendar_"+resultInputId+"').style.display = '';";var sEmptyCell='<td class="empty">&nbsp;</td>';var sEmptyCell1='<td class="empty"><a href="javascript:'+resultInputId+'.selectDateAndUpdateCalendarView(';var sEmptyCell2=');selectDateOnClick_'+resultInputId+'(true); '+chooseDateOnclick+'"><font class="empty">';var sEmptyCellClose='</font></a></td>';var sCellOpen1='<td><a href="javascript:'+resultInputId+'.selectDateAndUpdateCalendarView(';var sCellOpen2=');selectDateOnClick_'+resultInputId+'(true); '+chooseDateOnclick+'">';var sCellSelected='<td class="selected"><a style="cursor: default;" href="javascript:selectDateOnClick_'+resultInputId+'(true);">';var sCellClose='</a></td>';var currentFirstDay=this.nGetFirstDay(nMonth+1,nYear);var previousMonthDays=this.nGetMonthDays(nMonth==0?12:nMonth,nMonth==0?nYear-1:nYear);var currentMonthDays=this.nGetMonthDays(nMonth+1,nYear);var sContent='';var nCurrent=1;document.getElementById("calendarTitle_"+resultInputId).innerHTML=sMonths[nMonth]+' '+nYear;sContent+='<table><tr>';for(var i=0;i<=6;i++)
sContent+='<th>'+sDaysShort[i]+'</th>';sContent+='</tr>';sContent+='<tr>';for(var i=currentFirstDay;i>1;i--){var previousMonth=nMonth-1;var previousMonthYear=nYear;if(previousMonth==-1){previousMonth=11;previousMonthYear--;}
if(isDaySelected(new Date(previousMonthYear,previousMonth,(previousMonthDays-i+2)))){sContent+=sCellSelected+(previousMonthDays-i+2)+sCellClose;;}else{sContent+=sEmptyCell1+previousMonthYear+','+previousMonth+','+(previousMonthDays-i+2)+sEmptyCell2+(previousMonthDays-i+2)+sEmptyCellClose;}}
for(nCurrent=1;currentFirstDay+nCurrent<=8;nCurrent++){sContent+=(isDaySelected(new Date(nYear,nMonth,nCurrent))==true?sCellSelected:(sCellOpen1+nYear+','+nMonth+','+nCurrent+sCellOpen2))
+nCurrent+sCellClose;}
sContent+='</tr>';var k__=1;while(nCurrent<=currentMonthDays){sContent+='<tr>';for(var nWeekDay=1;nWeekDay<=7;nWeekDay++){if(nCurrent<=currentMonthDays){sContent+=(isDaySelected(new Date(nYear,nMonth,nCurrent))==true?sCellSelected:(sCellOpen1+nYear+','+nMonth+','+nCurrent+sCellOpen2))
+nCurrent+sCellClose;}else{var nextMonth=nMonth+1;var nextMonthYear=nYear;if(nextMonth==12){nextMonth=0;nextMonthYear++;}
if(isDaySelected(new Date(nextMonthYear,nextMonth,k__))){sContent+=sCellSelected+k__+sCellClose;;}else{sContent+=sEmptyCell1+nextMonthYear+','+nextMonth+','+k__+sEmptyCell2+k__+sEmptyCellClose;}
k__++;}
nCurrent++;}
sContent+='</tr>';}
sContent+='</table>';document.getElementById("calendarLayout_"+resultInputId).innerHTML=sContent;};var isDaySelected=function(date_){for(var i=0;i<dates.length;i++){if(dates[i].getDate()==date_.getDate()&&dates[i].getMonth()==date_.getMonth()&&dates[i].getFullYear()==date_.getFullYear())
{return true;}}
return false;}
this.calSetDay=function(nDay){this.calSetDateFields(nDay);this.createCalendar();};this.calBack=function(){var nMonth=this.getCurrentMonth().getMonth()+1;var nYear=this.getCurrentMonth().getFullYear();nMonth--;if(nMonth==0){nMonth=12;nYear--;}
this.calSetDateFields(null,nMonth-1,nYear);this.createCalendar();};this.calForward=function(){var nMonth=this.getCurrentMonth().getMonth()+1;var nYear=this.getCurrentMonth().getFullYear();nMonth++;if(nMonth==13){nMonth=1;nYear++;}
this.calSetDateFields(null,nMonth-1,nYear);this.createCalendar();};this.calSetDateFields=function(nDay,nMonth,nYear){if(nDay==null)nDay=this.getCurrentMonth().getDate();if(nMonth==null)nMonth=this.getCurrentMonth().getMonth();if(nYear==null)nYear=this.getCurrentMonth().getFullYear();nDay=this.nCorrectLastDay(nDay,nMonth,nYear);this.getCurrentMonth().setDate(1);this.getCurrentMonth().setFullYear(nYear);this.getCurrentMonth().setMonth(nMonth);if(daysPerMonth[nMonth+1]<nDay){nDay=daysPerMonth[nMonth+1];}
this.getCurrentMonth().setDate(nDay);};this.calOpen=function(obj,sFieldId,event,useDateFromElement){if(!((typeof checkCalendarOpening)=="undefined")&&!locationDropdown)return;if(!((typeof checkCalendarOpening)=="undefined")&&$('popup').style.display=='block')return;var sDate="";this.setCurrentMonth(null);if(sFieldId!=null&&sFieldId!=""){sDate=normalizeDateFormat(document.getElementById(sFieldId).value);var d;if(this.calDateValidation(sDate)){d=new Date(sDate.split(calendarDateSeparator)[2],sDate.split(calendarDateSeparator)[1]-1,sDate.split(calendarDateSeparator)[0]);}else{if(useDateFromElement!=null&&document.getElementById(useDateFromElement)!=null&&this.calDateValidation(document.getElementById(useDateFromElement).value))
{sDate=document.getElementById(useDateFromElement).value;d=new Date(sDate.split(calendarDateSeparator)[2],sDate.split(calendarDateSeparator)[1]-1,sDate.split(calendarDateSeparator)[0]);}else{d=new Date();}}
this.setDate(d);}else{this.createCalendar();}
var position=findPos(obj);document.getElementById('calendar_'+resultInputId).style.top=position[1]+endPx();document.getElementById('calendar_'+resultInputId).style.left=position[0]+endPx();if(multipleSelection==true){document.getElementById('calendar_'+resultInputId).style.display="block";}else{if(dontCloseIt){document.getElementById('calendar_'+resultInputId).style.display="block";}else{dropdown(event,'calendar_'+resultInputId,'closeCalendar',function(){hideModal('calendar_overlay');});}}};function findPos(obj){var curleft=curtop=0;if(obj!=null){var originalObj=obj;if(obj.offsetParent){curleft=obj.offsetLeft;curtop=obj.offsetTop;while(obj=obj.offsetParent){curleft+=obj.offsetLeft;curtop+=obj.offsetTop;}}
if(originalObj.id==$('offerListFragment').id){var pageSize=_getPageSize();curleft=(pageSize.windowWidth-207)/2;}}else{var pageSize=_getPageSize();curleft=(pageSize.windowWidth-207)/2;var pos=_realOffset(document.body);var height=200;curtop=pageSize.windowHeight/2-height/2+pos[1];if(curtop<0){curtop=0;}}
return[curleft,curtop];};this.getValue=function(){if(dates!=null&&dates[0]!=null){return dates[0].getDate()+dateFormatSeparator+(dates[0].getMonth()+1)+dateFormatSeparator+dates[0].getFullYear();}else{return null;}}
this.calClose=function(doNotSetValue){var temp=document.getElementById(resultInputId);if(temp!=null&&doNotSetValue!=true){temp.value=this.getValue();}
document.getElementById('calendar_'+resultInputId).style.display="none";hideModal('calendar_overlay');};this.setDates=function(dates_){dates=dates_;this.createCalendar();}
this.setDate=function(date_){dates=new Array();dates[0]=date_;this.createCalendar();}
this.getDates=function(){return dates;};this.getCurrentMonth=function(){return currentMonth;}
this.setCurrentMonth=function(currentMonth_){currentMonth=currentMonth_;}
this.changeYear=function(year_){this.getCurrentMonth().setFullYear(year_);$('currentCalendarViewYear').value=year_;dropdown('event','periodYearSelect');this.createCalendar();}
this.selectDateAndUpdateCalendarView=function(year_,month_,day_){selectDate(year_,month_,day_);this.createCalendar();}
this.clearDate=function(){dates=new Array();this.createCalendar();}
var selectDate=function(year_,month_,day_){if(multipleSelection==true){dates[dates.length]=new Date(year_,month_,day_);}else{dates[0]=new Date(year_,month_,day_);}}
this.removeDateAndUpdateCalendarView=function(year_,month_,day_){removeDate(year_,month_,day_);this.createCalendar();}
var removeDate=function(year_,month_,day_){var theDate=new Date(year_,month_,day_);for(var i=0;i<dates.length;i++){if(dates[i].getDate()==theDate.getDate()&&dates[i].getMonth()==theDate.getMonth()&&dates[i].getFullYear()==theDate.getFullYear())
{for(var j=i;j<dates.length-1;j++){dates[j]=dates[j+1];}
dates[dates.length-1]=null;dates.length=dates.length-1;break;}}}};var disabledLinkColor='rgb(255, 185, 162)';var enabledLinkColor='rgb(0, 0, 0)';var enabledLinkColorWhite='rgb(255, 255, 255)';var enabledButtonLinkColor='rgb(255, 255, 255)';var disabledLinkColorIE='rgb(255,185,162)';var enabledLinkColorIE='rgb(0,0,0)';var enabledLinkColorIEWhite='rgb(255, 255, 255)';var enabledButtonLinkColorIE='rgb(255, 255, 255)';var whereInputFromHeader='whereInputFromHeader';var autocompleteZipAndCityEnter=false;var locationDropdown=null;var wherePopList='wherePopList2';var whereSearchTimer;var whereInput='whereInputFromHeader';var FORCE_TOP=100;var MIN_POPUP_TOP=50;var DEFAULT_POPUP_OFFSET=-200;var MIN_ACTION_BAR_TOP=600;var loadCompleted=false;var init_getPromoOffers;var init_whatQuery;var init_reducedPageSpecific=false;function resultPageInit(getPromoOffers,whatQuery){init_getPromoOffers=getPromoOffers;init_whatQuery=whatQuery;resultPageInitSteps(1);}
function resultReducedPageInit(getPromoOffers,whatQuery,reducedPageSpecific){init_getPromoOffers=getPromoOffers;init_whatQuery=whatQuery;if(reducedPageSpecific!=null&&reducedPageSpecific){init_reducedPageSpecific=true;}
resultPageInitSteps(3);}
function resultGoogleModePageInit(getPromoOffers,whatQuery){init_whatQuery=whatQuery;$('whatInputFromHeader').disabled=false;loadCompleted=true;}
function resultPageInitSteps(stepIndex){switch(stepIndex){case 1:showSelected();case 2:refinePortalSearch(2);break;case 3:JResultsPageBean.getOfferSortOptions($('offerResults:subsessionId').value,fillOfferSortingOptionComponent);case 4:whereWhenWhatModification.UI.initLocationField();if($(whereInputFromHeader)!=null){$(whereInputFromHeader).value=document.getElementById('locationFullText').value;}
inputDefaultValueOnBlur('whereInputFromHeader');case 5:whereWhenWhatModification.UI.initWhatDialog(init_whatQuery,init_reducedPageSpecific)
case 6:if(init_getPromoOffers==true){fillPromoOffers();}
case 8:loadCompleted=true;}}
function fillPromoOffers(){JResultsPageBean.getPromoOffersForAjaxRequest($('offerResults:subsessionId').value,function(content){if(document.getElementById('doNotMiss')!=null){document.getElementById('doNotMiss').innerHTML=content+'\n';}});}
function contentHeightIe7Hack(){var ieVersion=0;if(navigator.appName.indexOf('Internet Explorer')!=-1){ieVersion=parseFloat(navigator.appVersion.split('MSIE')[1]);}
if(ieVersion==7){setTimeout("fillPromoOffers()",500);}}
function initFloatingLayers(){var fl=new FloatLayer('actionBar',0,-34,3,'gridTopContentLayer');fl.detach();}
function initFloatingLayersReduced(){var fl=new FloatLayer('actionBar',0,-34,3,'resultsReducedPage','actionBarYCoordinateAlignField',100);fl.detach();}
function initFloatingLayersHomepage(){var fl=new FloatLayer('actionBar',0,-34,3,'offerListFragment');fl.detach();}
var disableHideModal=null;function setResultDWR_RPC_Hook(){DWREngine.setPreHook(function(){showModal('popup',null,false,true);if(init_reducedPageSpecific){var pageSize=_getPageSize();leftPosition=(pageSize.windowWidth-$('popup').clientWidth)/2;$('popup').style.left=leftPosition+"px";}
$('popup').focus();});DWREngine.setPostHook(function(){if(disableHideModal!=true){hideModal('popup',null,false,true);}});}
function clearResultDWR_RPC_Hook(){DWREngine.setPreHook(function(){});DWREngine.setPostHook(function(){});}
function pointsSelected(){additionalSearchCriteria.UI.hideAdditionalSearchCriteriaDialog();showModal('popup',null,false,true);if(init_reducedPageSpecific){var pageSize=_getPageSize();leftPosition=(pageSize.windowWidth-$('popup').clientWidth)/2;$('popup').style.left=leftPosition+"px";}
toggleRcst();var firstIdFlag=true;var mustToHave=document.getElementById("offerResults:mustToHave");mustToHave.value="";for(var i=0;i<mustSelected.length;i++){if(firstIdFlag==true){firstIdFlag=false;}else{mustToHave.value+=",";}
mustToHave.value+=mustSelected[i].objectId;}
var niceToHave=document.getElementById("offerResults:niceToHave");niceToHave.value="";firstIdFlag=true;for(var i=0;i<nthSelected.length;i++){if(firstIdFlag==true){firstIdFlag=false;}else{niceToHave.value+=",";}
niceToHave.value+=nthSelected[i].objectId;}
var el=document.getElementById("offerResults:refineSearch");el.onclick();}
var rcstComponent;var rcstObserver=new ObserverForMustAndNiceToHave();var mustSelected=new Array();var nthSelected=new Array();function rcstCallback_OLD(rootElement){if(rootElement!=null&&rootElement.children.length>0){$('showAdditionalSearchCriteriaDialog').style.color=enabledLinkColor;$('showAdditionalSearchCriteriaDialog').style.textDecoration='underline';$('showAdditionalSearchCriteriaDialog').style.cursor='pointer';rcstComponent=new DropdownComponent(rootElement,true,'rcstComponent','en',false,false);rcstComponent.addObserver(rcstObserver);rcstComponent.performAction=pointsSelected;var rcstHTMLString=rcstComponent.generateDropdown();var rcstHolder=document.getElementById('rcstHolder');rcstHolder.innerHTML=rcstHTMLString;rcstComponent.defaultCaseOpenFirstLevel();additionalSearchCriteria=new AdditionalSearchCriteriaClass($('offerResults:mustToHave'),$('offerResults:niceToHave'),rcstComponent,showSelected);$('showAdditionalSearchCriteriaDialog').onclick=additionalSearchCriteria.UI.showAdditionalSearchCriteriaDialog;if(document.getElementById('whatSelected')!=null){document.getElementById('whatSelected').innerHTML='';}
var attachedTags;var mustToHave=document.getElementById('offerResults:mustToHave');if(mustToHave!=null&&mustToHave.value!=''){attachedTags=mustToHave.value.split(',');rcstComponent.selectMustElements(attachedTags);}
var niceToHave=document.getElementById('offerResults:niceToHave');if(niceToHave!=null&&niceToHave.value!=''){attachedTags=niceToHave.value.split(',');rcstComponent.selectNthElements(attachedTags);}
showSelected();}else{$('showAdditionalSearchCriteriaDialog').style.display='none';var NoAdditionalSearchCriteriaTitle=$('NoAdditionalSearchCriteriaTitle');NoAdditionalSearchCriteriaTitle.innerHTML=i18n['resultsPage.additionalSearchCriteria.link.title'];showSelected();}
$('whatInputFromHeader').disabled=false;JResultsPageBean.getOfferSortOptions($('offerResults:subsessionId').value,fillOfferSortingOptionComponent);}
function fillOfferSortingOptionComponent(offerSortOptions){var offerResults_offerSortCriteria=$('offerResults:offerSortCriteria');offerResults_offerSortCriteria.value=offerSortOptions[resultsPageBean_offerSortCriteria];if($('offerSortCriteriaCombo')!=null){$('offerSortCriteriaCombo').innerHTML=offerSortOptions[resultsPageBean_offerSortCriteria];}
var offerSortOptionsDivTag=$('offerSortOptions');var newAElement;var i=0;for(var key in offerSortOptions){newAElement=document.createElement('a');newAElement.innerHTML=offerSortOptions[key];newAElement.href='javascript:changeOfferSortCriteria();';newAElement.onclick=setFunctoinCloseOrderOfferBy(key,offerSortOptions[key]);offerSortOptionsDivTag.appendChild(newAElement);i++;}
var oscDropdownClick=$('oscDropdownClick');if(oscDropdownClick!=null){if(oscDropdownClick.src!=null){oscDropdownClick.src=(typeof(requestContextPath_)!="undefined"?requestContextPath_+'/':'')
+(reducedView_?'images/buttonDropdown2.gif':'images/buttonDropdown.gif');}
oscDropdownClick.style.cursor='pointer';oscDropdownClick.onclick=toggleOsc;}}
function setFunctoinCloseOrderOfferBy(key_,offerSortOption_){return function(){closeOrderOfferBy('events','offerResults','offerSortCriteria',key_,offerSortOption_);};}
function selectPreviouslyChosenElements(component_){var mustToHave=document.getElementById("offerResults:mustToHave");if(mustToHave!=null&&mustToHave.value!=""){component_.selectTags(mustToHave.value.split(","));}
var niceToHave=document.getElementById("offerResults:niceToHave");if(niceToHave!=null&&niceToHave.value!=""){component_.selectTags(niceToHave.value.split(","));}}
function toggleRcst(){this.functionOnClose=function(){;};this.functionOnOpen=function(){;};dropdown('events','rcstHolder',null,this.functionOnClose,this.functionOnOpen);}
function toggleOsc(){this.functionOnClose=function(){;};this.functionOnOpen=function(){;};dropdown('events','offerSortCriteriaSelect',null,this.functionOnClose,this.functionOnOpen);}
function ObserverForMustAndNiceToHave(){this.update=function(observerContext){mustSelected=observerContext.mustSelected;nthSelected=observerContext.nthSelected;showSelected();return;};}
function checkActionsEnable(preventFloatingLayerImmediateShowing){var el__=document.getElementById("selectedElements");var actionDropdownComponentHolder=null;var actionDropdownComponentImage=null;if(el__!=null&&el__.value!=""){actionDropdownComponentHolder=document.getElementById('actionDropdownComponentHolder');removeClass(actionDropdownComponentHolder,'inactive2');actionDropdownComponentImage=document.getElementById('actionDropdownComponentImage');actionDropdownComponentImage.src=(typeof(requestContextPath_)!="undefined"?requestContextPath_+'/':'')+'images/buttonDropdown.gif';if(!preventFloatingLayerImmediateShowing){showFloatingLayer();}}else{actionDropdownComponentHolder=document.getElementById('actionDropdownComponentHolder');addClass(actionDropdownComponentHolder,'inactive2');actionDropdownComponentImage=document.getElementById('actionDropdownComponentImage');actionDropdownComponentImage.src=(typeof(requestContextPath_)!="undefined"?requestContextPath_+'/':'')+'images/buttonDropdownDisabled2.gif';hideFloatingLayer();}}
var currentLanguage;function removeDuplicates(anArray){if(null==anArray){return null;}
if(anArray.length==0){return new Array();}
var resultString='';for(var i=0;i<anArray.length;i++){if(resultString.indexOf(anArray[i])<0){resultString+=anArray[i]+'#%$%#';}}
return resultString.substr(0,resultString.length-('#%$%#'.length)).split('#%$%#');}
function showSelected(){var whatSelected=document.getElementById("whatSelected");var selectedTagHtml=(whatQuery=='')?'':whatQuery+(elementNames!=null&&elementNames.length>0?'<br />':'');var selectedTagIds=document.getElementById("offerResults:selectedTagIdsFromWhat");if((selectedTagIds!=null&&selectedTagIds.value!=""||selectedTagHtml=='')&&elementNames!=null&&elementNames.length>0){var names_='';for(var i=0;i<elementNames.length;i++){if(elementNames[i]!='null'){names_+=elementNames[i]+'#%$%#';}}
names_=removeDuplicates(names_.substr(0,names_.length-('#%$%#'.length)).split("#%$%#"));for(var i=0;i<names_.length;i++){selectedTagHtml+='<li>'+names_[i]+"</li>";}}
var mustSelectedHtml="";if((mustSelected==null||mustSelected.length)==0&&$('offerResults:mustToHave').value.length>0&&elementNamesASC!=null&&elementNamesASC.length>0){var tags_=$('offerResults:mustToHave').value.split(",");for(var i=0;i<elementNamesASC.length;i++){if(elementNamesASC[i]!='null'){var tagId=elementNamesASCIds[i];for(var j=0;j<tags_.length;j++){if(tagId==tags_[j]){var tagName=elementNamesASC[i];mustSelectedHtml+='<li>'+tagName+'</li>';break;}}}}}else{for(var i=0;i<mustSelected.length;i++){var tagName=mustSelected[i].name;mustSelectedHtml+='<li>'+tagName+'</li>';}}
var nthSelectedHtml="";if((nthSelected==null||nthSelected.length)==0&&$('offerResults:niceToHave').value.length>0&&elementNamesASC!=null&&elementNamesASC.length>0){var tags_=$('offerResults:niceToHave').value.split(",");for(var i=0;i<elementNamesASC.length;i++){if(elementNamesASC[i]!='null'){var tagId=elementNamesASCIds[i];for(var j=0;j<tags_.length;j++){if(tagId==tags_[j]){var tagName=elementNamesASC[i];nthSelectedHtml+='<li class="bullet2">'+tagName+'</li>';break;}}}}}else{for(var i=0;i<nthSelected.length;i++){var tagName=nthSelected[i].name;nthSelectedHtml+='<li class="bullet2">'+tagName+'</li>';}}
if(whatSelected!=null){whatSelected.innerHTML=oldWhatSelectedInnerHTML+selectedTagHtml;}
var mustAndNiceToHaveHolder=$('mustAndNiceToHaveHolder');if(mustAndNiceToHaveHolder!=null){if(mustSelectedHtml+nthSelectedHtml!=''){mustAndNiceToHaveHolder.style.display='';}else{mustAndNiceToHaveHolder.style.display='none';}
mustAndNiceToHaveHolder.innerHTML=mustSelectedHtml+nthSelectedHtml;}
setInnerLeftHeight();}
var oldWhatSelectedInnerHTML="";function closeOfferAction(action,form,obj,title,extra){dropdown('events',obj+'Select'+(extra!=null?extra:''));get(obj+(extra!=null?extra:'')).value=title;var actionFlag=document.getElementById('actionFlag'+(extra!=null?extra:''));if(actionFlag!=null){actionFlag.value=action;}
if(typeof initialActionDropdownValue_!="undefined"){document.getElementById("actionDropdown").value=initialActionDropdownValue_;}}
var forceTop=null;var forceTopOffset=null;function executeAction(extra,forceTopFlag,customTopOffset){var actionOptionsDropdownField=document.getElementById("actionDropdown");if(forceTopFlag){forceTop=getYCoord1(actionOptionsDropdownField);if(customTopOffset!=null){forceTopOffset=customTopOffset;}else{forceTopOffset=DEFAULT_POPUP_OFFSET;}
if(forceTop<MIN_ACTION_BAR_TOP){forceTopOffset=22;}else if(forceTop+forceTopOffset<MIN_POPUP_TOP){forceTop=MIN_POPUP_TOP;forceTopOffset=0;}}
var actionFlag=document.getElementById('actionFlag'+(extra!=null?extra:''));if(actionFlag!=null){if('print'==actionFlag.value){window.location.href=getHref(document.getElementById("selectedElements"));}else if('print2'==actionFlag.value){window.location.href=getHref2(document.getElementById("selectedElements"));}else if('contact'==actionFlag.value){contactAndFeedback.UI.showContactDialog(document.getElementById("selectedElements").value,forceTop,forceTopOffset);}else if('sendToFriend'==actionFlag.value){contactAndFeedback.UI.showSendToFriendDialog(document.getElementById("selectedElements").value,forceTop,forceTopOffset);}}else{return;}}
function deselectAll(){var selectedElementsField=document.getElementById("selectedElements");if(selectedElementsField!=null){var selectedElements=selectedElementsField.value
if(selectedElements!=null){var ids=selectedElements.split(",");for(var i=0;i<ids.length;i++){selectElement(ids[i],null,true,'checked');var selectedOption=document.getElementsByName('selectAction_'+ids[i]);if(selectedOption!=null){var offers_=document.getElementsByName("offerRow_"+ids[i]);if(offers_!=null){for(var j=0;j<offers_.length;j++){flipCssClass(offers_[j],'checked');}}
for(var j=0;j<selectedOption.length;j++){selectedOption[j].style.display='';}
var deselectedOption=document.getElementsByName('deselectAction_'+ids[i]);for(var j=0;j<deselectedOption.length;j++){deselectedOption[j].style.display='none';}}}}}
hideFloatingLayer();}
function hideFloatingLayer(){var actionBarLayer=document.getElementById("actionBar");if(actionBarLayer!=null){document.getElementById("actionBar").style.display="none";}}
function showFloatingLayer(){document.getElementById("actionBar").style.display="block";}
function getHref(ids){var printableIds=getPrintableIds(ids);if(''!=printableIds){var url=(typeof(requestContextPath_)!="undefined"?requestContextPath_+'/':'')
+"offerReport/?lang=no&id="
+printableIds
+"&type=offer&lookForLang=true";if($('offerResults:subsessionId')!=null){url+="&subsessionId="+$('offerResults:subsessionId').value;}
return url;}
return"javascript:void(0);";}
function getHref2(ids){var printableIds=getPrintableIds(ids);if(''!=printableIds){var url=(typeof(requestContextPath_)!="undefined"?requestContextPath_+'/':'')
+"offerReport2/?lang=no&id="
+printableIds
+"&type=offer&lookForLang=true";if($('offerResults:subsessionId')!=null){url+="&subsessionId="+$('offerResults:subsessionId').value;}
return url;}
return"javascript:void(0);";}
function getPrintableIds(ids){var result='';if(null!=ids&&""!=ids.value){var arrayIds=ids.value.replace(/p/g,"").split(',');for(var i=0;i<arrayIds.length;i++){if('true'==document.getElementById('showDetailsLink_'+arrayIds[i]).value){result+=arrayIds[i]+',';}}
if(result.length>0){result=result.substring(0,result.length-1);}}
return result;}
function RepresentationViewClass(){var that=this;var extendedGroupName='extendedGroup';var collapsedGroupName='collapsedGroup';this.showExtendedView=function(){hideCollapsedGroup();showExtendedGroup();}
this.showCollapsedView=function(){hideExtendedGroup();showCollapsedGroup();}
function showExtendedGroup(){showGroupByNameAttribute(extendedGroupName);}
function hideExtendedGroup(){hideGroupByNameAttribute(extendedGroupName);}
function showCollapsedGroup(){showGroupByNameAttribute(collapsedGroupName);}
function hideCollapsedGroup(){hideGroupByNameAttribute(collapsedGroupName);}
function showGroupByNameAttribute(nameAttributeValue){var elements_=document.getElementsByName(nameAttributeValue);for(var el_ in elements_){el_.style.display='';}}
function hideGroupByNameAttribute(nameAttributeValue){var elements_=document.getElementsByName(nameAttributeValue);for(var el_ in elements_){el_.style.display='none';}}}
var representationView=RepresentationViewClass();function AdditionalSearchCriteriaClass(mustToHaveValueHolder,niceToHaveValueHolder,mustNiceToHaveComponentReference,reShowSelectedTags){var that=this;var UIClass=function(mustToHaveValueHolder,niceToHaveValueHolder,mustNiceToHaveComponentReference,reShowSelectedTags){var thatUI=this;this.additionalSearchCriteria=new Object();this.additionalSearchCriteria.popupAdditionalSearchCriteria='popupAdditionalSearchCriteria';this.additionalSearchCriteria.popupAdditionalSearchCriteriaTitleHolder='popupAdditionalSearchCriteriaTitleHolder';this.additionalSearchCriteria.limitDomElementId='leftContentId';this.mustToHaveValueHolder_=mustToHaveValueHolder;this.niceToHaveValueHolder_=niceToHaveValueHolder;var previousSelection=new Object();previousSelection.mustToHave=null;previousSelection.niceToHave=null;this.mustNiceToHaveComponentReference_=mustNiceToHaveComponentReference;var reShowSelectedTags_=reShowSelectedTags;this.showAdditionalSearchCriteriaDialog=function(){if(this.mustNiceToHaveComponentReference_==null){showHideModal('popup',true);JResultsPageBean.makeSecondaryRelevantCombinedTree($('offerResults:subsessionId').value,rcstCallback);}else{this.showGeneratedDialog();}}
this.showAdditionalSearchCriteriaDialogNew=function(){if(this.mustNiceToHaveComponentReference_==null){showHideModal('popup',true);var pageSize=_getPageSize();leftPosition=(pageSize.windowWidth-document.getElementById('popup').clientWidth)/2;document.getElementById('popup').style.left=leftPosition+"px";JResultsPageBean.makeSecondaryRelevantCombinedTree($('offerResults:subsessionId').value,rcstCallback);}else{this.showGeneratedDialog();}}
this.showGeneratedDialog=function(){recordPreviousSelection(thatUI.mustToHaveValueHolder_.value,thatUI.niceToHaveValueHolder_.value);additionalSearchCriteriaDialogAddShortCuts();showModal(thatUI.additionalSearchCriteria.popupAdditionalSearchCriteria,thatUI.additionalSearchCriteria.popupAdditionalSearchCriteria,true,true,thatUI.additionalSearchCriteria.limitDomElementId,(typeof(changeSearchPopupForceTopFlag)!="undefined"?FORCE_TOP:null),null);document.getElementById("popupAdditionalSearchCriteriapoverlay").style.background="#000";setOpacity(document.getElementById("popupAdditionalSearchCriteriapoverlay"),8);var pageSize=_getPageSize();leftPosition=(pageSize.windowWidth-document.getElementById('popupAdditionalSearchCriteria').clientWidth)/2;document.getElementById('popupAdditionalSearchCriteria').style.left=leftPosition+"px";rcstComponent.selectOtherElements=false;}
function rcstCallback(rootElement){if(rootElement!=null&&rootElement.children.length>0){rcstComponent=new DropdownComponent(rootElement,true,'rcstComponent','en',false,false);rcstComponent.addObserver(rcstObserver);rcstComponent.performAction=pointsSelected;var rcstHTMLString=rcstComponent.generateDropdown();var rcstHolder=document.getElementById('rcstHolder');rcstHolder.innerHTML=rcstHTMLString;rcstComponent.defaultCaseOpenFirstLevel();thatUI.mustNiceToHaveComponentReference_=rcstComponent;if(document.getElementById('whatSelected')!=null){document.getElementById('whatSelected').innerHTML='';}
var attachedTags;var mustToHave=document.getElementById('offerResults:mustToHave');if(mustToHave!=null&&mustToHave.value!=''){attachedTags=mustToHave.value.split(',');rcstComponent.selectMustElements(attachedTags);}
var niceToHave=document.getElementById('offerResults:niceToHave');if(niceToHave!=null&&niceToHave.value!=''){attachedTags=niceToHave.value.split(',');rcstComponent.selectNthElements(attachedTags);}
showSelected();showHideModal('popup',false);thatUI.showGeneratedDialog();showModal(thatUI.additionalSearchCriteria.popupAdditionalSearchCriteria,thatUI.additionalSearchCriteria.popupAdditionalSearchCriteria,true,true,thatUI.additionalSearchCriteria.limitDomElementId,(typeof(changeSearchPopupForceTopFlag)!="undefined"?FORCE_TOP:null),null);document.getElementById("popupAdditionalSearchCriteriapoverlay").style.background="#000";setOpacity(document.getElementById("popupAdditionalSearchCriteriapoverlay"),8);var pageSize=_getPageSize();leftPosition=(pageSize.windowWidth-document.getElementById('popupAdditionalSearchCriteria').clientWidth)/2;document.getElementById('popupAdditionalSearchCriteria').style.left=leftPosition+"px";}else{showSelected();showHideModal('popup',false);noAdditionalSearchCriteriaAlert();}
$('whatInputFromHeader').disabled=false;}
function additionalSearchCriteriaDialogAddShortCuts(){shortcut.add("enter",function(){var additionalSearchCriteriaDialogSelectionFinishedButton_=document.getElementById('additionalSearchCriteriaDialogSelectionFinishedButton');additionalSearchCriteriaDialogSelectionFinishedButton_.onclick();},{'type':'keypress','disable_in_input':true,'propagate':false,'target':document});shortcut.add("esc",function(){thatUI.cancelAdditionalSearchCriteriaDialog();},{'type':'keypress','disable_in_input':true,'propagate':false,'target':document});}
this.cancelAdditionalSearchCriteriaDialog=function(){this.hideAdditionalSearchCriteriaDialog();popPreviousSelection(thatUI.mustToHaveValueHolder_.value,thatUI.niceToHaveValueHolder_.value);}
this.resetAdditionalSearchCriteriaDialog=function(){clearAllSelectedElements(thatUI.mustToHaveValueHolder_.value,thatUI.niceToHaveValueHolder_.value);}
this.hideAdditionalSearchCriteriaDialog=function(){hideModal(thatUI.additionalSearchCriteria.popupAdditionalSearchCriteria);}
function recordPreviousSelection(mustToHave_,niceToHave_){previousSelection.mustToHave=mustToHave_;previousSelection.niceToHave=niceToHave_;}
function popPreviousSelection(mustToHave_,niceToHave_){mustToHave_=previousSelection.mustToHave;niceToHave_=previousSelection.niceToHave;thatUI.mustNiceToHaveComponentReference_.setNotifyObserversFlag(false);thatUI.mustNiceToHaveComponentReference_.deselectAll();var attachedTags;attachedTags=previousSelection.mustToHave.split(",");if(attachedTags==""){attachedTags=[];}
thatUI.mustNiceToHaveComponentReference_.selectMustElements(attachedTags);attachedTags=previousSelection.niceToHave.split(",");if(attachedTags==""){attachedTags=[];}
thatUI.mustNiceToHaveComponentReference_.selectNthElements(attachedTags);thatUI.mustNiceToHaveComponentReference_.setNotifyObserversFlag(true);reShowSelectedTags_();}
function clearAllSelectedElements(mustToHave_,niceToHave_){mustToHave_='';niceToHave_='';thatUI.mustNiceToHaveComponentReference_.setNotifyObserversFlag(false);thatUI.mustNiceToHaveComponentReference_.deselectAll();thatUI.mustNiceToHaveComponentReference_.setNotifyObserversFlag(true);reShowSelectedTags_();}}
this.UI=new UIClass(mustToHaveValueHolder,niceToHaveValueHolder,mustNiceToHaveComponentReference,reShowSelectedTags);}
var additionalSearchCriteria=null;function ContactAndFeedbackClass(){var that=this;this.offerId;this.bpId;var UIClass=function(){var thatUI=this;this.contactDialog=new Object();this.contactDialog.popupContact='popupContact';this.contactDialog.popupContactTitleHolder='popupContactTitleHolder';this.contactDialog.checkBoxSelectedCssClass='checkboxTrue';this.contactDialog.lastName='contactDialog.lastName';this.contactDialog.firstName='contactDialog.firstName';this.contactDialog.address='contactDialog.address';this.contactDialog.zip='contactDialog.zip';this.contactDialog.city='contactDialog.city';this.contactDialog.telephone='contactDialog.telephone';this.contactDialog.email='contactDialog.email';this.contactDialog.concerns='contactDialog.concerns';this.contactDialog.copyOfEmailToMe='contactDialog.copyOfEmailToMe';this.contactDialog.contactDialogSendButton='contactDialogSendButton';this.feedbackDialog=new Object();this.feedbackDialog.popupFeedback='popupFeedback';this.feedbackDialog.popupFeedbackTitleHolder='popupFeedbackTitleHolder';this.feedbackDialog.checkBoxSelectedCssClass='checkboxTrue';this.feedbackDialog.generalFeedback='feedbackDialog.generalFeedback';this.feedbackDialog.offerNotValid='feedbackDialog.offerNotValid';this.feedbackDialog.offerIncomplete='feedbackDialog.offerIncomplete';this.feedbackDialog.lastName='feedbackDialog.lastName';this.feedbackDialog.firstName='feedbackDialog.firstName';this.feedbackDialog.email='feedbackDialog.email';this.feedbackDialog.concerns='feedbackDialog.concerns';this.feedbackDialog.copyOfEmailToMe='feedbackDialog.copyOfEmailToMe';this.feedbackDialog.feedbackDialogSendButton='feedbackDialogSendButton';this.notificationDialog=new Object();this.notificationDialog.popupNotificationkHolder_='popupNotificationHolder_';this.notificationDialog.popupNotification='popupNotification';this.notificationDialog.popupNotificationTitleHolder='popupNotificationTitleHolder';this.notificationDialog.successfullResultInformation='notificationDialog.successfullResultInformation';this.notificationDialog.unsuccessfullResultInformation='notificationDialog.unsuccessfullResultInformation';this.notificationDialog.checkBoxSelectedCssClass='checkboxTrue';this.sendToFriendDialog=new Object()
this.sendToFriendDialog.popupSendToFriend='popupSendToFriend';this.sendToFriendDialog.popupSendToFriendTitleHolder='popupSendToFriendTitleHolder';this.sendToFriendDialog.checkBoxSelectedCssClass='checkboxTrue';this.sendToFriendDialog.sender='sendToFriendDialog.sender';this.sendToFriendDialog.recipient='sendToFriendDialog.recipient';this.sendToFriendDialog.message='sendToFriendDialog.message';this.sendToFriendDialog.copyOfEmailToMe='sendToFriendDialog.copyOfEmailToMe';this.sendToFriendDialog.sendButton='sendToFriendDialog.sendButton';this.showContactDialog=function(offerId,forceTop,forceTopOffset){clearContactDialog();var contactDialogSendButton=$(this.contactDialog.contactDialogSendButton);contactDialogSendButton.onclick=function(){thatUI.sendContact(offerId);}
contactDialogAddShortCuts(offerId);showModal(this.contactDialog.popupContact,this.contactDialog.popupContactTitleHolder,true,true,null,forceTop,forceTopOffset);document.getElementById("popupContactpoverlay").style.background="#000";setOpacity(document.getElementById("popupContactpoverlay"),8);if(init_reducedPageSpecific){var pageSize=_getPageSize();leftPosition=(pageSize.windowWidth-$(this.contactDialog.popupContact).clientWidth)/2;$(this.contactDialog.popupContact).style.left=leftPosition+"px";}}
function contactDialogAddShortCuts(offerId){shortcut.add("enter",function(){thatUI.sendContact(offerId);},{'type':'keypress','disable_in_input':true,'propagate':false,'target':document});shortcut.add("esc",function(){thatUI.hideContactDialog();},{'type':'keypress','disable_in_input':true,'propagate':false,'target':document});}
function clearContactDialog(){var contactDialog_lastName=$(thatUI.contactDialog.lastName);contactDialog_lastName.value='';var contactDialog_firstName=$(thatUI.contactDialog.firstName);contactDialog_firstName.value='';var contactDialog_address=$(thatUI.contactDialog.address);contactDialog_address.value='';var contactDialog_zip=$(thatUI.contactDialog.zip);contactDialog_zip.value='';var contactDialog_city=$(thatUI.contactDialog.city);contactDialog_city.value='';var contactDialog_telephone=$(thatUI.contactDialog.telephone);contactDialog_telephone.value='';var contactDialog_email=$(thatUI.contactDialog.email);contactDialog_email.value='';var contactDialog_concerns=$(thatUI.contactDialog.concerns);contactDialog_concerns.value='';var contactDialog_copyOfEmailToMe=$(thatUI.contactDialog.copyOfEmailToMe);removeCssClass(contactDialog_copyOfEmailToMe,thatUI.contactDialog.checkBoxSelectedCssClass);}
this.hideContactDialog=function(){contactDialogRemoveShortCuts();hideModal(this.contactDialog.popupContact);}
function contactDialogRemoveShortCuts(){shortcut.remove("enter");shortcut.remove("esc");}
this.showFeedbackDialog=function(offerId,forceTop,forceTopOffset){clearFeedbackDialog();var feedbackDialogSendButton=$(this.feedbackDialog.feedbackDialogSendButton);feedbackDialogSendButton.onclick=function(){thatUI.sendFeedback(offerId);}
feedbackDialogAddShortCuts(offerId);showModal(this.feedbackDialog.popupFeedback,this.feedbackDialog.popupFeedbackTitleHolder,true,true,null,forceTop,forceTopOffset);document.getElementById("popupFeedbackpoverlay").style.background="#000";setOpacity(document.getElementById("popupFeedbackpoverlay"),8);if(init_reducedPageSpecific){var pageSize=_getPageSize();leftPosition=(pageSize.windowWidth-$(this.feedbackDialog.popupFeedback).clientWidth)/2;$(this.feedbackDialog.popupFeedback).style.left=leftPosition+"px";}}
function feedbackDialogAddShortCuts(offerId){shortcut.add("enter",function(){thatUI.sendFeedback(offerId);},{'type':'keypress','disable_in_input':true,'propagate':false,'target':document});shortcut.add("esc",function(){thatUI.hideFeedbackDialog();},{'type':'keypress','disable_in_input':true,'propagate':false,'target':document});}
function clearFeedbackDialog(){var feedbackDialog_generalFeedback=$(thatUI.feedbackDialog.generalFeedback);removeCssClass(feedbackDialog_generalFeedback,thatUI.feedbackDialog.checkBoxSelectedCssClass);var feedbackDialog_offerNotValid=$(thatUI.feedbackDialog.offerNotValid);removeCssClass(feedbackDialog_offerNotValid,thatUI.feedbackDialog.checkBoxSelectedCssClass);var feedbackDialog_offerIncomplete=$(thatUI.feedbackDialog.offerIncomplete);removeCssClass(feedbackDialog_offerIncomplete,thatUI.feedbackDialog.checkBoxSelectedCssClass);var feedbackDialog_lastName=$(thatUI.feedbackDialog.lastName);feedbackDialog_lastName.value='';var feedbackDialog_firstName=$(thatUI.feedbackDialog.firstName);feedbackDialog_firstName.value='';var feedbackDialog_email=$(thatUI.feedbackDialog.email);feedbackDialog_email.value='';var feedbackDialog_concerns=$(thatUI.feedbackDialog.concerns);feedbackDialog_concerns.value='';var feedbackDialog_copyOfEmailToMe=$(thatUI.feedbackDialog.copyOfEmailToMe);removeCssClass(feedbackDialog_copyOfEmailToMe,thatUI.feedbackDialog.checkBoxSelectedCssClass);}
this.hideFeedbackDialog=function(){feedbackDialogRemoveShortCuts();hideModal(this.feedbackDialog.popupFeedback);}
function feedbackDialogRemoveShortCuts(){shortcut.remove("enter");shortcut.remove("esc");}
function showNotificationDialog(successfullResult){var successfullResultInformation=$(thatUI.notificationDialog.successfullResultInformation);var unsuccessfullResultInformation=$(thatUI.notificationDialog.unsuccessfullResultInformation);if(successfullResult==true){successfullResultInformation.style.display='';unsuccessfullResultInformation.style.display='none';}else{successfullResultInformation.style.display='none';unsuccessfullResultInformation.style.display='';}
notificationDialogAddShortCuts();showModal(thatUI.notificationDialog.popupNotification,thatUI.notificationDialog.popupNotificationTitleHolder,true,true);if(init_reducedPageSpecific){var pageSize=_getPageSize();leftPosition=(pageSize.windowWidth-$(thatUI.notificationDialog.popupNotification).clientWidth)/2;$(thatUI.notificationDialog.popupNotification).style.left=leftPosition+"px";}}
function notificationDialogAddShortCuts(){shortcut.add("enter",function(){thatUI.hideNotificationDialog();},{'type':'keypress','disable_in_input':true,'propagate':false,'target':document});shortcut.add("esc",function(){thatUI.hideNotificationDialog();},{'type':'keypress','disable_in_input':true,'propagate':false,'target':document});}
this.hideNotificationDialog=function(){notificationDialogRemoveShortCuts();hideModal(this.notificationDialog.popupNotification);}
function notificationDialogRemoveShortCuts(){shortcut.remove("enter");shortcut.remove("esc");}
this.showSendToFriendDialog=function(offerId,forceTop,forceTopOffset){clearSendToFriendDialog();var sendToFriendSendButton=$(this.sendToFriendDialog.sendButton);sendToFriendSendButton.onclick=function(){thatUI.sendEmailToFriend(offerId);}
sendToFriendAddShortCuts(offerId);showModal(this.sendToFriendDialog.popupSendToFriend,this.sendToFriendDialog.popupSendToFriendTitleHolder,true,true,null,forceTop,forceTopOffset);document.getElementById("popupSendToFriendpoverlay").style.background="#000";setOpacity(document.getElementById("popupSendToFriendpoverlay"),8);if(init_reducedPageSpecific){var pageSize=_getPageSize();leftPosition=(pageSize.windowWidth-$(this.sendToFriendDialog.popupSendToFriend).clientWidth)/2;$(this.sendToFriendDialog.popupSendToFriend).style.left=leftPosition+"px";}}
function sendToFriendAddShortCuts(offerId){shortcut.add("enter",function(){thatUI.sendEmailToFriend(offerId);},{'type':'keypress','disable_in_input':true,'propagate':false,'target':document});shortcut.add("esc",function(){thatUI.hideSendToFriendDialog();},{'type':'keypress','disable_in_input':true,'propagate':false,'target':document});}
function clearSendToFriendDialog(){$(thatUI.sendToFriendDialog.sender).value='';if(sendToEmail_recipient_info!=null){$(thatUI.sendToFriendDialog.recipient).value=sendToEmail_recipient_info;$(thatUI.sendToFriendDialog.recipient).style.color='#666666';}else{$(thatUI.sendToFriendDialog.recipient).value='';$(thatUI.sendToFriendDialog.recipient).style.color='black';}
$(thatUI.sendToFriendDialog.message).value='';var sendToFriend_copyOfEmailToMe=$(thatUI.sendToFriendDialog.copyOfEmailToMe);removeCssClass(sendToFriend_copyOfEmailToMe,thatUI.sendToFriendDialog.checkBoxSelectedCssClass);}
this.clearDefaultInfo=function(){if(sendToEmail_recipient_info==$(thatUI.sendToFriendDialog.recipient).value){$(thatUI.sendToFriendDialog.recipient).value='';$(thatUI.sendToFriendDialog.recipient).style.color='black';}}
this.hideSendToFriendDialog=function(){sendToFriendDialogRemoveShortCuts();hideModal(this.sendToFriendDialog.popupSendToFriend);}
function sendToFriendDialogRemoveShortCuts(){shortcut.remove("enter");shortcut.remove("esc");}
this.sendContact=function(offerId){if(contactAndFeedback.VALIDATION.checkValidationForContact()==false){return;}
var contactDialog_lastName=$(thatUI.contactDialog.lastName);var contactDialog_firstName=$(thatUI.contactDialog.firstName);var contactDialog_address=$(thatUI.contactDialog.address);var contactDialog_zip=$(thatUI.contactDialog.zip);var contactDialog_city=$(thatUI.contactDialog.city);var contactDialog_telephone=$(thatUI.contactDialog.telephone);var contactDialog_email=$(thatUI.contactDialog.email);var contactDialog_concerns=$(thatUI.contactDialog.concerns);var contactDialog_copyOfEmailToMe=$(thatUI.contactDialog.copyOfEmailToMe);this.hideContactDialog();setResultDWR_RPC_Hook();RPC.sendContact(contactDialog_firstName.value,contactDialog_lastName.value,contactDialog_address.value,contactDialog_zip.value,contactDialog_city.value,contactDialog_telephone.value,contactDialog_email.value,contactDialog_concerns.value,isContainCssClass(contactDialog_copyOfEmailToMe,thatUI.contactDialog.checkBoxSelectedCssClass),offerId);}
this.sendContactCallback=function(resultIndicator){showNotificationDialog(resultIndicator>0);if($('merkListSpecificFlag')==null){deselectAll();}}
this.sendFeedback=function(offerId){if(contactAndFeedback.VALIDATION.checkValidationForFeedback()==false){return;}
var feedbackDialog_generalFeedback=$(thatUI.feedbackDialog.generalFeedback);var feedbackDialog_offerNotValid=$(thatUI.feedbackDialog.offerNotValid);var feedbackDialog_offerIncomplete=$(thatUI.feedbackDialog.offerIncomplete);var feedbackDialog_lastName=$(thatUI.feedbackDialog.lastName);var feedbackDialog_firstName=$(thatUI.feedbackDialog.firstName);var feedbackDialog_email=$(thatUI.feedbackDialog.email);var feedbackDialog_concerns=$(thatUI.feedbackDialog.concerns);var feedbackDialog_copyOfEmailToMe=$(thatUI.feedbackDialog.copyOfEmailToMe);this.hideFeedbackDialog();setResultDWR_RPC_Hook();RPC.sendFeedback(isContainCssClass(feedbackDialog_generalFeedback,thatUI.feedbackDialog.checkBoxSelectedCssClass),isContainCssClass(feedbackDialog_offerNotValid,thatUI.feedbackDialog.checkBoxSelectedCssClass),isContainCssClass(feedbackDialog_offerIncomplete,thatUI.feedbackDialog.checkBoxSelectedCssClass),feedbackDialog_lastName.value,feedbackDialog_firstName.value,feedbackDialog_email.value,feedbackDialog_concerns.value,isContainCssClass(feedbackDialog_copyOfEmailToMe,thatUI.feedbackDialog.checkBoxSelectedCssClass),offerId);}
this.sendFeedbackCallback=function(resultIndicator){if(resultIndicator>0){showNotificationDialog(true);}else{showNotificationDialog(false);}}
this.sendEmailToFriend=function(offerId){if(contactAndFeedback.VALIDATION.checkValidationForSendToFriend()==false){return;}
var sendToFriend_sender=$(thatUI.sendToFriendDialog.sender);var sendToFriend_recipient=$(thatUI.sendToFriendDialog.recipient);var sendToFriend_message=$(thatUI.sendToFriendDialog.message);var sendToFriend_copyOfEmailToMe=$(thatUI.sendToFriendDialog.copyOfEmailToMe);this.hideSendToFriendDialog();setResultDWR_RPC_Hook();RPC.sendEmailToFriend(sendToFriend_sender.value,sendToFriend_recipient.value,sendToFriend_message.value,isContainCssClass(sendToFriend_copyOfEmailToMe,thatUI.sendToFriendDialog.checkBoxSelectedCssClass),offerId);}
this.sendEmailToFriendCallback=function(resultIndicator){if(resultIndicator>0){showNotificationDialog(true);}else{showNotificationDialog(false);}}}
var ValidationClass=function(){this.checkValidationForContact=function(){var contactDialog_email=$(that.UI.contactDialog.email);var contactDialog_concerns=$(that.UI.contactDialog.concerns);var contactDialog_copyOfEmailToMe=$(that.UI.contactDialog.copyOfEmailToMe);var contactDialogSendButton=$(that.UI.contactDialog.contactDialogSendButton);if(trimString(contactDialog_concerns.value)==''||(isContainCssClass(contactDialog_copyOfEmailToMe,that.UI.contactDialog.checkBoxSelectedCssClass)&&!emailRegex(contactDialog_email.value))||(contactDialog_email.value!=''&&!emailRegex(contactDialog_email.value))){if(isContainCssClass(contactDialogSendButton,'disabled')==false){addCssClass(contactDialogSendButton,'disabled');}
return false;}else{removeCssClass(contactDialogSendButton,'disabled');return true;}}
this.checkValidationForFeedback=function(){var feedbackDialog_email=$(that.UI.feedbackDialog.email);var feedbackDialog_concerns=$(that.UI.feedbackDialog.concerns);var feedbackDialog_copyOfEmailToMe=$(that.UI.feedbackDialog.copyOfEmailToMe);var feedbackDialogSendButton=$(that.UI.feedbackDialog.feedbackDialogSendButton);if(trimString(feedbackDialog_concerns.value)==''||(isContainCssClass(feedbackDialog_copyOfEmailToMe,that.UI.feedbackDialog.checkBoxSelectedCssClass)==true&&!emailRegex(feedbackDialog_email.value))||(feedbackDialog_email.value!=''&&!emailRegex(feedbackDialog_email.value))){if(isContainCssClass(feedbackDialogSendButton,'disabled')==false){addCssClass(feedbackDialogSendButton,'disabled');}
return false;}else{removeCssClass(feedbackDialogSendButton,'disabled');return true;}}
this.checkValidationForSendToFriend=function(){var sendToFriend_sender=$(that.UI.sendToFriendDialog.sender);var sendToFriend_recipient=$(that.UI.sendToFriendDialog.recipient);var sendToFriend_message=$(that.UI.sendToFriendDialog.message);var sendToFriend_copyOfEmailToMe=$(that.UI.sendToFriendDialog.copyOfEmailToMe);var sendToFriendDialogSendButton=$(that.UI.sendToFriendDialog.sendButton);if(trimString(sendToFriend_sender.value)==''||trimString(sendToFriend_recipient.value)==''||!validateMultipleEmails(trimString(sendToFriend_sender.value))||!validateMultipleEmails(trimString(sendToFriend_recipient.value))){if(isContainCssClass(sendToFriendDialogSendButton,'disabled')==false){addCssClass(sendToFriendDialogSendButton,'disabled');}
return false;}else{removeCssClass(sendToFriendDialogSendButton,'disabled');return true;}}}
var RPCClass=function(){function replaceAllPs(offerIds){if(typeof(offerIds)!='string'){offerIds+='';}
return offerIds.replace(/\p/g,"")}
this.sendContact=function(name_,lastName_,address_,zip_,city_,telephone_,email_,concerns_,copyOfEmailToMe_,offerId_){var contact=new Object();contact.name=name_;contact.lastName=lastName_;contact.address=address_;contact.zip=zip_;contact.city=city_;contact.telephone=telephone_;contact.email=email_;contact.concerns=concerns_;contact.copyOfEmailToMe=copyOfEmailToMe_;var offerIds=replaceAllPs(offerId_);offerIds=removeOffersWithoutContacts(offerIds);if(offerIds.indexOf(',')==-1){contact.offerId=offerIds;}else{contact.offerId=offerIds.substring(0,offerIds.indexOf(','));}
var subsessionId=null;if($(document.forms[0].id+":subsessionId")!=null){subsessionId=$(document.forms[0].id+":subsessionId").value;}
contact.offerIds=offerIds;JResultsPageBean.sendContactMail(subsessionId,contact,sendContactCallback);}
function sendContactCallback(resultIndicator){that.UI.sendContactCallback(resultIndicator);}
this.sendFeedback=function(generalFeedback_,offerNotValid_,offerIncomplete_,name_,lastName_,email_,concerns_,copyOfEmailToMe_,offerId_){var feedback=new Object();feedback.generalFeedback=generalFeedback_;feedback.offerNotValid=offerNotValid_;feedback.offerIncomplete=offerIncomplete_;feedback.name=name_;feedback.lastName=lastName_;feedback.email=email_;feedback.concerns=concerns_;feedback.copyOfEmailToMe=copyOfEmailToMe_;feedback.offerId=offerId_;JResultsPageBean.sendFeedbackMail($(document.forms[0].id+':subsessionId').value,feedback,sendFeedbackCallback);}
function sendFeedbackCallback(resultIndicator){that.UI.sendFeedbackCallback(resultIndicator);}
this.sendEmailToFriend=function(sender,recipient,message,copyOfEmailToMe,offerIds){var sendToFriend=new Object();sendToFriend.sender=sender;sendToFriend.recipient=recipient;sendToFriend.copyOfEmailToMe=copyOfEmailToMe;sendToFriend.offerIds=offerIds;sendToFriend.message=message;JResultsPageBean.sendEmailToFriendMail(sendToFriend,sendEmailToFriendCallback);}
function sendEmailToFriendCallback(resultIndicator){that.UI.sendEmailToFriendCallback(resultIndicator);}}
this.UI=new UIClass();this.VALIDATION=new ValidationClass();var RPC=new RPCClass();}
var contactAndFeedback=new ContactAndFeedbackClass();PresentationView=new Object();PresentationView.EXTENDED='EXTENDED';PresentationView.COLLAPSED='COLLAPSED';PresentationViewCssStyle=new Object();PresentationViewCssStyle.iconViewThumbsTextActive='iconViewThumbsTextActive';PresentationViewCssStyle.iconViewThumbsTextInactive='iconViewThumbsTextInactive';PresentationViewCssStyle.iconTextThumbsTextActive='iconViewTextActive';PresentationViewCssStyle.iconTextThumbsTextInactive='iconViewTextInactive';function setPresentationView(presentationViewType,noIcons){var presentationViewType_=$('offerResults:presentationViewType');if(presentationViewType_.value==presentationViewType){return;}else{presentationViewType_.value=presentationViewType;}
var itemsWithThumbnails=$('itemsWithThumbnails');var itemsWithoutThumbnails=$('itemsWithoutThumbnails');var iconViewThumbs=$('iconViewThumbs');var iconViewText=$('iconViewText');if(presentationViewType==PresentationView.EXTENDED){if(!noIcons){addCssClass(iconViewThumbs,PresentationViewCssStyle.iconViewThumbsTextActive);removeCssClass(iconViewThumbs,PresentationViewCssStyle.iconViewThumbsTextInactive);addCssClass(iconViewText,PresentationViewCssStyle.iconTextThumbsTextInactive);removeCssClass(iconViewText,PresentationViewCssStyle.iconTextThumbsTextActive);}else{removeCssClass(iconViewText,'active');addCssClass(iconViewThumbs,'active');}
itemsWithThumbnails.style.display='';itemsWithoutThumbnails.style.display='none';}else{if(!noIcons){addCssClass(iconViewThumbs,PresentationViewCssStyle.iconViewThumbsTextInactive);removeCssClass(iconViewThumbs,PresentationViewCssStyle.iconViewThumbsTextActive);addCssClass(iconViewText,PresentationViewCssStyle.iconTextThumbsTextActive);removeCssClass(iconViewText,PresentationViewCssStyle.iconTextThumbsTextInactive);}else{removeCssClass(iconViewThumbs,'active');addCssClass(iconViewText,'active');}
itemsWithThumbnails.style.display='none';itemsWithoutThumbnails.style.display='';}}
function WhereWhenWhatCriteriaModificationClass(whereDialogDataStructure,whenDialogDataStructure,whatDialogDataStructure){var that=this;var UIClass=function(whereDialogDataStructure,whenDialogDataStructure,whatDialogDataStructure){var thatUI=this;this.whereDialog={popup:'popupWhere',popupTitleHolder:'popupWhereTitleHolder',popupAutocomplete:'popupWhereAutocomplete',popupLocationTree:'popupWhereLocationTree',popupLocationTreeHolder:'popupWhereLocationTreeHolder',selectedLocations:whereDialogDataStructure.initialData.selectedLocations,referentSelectedLocations:whereDialogDataStructure.initialData.selectedLocations,whereInput:'locationFullText',whereDialogResetSelectionButton:'whereDialogResetSelection'}
this.whereDialogLocationDropdown;this.expirySearchTimer;this.autocompleteZipAndCityEnter=false;this.whereAutoBlur=true;this.whenDialog={popup:'popupWhen',popupTitleHolder:'popupWhenTitleHolder',calendarDateFrom:'calendarDateFrom',calendarDateTo:'calendarDateTo',newDateOption:'',dateOption:whenDialogDataStructure.initialData.dateOption,from:whenDialogDataStructure.initialData.from,to:whenDialogDataStructure.initialData.to}
var dateOptions={"NA":"NA","ANY":"ANY","TODAY":"TODAY","TOMORROW":"TOMORROW","DAY_AFTER_TOMORROW":"DAY_AFTER_TOMORROW","THIS_WEEKEND":"THIS_WEEKEND","NEXT_10_DAYS":"NEXT_10_DAYS","NEXT_30_DAYS":"NEXT_30_DAYS"};this.whatDialog={popup:'popupWhat',popupTitleHolder:'popupWhatTitleHolder',popupAutocomplete:'popupWhatAutocompleteAndNodes',popupCombinedTree:'popupWhatCombinedTree',selectedTopLevelNodeIds:whatDialogDataStructure.initialData.selectedTopLevelNodeIds,selectedTags:whatDialogDataStructure.initialData.selectedTags,queryString:whatDialogDataStructure.initialData.queryString,initialSelectedTags:whatDialogDataStructure.initialData.selectedTags,initialQueryString:whatDialogDataStructure.initialData.queryString,referentTags:whatDialogDataStructure.initialData.selectedTags,referentqueryString:whatDialogDataStructure.initialData.queryString,initialCombinedTree:null,initialEnabledWhatNodesList:whatDialogDataStructure.initialData.enabledWhatNodesList,initialEnabledWhatNodesListWithQuery:whatDialogDataStructure.initialData.enabledWhatNodesListWithQuery,whatDialogResetSelectionButton:'whatDialogResetSelection'}
this.initLocationField=function(){if(this.whereDialogLocationDropdown==null){fillLocationTree();selectWhereTagsInDropdown();}
setLocationText();locationDropdown=this.whereDialogLocationDropdown;}
this.whatPopupDisplayedFlag=false;this.wherePopupDisplayedFlag=false;this.whenPopupDisplayedFlag=false;this.baseDateOption;this.baseDateFrom;this.baseDateTo;this.baseLocationTagsAndNodes;this.baseAllTopLevelLocationIds
this.whatTreeRecalculated=false;this.displayWhatPart=function(fromPopup){if($('showWhatDialogLinkReduced').style.color==disabledLinkColor||$('showWhatDialogLinkReduced').style.color==disabledLinkColorIE){return;}
if(fromPopup=='where'){this.updateWhereLabelCall();}
if(fromPopup=='when'){this.updateWhenLabelCall();}
this.showWhatDialogNew($('showWhatDialogLinkReduced'));if((fromPopup=='where'||fromPopup=='when')&&this.wherWhenDataChanged()){this.recalculateWhatDialog();}
$(this.whereDialog.popup).style.display='none';$(this.whenDialog.popup).style.display='none';setOpacity(document.getElementById("popupWherepoverlay"),0);setOpacity(document.getElementById("popupWhenpoverlay"),0);}
this.displayWherePart=function(fromPopup){if(fromPopup=='what'){this.updateWhatLabelCall();}
if(fromPopup=='when'){this.updateWhenLabelCall();}
this.showWhereDialogNew();$(this.whenDialog.popup).style.display='none';$(this.whatDialog.popup).style.display='none';setOpacity(document.getElementById("popupWhenpoverlay"),0);setOpacity(document.getElementById("popupWhatpoverlay"),0);if($('showWhatDialogLinkReduced').style.color==disabledLinkColor||$('showWhatDialogLinkReduced').style.color==disabledLinkColorIE){}else{}}
this.displayWhenPart=function(fromPopup){if(fromPopup=='what'){this.updateWhatLabelCall();}
if(fromPopup=='where'){this.updateWhereLabelCall();}
this.showWhenDialogNew();$(this.whereDialog.popup).style.display='none';$(this.whatDialog.popup).style.display='none';setOpacity(document.getElementById("popupWherepoverlay"),0);setOpacity(document.getElementById("popupWhatpoverlay"),0);if($('showWhatDialogLinkReduced').style.color==disabledLinkColor||$('showWhatDialogLinkReduced').style.color==disabledLinkColorIE){}else{}}
this.cancelWhereWhenWhatPopup=function(){$(this.whereDialog.popup).style.display='none';$(this.whenDialog.popup).style.display='none';$(this.whatDialog.popup).style.display='none';this.initWhatComponent();hideModal(this.whatDialog.popup);this.restoreWhereTree();hideModal(this.whereDialog.popup);this.initWhenComponent();hideModal(this.whenDialog.popup);if(this.whatPopupDisplayedFlag){this.whatPopupDisplayedFlag=false;this.updateWhatLabelCall();}
if(this.wherePopupDisplayedFlag){this.wherePopupDisplayedFlag=false;this.updateWhereLabelCall();}
if(this.whenPopupDisplayedFlag){this.whenPopupDisplayedFlag=false;this.updateWhenLabelCall();}
if(this.whatTreeRecalculated){this.whatTreeRecalculated=false;this.restoreWhatTree();}}
this.closePopups=function(){$(this.whereDialog.popup).style.display='none';$(this.whenDialog.popup).style.display='none';$(this.whatDialog.popup).style.display='none';hideModal(this.whatDialog.popup);hideModal(this.whereDialog.popup);hideModal(this.whenDialog.popup);}
this.initWhatComponent=function(){if(this.combinedTreeDropdown!=null){this.combinedTreeDropdown.deselectAllTagsAndNodes();this.combinedTreeDropdown.selectTags(this.whatDialog.selectedTags);}
if(this.whatDialog.queryString!=null&&this.whatDialog.queryString!=""){$('whatInput').value=this.whatDialog.queryString;}else{$('whatInput').value=inputDefaultValues['whatInput'];}
if((this.whatDialog.queryString==null||this.whatDialog.queryString=="")||this.whatDialog.queryString==inputDefaultValues['whatInput']){$('whatInput').style.color='#666666';}else{$('whatInput').style.color='black';}
previousWhatInput=$('whatInputFromHeader').value;}
this.initWhereComponent=function(){if(this.whereDialogLocationDropdown!=null){this.whereDialogLocationDropdown.deselectAllTagsAndNodes();this.whereDialogLocationDropdown.selectTags(this.whereDialog.selectedLocations);}
if(this.whereDialog.whereInput!=null&&this.whereDialog.whereInput!=""){$('locationFullText').value=this.whereDialog.whereInput;}else{$('locationFullText').value=inputDefaultValues['locationFullText'];}
if((this.whereDialog.whereInput==null||this.whereDialog.whereInput=="")||this.whereDialog.whereInput==inputDefaultValues['locationFullText']){$('locationFullText').style.color='#666666';}else{$('locationFullText').style.color='black';}
previousWhatInput=$('whatInputFromHeader').value;}
this.initWhenComponent=function(){if(this.whenDialog.dateOption==dateOptions.NA){$(this.whenDialog.calendarDateFrom).value=this.whenDialog.from;$(this.whenDialog.calendarDateTo).value=this.whenDialog.to;this.toggleWhenOption(dateOptions.NA);}else{this.toggleWhenOption(this.whenDialog.dateOption);}}
this.getLocationTagsAndNodes=function(){var locationTagsAndNodes='';this.whereDialog.selectedLocations=this.whereDialogLocationDropdown.getMinimalSelected();for(var i=0;i<this.whereDialog.selectedLocations.length;i++){locationTagsAndNodes+=this.whereDialog.selectedLocations[i];if(i<this.whereDialog.selectedLocations.length-1){locationTagsAndNodes+=',';}}
return locationTagsAndNodes;}
this.getAllTopLevelLocations=function(){var allTopLevelLocations=this.whereDialogLocationDropdown.getTopLevelIds();var allTopLevelLocationIds='';for(var i=0;i<allTopLevelLocations.length;i++){allTopLevelLocationIds+=allTopLevelLocations[i];if(i<allTopLevelLocations.length-1){allTopLevelLocationIds+=',';}}
return allTopLevelLocationIds;}
this.newSearch=function(){var locationTagsAndNodes=this.getLocationTagsAndNodes();var allTopLevelLocationIds=this.getAllTopLevelLocations();if(this.whenDialog.newDateOption==''){this.whenDialog.newDateOption=this.whenDialog.dateOption;}
var dateOption=this.whenDialog.newDateOption==dateOptions.ANY?dateOptions.NA:this.whenDialog.newDateOption;var queryString=$('whatInput').value;if(!this.whatPopupDisplayedFlag&&this.combinedTreeDropdown!=null){this.combinedTreeDropdown.deselectAllTagsAndNodes();this.combinedTreeDropdown.selectTags(this.whatDialog.selectedTags);}
if((this.combinedTreeDropdown.getMinimalSelected()==null||this.combinedTreeDropdown.getMinimalSelected().length==0)&&(queryString==inputDefaultValues['whatInput']||queryString=='')&&(this.whatDialog.selectedTags==null||this.whatDialog.selectedTags.length==0)){this.combinedTreeDropdown.selectAll();}
if((queryString!=inputDefaultValues['whatInput']&&queryString!='')&&(this.combinedTreeDropdown.getMinimalSelected()!=null&&this.combinedTreeDropdown.getMinimalSelected().length==0)){this.combinedTreeDropdown.deselectAll();}
var selectedTopLevelNodeId='';var selectedTags='';if(this.combinedTreeDropdown!=null){var selectedTopLevelNodeIds_=this.combinedTreeDropdown.getSelectedTopLevelNodes();for(var i=0;i<selectedTopLevelNodeIds_.length;i++){selectedTopLevelNodeId+=selectedTopLevelNodeIds_[i];if(i<selectedTopLevelNodeIds_.length-1){selectedTopLevelNodeId+=',';}}
var selectedTags_=this.combinedTreeDropdown.getMinimalSelected();for(var i=0;i<selectedTags_.length;i++){selectedTags+=selectedTags_[i];if(i<selectedTags_.length-1){selectedTags+=',';}}}
if(queryString==inputDefaultValues['whatInput']||queryString==''){queryString=null;}
var whatQueryChanged=false;var currentSelectedTags='';if(this.whatPopupDisplayedFlag){var selectedTagsChanged=false;var initialSelectedTags=this.whatDialog.initialSelectedTags;if(selectedTags_.length==this.whatDialog.initialSelectedTags.length){for(var i=0;i<selectedTags_.length;i++){var found=false;for(var j=0;j<initialSelectedTags.length;j++){if(selectedTags_[i]==initialSelectedTags[j]){found=true;break;}}
if(!found){selectedTagsChanged=true;break;}}}else{selectedTagsChanged=true;}
var realInitialQuery=this.whatDialog.initialQueryString;if(realInitialQuery==inputDefaultValues['whatInput']||realInitialQuery==''){realInitialQuery=null;}
var queryChanged=(queryString!=realInitialQuery);if(selectedTagsChanged||queryChanged){whatQueryChanged=true;}}
this.closePopups();showHideModal('popup',true,false);$('popup').style.left=((_getPageSize().windowWidth-$('popup').clientWidth)/2)+"px";$('calendarDateFrom').value=normalizeDateFormat($('calendarDateFrom').value);$('calendarDateTo').value=normalizeDateFormat($('calendarDateTo').value);window.location.href=(typeof(requestContextPath_)!="undefined"?requestContextPath_+'/':'')
+'updateResultsWithWhereWhenWhatCriteriaChanged.jsf?locationTagsAndNodes='+locationTagsAndNodes
+'&allTopLevelLocationIds='+allTopLevelLocationIds
+'&dateOption='+dateOption
+'&from='+$('calendarDateFrom').value
+'&to='+$('calendarDateTo').value
+'&selectedTopLevelNodeId='+selectedTopLevelNodeId
+'&selectedTags='+selectedTags
+'&queryString='+(queryString!=null?escape(queryString):'')
+'&whatQueryChanged='+whatQueryChanged
+'&toolbarsVisible='+$('offerResults:toolbarsVisible').value
+'&presentationViewType='
+($('offerResults:presentationViewType')!=null?$('offerResults:presentationViewType').value:'EXTENDED')
+'&subsessionId='+$('offerResults:subsessionId').value;}
this.wherWhenDataChanged=function(){var currentDateOption=this.whenDialog.newDateOption==dateOptions.ANY?dateOptions.NA:this.whenDialog.newDateOption;var currentDateFrom=$(this.whenDialog.calendarDateFrom).value;var currentDateTo=$(this.whenDialog.calendarDateTo).value;var currentLocationTagsAndNodes=this.getLocationTagsAndNodes();var currentAllTopLevelLocationIds=this.getAllTopLevelLocations();if((this.baseDateOption!=undefined&&(currentDateOption!=this.baseDateOption||currentDateFrom!=this.baseDateFrom||currentDateTo!=this.baseDateTo))||(this.baseLocationTagsAndNodes!=undefined&&(currentLocationTagsAndNodes!=this.baseLocationTagsAndNodes||currentAllTopLevelLocationIds!=this.baseAllTopLevelLocationIds))){this.baseDateOption=currentDateOption;this.baseDateFrom=currentDateFrom;this.baseDateTo=currentDateTo;this.baseLocationTagsAndNodes=currentLocationTagsAndNodes;this.baseAllTopLevelLocationIds=currentAllTopLevelLocationIds;return true;}
return false;}
this.updateWhereLabelCall=function(){var locationTagsAndNodes=this.getLocationTagsAndNodes();JServiceProxy.getWhereShortLabels($('offerResults:subsessionId').value,locationTagsAndNodes,currentLanguage," | ",330,updateWhereLabelCallback);}
this.updateWhenLabelCall=function(){if(this.whenDialog.newDateOption==''){this.whenDialog.newDateOption=this.whenDialog.dateOption;}
var dateOption=this.whenDialog.newDateOption==dateOptions.ANY?dateOptions.NA:this.whenDialog.newDateOption;var from=$('calendarDateFrom').value
var to=$('calendarDateTo').value
JServiceProxy.getWhenShortLabel($('offerResults:subsessionId').value,dateOption,from,to,currentLanguage,330,updateWhenLabelCallback);}
this.updateWhatLabelCall=function(){var queryString=$('whatInput').value;if($(this.whatDialog.popup).style.display==''){queryString=$('whatInputFromHeader').value;}
if((this.combinedTreeDropdown.getMinimalSelected()==null||this.combinedTreeDropdown.getMinimalSelected().length==0)&&(queryString==inputDefaultValues['whatInput']||queryString=='')){this.combinedTreeDropdown.selectAll();}
if((queryString!=inputDefaultValues['whatInput']&&queryString!='')&&(this.combinedTreeDropdown.getMinimalSelected()!=null&&this.combinedTreeDropdown.getMinimalSelected().length==0)){this.combinedTreeDropdown.deselectAll();}
var selectedTags='';if(this.combinedTreeDropdown!=null){var selectedTags_=this.combinedTreeDropdown.getMinimalSelected();for(var i=0;i<selectedTags_.length;i++){selectedTags+=selectedTags_[i];if(i<selectedTags_.length-1){selectedTags+=',';}}}
if(queryString==inputDefaultValues['whatInput']||queryString==''){queryString=null;}
JServiceProxy.getWhatShortLabels($('offerResults:subsessionId').value,queryString,selectedTags,currentLanguage," | ",330,updateWhatLabelCallback);}
function updateWhereLabelCallback(result){$('whereLabelFromWhat').innerHTML=result;$('whereLabelFromWhen').innerHTML=result;JServiceProxy.getExtendedPaddingArialFontPlain12(result,330,50,updateWhereLabelCallback2);}
function updateWhereLabelCallback2(result){$('whatPopupWhereQueryPart').style.paddingRight=result+'px';$('whenPopupWhereQueryPart').style.paddingRight=result+'px';}
function updateWhenLabelCallback(result){$('whenLabelFromWhat').innerHTML=result;$('whenLabelFromWhere').innerHTML=result;}
function updateWhatLabelCallback(result){$('whatLabelFromWhen').innerHTML=result;$('whatLabelFromWhere').innerHTML=result;var queryString=$('whatInput').value;if($(thatUI.whatDialog.popup).style.display==''){queryString=$('whatInputFromHeader').value;}
if((thatUI.combinedTreeDropdown.getMinimalSelected()==null||thatUI.combinedTreeDropdown.getMinimalSelected().length==0)&&(queryString==inputDefaultValues['whatInput']||queryString=='')){thatUI.combinedTreeDropdown.selectAll();}
if((queryString!=inputDefaultValues['whatInput']&&queryString!='')&&(thatUI.combinedTreeDropdown.getMinimalSelected()!=null&&thatUI.combinedTreeDropdown.getMinimalSelected().length==0)){thatUI.combinedTreeDropdown.deselectAll();}
var selectedTags='';if(thatUI.combinedTreeDropdown!=null){var selectedTags_=thatUI.combinedTreeDropdown.getMinimalSelected();for(var i=0;i<selectedTags_.length;i++){selectedTags+=selectedTags_[i];if(i<selectedTags_.length-1){selectedTags+=',';}}}
if(queryString==inputDefaultValues['whatInput']||queryString==''){queryString=null;}
JServiceProxy.getWhatPartExtendedPaddingArialFontPlain12($('offerResults:subsessionId').value,queryString,selectedTags,currentLanguage," | ",330,50,updateWhatLabelCallback2);}
function updateWhatLabelCallback2(result){$('wherePopupWhatQueryPart').style.paddingRight=result+'px';$('whenPopupWhatQueryPart').style.paddingRight=result+'px';}
this.showWhereDialog=function(){if(this.whereDialogLocationDropdown==null){fillLocationTree();selectWhereTagsInDropdown();}
if(thatUI.whereDialogLocationDropdown.getMinimalSelected().length>0){$('regionsMark').style.display='';document.getElementById('locationFullText').style.color="#000000";setLocationText();}else{$('regionsMark').style.display='none';document.getElementById('locationFullText').style.color="#666666";document.getElementById('locationFullText').value=inputDefaultValues['locationFullText'];}
whereDialogAddShortCuts();that.VALIDATION.checkOkButtonValidationForWhereDialog();showModal(this.whereDialog.popup,this.whereDialog.popupTitleHolder,true,true,null,(typeof(changeSearchPopupForceTopFlag)!="undefined"?FORCE_TOP:null),null);}
this.showWhereDialogNew=function(){if(!this.wherePopupDisplayedFlag&&this.whereDialogLocationDropdown==null){fillLocationTree();selectWhereTagsInDropdown();this.wherePopupDisplayedFlag=true;}
if(thatUI.whereDialogLocationDropdown.getMinimalSelected().length>0){$('regionsMark').style.display='';document.getElementById('locationFullText').style.color="#000000";setLocationText();}else{$('regionsMark').style.display='none';document.getElementById('locationFullText').style.color="#666666";document.getElementById('locationFullText').value=inputDefaultValues['locationFullText'];}
whereDialogAddShortCuts();that.VALIDATION.checkOkButtonValidationForWhereDialog();if($('showWhatDialogLinkReduced').style.color==disabledLinkColor||$('showWhatDialogLinkReduced').style.color==disabledLinkColorIE){}else{}
this.baseLocationTagsAndNodes=this.getLocationTagsAndNodes();this.baseAllTopLevelLocationIds=this.getAllTopLevelLocations();showModal(this.whereDialog.popup,this.whereDialog.popupTitleHolder,true,true,null,(typeof(changeSearchPopupForceTopFlag)!="undefined"?FORCE_TOP:null),null);document.getElementById("popupWherepoverlay").style.background="#000";setOpacity(document.getElementById("popupWherepoverlay"),8);var pageSize=_getPageSize();leftPosition=(pageSize.windowWidth-document.getElementById('popupWhere').clientWidth)/2;document.getElementById('popupWhere').style.left=leftPosition+"px";}
this.cancelWhereDialog=function(){whereDialogRemoveShortCuts();if(this.whereDialogLocationDropdown!=null){selectWhereTagsInDropdown();}
if($(whereInputFromHeader)!=null){this.initLocationField();$(whereInputFromHeader).value=$(thatUI.whereDialog.whereInput).value;inputDefaultValueOnBlur('whereInputFromHeader');}
hideModal(this.whereDialog.popup);}
function whereDialogAddShortCuts(){shortcut.add("enter",function(){thatUI.updateResultsWithWhereCriteriaChanged();},{'type':'keypress','disable_in_input':true,'propagate':false,'target':document});shortcut.add("esc",function(){thatUI.hideWhereDialog();},{'type':'keypress','disable_in_input':true,'propagate':false,'target':document});}
function selectWhereTagsInDropdown(theSelectedLocations){thatUI.whereDialogLocationDropdown.deselectAllTagsAndNodes();if(theSelectedLocations!=null){thatUI.whereDialogLocationDropdown.selectTags(theSelectedLocations);}else{thatUI.whereDialogLocationDropdown.selectTags(thatUI.whereDialog.selectedLocations);}}
this.restoreWhereTree=function(){this.whereDialog.selectedTags=this.whereDialog.referentSelectedLocations;selectWhereTagsInDropdown(this.whereDialog.selectedTags);}
this.hideWhereDialog=function(immediateClose){whereDialogRemoveShortCuts();hideModal(this.whereDialog.popup);if(this.whereDialogLocationDropdown!=null){selectWhereTagsInDropdown();}}
function whereDialogRemoveShortCuts(){shortcut.remove("enter");shortcut.remove("esc");}
this.resetWhereDialogTreeSelection=function(){document.getElementById('locationFullText').value=inputDefaultValues['locationFullText'];if($(whereInputFromHeader)!=null){$(whereInputFromHeader).value="";}
document.getElementById('locationFullText').style.color='#666666';this.whereDialogLocationDropdown.deselectAllTagsAndNodes();that.VALIDATION.checkOkButtonValidationForWhereDialog();}
this.updateResultsWithWhereCriteriaChanged=function(){var locationTagsAndNodes=this.getLocationTagsAndNodes();this.hideWhereDialog(true);showModal('popup',null,false,true,null,(typeof(changeSearchPopupForceTopFlag)!="undefined"?FORCE_TOP:null),null);var allTopLevelLocationIds=this.getAllTopLevelLocations();ACTION.updateResultsWithWhereCriteriaChanged(locationTagsAndNodes,allTopLevelLocationIds);}
this.showWhereLocationTree=function(){var el_=$(this.whereDialog.popupAutocomplete);el_.style.display='none';el_=$(this.whereDialog.whereDialogResetSelectionButton);el_.style.display='';el_=$('backToWhereAutocomplete');el_.style.display='';el_=$(this.whereDialog.popupLocationTree);el_.style.display='block';}
this.showWhereAutocomplete=function(){var el_=$(this.whereDialog.popupAutocomplete);el_.style.display='block';el_=$(this.whereDialog.whereDialogResetSelectionButton);el_.style.display='none';el_=$('backToWhereAutocomplete');el_.style.display='none';el_=$(this.whereDialog.popupLocationTree);el_.style.display='none';if(this.whereDialogLocationDropdown.getMinimalSelected().length==0){$('regionsMark').style.display='none';}else{$('regionsMark').style.display='';}}
this.autocompleteZipAndCityWrapper=function(t,e){if(!e)
e=window.event;if(e.keyCode==13||e.keyCode==keyTab){return false;}}
this.autocompleteZipAndCity=function(obj,e){var stop=false;if($('wherePopList').style.display=='block'){if(showWherePopList(e)){return;};}
if(!doAutocomplete(e)&&e.keyCode!=keyTab){return;}
if($('wherePopList').style.display=='block'){dropdown('events','wherePopList');}
if(this.autocompleteZipAndCityEnter)
return;if(!e)
e=window.event;if(e.which)
keyCode=e.which;if(e.keyCode)
keyCode=e.keyCode;this.autocompleteZipAndCityEnter=false;clearTimeout(this.expirySearchTimer);var locationAutocompleteHolder=$("wherePopList");if(obj.value!=inputDefaultValues[this.whereDialog.whereInput]){if(e.keyCode==13||keyCode==keyTab){this.autocompleteZipAndCityEnter=true;locationAutocompleteHolder.style.display="none";this.locTagsFreeTextSearchByWordsCall(obj.value);}else{if(obj.value.length>1){this.autocompleteZipAndCityEnter=false;locationAutocompleteHolder.style.display="none";this.expirySearchTimer=setTimeout("whereWhenWhatModification.UI.locTagsFreeTextSearchByWordsCall('"
+myEscape(obj.value)+"' )",1000);}else{return;}}}else{return;}}
this.locTagsFreeTextSearchByWordsCall=function(value){setFreeTextSearchProgres(true,'whereFTSInProgressLink','whereFTSInProgressImage');JServiceProxy.locTagsFreeTextSearchByWordsBySubsession($('offerResults:subsessionId').value,value,false,false,true,locTagsFreeTextSearchCallback);}
function locTagsFreeTextSearchCallback(results){if(thatUI.autocompleteZipAndCityEnter&&results.length>0){$(thatUI.whereDialog.whereInput).value=(myEscape(results[0].text123));thatUI.autocompleteZipAndCityEnter=false;thatUI.setLocationTagId(results[0].id,results[0].text123);setFreeTextSearchProgres(false,'whereFTSInProgressLink','whereFTSInProgressImage');$('regionsMark').style.display='';return;}
if(thatUI.autocompleteZipAndCityEnter&&results.length==0){thatUI.autocompleteZipAndCityEnter=false;setFreeTextSearchProgres(false,'whereFTSInProgressLink','whereFTSInProgressImage');$('regionsMark').style.display='none';thatUI.whereDialogLocationDropdown.deselectAllTagsAndNodes();return;}
thatUI.autocompleteZipAndCityEnter=false;setFreeTextSearchProgres(false,'whereFTSInProgressLink','whereFTSInProgressImage');var locationAutocompleteHolder=$("wherePopList");if(results==null||results.length==0){locationAutocompleteHolder.className="shortlist whereShortlist";locationAutocompleteHolder.innerHTML=i18n["noResults"];thatUI.whereDialogLocationDropdown.deselectAllTagsAndNodes();}else{var htmlString;var htmlSuffix;if(results.length>10){locationAutocompleteHolder.className='shortlist popList wherePopList';htmlString='<div class="popListUp popListUpInactive" id="wherePopListUp" onmouseover="popListUp(\'where\')" onmouseout="popListStop(\'where\')"></div>';htmlString+='<div class="popListContent" id="wherePopContent">';htmlString+='<div class="popListPage" id="wherePopPage">';htmlSuffix='</div></div><div class="popListDown" id="wherePopListDown" onmouseover="popListDown(\'where\')" onmouseout="popListStop(\'where\')"></div>';}else{locationAutocompleteHolder.className='shortlist whereShortlist';htmlString='<div class="shortlistContent" id="wherePopContent">';htmlString+='<div class="popListPage" id="wherePopPage">';htmlSuffix='</div></div>';}
for(var i=0;i<results.length;i++){htmlString+="<a "
+"locId='"
+results[i].id
+"' href=\"javascript: whereWhenWhatModification.UI.setLocationTagId('"
+results[i].id+"', '"
+results[i].text123.replace(/'/g,"\\\'").replace(/"/g,"\\\"")+"'"+");\">"
+results[i].text123+"</a>";}
locationAutocompleteHolder.innerHTML=htmlString+htmlSuffix;}
dropdown('events','wherePopList');}
function myEscape(text){return text.replace(/'/g,"\'").replace(/"/g,"\"");}
function setFreeTextSearchProgres(showProgress,linkId,imageId){if(showProgress){$(linkId).style.display='none';$(imageId).style.display='';}else{$(imageId).style.display='none';}}
function scrollPopListElement(sPopList,keyCode){var oPage=$(sPopList+'PopPage');var len=oPage.childNodes.length;if(len==0)
return;var el;var s='';var f=-1;var p=-1;var ls=-1;var i;for(i=0;i<len;i++){el=oPage.childNodes[i];if(el.tagName){if(f==-1)
f=i;if(s=='findNext'){oPage.childNodes[i].className='selected';oPage.childNodes[ls].className='';s='selected';break;}
if(el.className=='selected'){if(keyCode==keyDown){if(i<len-1){ls=i;s='findNext';}else{if(ls!=f){if(ls>=0&&ls<oPage.childNodes.length){oPage.childNodes[ls].className='';}else{var elem=getElementsByClassName('a','selected');for(ii=0;ii<elem.length;ii++){elem[ii].className='';}}
oPage.childNodes[f].className='selected';i=f;s='selected';break;}}}else if(keyCode==keyUp){if(p!=-1){oPage.childNodes[p].className='selected';oPage.childNodes[i].className='';i=p;s='selected';break;}}else if(keyCode==keyEnter){var v=oPage.childNodes[i];oPage.childNodes[i].className='';hide(sPopList+'PopList');oPage.style.top=0;return v;}else if(keyCode==keyEsc){oPage.childNodes[i].className='';hide(sPopList+'PopList');oPage.style.top=0;return;}}else{p=i;}}}
if((s=='')&&(f!=-1)&&(ls==-1)){oPage.childNodes[f].className='selected';i=f;s='selected';}
if(s=='selected'){var el=oPage.childNodes[i];var elTop=el.offsetTop;var pageTop=oPage.offsetTop;var content=$(sPopList+'PopContent');var contentHeight=content.offsetHeight;var elHeight=el.offsetHeight;if(elTop<-pageTop){popListStep(sPopList,-pageTop-elTop);}else if(elTop+pageTop>contentHeight-elHeight){popListStep(sPopList,-(elTop+pageTop-contentHeight+elHeight));}}}
function showWherePopList(e){if($('wherePopList').style.display=='block'){if(e.keyCode)
keyCode=e.keyCode;if(e.which)
keyCode=e.which;if(keyCode in arrayChecker([keyUp,keyDown,keyEnter,keyEsc])){var v=scrollPopListElement('where',keyCode);if(v!=null){thatUI.setLocationTagId(v.getAttribute('locId'),v.innerHTML);return true;}
return false;}}
return false;}
this.hideWherePopList=function(e){}
this.setLocationTagId=function(objectId,zipAndName){JServiceProxy.getUniqueIdByObjectIdBySubsession($('offerResults:subsessionId').value,false,objectId,setLocationTagIdCallback);$(this.whereDialog.whereInput).value=zipAndName;if($('whereInputFromHeader')!=null){$('whereInputFromHeader').value=zipAndName;}
$(this.whereDialog.whereInput).blur();}
function setLocationTagIdCallback(results){var locationAutocompleteHolder=$("wherePopList");locationAutocompleteHolder.style.display="none";var selectedLocations__=new Array();for(var i=0;i<results.length;i++){selectedLocations__[i]=results[i];}
selectWhereTagsInDropdown(selectedLocations__);$('regionsMark').style.display='';whereWhenWhatModification.UI.updateResultsWithWhereCriteriaChanged();}
function setLocationText(){var allSelected=thatUI.whereDialogLocationDropdown.areAllTopLevelNodesSelected();if(allSelected){$(thatUI.whereDialog.whereInput).value=thatUI.whereDialogLocationDropdown.getRootName();return;}else{var names=getNamesWithoutDuplicates(thatUI.whereDialogLocationDropdown.getSelectedOnlyArray());if(names.length==0){$(thatUI.whereDialog.whereInput).value=inputDefaultValues['whereInputFromHeader'];}else if(names.length==1){$(thatUI.whereDialog.whereInput).value=names[0].name.replace(/!!/," ");}else{$(thatUI.whereDialog.whereInput).value=i18n['manyLocations'];}}}
function getNamesWithoutDuplicates(namesWithDuplicates){var names=new Array();if(namesWithDuplicates.length>0){names.push(namesWithDuplicates[0]);for(var i=1;i<namesWithDuplicates.length;i++){if(!inArray(names,namesWithDuplicates[i])){names.push(namesWithDuplicates[i]);}}}
return names.sort(function(a,b){for(var i=0;i<a.parentsFromRoot.length;i++){if(b==a.parentsFromRoot[i]){return-1;}}
for(var i=0;i<b.parentsFromRoot.length;i++){if(a==b.parentsFromRoot[i]){return 1;}}
for(var i=0;i<Math.min(a.parentsFromRoot.length,b.parentsFromRoot.length);i++){var difference=a.parentsFromRoot[i].sortKey
-b.parentsFromRoot[i].sortKey;if(difference!=0){return difference;}}
return a.objectId-b.objectId;});}
this.clearWhere=function(){resetLocTreeSelection(false,true);$(this.whereDialog.whereInput).focus();}
var resetLocTreeSelection=function(isCancel,isClearWhat){thatUI.whereDialogLocationDropdown.deselectAllTagsAndNodes();if(isCancel){selectWhereTagsInDropdown();}else{if(isClearWhat){}}
if(thatUI.whereDialogLocationDropdown.getMinimalSelected().length>0){if(isCancel){}
$('regionsMark').style.display='';}else{$('regionsMark').style.display='none';}}
function fillLocationTree(){if(locationRoot==null){return;}
thatUI.whereDialogLocationDropdown=new Dropdown2Component(locationRoot,true,'whereWhenWhatModification.UI.whereDialogLocationDropdown',currentLanguage);thatUI.whereDialogLocationDropdown.holderName=thatUI.whereDialog.popupLocationTreeHolder;thatUI.whereDialogLocationDropdown.addObserver(new WhereDialogObserver());var locationsHTMLString=thatUI.whereDialogLocationDropdown.generateDropdown();var locationHolder=$(thatUI.whereDialog.popupLocationTreeHolder);locationHolder.innerHTML=locationsHTMLString;thatUI.whereDialogLocationDropdown.defaultCaseOpenFirstLevel();}
function WhereDialogObserver(){this.update=function(observerContext){that.VALIDATION.checkOkButtonValidationForWhereDialog();return;};}
function setWhereWhatWhen(){var whereSelected=$('whereSelected');var selectedLocations__=thatUI.whereDialogLocationDropdown.getMinimalSelected();var whereSelected_='';for(var i=0;i<selectedLocations__.length;i++){whereSelected_+='<p>'+thatUI.whereDialogLocationDropdown.getTagName(selectedLocations__[i])+'</p>';}
whereSelected.innerHTML=whereSelected_;}
this.showWhenDialog=function(){if(this.whenDialog.dateOption==dateOptions.NA){$(this.whenDialog.calendarDateFrom).value=this.whenDialog.from;$(this.whenDialog.calendarDateTo).value=this.whenDialog.to;this.toggleWhenOption(dateOptions.NA);}else{this.toggleWhenOption(this.whenDialog.dateOption);}
whenDialogAddShortCuts();showModal(this.whenDialog.popup,this.whenDialog.popupTitleHolder,true,true,null,(typeof(requestContextPath_)!="undefined"?FORCE_TOP:null),null);}
this.showWhenDialogNew=function(){if(!this.whenPopupDisplayedFlag){if(this.whenDialog.dateOption==dateOptions.NA){$(this.whenDialog.calendarDateFrom).value=this.whenDialog.from;$(this.whenDialog.calendarDateTo).value=this.whenDialog.to;this.toggleWhenOption(dateOptions.NA);}else{this.toggleWhenOption(this.whenDialog.dateOption);}}
this.whenPopupDisplayedFlag=true;whenDialogAddShortCuts();if($('showWhatDialogLinkReduced').style.color==disabledLinkColor||$('showWhatDialogLinkReduced').style.color==disabledLinkColorIE){}else{}
this.baseDateOption=this.whenDialog.newDateOption==dateOptions.ANY?dateOptions.NA:this.whenDialog.newDateOption;this.baseDateFrom=$(this.whenDialog.calendarDateFrom).value;this.baseDateTo=$(this.whenDialog.calendarDateTo).value;showModal(this.whenDialog.popup,this.whenDialog.popupTitleHolder,true,true,null,(typeof(requestContextPath_)!="undefined"?FORCE_TOP:null),null);document.getElementById("popupWhenpoverlay").style.background="#000";setOpacity(document.getElementById("popupWhenpoverlay"),8);var pageSize=_getPageSize();leftPosition=(pageSize.windowWidth-document.getElementById('popupWhen').clientWidth)/2;document.getElementById('popupWhen').style.left=leftPosition+"px";}
this.initFromDateCalendar=function(){if(!this.whenPopupDisplayedFlag){if(this.whenDialog.dateOption==dateOptions.NA){$(this.whenDialog.calendarDateFrom).value=this.whenDialog.from;$(this.whenDialog.calendarDateTo).value=this.whenDialog.to;this.toggleWhenOption(dateOptions.NA);}else{this.toggleWhenOption(this.whenDialog.dateOption);}}
this.whenPopupDisplayedFlag=true;whenDialogAddShortCuts();if($('showWhatDialogLinkReduced').style.color==disabledLinkColor||$('showWhatDialogLinkReduced').style.color==disabledLinkColorIE){}else{}
this.baseDateOption=this.whenDialog.newDateOption==dateOptions.ANY?dateOptions.NA:this.whenDialog.newDateOption;this.baseDateFrom=$(this.whenDialog.calendarDateFrom).value;this.baseDateTo=$(this.whenDialog.calendarDateTo).value;showHideModal('calendar_overlay',true,false);calendarDateFrom2.calOpen($('offerListFragment'),'calendarDateFrom');}
function whenDialogAddShortCuts(){shortcut.add("enter",function(){thatUI.updateResultsWithWhenCriteriaChanged();},{'type':'keypress','disable_in_input':true,'propagate':false,'target':document});shortcut.add("esc",function(){thatUI.hideWhenDialog();},{'type':'keypress','disable_in_input':true,'propagate':false,'target':document});}
this.hideWhenDialog=function(){whenDialogRemoveShortCuts();hideModal(this.whenDialog.popup);}
function whenDialogRemoveShortCuts(){shortcut.remove("enter");shortcut.remove("esc");}
this.updateResultsWithWhenCriteriaChanged=function(){if(that.VALIDATION.whenActionExecutionValidation()==false){return;}
if(this.whenDialog.newDateOption==''){this.whenDialog.newDateOption=this.whenDialog.dateOption;}
ACTION.updateResultsWithWhenCriteriaChanged(this.whenDialog.newDateOption==dateOptions.ANY?dateOptions.NA:this.whenDialog.newDateOption,$(this.whenDialog.calendarDateFrom).value,$(this.whenDialog.calendarDateTo).value);}
this.potentiallySet_ToDateInputField_From_CalendarDateFrom=function(calendarDateFromValue_){var calendarDateToValue_=$('calendarDateTo').value;if(dateFormatForCurrentLocale==calendarDateToValue_||(validateDate(calendarDateToValue_)&&!that.VALIDATION.isFirstDateLower(calendarDateFromValue_,calendarDateToValue_))){$('calendarDateTo').value=calendarDateFromValue_;}}
this.potentiallySet_ToDateInputField_From_CalendarDateTo=function(calendarDateToValue_){var calendarDateFromValue_=$('calendarDateFrom').value;if(!validateDate(calendarDateFromValue_)||(validateDate(calendarDateFromValue_)&&that.VALIDATION.isFirstDateLower(calendarDateFromValue_,calendarDateToValue_))){$('calendarDateTo').value=calendarDateToValue_;}}
var activeRadioButtonClass="option";var selectedRadioButtonClass="option optionTrue";this.toggleWhenOption=function(dateOption){selectWhenRadioButton(dateOption);that.VALIDATION.checkOkButtonValidationForWhenDialog();}
function selectWhenRadioButton(dateOption){var whenOptionArray=document.getElementsByName('whenOption');for(var i=0;i<whenOptionArray.length;i++){whenOptionArray[i].className=activeRadioButtonClass;}
if(dateOption!=dateOptions.NA){$('whenOption_'+dateOption).className=selectedRadioButtonClass;thatUI.whenDialog.newDateOption=dateOption;fillFromToDate(dateOption);that.VALIDATION.clearValidationClasses();}else{thatUI.whenDialog.newDateOption=dateOptions.NA;}}
function fillFromToDate(dateOption){switch(dateOption){case dateOptions.ANY:makeAnyInput();break;case dateOptions.TODAY:makeTodayInput();break;case dateOptions.TOMORROW:makeTomorrowInput();break;case dateOptions.DAY_AFTER_TOMORROW:makeDayAfterTomorrowInput();break;case dateOptions.THIS_WEEKEND:makeWeekendInput();break;case dateOptions.NEXT_10_DAYS:makeNext10DaysInput();break;case dateOptions.NEXT_30_DAYS:makeNext30DaysInput();break;default:break;}}
var fromDateInput='calendarDateFrom';var toDateInput='calendarDateTo';function makeAnyInput(){$(fromDateInput).value=dateFormatForCurrentLocale;$(toDateInput).value=dateFormatForCurrentLocale;}
function makeTodayInput(){$(fromDateInput).value=formatDate(new Date());$(toDateInput).value=formatDate(new Date());}
function makeTomorrowInput(){$(fromDateInput).value=formatDate(AddDaysToDate(new Date(),1));$(toDateInput).value=formatDate(AddDaysToDate(new Date(),1));}
function makeDayAfterTomorrowInput(){$(fromDateInput).value=formatDate(AddDaysToDate(new Date(),2));$(toDateInput).value=formatDate(AddDaysToDate(new Date(),2));}
function makeWeekendInput(){var date=new Date();var day=date.getDay();var mondayToFriday=4;var mondayToSunday=6;switch(day){case 0:day=6;break;default:day--;break;}
if(day>4)
mondayToFriday=day;var monday1=AddDaysToDate(new Date(),-day);var monday2=AddDaysToDate(new Date(),-day);$(fromDateInput).value=formatDate(AddDaysToDate(monday1,mondayToFriday));$(toDateInput).value=formatDate(AddDaysToDate(monday2,mondayToSunday));}
function makeNext10DaysInput(){$(fromDateInput).value=formatDate(new Date());$(toDateInput).value=formatDate(AddDaysToDate(new Date(),10));}
function makeNext30DaysInput(){$(fromDateInput).value=formatDate(new Date());$(toDateInput).value=formatDate(AddDaysToDate(new Date(),30));}
function formatDate(date){return date.getDate()+dateFormatSeparator+(date.getMonth()+1)
+dateFormatSeparator+date.getFullYear();}
this.showWhatDialog=function(t){if(t.style.color==disabledLinkColor||t.style.color==disabledLinkColorIE){return;}
if(this.combinedTreeDropdown!=null){this.combinedTreeDropdown.deselectAllTagsAndNodes();this.combinedTreeDropdown.selectTags(this.whatDialog.selectedTags);}
if(this.whatDialog.queryString!=null&&this.whatDialog.queryString!=""){$(whatInput).value=this.whatDialog.queryString;}else{$(whatInput).value=inputDefaultValues[whatInput];}
if((this.whatDialog.queryString==null||this.whatDialog.queryString=="")||this.whatDialog.queryString==inputDefaultValues['whatInput']){$(whatInput).style.color='#666666';}else{$(whatInput).style.color='black';}
previousWhatInput=$('whatInputFromHeader').value;whatDialogAddShortCuts();showModal(this.whatDialog.popup,this.whatDialog.popupTitleHolder,true,true,null,(typeof(requestContextPath_)!="undefined"?FORCE_TOP:null),null);}
this.showWhatDialogNew=function(t){if(t.style.color==disabledLinkColor||t.style.color==disabledLinkColorIE){return;}
if(!this.whatPopupDisplayedFlag){if(this.combinedTreeDropdown!=null){this.combinedTreeDropdown.deselectAllTagsAndNodes();this.combinedTreeDropdown.selectTags(this.whatDialog.selectedTags);}
if(this.whatDialog.queryString!=null&&this.whatDialog.queryString!=""){$(whatInput).value=this.whatDialog.queryString;}else{$(whatInput).value=inputDefaultValues[whatInput];}}
this.whatPopupDisplayedFlag=true;if((this.whatDialog.queryString==null||this.whatDialog.queryString=="")||this.whatDialog.queryString==inputDefaultValues['whatInput']){$(whatInput).style.color='#666666';}else{$(whatInput).style.color='black';}
previousWhatInput=$('whatInputFromHeader').value;whatDialogAddShortCuts();showModal(this.whatDialog.popup,this.whatDialog.popupTitleHolder,true,true,null,(typeof(requestContextPath_)!="undefined"?FORCE_TOP:null),null);document.getElementById("popupWhatpoverlay").style.background="#000";setOpacity(document.getElementById("popupWhatpoverlay"),8);var pageSize=_getPageSize();leftPosition=(pageSize.windowWidth-document.getElementById('popupWhat').clientWidth)/2;document.getElementById('popupWhat').style.left=leftPosition+"px";}
function whatDialogAddShortCuts(){shortcut.add("enter",function(){thatUI.updateResultsWithWhatCriteriaChanged(true);},{'type':'keypress','disable_in_input':true,'propagate':false,'target':document});shortcut.add("esc",function(){thatUI.hideWhatDialog();},{'type':'keypress','disable_in_input':true,'propagate':false,'target':document});}
this.hideWhatDialog=function(immediateClose){var popupCombinedTree__=$(this.whatDialog.popupCombinedTree);whatDialogRemoveShortCuts();hideModal(this.whatDialog.popup);buildWhatCombinedTreeCallback(this.whatDialog.initialCombinedTree);}
this.cancelWhatDialog=function(immediateClose){$(whatInput).value=previousWhatInput;$(whatInputFromHeader).value=previousWhatInput;if(previousWhatInput==inputDefaultValues['whatInput']){$(whatInput).style.color='#666666';$(whatInputFromHeader).style.color='#666666';}else{$(whatInput).style.color='black';$(whatInputFromHeader).style.color='black';}
this.hideWhatDialog(immediateClose);}
function whatDialogRemoveShortCuts(){shortcut.remove("enter");shortcut.remove("esc");}
var previousWhatInput="";this.resetWhatDialogTreeSelection=function(){$(whatInput).value="";$(whatInputFromHeader).value="";if(this.combinedTreeDropdown!=null){this.combinedTreeDropdown.deselectAllTagsAndNodes();}}
this.searchFieldOnBlur=function(t){if(t.value==''){inputDefaultValueOnBlur('whatInputFromHeader');$('whatInput').value=inputDefaultValues['whatInput'];this.whatDialog.queryString=inputDefaultValues['whatInput'];}}
this.whereAutocompleteonBlur=function(value){setTimeout("whereWhenWhatModification.UI.whereAutocompleteonBlurCall('"+myEscape(value)+"' )",300);}
this.whereAutocompleteonBlurCall=function(value){if(this.whereAutoBlur){var subsessionIdField=getFieldJsf('subsessionId');var subSessionId=subsessionIdField.value;JServiceProxy.locTagsFreeTextSearchByWordsBySubsession(subSessionId,value,false,false,true,{callback:function(data){whereWhenWhatModification.UI.whereAutocompleteOnBlurCallback(data);},errorHandler:function(){},timeout:dwrTimeout});}}
this.whereAutocompleteOnBlurCallback=function(results){if(results.length>0){var label=myEscape(results[0].text123);$(whereInput).value=label;setLocationTagId(results[0].uniqueId,label,true);}else{showHideModal('chooseLocationPopup',true);}}
this.resetWhatDialogTreeSelection_1=function(defaultText){$(whatInput).value=defaultText;$(whatInputFromHeader).value=defaultText;this.combinedTreeDropdown.deselectAllTagsAndNodes();}
this.updateResultsWithOnlyQueryStringFromWhat=function(ajaxCall){this.combinedTreeDropdown.deselectAll();this.updateResultsWithWhatCriteriaChanged(false,ajaxCall);}
this.updateResultsWithWhatCriteriaChanged=function(dontShowProgressbar,ajaxCall){var queryString=$(whatInput).value;if((this.combinedTreeDropdown.getMinimalSelected()==null||this.combinedTreeDropdown.getMinimalSelected().length==0)&&(queryString==inputDefaultValues[whatInput]||queryString=='')){this.combinedTreeDropdown.selectAll();}
this.hideWhatDialog(true);if(dontShowProgressbar!=true){showModal('popup',null,false,true,null,(typeof(changeSearchPopupForceTopFlag)!="undefined"?FORCE_TOP:null),null);if(init_reducedPageSpecific){var pageSize=_getPageSize();leftPosition=(pageSize.windowWidth-$('popup').clientWidth)/2;$('popup').style.left=leftPosition+"px";}}
if((queryString!=inputDefaultValues[whatInput]&&queryString!='')&&(this.combinedTreeDropdown.getMinimalSelected()!=null&&this.combinedTreeDropdown.getMinimalSelected().length==0)){this.combinedTreeDropdown.deselectAll();}
var theTopLevelNodeIds='';var theSelectedTags='';if(this.combinedTreeDropdown!=null){var selectedTopLevelNodeIds_=this.combinedTreeDropdown.getSelectedTopLevelNodes();for(var i=0;i<selectedTopLevelNodeIds_.length;i++){theTopLevelNodeIds+=selectedTopLevelNodeIds_[i];if(i<selectedTopLevelNodeIds_.length-1){theTopLevelNodeIds+=',';}}
var selectedTags_=this.combinedTreeDropdown.getMinimalSelected();for(var i=0;i<selectedTags_.length;i++){theSelectedTags+=selectedTags_[i];if(i<selectedTags_.length-1){theSelectedTags+=',';}}}
if(queryString==inputDefaultValues[whatInput]||queryString==''){queryString=null;}
if(ajaxCall!=null&&!ajaxCall){ACTION.updateResultsWithWhatCriteriaChanged(theTopLevelNodeIds,theSelectedTags,queryString);}else{this.updateResultsWithWhatCriteriaChangedAjaxCall(theTopLevelNodeIds,theSelectedTags,queryString);}}
this.updateResultsWithWhatCriteriaChangedAjaxCall=function(theTopLevelNodeIds,theSelectedTags,queryString){JResultsPageBean.updateResultsWithWhatCriteriaChangedAjaxCall($('offerResults:subsessionId').value,theTopLevelNodeIds,theSelectedTags,queryString,false,updateResultsWithWhatCriteriaChangedAjaxCallCallback);}
function updateResultsWithWhatCriteriaChangedAjaxCallCallback(result){if(result==0){showHideModal('popup',false);showModal('freeTextSearchNoResultsPopup',null,false,true,null,(typeof(changeSearchPopupForceTopFlag)!="undefined"?FORCE_TOP:null),null);if(init_reducedPageSpecific){var pageSize=_getPageSize();leftPosition=(pageSize.windowWidth-$('freeTextSearchNoResultsPopup').clientWidth)/2;$('freeTextSearchNoResultsPopup').style.left=leftPosition+"px";}
freeTextSearchNoResultsPopupAddShortCuts();}else{window.location.href=(typeof(requestContextPath_)!="undefined"?requestContextPath_+'/':'')
+'displayResultPage.jsf?subsessionId='+$('offerResults:subsessionId').value
+'&toolbarsVisible='+$('offerResults:toolbarsVisible').value
+'&presentationViewType='+$('offerResults:presentationViewType').value;}}
this.initWhatDialog=function(whatQuery,reducedPageSpecific){if(reducedPageSpecific){JResultsPageBean.initialWhatSearchWithReducedPageSpecific($('offerResults:subsessionId').value,this.whatDialog.selectedTopLevelNodeIds,this.whatDialog.selectedTags,whatQuery,buildWhatCombinedTreeCallback);}else{JResultsPageBean.initialWhatSearch($('offerResults:subsessionId').value,this.whatDialog.selectedTopLevelNodeIds,this.whatDialog.selectedTags,whatQuery,buildWhatCombinedTreeCallback);}}
this.restoreWhatTree=function(){this.whatDialog.selectedTags=this.whatDialog.referentTags;this.whatDialog.queryString=this.whatDialog.referentqueryString;JResultsPageBean.restoreWhatTree($('offerResults:subsessionId').value,buildWhatCombinedTreeCallback);}
this.recalculateWhatDialog=function(){var locationTagsAndNodes=this.getLocationTagsAndNodes();var allTopLevelLocationIds=this.getAllTopLevelLocations();if(this.whenDialog.newDateOption==''){this.whenDialog.newDateOption=this.whenDialog.dateOption;}
var dateOption=this.whenDialog.newDateOption==dateOptions.ANY?dateOptions.NA:this.whenDialog.newDateOption;$('combinedTreeHolder').innerHTML=$('pleaseWaitContent').innerHTML;var selectedTopLevelNodeId='';var selectedTags='';if(this.combinedTreeDropdown!=null){var selectedTopLevelNodeIds_=this.combinedTreeDropdown.getSelectedTopLevelNodes();for(var i=0;i<selectedTopLevelNodeIds_.length;i++){selectedTopLevelNodeId+=selectedTopLevelNodeIds_[i];if(i<selectedTopLevelNodeIds_.length-1){selectedTopLevelNodeId+=',';}}
var selectedTags_=this.combinedTreeDropdown.getMinimalSelected();for(var i=0;i<selectedTags_.length;i++){selectedTags+=selectedTags_[i];if(i<selectedTags_.length-1){selectedTags+=',';}}}
this.whatDialog.selectedTags=this.combinedTreeDropdown.getMinimalSelected();this.whatDialog.queryString=$('whatInput').value;JResultsPageBean.recalculateWhatTree($('offerResults:subsessionId').value,locationTagsAndNodes,allTopLevelLocationIds,dateOption,$('calendarDateFrom').value,$('calendarDateTo').value,this.whatDialog.selectedTopLevelNodeIds,this.whatDialog.selectedTags,this.whatDialog.queryString,buildWhatCombinedTreeCallback2);}
function buildWhatCombinedTreeCallback2(combinedTree){buildWhatCombinedTreeCallback(combinedTree);whereWhenWhatModification.UI.showWhatDialogNew($('showWhatDialogLinkReduced'));whereWhenWhatModification.UI.whatTreeRecalculated=true;if(whereWhenWhatModification.UI.combinedTreeDropdown!=null){whereWhenWhatModification.UI.combinedTreeDropdown.deselectAllTagsAndNodes();whereWhenWhatModification.UI.combinedTreeDropdown.selectTags(whereWhenWhatModification.UI.whatDialog.selectedTags);}
if(whereWhenWhatModification.UI.whatDialog.queryString!=null&&whereWhenWhatModification.UI.whatDialog.queryString!=""){$(whatInput).value=whereWhenWhatModification.UI.whatDialog.queryString;}else{$(whatInput).value=inputDefaultValues[whatInput];}
whatDialogAddShortCuts();}
var whatFTSTimer;var whatInput='whatInput';var whatInputFromHeader='whatInputFromHeader';var freeTextSearchDone=false;var rbSearchTimer;var rbSearchText;var activeRadioButtonClass="option";var selectedRadioButtonClass="option optionTrue";var inactiveRadioButtonClass="option inactive";this.combinedTreeDropdown=null;this.whatFullTextChangedWrapper=function(t,e){if(!e)
e=window.event;if(e.keyCode==13){this.updateResultsWithOnlyQueryStringFromWhat();}}
this.whatFullTextFromHeaderChanged=function(e){if(!e)
e=window.event;if(e.keyCode==13&&!noResultsPopupDisplayed){setTimeout("whereWhenWhatModification.UI.submitWhatFullTextFromHeade()",10);return false;}}
this.submitWhatFullTextFromHeade=function(){$(whatInput).value=$(whatInputFromHeader).value;setTimeout("whereWhenWhatModification.UI.updateResultsWithOnlyQueryStringFromWhat(true)",500);}
this.submitDrilling=function(id,parentTopLevelNode,drillUpFlag){if(parentTopLevelNode){id="";}
var queryString=$(whatInputFromHeader).value;if(queryString==inputDefaultValues[whatInput]||queryString==''){queryString=null;}
var drillRuleForExpandColapse=drillUpFlag?($('currentOfferSortCriteria').value!=-2):true;ACTION.updateResultsWithWhatCriteriaChanged('',id,queryString,drillRuleForExpandColapse);}
function buildWhatCombinedTreeCallback(combinedTree){if(combinedTree==null||combinedTree.combinedTree==null){combinedTree={combinedTree:new Array({children:null})};}
if(thatUI.combinedTreeDropdown==null){thatUI.whatDialog.initialCombinedTree=combinedTree;}
thatUI.combinedTreeDropdown=new Dropdown2Component(combinedTree.combinedTree,true,'whereWhenWhatModification.UI.combinedTreeDropdown',currentLanguage);thatUI.combinedTreeDropdown.holderName='combinedTreeHolder';thatUI.combinedTreeDropdown.addObserver(new WhatDialogObserver());if(combinedTree==null||combinedTree.numResults==null||combinedTree.numResults==0||combinedTree.combinedTree==null||combinedTree.combinedTree.children==null||(combinedTree.combinedTree.children!=null&&combinedTree.combinedTree.children.length==0)){var el_=$('showWhatCombinedTreeLink');if(el_!=null){el_.style.display='none';}}
if(combinedTree.combinedTree!=null&&combinedTree.combinedTree.children!=null&&combinedTree.combinedTree.children.length!=0){var combinedTreeHTMLString=thatUI.combinedTreeDropdown.generateDropdown();$('combinedTreeHolder').innerHTML=combinedTreeHTMLString;if($('showWhatDialogLink')!=null){$('showWhatDialogLink').style.color=enabledButtonLinkColor;$('showWhatDialogLink').style.cursor='pointer';}else if($('showWhatDialogLinkReduced')!=null){$('showWhatDialogLinkReduced').style.cursor='pointer';}
thatUI.combinedTreeDropdown.defaultCaseOpenFirstLevel();}
if($('whatInputFromHeader')!=null){$('whatInputFromHeader').disabled=false;}}
function WhatDialogObserver(){this.update=function(observerContext){return;};}}
var ValidationClass=function(){this.whenDialog={calendarDateFrom:'calendarDateFrom',calendarDateTo:'calendarDateTo'}
var dateOptions={"NA":"NA","ANY":"ANY","TODAY":"TODAY","TOMORROW":"TOMORROW","DAY_AFTER_TOMORROW":"DAY_AFTER_TOMORROW","THIS_WEEKEND":"THIS_WEEKEND","NEXT_10_DAYS":"NEXT_10_DAYS","NEXT_30_DAYS":"NEXT_30_DAYS"};this.checkOkButtonValidationForWhereDialog=function(){if($('whereDialogSelectionFinishedButton').className.match("gButton")){$('whereDialogSelectionFinishedButton').className='gButton';$('whereDialogSelectionFinishedButton_top').className='gButton';}else{$('whereDialogSelectionFinishedButton').className='button-submit';$('whereDialogSelectionFinishedButton_top').className='button-submit';}}
this.whenValidation=function(inputId,holderId){var results=false;if(checkDateAndSetErrorCssClass(inputId,holderId)==true){results=this.checkDatesValidity();}
this.checkOkButtonValidationForWhenDialog();return results;}
this.checkOkButtonValidationForWhenDialog=function(){if(this.whenActionExecutionValidation()==false){if($('whenDialogSelectionFinishedButton1')){$('whenDialogSelectionFinishedButton1').className='button-submit disabled';$('whenDialogSelectionFinishedButton2').className='button-submit disabled';}else if($('whenDialogSelectionFinishedButton')){$('whenDialogSelectionFinishedButton').className='gButton disabled';}}else{if($('whenDialogSelectionFinishedButton1')){$('whenDialogSelectionFinishedButton1').className='button-submit';$('whenDialogSelectionFinishedButton2').className='button-submit';if($('showWhatDialogLinkReduced').style.color==disabledLinkColor||$('showWhatDialogLinkReduced').style.color==disabledLinkColorIE){}else{}}else if($('whenDialogSelectionFinishedButton')){$('whenDialogSelectionFinishedButton').className='gButton';}}}
this.whenActionExecutionValidation=function(){var fromDateValue=$('calendarDateFrom').value;var toDateValue=$('calendarDateTo').value;if(that.UI.whenDialog.newDateOption==dateOptions.NA){if(!whereWhenWhatModification.VALIDATION.checkDate(normalizeDateFormat(fromDateValue))||!whereWhenWhatModification.VALIDATION.checkDate(normalizeDateFormat(toDateValue))){return false;}else{var dateFrom=normalizeDateFormat(fromDateValue);var dateTo=normalizeDateFormat(toDateValue);if(dateFrom!=normalizedNotSelectedDate&&dateTo!=normalizedNotSelectedDate&&dateFrom!=dateTo&&this.isFirstDateLower(toDateValue,fromDateValue)){this.markDateCorrectness('calendarDateToTrHolder',false);return false;}
else{this.markDateCorrectness('calendarDateToTrHolder',true);return true;}}}else{return true;}}
this.checkDate=function(theDate){var result=true;var dateInput=normalizeDateFormat(theDate);if(!(theDate==dateFormatForCurrentLocale)&&!validateDate(dateInput)){result=false;}
return result;}
this.checkBothDates=function(firstId,secondId){var result=true;if($(firstId).value==dateFormatForCurrentLocale&&$(secondId).value!=dateFormatForCurrentLocale){result=false;}
if($(secondId).value==dateFormatForCurrentLocale&&$(firstId).value!=dateFormatForCurrentLocale){result=false;}
return result;}
function checkDateAndSetErrorCssClass(inputId,holderId){var calendarDateTrHolder=$(holderId);if(that.UI.whenDialog.newDateOption!=dateOptions.NA){return true;}
if(!whereWhenWhatModification.VALIDATION.checkDate($(inputId).value)){if($(inputId).value!=""&&$(inputId).value!=dateFormatForCurrentLocale){calendarDateTrHolder.className="error";}
return false;}else{calendarDateTrHolder.className="";}
return true;}
this.checkDatesValidity=function(){var dateFrom=normalizeDateFormat($('calendarDateFrom').value);var dateTo=normalizeDateFormat($('calendarDateTo').value);var dateFromParts=dateFrom.split(dateFormatSeparator);var dateFromDay=parseInt(dateFromParts[0]);var dateFromMonth=parseInt(dateFromParts[1]);var dateFromYear=parseInt(dateFromParts[2]);var dateToParts=dateTo.split(dateFormatSeparator);var dateToDay=parseInt(dateToParts[0]);var dateToMonth=parseInt(dateToParts[1]);var dateToYear=parseInt(dateToParts[2]);var badDateRange=false;if(dateToYear<dateFromYear){badDateRange=true;}
if(dateToYear==dateFromYear&&dateToMonth<dateFromMonth){badDateRange=true;}
if(dateToYear==dateFromYear&&dateToMonth==dateFromMonth&&dateToDay<dateFromDay){badDateRange=true;}
if(!validateDate($('calendarDateFrom').value)||!validateDate($('calendarDateTo').value)){correctDateRange=false;}
if(dateFromYear<2007){var correctDateFrom=1+dateFormatSeparator+1
+dateFormatSeparator+2007;calendarDateFrom.setDate(new Date(correctDateFrom));$('calendarDateFrom').value=correctDateFrom;}
if(badDateRange){var correctDate=$('calendarDateFrom').value;calendarDateTo.setDate(new Date(correctDate));$('calendarDateTo').value=correctDate;}}
this.markDateCorrectness=function(holderId,isCorrect){var calendarDateTrHolder=$(holderId);calendarDateTrHolder.className=isCorrect?"":"error";}
this.dateOnFocus=function(t){whereWhenWhatModification.UI.toggleWhenOption('NA');fieldFocus(t,dateFormatForCurrentLocale);}
this.dateOnBlur=function(t,trHolderId){fieldBlur(t,dateFormatForCurrentLocale);if(whereWhenWhatModification.VALIDATION.checkDate($(t.id).value)){this.checkDatesValidity();this.markDateCorrectness(trHolderId,true);}else{this.markDateCorrectness(trHolderId,false);}
var dateFrom=normalizeDateFormat($('calendarDateFrom').value);var dateTo=normalizeDateFormat($('calendarDateTo').value);if(dateFrom==normalizedNotSelectedDate&&dateTo!=normalizedNotSelectedDate){this.markDateCorrectness('calendarDateFromTrHolder',false);}
else{this.markDateCorrectness('calendarDateFromTrHolder',true);}
if(dateTo==normalizedNotSelectedDate&&dateFrom!=normalizedNotSelectedDate){this.markDateCorrectness('calendarDateToTrHolder',false);}
else{this.markDateCorrectness('calendarDateToTrHolder',true);}
whereWhenWhatModification.UI.toggleWhenOption('NA');}
this.isFirstDateLower=function(firstDate,secondDate){var dateFromParts=normalizeDateFormat(firstDate).split(dateFormatSeparator);var dateFromDay=parseInt(dateFromParts[0]);var dateFromMonth=parseInt(dateFromParts[1]);var dateFromYear=parseInt(dateFromParts[2]);var dateToParts=normalizeDateFormat(secondDate).split(dateFormatSeparator);var dateToDay=parseInt(dateToParts[0]);var dateToMonth=parseInt(dateToParts[1]);var dateToYear=parseInt(dateToParts[2]);var isFirstDateLower_=true;if(dateToYear<dateFromYear){isFirstDateLower_=false;}
if(dateToYear==dateFromYear&&dateToMonth<dateFromMonth){isFirstDateLower_=false;}
if(dateToYear==dateFromYear&&dateToMonth==dateFromMonth&&dateToDay<dateFromDay){isFirstDateLower_=false;}
return isFirstDateLower_;}
this.clearValidationClasses=function(){var calendarDateFromTrHolder=$('calendarDateFromTrHolder');var calendarDateToTrHolder=$('calendarDateToTrHolder');calendarDateFromTrHolder.className="";calendarDateToTrHolder.className="";}
var whatInput='whatInput';this.checkOkButtonValidationForWhatDialog=function(){var queryString=$(whatInput).value;if((that.UI.combinedTreeDropdown.getMinimalSelected()==null||that.UI.combinedTreeDropdown.getMinimalSelected().length==0)&&(queryString==inputDefaultValues[whatInput]||queryString=='')){$('whatDialogSelectionFinishedButton').className='gButton disabled';$('whatDialogSelectionFinishedButton_top').className='gButton disabled';}else{$('whatDialogSelectionFinishedButton').className='gButton';$('whatDialogSelectionFinishedButton_top').className='gButton';}}
this.whatValidation=function(){}}
var ActionClass=function(whereDialogActionParamsStructure,whenDialogActionParamsStructure,whatDialogActionParamsStructure){this.whereDialog={actionUrlParamsStructure:whereDialogActionParamsStructure}
this.whenDialog={actionUrlParamsStructure:whenDialogActionParamsStructure}
this.whatDialog={actionUrlParamsStructure:whatDialogActionParamsStructure}
this.utilStructure={questionMarkKey:'?',equalMarkKey:'=',andMarkKey:'&'}
this.updateResultsWithWhereCriteriaChanged=function(locationTagsAndNodes,allTopLevelLocationIds){window.location.href=(typeof(requestContextPath_)!="undefined"?requestContextPath_+'/':'')
+this.whereDialog.actionUrlParamsStructure.url
+'?'
+this.whereDialog.actionUrlParamsStructure.paramKeys.locationTagsAndNodes
+'='
+locationTagsAndNodes
+'&allTopLevelLocationIds='+allTopLevelLocationIds
+'&toolbarsVisible='+$('offerResults:toolbarsVisible').value
+'&'
+'presentationViewType'
+'='
+($('offerResults:presentationViewType')!=null?$('offerResults:presentationViewType').value:'EXTENDED')
+'&subsessionId='+$('offerResults:subsessionId').value;}
this.updateResultsWithWhenCriteriaChanged=function(dateOption,from,to){if(!whereWhenWhatModification.VALIDATION.checkDate($('calendarDateFrom').value)){$('calendarDateFrom').focus();return;}
if(!whereWhenWhatModification.VALIDATION.checkDate($('calendarDateTo').value)){$('calendarDateTo').focus();return;}
if(!whereWhenWhatModification.VALIDATION.checkBothDates('calendarDateFrom','calendarDateTo')){if($('calendarDateFrom').value==dateFormatForCurrentLocale){$('calendarDateFromTrHolder').className='error';$('calendarDateFrom').focus();}
else{$('calendarDateToTrHolder').className='error';$('calendarDateTo').focus();}
return;}
$('calendarDateFrom').value=normalizeDateFormat($('calendarDateFrom').value);$('calendarDateTo').value=normalizeDateFormat($('calendarDateTo').value);whereWhenWhatModification.UI.hideWhenDialog();showHideModal('popup',true,false);window.location.href=(typeof(requestContextPath_)!="undefined"?requestContextPath_+'/':'')
+this.whenDialog.actionUrlParamsStructure.url
+'?'
+this.whenDialog.actionUrlParamsStructure.paramKeys.dateOption
+'='
+dateOption
+'&'
+this.whenDialog.actionUrlParamsStructure.paramKeys.from
+'='
+$('calendarDateFrom').value
+'&'
+this.whenDialog.actionUrlParamsStructure.paramKeys.to
+'='
+$('calendarDateTo').value
+'&toolbarsVisible='+$('offerResults:toolbarsVisible').value
+'&'
+'presentationViewType'
+'='
+($('offerResults:presentationViewType')!=null?$('offerResults:presentationViewType').value:'EXTENDED')
+'&subsessionId='+$('offerResults:subsessionId').value;}
this.updateResultsWithWhatCriteriaChanged=function(selectedTopLevelNodeId,selectedTags,queryString,drillRuleForExpandColapse){var drillRuleForExpandColapseUrlPart="";if(drillRuleForExpandColapse!=null&&drillRuleForExpandColapse){drillRuleForExpandColapseUrlPart="&drillRuleForExpandColapse=true"}
$('offerResults:drillRuleForExpandColapse').value=drillRuleForExpandColapseUrlPart;$('offerResults:drillSelectedTags').value=selectedTags;$('offerResults:drillQueryString').value=queryString!=null?queryString:'';triggerJsfButton('drillCall');}}
this.UI=new UIClass(whereDialogDataStructure,whenDialogDataStructure,whatDialogDataStructure);this.VALIDATION=new ValidationClass();var ACTION=new ActionClass(whereDialogDataStructure,whenDialogDataStructure,whatDialogDataStructure);this.REF_ACTION=ACTION;}
function setInnerLeftHeight(){if(document.getElementById('resultPanel')!=null&&document.getElementById('searchLinks')!=null){document.getElementById('resultPanel').style.height=document.getElementById('searchLinks').offsetHeight+'px';}}
function displayOfferResults(contextPath,actionId,skippExecution){if(skippExecution!=null&&skippExecution){return false;}
var url=contextPath+'/facelets-tags/offerListFragment.jsf?presentationViewType='+$('offerResults:presentationViewType').value;if(actionId!=null){url+='&actionId='+actionId;}
if($('whatInputFromHeader').value!=null&&$('whatInputFromHeader').value!=''&&$('whatInputFromHeader').value!=inputDefaultValues['whatInput']){url+='&query='+$('whatInputFromHeader').value;}else{url+='&query=';}
url+='&selectedTopLevelNodeIds='+whereWhenWhatModification.UI.whatDialog.selectedTopLevelNodeIds;url+='&selectedTags='+whereWhenWhatModification.UI.whatDialog.selectedTags;url+='&sortCriteria='+$('currentOfferSortCriteria').value;url+='&subsessionId='+$('offerResults:subsessionId').value;getResultOffersOverAjax(url,true);return false;}
var resultOffersRequest;function getResultOffersOverAjax(url,usePost){if(url.indexOf('?')!=-1){url+='&';}else{url+='?';}
url+='rnd='+Math.floor(Math.random()*Number.MAX_VALUE);var postUrl=url.substring(0,url.indexOf('?'));var params=url.substring(url.indexOf('?')+1);if(window.XMLHttpRequest){resultOffersRequest=new XMLHttpRequest();resultOffersRequest.onreadystatechange=visibleOffersCallback;if(usePost){resultOffersRequest.open("POST",postUrl,true);resultOffersRequest.setRequestHeader("Content-type","application/x-www-form-urlencoded");resultOffersRequest.setRequestHeader("Content-length",params.length);resultOffersRequest.setRequestHeader("Connection","close");resultOffersRequest.send(params);}else{resultOffersRequest.open("GET",url,true);resultOffersRequest.send(null);}}else if(window.ActiveXObject){resultOffersRequest=new ActiveXObject("Microsoft.XMLHTTP");if(resultOffersRequest){resultOffersRequest.onreadystatechange=visibleOffersCallback;if(usePost){resultOffersRequest.open("POST",postUrl,true);resultOffersRequest.setRequestHeader("Content-type","application/x-www-form-urlencoded");resultOffersRequest.setRequestHeader("Content-length",params.length);resultOffersRequest.setRequestHeader("Connection","close");resultOffersRequest.send(params);}else{resultOffersRequest.open("GET",url,true);resultOffersRequest.send();}}}}
function visibleOffersCallback(){if(resultOffersRequest.readyState==4&&resultOffersRequest.status==200){document.getElementById('tempOfferListFragment').innerHTML=resultOffersRequest.responseText;if(document.getElementById('topPager')!=null){document.getElementById('topPager').innerHTML=document.getElementById('topPagerAfterRecreateList').innerHTML;}
if(document.getElementById('bottomPager')!=null){document.getElementById('bottomPager').innerHTML=document.getElementById('bottomPagerAfterRecreateList').innerHTML;}
if(document.getElementById('expandCollapseLinks')!=null){document.getElementById('expandCollapseLinks').innerHTML=document.getElementById('expandCollapseLinksAfterRecreateList').innerHTML;}
var visibleSelected='';var oldSelected=document.getElementById("selectedElements");if(oldSelected!=null&&oldSelected.value!=''){ids=oldSelected.value.split(',');for(var i=0;i<ids.length;i++){var visibleOffer=document.getElementsByName("checkbox_"+ids[i]);if(visibleOffer!=null&&visibleOffer.length!=0){if(visibleSelected!=''){visibleSelected+=',';}
visibleSelected+=ids[i];}
selectElement(ids[i],null,true,'checked');}
document.getElementById("selectedElements").value=visibleSelected;}
if(visibleSelected==''){hideFloatingLayer();}
setOffersWithContact($('offersWithContactFragment').innerHTML);document.getElementById('offerListFragment').innerHTML=document.getElementById('offersRecreateList').innerHTML;document.getElementById('tempOfferListFragment').innerHTML='';}}
var popupWindow;function openDetailPage(requestContextPathParam,offerId){if(popupWindow!=null&&!popupWindow.closed&&popupWindow!=self){popupWindow.close();}
popupWindow=window.open((typeof(requestContextPathParam)!='undefined'?requestContextPathParam+'/':'')+'offer.jsf?lang=no&lookForLang=true&id='+offerId+'&type=offer&subsessionId='+$('offerResults:subsessionId').value+'&externalLink=true','OfferPreview','width=910px, height=713px, resizable=yes, scrollbars=yes, toolbar=no, location=no, directories=no, status=no, menubar=no, copyhistory=no, left='+
Math.round((window.screen.availWidth-892)/2)+'px, top='+Math.round((window.screen.availHeight-728)/2)+'px');popupWindow.focus();}
var ticketingPopupWindow;function openTicketingPage(url){if(ticketingPopupWindow!=null&&!ticketingPopupWindow.closed&&ticketingPopupWindow!=self){ticketingPopupWindow.close();}
ticketingPopupWindow=window.open(((url.match(/^http:\/\//)==null&&url.match(/^https:\/\//)==null)?'http://':'')+url,'ticketingPopup','width=910px, height=713px, resizable=yes, scrollbars=yes, toolbar=no, location=no, directories=no, status=no, menubar=no, copyhistory=no, left='+
Math.round((window.screen.availWidth-892)/2)+'px, top='+Math.round((window.screen.availHeight-728)/2)+'px');ticketingPopupWindow.focus();}
function executeOfferAction(offerId,actionDropDownId,actionName,forceTopFlag){var actionOptionsDropdownField=document.getElementById("actionOptions_"+actionDropDownId);forceTop=null;forceTopOffset=null;if(forceTopFlag){forceTop=getYCoord1(actionOptionsDropdownField);if(actionName=="feedback"){forceTopOffset=-500;}else if(actionName=="contact"){forceTopOffset=-500;}else if(actionName=="sendToFriend"){forceTopOffset=-300;}else{forceTopOffset=DEFAULT_POPUP_OFFSET;}
if(forceTop+forceTopOffset<MIN_POPUP_TOP){forceTop=MIN_POPUP_TOP;forceTopOffset=0;}}
if(actionName=="print"){printOffer(offerId);}else if(actionName=="feedback"){contactAndFeedback.UI.showFeedbackDialog(offerId,forceTop,forceTopOffset);}else if(actionName=="contact"){contactAndFeedback.UI.showContactDialog(offerId,forceTop,forceTopOffset);}else if(actionName=="sendToFriend"){contactAndFeedback.UI.showSendToFriendDialog(offerId,forceTop,forceTopOffset);}
if(actionOptionsDropdownField!=null){actionOptionsDropdownField.style.display="none";}
openedActionDropDownId=null;}
function printOffer(offerId){var printOfferHref=(typeof(requestContextPath_)!="undefined"?requestContextPath_+'/':'')
+"offerReport/?lang=no&id="
+offerId
+"&type=offer&lookForLang=true";window.location.href=printOfferHref;}
function showHideToolbars(){var toolbarsVisibleField=$('offerResults:toolbarsVisible');var toolbar1ElementA=$("toolbarSearchLine2");var toolbar1ElementB=$("toolbarSearchLine3");var toolbar2Element=$("toolbarSearch2");var showHideOptionLabelElement=$("showHideSearchOptionsLabel");if(toolbarsVisibleField.value=="true"){toolbarsVisibleField.value="false";if(toolbar1ElementA)toolbar1ElementA.style.display='none';if(toolbar1ElementB)toolbar1ElementB.style.display='none';if(toolbar2Element)toolbar2Element.style.display='none';showHideOptionLabelElement.innerHTML=showSearchOptionsLabel_;}else{toolbarsVisibleField.value="true";if(toolbar1ElementA)toolbar1ElementA.style.display='';if(toolbar1ElementB)toolbar1ElementB.style.display='';if(toolbar2Element)toolbar2Element.style.display='';showHideOptionLabelElement.innerHTML=hideSearchOptionsLabel_;}}
function whereAutocompleteWrapper(t,e){afterLoadCompleted=1;if(!locationDropdown||$('popup').style.display=='block')return false;if(!e)e=window.event;var keyCode;if(e.keyCode)keyCode=e.keyCode;if(e.which)keyCode=e.which;if(keyCode==13||keyCode==keyTab){if(!loadCompleted)afterLoadCompleted=2;return false;}
else return true;}
function whereAutocomplete(obj,e){if(!loadCompleted||autocompleteZipAndCityEnter)return false;if(!e)e=window.event;if(e.which)keyCode=e.which;if(e.keyCode)keyCode=e.keyCode;var locationAutocompleteHolder=$(wherePopList);if(locationAutocompleteHolder.style.display=='block'){if(showWherePopList(e))return;}
if(!doAutocomplete(e)&&keyCode!=keyTab){return;}
if(locationAutocompleteHolder.style.display=='block'){dropdown('events',wherePopList);}
autocompleteZipAndCityEnter=false;clearTimeout(whereSearchTimer);if(obj.value!=inputDefaultValues[whereInput]){locationAutocompleteHolder.style.display='none';if(keyCode==13||keyCode==keyTab){autocompleteZipAndCityEnter=true;JServiceProxy.locTagsFreeTextSearchByWordsBySubsession($('offerResults:subsessionId').value,obj.value,false,false,true,{callback:function(data){whereAutocompleteOnEnterCallback(data);},errorHandler:function(){showHideModal('popupDwrTimeout',true);},timeout:dwrTimeout});}
else{if(obj.value.length>=2){autocompleteZipAndCityEnter=false;whereSearchTimer=setTimeout("whereAutocompleteCall('"+myEscape(obj.value)+"' )",500);}}}}
function whereAutocompleteOnEnterCallback(results){if(autocompleteZipAndCityEnter&&results.length>0){var label=myEscape(results[0].text123);$(whereInput).value=label;setLocationTagId(results[0].uniqueId,results[0].text123);}
else{showHideModal('chooseLocationPopup',true);}
autocompleteZipAndCityEnter=false;}
function whereAutocompleteCall(value){JServiceProxy.locTagsFreeTextSearchByWordsBySubsession($('offerResults:subsessionId').value,value,false,false,true,{callback:function(data){whereAutocompleteCallback(data);},errorHandler:function(){showHideModal('popupDwrTimeout',true);},timeout:dwrTimeout});}
function whereAutocompleteCallback(results){var locationAutocompleteHolder=$(wherePopList);autocompleteZipAndCityEnter=false;if(results==null||results.length==0){locationAutocompleteHolder.className='whereAutocompleteFromHeader';locationAutocompleteHolder.innerHTML=i18n['noResults'];}else{var htmlString;var htmlSuffix;if(results.length>10){locationAutocompleteHolder.className='popList whereAutocompleteFromHeader';htmlString='<div class="popListUp popListUpInactive" id="whereResultPopListUp" style="float:none;" onmouseover="popListUp(\'whereResult\')" onmouseout="popListStop(\'whereResult\')"></div>';htmlString+='<div class="popListContent" id="whereResultPopContent" style="float:none; z-index:2000;">';htmlString+='<div class="popListPage" id="whereResultPopPage">';htmlSuffix='</div></div><div class="popListDown" id="whereResultPopListDown" style="float:none;" onmouseover="popListDown(\'whereResult\')" onmouseout="popListStop(\'whereResult\')"></div>';}else{locationAutocompleteHolder.className='whereAutocompleteFromHeader';htmlString='<div class="shortlistContent" id="whereResultPopContent" style="float:none; z-index:2000;">';htmlString+='<div class="popListPage" id="whereResultPopPage">';htmlSuffix='</div></div>';}
for(var i=0;i<results.length;i++){htmlString+="<a "+"locId='"+results[i].uniqueId+"' href=\"javascript:setLocationTagIdOnClick('"+results[i].uniqueId+"', '"+myEscape(results[i].text123)+"'"+");\" style='color:#000000;line-height:18px;'>"+results[i].text123+"</a>";}
locationAutocompleteHolder.innerHTML=htmlString+htmlSuffix;}
dropdown('events',wherePopList);}
function setLocationTagIdOnClick(commaSeparatedString,zipAndName){var uniqueId=new Array();var el=commaSeparatedString.split(',');for(var i=0;i<el.length;i++){uniqueId[i]=Number(el[i]);}
whereWhenWhatModification.UI.whereAutoBlur=false;setLocationTagId(uniqueId,zipAndName);}
function setLocationTagId(uniqueId,zipAndName,onBlurAutocomplete){if($(wherePopList).style.display=='block'){dropdown('events',wherePopList);}
$(whereInput).value=zipAndName;selectedLocations=uniqueId;locationDropdown.deselectAllTagsAndNodes();locationDropdown.selectTags(selectedLocations);if(whereWhenWhatModification.UI.onBlurAutocomplete==null||!whereWhenWhatModification.UI.onBlurAutocomplete){whereWhenWhatModification.UI.updateResultsWithWhereCriteriaChanged();}}
function showWherePopList(e){if($(wherePopList).style.display=='block'){if(e.keyCode)keyCode=e.keyCode;if(e.which)keyCode=e.which;if(keyCode in arrayChecker([keyUp,keyDown,keyEnter,keyEsc])){var v=scrollPopListElement('whereResult',keyCode);if(v!=null){var idList=new Array();var el=v.getAttribute('locId').split(",");for(var i=0;i<el.length;i++){idList[i]=Number(el[i]);}
setLocationTagId(idList,v.innerHTML);return true;}
return false;}}
return false;}
function scrollPopListElement(sPopList,keyCode){var oPage=$(sPopList+'PopPage');var len=oPage.childNodes.length;if(len==0)return;var el;var s='';var f=-1;var p=-1;var ls=-1;var i;for(i=0;i<len;i++){el=oPage.childNodes[i];if(el.tagName){if(f==-1)f=i;if(s=='findNext'){oPage.childNodes[i].className='selected';oPage.childNodes[ls].className='';s='selected';break;}
if(el.className=='selected'){if(keyCode==keyDown){if(i<len-1){ls=i;s='findNext';}else{if(ls!=f){if(ls>=0&&ls<oPage.childNodes.length){oPage.childNodes[ls].className='';}
else{var elem=getElementsByClassName('a','selected');for(ii=0;ii<elem.length;ii++){elem[ii].className='';}}
oPage.childNodes[f].className='selected';i=f;s='selected';break;}}}else if(keyCode==keyUp){if(p!=-1){oPage.childNodes[p].className='selected';oPage.childNodes[i].className='';i=p;s='selected';break;}}else if(keyCode==keyEnter){var v=oPage.childNodes[i];oPage.childNodes[i].className='';hide(sPopList+'PopList');oPage.style.top=0;return v;}else if(keyCode==keyEsc){oPage.childNodes[i].className='';hide(sPopList+'PopList');oPage.style.top=0;return;}}else{p=i;}}}
if((s=='')&&(f!=-1)&&(ls==-1)){oPage.childNodes[f].className='selected';i=f;s='selected';}
if(s=='selected'){var el=oPage.childNodes[i];var elTop=el.offsetTop;var pageTop=oPage.offsetTop;var content=$(sPopList+'PopContent');var contentHeight=content.offsetHeight;var elHeight=el.offsetHeight;if(elTop<-pageTop){popListStep(sPopList,-pageTop-elTop);}else if(elTop+pageTop>contentHeight-elHeight){popListStep(sPopList,-(elTop+pageTop-contentHeight+elHeight));}}}
function clearWhatText(){whereWhenWhatModification.UI.cancelWhatDialog();$('whatInputFromHeader').blur();$('whatInputFromHeader').value=whatQuery;inputDefaultValueOnBlur('whatInputFromHeader');showHideModal('popup',false);}
function showLocationPopup(){if(!loadCompleted){afterLoadCompleted=3;return;}
if(!locationDropdown||$('popup').style.display=='block')return;showHideModal('popupWhere',true,true);}
function getYCoord1(el){y=0;while(el){y+=el.offsetTop;el=el.offsetParent;}
return y;}
function changeNumberOfOffersPerPage(count){window.location.href=(typeof(requestContextPath_)!="undefined"?requestContextPath_+'/':'')
+'changeNumberOfOffersPerPage.jsf?'
+'count='+count
+'&toolbarsVisible='+$('offerResults:toolbarsVisible').value
+'&presentationViewType='
+($('offerResults:presentationViewType')!=null?$('offerResults:presentationViewType').value:'EXTENDED')
+'&subsessionId='+$('offerResults:subsessionId').value;}
function changeOfferSortCriteria(){window.location.href=(typeof(requestContextPath_)!="undefined"?requestContextPath_+'/':'')
+'changeOfferSortCriteria.jsf?'
+'newOfferSortCriteria='+$('offerResults:offerSortCriteria_id').value
+'&toolbarsVisible='+$('offerResults:toolbarsVisible').value
+'&presentationViewType='
+($('offerResults:presentationViewType')!=null?$('offerResults:presentationViewType').value:'EXTENDED')
+'&subsessionId='+$('offerResults:subsessionId').value;}
function changeSortOrder(sortOrder){window.location.href=(typeof(requestContextPath_)!="undefined"?requestContextPath_+'/':'')
+'changeSortOrder.jsf?'
+'sortOrder='+sortOrder
+'&toolbarsVisible='+$('offerResults:toolbarsVisible').value
+'&presentationViewType='
+($('offerResults:presentationViewType')!=null?$('offerResults:presentationViewType').value:'EXTENDED')
+'&subsessionId='+$('offerResults:subsessionId').value;}
var portalCombinedTreeDropdown;function refinePortalSearch(stepIndex){JResultsPageBean.getPortalCombinedTree($('offerResults:subsessionId').value,{callback:function(data){refinePortalSearchCallback(data,stepIndex);},errorHandler:function(){showHideModal('popup',false);showHideModal('popupDwrTimeout',true);},timeout:dwrTimeout});}
function refinePortalSearchCallback(combinedTree,stepIndex){if(combinedTree!=null&&combinedTree.numResults>minOfferNumber&&combinedTree.combinedTree){buildCombinedTreeCallback(combinedTree);showHideModal('popup',false);}
resultPageInitSteps(stepIndex+1);}
function buildCombinedTreeCallback(combinedTree){portalCombinedTreeDropdown=new Dropdown2Component(combinedTree.combinedTree,true,'portalCombinedTreeDropdown',currentLanguage);portalCombinedTreeDropdown.holderName='portalCombinedTreeHolder';var combinedTreeHTMLString=portalCombinedTreeDropdown.generateDropdown();$('portalCombinedTreeHolder').innerHTML=combinedTreeHTMLString;showHideModal('popup',false);$('combinedTreeMessage').innerHTML=i18n['msg1']+' '+combinedTree.resultsNumber+' '+i18n['msg2'];if(portalCombinedTreeDropdown.isTreeLinear()){tagsSearch();}else{portalCombinedTreeDropdown.defaultCaseOpenFirstLevel();showHideModal('combinedTreePopup',true,true);}}
function tagsSearch(){selectedTags=portalCombinedTreeDropdown.getMinimalSelected();if(selectedTags.length!=0){whereWhenWhatModification.REF_ACTION.updateResultsWithWhatCriteriaChanged('',selectedTags,whatDialogDataStructure_.initialData.queryString);}else{hideModal('combinedTreePopup');}}
function resetTagSelection(){portalCombinedTreeDropdown.deselectAllTagsAndNodes();}
function selectDate(dateString,subsessionId){JResultsPageBean.selectDate(dateString,subsessionId,null);}
function showHideContact(){var selectedElementsField=$('selectedElements');var offersWithContact=$('offersWithContact').value;if(selectedElementsField!=null&&offersWithContact!=null&&offersWithContact.length>0){var selectedElements=selectedElementsField.value
if(selectedElements!=null){var ids=selectedElements.split(",");for(var i=0;i<ids.length;i++){var offersWithContactIds=offersWithContact.split(",");for(var j=0;j<offersWithContactIds.length;j++){if(ids[i]==offersWithContactIds[j]){$('floatingActionContact').style.display='';return;}}}}}
$('floatingActionContact').style.display='none';}
function removeOffersWithoutContacts(offerIds){if($('offersWithContact')==null){return offerIds;}
var resultedOffers='';var offersWithContact=$('offersWithContact').value;if(offerIds!=null&&offersWithContact!=null&&offersWithContact.length>0){var ids=offerIds.split(",");var offersWithContactIds=offersWithContact.split(",");for(var i=0;i<ids.length;i++){for(var j=0;j<offersWithContactIds.length;j++){if(ids[i]==offersWithContactIds[j]){resultedOffers+=ids[i]+',';break;}}}}
return resultedOffers;}
function setInitialOffersWithContact(){var offersWithContact='';if(offersWithContactArray!=null&&offersWithContactArray.length>0){for(var i=0;i<offersWithContactArray.length;i++){if(offersWithContactArray[i]==-12345){continue;}
if(offersWithContact!=''){offersWithContact+=',';}
offersWithContact+=offersWithContactArray[i];}}
$('offersWithContact').value=offersWithContact;}
function setOffersWithContact(offerIds){var offersWithContact='';if(offerIds!=null&&offerIds.length>0){var ids=offerIds.split(",");for(var i=0;i<ids.length;i++){var id=trimString(ids[i]);if(id==-12345){continue;}
if(offersWithContact!=''){offersWithContact+=',';}
offersWithContact+=id;}}
$('offersWithContact').value=offersWithContact;}
function setOpacity(obj,value){if(obj!=null){obj.style.opacity=value/10;obj.style.filter='alpha(opacity='+value*10+')';}}
function changeFocus(focusFieldId,e){var field=getFieldJsf(focusFieldId);if(field==null){field=$(focusFieldId);}
if(!e)e=window.event;var keyCode;if(e.keyCode)keyCode=e.keyCode;if(e.which)keyCode=e.which;if(keyCode==13){field.focus();return false;}
return true;}
function submitWhen(e){if(!e)e=window.event;var keyCode;if(e.keyCode)keyCode=e.keyCode;if(e.which)keyCode=e.which;if(keyCode==13&&whereWhenWhatModification.VALIDATION.whenActionExecutionValidation()){whereWhenWhatModification.UI.newSearch();return false;}
return true;}
function freeTextSearchNoResultsPopupAddShortCuts(){noResultsPopupDisplayed=true;shortcut.add("enter",function(){document.getElementById('no_results_cancel').onclick();},{'type':'keypress','disable_in_input':false,'propagate':false,'target':document});shortcut.add("esc",function(){document.getElementById('no_results_cancel').onclick();},{'type':'keypress','disable_in_input':false,'propagate':false,'target':document});}
var FloatLayers=new Array();var FloatLayersByName=new Array();function addFloatLayer(n,offX,offY,spd,customElementName1){new FloatLayer(n,offX,offY,spd,customElementName1,forceTopCoordinateFieldName,topOffset);}
function getFloatLayer(n){return FloatLayersByName[n];}
function alignFloatLayers(){for(var i=0;i<FloatLayers.length;i++)FloatLayers[i].align();}
function getXCoord(el){x=0;while(el){x+=el.offsetLeft;el=el.offsetParent;}
return x;}
function getYCoord(el){y=0;while(el){y+=el.offsetTop;el=el.offsetParent;}
return y;}
FloatLayer.prototype.setFloatToTop=setTopFloater;FloatLayer.prototype.setFloatToBottom=setBottomFloater;FloatLayer.prototype.setFloatToLeft=setLeftFloater;FloatLayer.prototype.setFloatToRight=setRightFloater;FloatLayer.prototype.initialize=defineFloater;FloatLayer.prototype.adjust=adjustFloater;FloatLayer.prototype.align=alignFloater;function FloatLayer(n,offX,offY,spd,customElementName1,topCoordinateField,yOffset){this.index=FloatLayers.length;FloatLayers.push(this);FloatLayersByName[n]=this;this.name=n;this.floatX=0;this.floatY=0;this.tm=null;this.steps=spd;this.alignHorizontal=(offX>=0)?leftFloater:rightFloater;this.alignVertical=(offY>0)?topFloater:bottomFloater;this.ifloatX=Math.abs(offX);this.ifloatY=Math.abs(offY);this.customElementNameForX=customElementName1;this.forceTopCoordinateFieldName=topCoordinateField;this.topOffset=yOffset;this.detach=function(){lay=document.getElementById(this.name);l=getXCoord(lay);if(this.customElementNameForX!=null){customElement=document.getElementById(this.customElementNameForX);l=getXCoord(customElement)+this.ifloatX;}
t=getYCoord(lay);newTop=t;if(this.forceTopCoordinateFieldName!=null){customElement=document.getElementById(this.forceTopCoordinateFieldName);if(customElement!=null&&customElement.value!=''){alignElement=document.getElementById(customElement.value);tempY=getYCoord(alignElement)+this.ifloatY;if(this.topOffset!=null){tempY+=this.topOffset;}
if(tempY<newTop){newTop=tempY;}}}
lay.style.position='absolute';lay.style.top=newTop+"px";lay.style.left=l+"px";getFloatLayer(this.name).initialize();alignFloatLayers();}}
function defineFloater(){this.layer=document.getElementById(this.name);this.width=this.layer.offsetWidth;this.height=this.layer.offsetHeight;this.prevX=this.layer.offsetLeft;this.prevY=this.layer.offsetTop;}
function adjustFloater(){this.tm=null;if(this.layer.style.position!='absolute')return;var dx=Math.abs(this.floatX-this.prevX);var dy=Math.abs(this.floatY-this.prevY);if(dx<this.steps/2)
cx=(dx>=1)?1:0;else
cx=Math.round(dx/this.steps);if(dy<this.steps/2)
cy=(dy>=1)?1:0;else
cy=Math.round(dy/this.steps);if(this.floatX>this.prevX)
this.prevX+=cx;else if(this.floatX<this.prevX)
this.prevX-=cx;if(this.floatY>this.prevY)
this.prevY+=cy;else if(this.floatY<this.prevY)
this.prevY-=cy;newLeft=this.prevX;if(this.customElementNameForX!=null){customElement=document.getElementById(this.customElementNameForX);newLeft=getXCoord(customElement)+this.ifloatX;}
newTop=this.prevY;if(this.forceTopCoordinateFieldName!=null){customElement=document.getElementById(this.forceTopCoordinateFieldName);if(customElement!=null&&customElement.value!=''){alignElement=document.getElementById(customElement.value);tempY=getYCoord(alignElement)+this.ifloatY;if(this.topOffset!=null){tempY+=this.topOffset;}
if(tempY<newTop){newTop=tempY;}}}
this.layer.style.left=newLeft+"px";this.layer.style.top=newTop+"px";if(cx!=0||cy!=0){if(this.tm==null)this.tm=setTimeout('FloatLayers['+this.index+'].adjust()',50);}else{alignFloatLayers();}}
function setLeftFloater(){this.alignHorizontal=leftFloater;}
function setRightFloater(){this.alignHorizontal=rightFloater;}
function setTopFloater(){this.alignVertical=topFloater;}
function setBottomFloater(){this.alignVertical=bottomFloater;}
function leftFloater(){this.floatX=document.documentElement.scrollLeft+this.ifloatX;}
function topFloater(){this.floatY=document.documentElement.scrollTop+this.ifloatY;}
function rightFloater(){this.floatX=document.documentElement.scrollLeft+document.documentElement.clientWidth-this.ifloatX-this.width;}
function bottomFloater(){this.floatY=document.documentElement.scrollTop+document.documentElement.clientHeight-this.ifloatY-this.height;}
function alignFloater(){if(this.layer==null)this.initialize();this.alignHorizontal();this.alignVertical();if(this.prevX!=this.floatX||this.prevY!=this.floatY){if(this.tm==null)this.tm=setTimeout('FloatLayers['+this.index+'].adjust()',150);}}
window.onscroll=alignFloatLayers;var callbackUrl='keepAlive';var globalContextPath;var globalSessionId;var globalSessionExparationTime;var globalSessionInactivityTime;var globalSubsessionId;var timerObj;var url;var ajaxRequest;function keepSessionAlive(contextPath,sessionId,sessionExpirationTime,sessionInactivityTime,subsessionId){globalContextPath=contextPath;globalSessionId=sessionId;globalSessionExparationTime=sessionExpirationTime*0.8;if(sessionInactivityTime!=null){globalSessionInactivityTime=sessionInactivityTime;}
if(subsessionId!=null){globalSubsessionId=subsessionId;}
timerObj=setTimeout("keepAliveCall()",globalSessionExparationTime);}
function keepAliveCall(){if(url==null){url=buildUrl(globalContextPath,globalSessionId);}
var random=Math.floor(Math.random()*Number.MAX_VALUE)
var callUrl=url+'?rnd='+random;if(globalSubsessionId!=null){callUrl+='&subsessionId='+globalSubsessionId;}
if(window.XMLHttpRequest){ajaxRequest=new XMLHttpRequest();ajaxRequest.onreadystatechange=keepAliveCallback;ajaxRequest.open("GET",callUrl,true);ajaxRequest.send(null);}else if(window.ActiveXObject){ajaxRequest=new ActiveXObject("Microsoft.XMLHTTP");if(ajaxRequest){ajaxRequest.onreadystatechange=keepAliveCallback;ajaxRequest.open("GET",callUrl,true);ajaxRequest.send();}}}
function buildUrl(){var url=globalContextPath+'/'+callbackUrl;if(globalSessionId!=null){url+=';jsessionId='+globalSessionId;}
return url;}
function keepAliveCallback(){if(ajaxRequest.readyState==4&&ajaxRequest.status==200){var sessionExpirationTime=globalSessionExparationTime;if(globalSessionInactivityTime!=null){sessionExpirationTime=globalSessionInactivityTime;}
keepSessionAlive(globalContextPath,globalSessionId,sessionExpirationTime*0.8);}}