
$(document).ready(function(){$('#iataNumber').focus();$('.search-state').change(function(){if(this.className.match("search-state"))
{var searchForm=this.form;var index=$(searchForm).find('select.search-state').index(this);var country=$(searchForm).find('select.search-country').get(index);if(this.selectedIndex==0){$(country).attr('selectedIndex',0);}
else{$(country).val('US');}}});$('.search-country').change(function(){if(this.className.match("search-country"))
{var searchForm=this.form;var index=$(searchForm).find('select.search-country').index(this);var state=$(searchForm).find('select.search-state').get(index);if(this.value!="US"){$(state).attr('selectedIndex',0);}}});if($('select.page-drop-down').length>0)
{$('select.page-drop-down').change(function(){setSelectPageURL(this);});}
if($('a.open-hss-popup').length>0)
{$('a.open-hss-popup').click(function(e){e.preventDefault();window.open(this.href,"_blank");});}
if($('a.open-meg-popup').length>0)
{$('a.open-meg-popup').click(function(e){e.preventDefault();window.open(this.href,"_blank");});}
if($('a.open-in-popup').length>0)
{$('a.open-in-popup').click(function(e){e.preventDefault();sendto('us','no_brand',this.href,"16");});}
if($('a.open-brand-popup').length>0)
{$('a.open-brand-popup').click(function(e){e.preventDefault();openBrandPage(this.href);});}
if($('a.open-other-brand-popup').length>0)
{$('a.open-other-brand-popup').click(function(e){e.preventDefault();window.open(this.href,"_blank");});}
$(".propertyPageLink").click(function(e){e.preventDefault();openBrandPage(this.href);});$('.code-description-link').click(function(e){e.preventDefault();travelAgentsPopup(this.href,'N','Y',2);});$('.forgot-password-link').click(function(e){e.preventDefault();showConfirm($('.forgot-password-message').val(),this.href);});$('.dd-discontinue').click(function(e){e.preventDefault();showConfirm($('.dd-discontinue-msg').val(),this.href);});$('.tp-popup-7').click(function(e){e.preventDefault();travelAgentsPopup(this.href,'N','Y',7);});$('.tp-dd-popup').click(function(e){e.preventDefault();openDDPopup(this.href);});$('.corporate-news-link').click(function(e){e.preventDefault();openBrandPage(this.href);});$("table#statement-detail-table tr.statement-property-info td.center a").click(function(e){e.preventDefault();var elem=$(this).parents("tr").next("tr.statement-guest-detail");$(elem).toggle($(elem).css('display')=='none');if($(this).hasClass('arrow-down'))
{$(this).removeClass('arrow-down').addClass('arrow-right');}
else if($(this).hasClass('arrow-right'))
{$(this).removeClass('arrow-right').addClass('arrow-down');}
var totalRecords=$('table#statement-detail-table tr.statement-property-info');if($(totalRecords).find('a.arrow-right').length>0)
{$(this).trigger('panelClosed');}
else
{$(this).trigger('panelOpened');}});$("table#statement-detail-table tr.statement-property-info td.center a").bind('panelClosed',function(){$('#switch').find('span.detail-expand').removeClass('hidden');$('#switch').find('span.detail-collapse').addClass('hidden');});$("table#statement-detail-table tr.statement-property-info td.center a").bind('panelOpened',function(){$('#switch').find('span.detail-collapse').removeClass('hidden');$('#switch').find('span.detail-expand').addClass('hidden');});$('#switch a').click(function(e){e.preventDefault();var action=$.trim($(this).find('span').filter(function(i){return $(this).css('display')!=='none';}).html());var records=$('table#statement-detail-table tr.statement-property-info');if(action=='Collapse All')
{$(records).each(function(){var openElementLink=$(this).find('a.arrow-down');if(openElementLink.length>0)
{openElementLink.removeClass('arrow-down').addClass('arrow-right');$(this).next("tr.statement-guest-detail").hide();openElementLink.trigger('panelClosed');}});}
else
{$(records).each(function(){var closedElementLink=$(this).find('a.arrow-right');if(closedElementLink.length>0)
{closedElementLink.removeClass('arrow-right').addClass('arrow-down');$(this).next("tr.statement-guest-detail").show();closedElementLink.trigger('panelOpened');}});}});if($(':hidden[name=gp-statement]').length>0)
{$('#switch a').click();}
$("#gpSubject").change(function()
{if(this.value=='UNPAIDCOMMINQUIRY')
{$('#unpaidCommissionInquiry').show();}
else
{$('#unpaidCommissionInquiry').hide();}});$('#gpSubject').change();$('#taSubject').change(function()
{if((this.value=='UNPAIDCOMMINQUIRYHOTELCODE')||(this.value=='UNPAIDCOMMINQUIRYCONFNUMB'))
{if(this.value=='UNPAIDCOMMINQUIRYHOTELCODE')
{$('#unpaidCommInqHotelCode').show();$('#unpaidCommInqConf').hide();}
else if(this.value=='UNPAIDCOMMINQUIRYCONFNUMB')
{$('#unpaidCommInqHotelCode').hide();$('#unpaidCommInqConf').show();}
$('#arrivalDates').show();}
else
{$('#unpaidCommInqHotelCode').hide();$('#unpaidCommInqConf').hide();$('#arrivalDates').hide();}});$('#taSubject').change();});function openDDPopup(url)
{window.open(url,"popUp","width=419,height=576,scrollbars=no,menubar=no,toolbar=no,status=no,resizable=yes");}
function setSelectPageURL(objElement)
{location.href=objElement.options[objElement.selectedIndex].value;}
function callSetPage(obj)
{var attribute=obj.name;var attributesValue=obj.value;if(attributesValue!=""){window.location="/travelagents/iataselector.mi?"+attribute+"="+attributesValue;}}
function resCallSetPage(obj)
{var attribute=obj.name;var attributesValue=obj.value;if(attributesValue!=""){window.location="/travelagents/resolutioniataselector.mi?"+attribute+"="+attributesValue;}}
var already_open=false;function travelAgentsPopup(strURL,strMenu,strResizable,poupstyle)
{var page=strURL;var lcl_width=document.body.clientWidth;var lcl_height=document.body.clientHeight;if(typeof(window.innerWidth)=='number')
{myWidth=window.innerWidth;myHeight=window.innerHeight;}
else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight))
{myWidth=document.documentElement.clientWidth;myHeight=document.documentElement.clientHeight;}
else if(document.body&&(document.body.clientWidth||document.body.clientHeight))
{myWidth=document.body.clientWidth;myHeight=document.body.clientHeight;}
lcl_width=myWidth;lcl_height=myHeight;if(strMenu=='Y'){windowprops="location=yes,scrollbars=yes,menubar=yes,toolbar=yes,status=yes";}
else{windowprops="location=no,scrollbars=yes,menubar=no,toolbar=no,status=no";}
if(strResizable=='Y'){windowprops=windowprops+",resizable=yes";}
else{windowprops=windowprops+",resizable=no";}
switch(poupstyle)
{case"1":lcl_width=255;lcl_height=206;break;case"2":lcl_width=418;lcl_height=583;break;case"3":lcl_width=370;lcl_height=475;break;case"4":lcl_width=372;lcl_height=306;break;case"5":lcl_width=605;lcl_height=385;break;case"6":lcl_width=605;lcl_height=535;break;case"7":lcl_width=((lcl_width*90)/100);lcl_height=((lcl_height*90)/100);break;}
windowprops=windowprops+",height="+lcl_height;windowprops=windowprops+",width="+lcl_width;window.open(page,"TravelAgentsPopUp",windowprops);}
function travelAgentsPopupWithDimension(strURL,strMenu,strResizable,strWidth,strHeight)
{page=strURL;var lcl_width=document.body.clientWidth;var lcl_height=document.body.clientHeight;if(typeof(window.innerWidth)=='number')
{myWidth=window.innerWidth;myHeight=window.innerHeight;}
else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight))
{myWidth=document.documentElement.clientWidth;myHeight=document.documentElement.clientHeight;}
else if(document.body&&(document.body.clientWidth||document.body.clientHeight))
{myWidth=document.body.clientWidth;myHeight=document.body.clientHeight;}
lcl_width=myWidth;lcl_height=myHeight;if(strMenu=='Y'){windowprops="location=yes,scrollbars=yes,menubar=yes,toolbar=yes,status=yes";}
else{windowprops="location=no,scrollbars=yes,menubar=no,toolbar=no,status=no";}
if(strResizable=='Y'){windowprops=windowprops+",resizable=yes";}
else{windowprops=windowprops+",resizable=no";}
if(lcl_height!=""){windowprops=windowprops+",height="+lcl_height;}
else
{lcl_height=((lcl_height*90)/100);windowprops=windowprops+",height="+lcl_height;}
if(lcl_width!=""){windowprops=windowprops+",width="+lcl_width;}
else
{lcl_width=((lcl_width*90)/100);windowprops=windowprops+",width="+lcl_width;}
window.open(page,"TravelAgentsPopUp",windowprops);}
function openBrandPage(url)
{var local_width=document.body.clientWidth;var local_height=document.body.clientHeight;if(typeof(window.innerWidth)=='number')
{myWidth=window.innerWidth;myHeight=window.innerHeight;}
else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight))
{myWidth=document.documentElement.clientWidth;myHeight=document.documentElement.clientHeight;}
else if(document.body&&(document.body.clientWidth||document.body.clientHeight))
{myWidth=document.body.clientWidth;myHeight=document.body.clientHeight;}
local_width=myWidth;local_height=myHeight;windowprops="location=yes,scrollbars=yes,menubar=yes,status=yes,toolbar=yes,resizable=yes";local_height=((local_height*90)/100);windowprops=windowprops+",height="+local_height;local_width=((local_width*90)/100);windowprops=windowprops+",width="+local_width;sendToMarriott(url,windowprops);}
function setPage(objElement,param)
{var curValue=objElement.options[objElement.selectedIndex].value;location.href=location.pathname+"?"+param+"="+curValue;}
function setPage(objElement)
{var curValue=objElement.options[objElement.selectedIndex].value;location.href=location.pathname+curValue;}
function GetAirportList(choice,form)
{var page="/search/getAirportList.mi?airportListType="+choice+"&formName="+form;windowprops="height=425,width=475,location=no,"
+"scrollbars=yes,menubar=no,toolbars=no,resizable=yes";window.open(page,"AirportListPopUp",windowprops);}
function submitOptions(actionPath,formname)
{var form=document.forms[formname];form.action=actionPath;form.submit();}
function montre(id)
{if(document.getElementById)
{document.getElementById(id).style.display="block";}
else if(document.all)
{document.all[id].style.display="block";}
else if(document.layers)
{document.layers[id].display="block";}
already_open=true;}
function callopen1(id)
{if(already_open)
{if(document.getElementById)
{document.getElementById(id).style.display="block";}
else if(document.all)
{document.all[id].style.display="block";}
else if(document.layers)
{document.layers[id].display="block";}}}
function cache(id)
{if(document.getElementById)
{document.getElementById(id).style.display="none";}
else if(document.all)
{document.all[id].style.display="none";}
else if(document.layers)
{document.layers[id].display="none";}
already_open=false;}
function cacheparent(id)
{if(document.getElementById)
{document.getElementById(id).style.display="none";}
else if(document.all)
{document.all[id].style.display="none";}
else if(document.layers)
{document.layers[id].display="none";}}
function sendToMarriott(path,winprop)
{var protocol=window.location.protocol;var hostLocation=window.location.host;var hostArray=hostLocation.split('.');var isGpSite="false";var isTaSite="false";for(var i=0;i<hostArray.length;i++)
{if(hostArray[i]=='grouppartners')
{isGpSite="true"}
else if(hostArray[i]=='travelagents')
{isTaSite="true";}}
var fullPopupPath=protocol+"//";if((isGpSite=="true")||(isTaSite=="true"))
{if(hostArray[0]=="www")
{for(var i=2;i<hostArray.length;i++)
{if(i!=hostArray.length-1)
{fullPopupPath+=hostArray[i]+".";}
else
{fullPopupPath+=hostArray[i]}}
fullPopupPath+=path.substring(path.indexOf(".com")+4);}
else
{for(var i=1;i<hostArray.length;i++)
{if(i!=hostArray.length-1)
{fullPopupPath+=hostArray[i]+".";}
else
{fullPopupPath+=hostArray[i];}}
fullPopupPath+=path.substring(path.indexOf(".com")+4);}}
else
{fullPopupPath+=hostLocation+path;}
if(winprop!='null')
{window.open(fullPopupPath,"_blank",winprop);}
else{window.open(fullPopupPath,"_blank")}}
function validateLength(field,maxlimit)
{if(field.value.length>maxlimit)
{field.value=field.value.substring(0,maxlimit);}}
function showConfirm(popupmessage,href)
{var message=popupmessage;var return_value=confirm(message);if(return_value==true)
{window.location=href;}}
function SetHotelCode(strHotelCode)
{for(i=0;i<window.opener.document.forms.length;i++)
{for(j=0;j<window.opener.document.forms[i].elements.length;j++)
{if(window.opener.document.forms[i].elements[j].name=="hotelCode"){window.opener.document.forms[i].elements[j].value=strHotelCode;window.opener.document.forms[i].elements[j].focus();window.close();}}}}
$(document).ready(function(){$('textarea').keyup(function(){var limit=400;var text=$(this).val();var chars=text.length;if(chars>limit){var new_text=text.substr(0,limit);$(this).val(new_text);}});});
