if(typeof (IXIGO)=="undefined"){IXIGO={}}IXIGO.HotelPartnerProfile=function(){var A=this;this.manageProps;
this.keeptabs;this.clean=false;this.tabs=["login","properties"];this.init=function(){this.manageProps=new IXIGO.OfflineProperties();
this.manageProps.init();$.each(this.tabs,function(B,C){$("#"+C).click(function(D){A.tabClick(this,D)})
});this.keeptabs="properties";if(window.location.hash!==""){this.keeptabs=window.location.hash.substring(1);
$("html, body").attr("scrollTop",0)}this.switchTo($("#form\\:whichpage").val()||this.keeptabs)};this.tabClick=function(E,B){var C="";
var D=B.target;while(D!=E&&!D.getAttribute("action")){D=D.parentNode}if(!this.clean){$.each(this.tabs,function(F,G){A.revert("#"+G)
});this.clean=true}this.revert("#"+this.keeptabs);this.keeptabs=D.id;this.switchTo(this.keeptabs);this.removeMessages()
};this.removeMessages=function(){$("div#infoContent .error").hide()};this.revert=function(B){$(B).attr("class","link");
$(B+"_form").hide()};this.switchTo=function(C){var B="#"+C;$(B).attr("class","");$(B+"_form").show();
$("#form\\:whichpage").val(C)}};IXIGO.OfflineHotel=function(){var A=null;this.pictureComponent=new IXIGO.PictureComponent();
this.amenitiesJson=null;this.amenitiesMap={"1":"internetAccess","2":"parking","3":"swimmingPool","4":"barOrLounge","5":"spa","6":"fitnessRoom"};
this.init=function(){A=this;this.pictureComponent.init();$("#registerButton").mouseover(function(E){IXIGO.buttonHover("#registerButton","b-","-bg-2")
}).mouseout(function(E){IXIGO.buttonHover("#registerButton","b-","-bg-2")});$("#cancelButton").click(function(){window.location.href="/secure/hotel/myixigo.ixi#properties"
}).mouseover(function(E){IXIGO.buttonHover("#cancelButton","b-","-bg-2")}).mouseout(function(E){IXIGO.buttonHover("#cancelButton","b-","-bg-2")
});$("#offlineHotelForm\\:registerOfflineHotel").click(function(){A.fill()});$("#offlineHotelForm\\:htl_where").keypress(function(E){return E.keyCode!=13
});$("input:radio","#partnerAuthBox").click(function(){$("#agreeBox").css("display",(this.value==1?"block":"none"))
});var D=new Autocompleter.Ajax();var B={indicator:"offlineHotelForm:htl_where",className:"autocomplete twozeronine",secure:true,width:"227"};
var C="https://"+window.location.hostname+":"+window.location.port;D.initialize("offlineHotelForm:htl_where",C+"/secure/action/content/intlcity?searchFor=city&value=",B);
$("#offlineHotelForm\\:referrer").val(document.referrer);$('input:radio[@value="'+$("#offlineHotelForm\\:registerOrLogin").val()+'"]',"#partnerAuthBox").trigger("click");
$.each($("#offlineHotelForm\\:hotelAmenities").val(),function(F,E){if(F<6){$("#offlineHotelForm\\:"+A.amenitiesMap[F+1])[0].checked=(E==1)
}else{return false}});$.getJSON("/secure/action/content/hotel?searchFor=amenities",function(E){A.amenitiesJson=E
})};this.fill=function(){$("#offlineHotelForm").attr({"enctype":"application/x-www-form-urlencoded","encoding":"application/x-www-form-urlencoded","target":"_self","action":"/secure/hotel/registerOfflineHotels.ixi"});
var B=this.pictureComponent.getUploads();$("#offlineHotelForm\\:pictures").val(B[0]);$("#offlineHotelForm\\:pictureNames").val(B[1]);
$("#offlineHotelForm\\:registerOrLogin").val($("input:radio[@checked]","#partnerAuthBox").val());var C=[];
$.each(this.amenitiesJson,function(E,D){if(A.amenitiesMap[E]){C[C.length]=($("#offlineHotelForm\\:"+A.amenitiesMap[E])[0].checked?1:0)
}else{C[C.length]=0}});$("#offlineHotelForm\\:hotelAmenities").val(C.join(""))};this.dopictureupload=function(B){this.pictureComponent.upload(B)
};this.onpictureupload=function(B){this.pictureComponent.callback(B)};this.onpictureunselect=function(C,B){this.pictureComponent.onunselect(C,B)
}};IXIGO.PictureComponent=function(){var A=null;this.count=0;this.sid=0;this.uploads={};this.uploadmutex=true;
var B=",";this.init=function(){A=this;$("#picAttachOne, #picAttachAnother").click(function(){A.addInputComponent()
});this.readPastUploads()};this.readPastUploads=function(){var E=$("#offlineHotelForm\\:pictures").val();
var D=$("#offlineHotelForm\\:pictureNames").val();if(E&&D){var C=[E.split(B),D.split(B)];$.each(C[0],function(H,F){var I=A.rnd();
var G={"name":F,"filename":C[1][H],"modifiedFileName":F};A.addFileUploaded(I,G);A.count=A.count+1});this.afterDisplay()
}};this.createNewInputFile=function(D){var C=document.createElement("input");C.setAttribute("id","input_"+D);
C.setAttribute("name","input_"+D);C.setAttribute("type","file");C.setAttribute("size","30");C.setAttribute("readonly","true");
C.setAttribute("style","float: left; margin-top: 0px;");return C};this.addInputComponent=function(){var D=this.rnd();
var C=""+'<div id="remove_'+D+'" class="link" style="outline:none; float:left; font-size:80%; padding: 5px;">remove</div>'+'<div id="progress_'+D+'" style="display: none; float: left; padding: 5px 0;"><img src="'+IXIGO.getStaticPath()+'/img/progress-bg.gif" /></div>'+'<div class="clear" />'+'<div id="error_'+D+'" style="display:none;margin:0px 1px 0px 15px;width:350px;"></div>';
$('<div id="'+D+'" />').append($(A.createNewInputFile(D))).append(C).appendTo("#picContainer");$("#input_"+D).change(function(E){A.upload(D)
});$("#remove_"+D).click(function(E){A.removeInputComponent(D)});A.count=A.count+1;this.afterDisplay()
};this.removeInputComponent=function(C){$("#"+C+", #frame_"+C).remove();A.count=A.count-1;this.afterDisplay()
};this.afterDisplay=function(){if(A.count>0){$("#picAttachOne").hide();$("#picAttachAnother").css("display",(A.count<5)?"inline":"none")
}else{A.count=0;$("#picAttachOne").show();$("#picAttachAnother").hide()}};this.upload=function(C){if(A.uploadmutex){A.uploadmutex=false;
A.sid=C;$("#error_"+C).hide();if(!$("#frame_"+C)[0]){$("#frameContainer").append(["<iframe",'id="frame_'+C+'"','name="frame_'+C+'"','src="/secure/blank.ixi"','style="border: 0; height: 0; width: 0; padding: 0; position: absolute;"',"/>"].join(" "))
}$("#offlineHotelForm").attr({"enctype":"multipart/form-data","encoding":"multipart/form-data","method":"post","target":"frame_"+C,"action":"/secure/action/upload"});
$("#progress_"+C).show();$("#offlineHotelForm")[0].submit()}else{setTimeout(function(){A.upload(C)},7000)
}};this.callback=function(D){try{var C=Ajax.evalJSON(D);var E=(C["name"])?C["name"].substr(C["name"].indexOf("_")+1):null;
$("#progress_"+E).hide();if(!C["error"]){A.addFileUploaded(E,C)}else{if(!E){E=A.sid}$("#input_"+E).remove();
$(A.createNewInputFile(E)).insertBefore("#remove_"+E);$("#input_"+E).change(function(F){A.upload(E)});
$("#error_"+E).html('<div class="error" style="" id="messages"><ul><li>'+C["msg"]+"</li></ul></div>").show()
}}finally{A.uploadmutex=true}};this.addFileUploaded=function(E,C){var D=""+'<div id="box_'+E+'">'+'<span><input id="check_'+E+'" name="check_'+E+'" type="checkbox" checked="true" value="'+C["name"]+'" class="checkBox" /></span>'+"<span> "+C["filename"]+(C["type"]?" ("+C["type"]+")":"")+"</span>"+"</div>";
$("#picUploaded").append(D);$("#"+E+", #frame_"+E).remove();A.uploads[C["modifiedFileName"]]=C["filename"];
$("#check_"+E).click(function(){setTimeout("window.offlineHotel.onpictureunselect('check_"+E+"', '"+C["modifiedFileName"]+"')",2000)
})};this.onunselect=function(D,C){if(!($("#"+D).attr("checked"))){$("#"+D.replace(/check/,"box")).remove();
A.uploads[C]=null;A.count=A.count-1;this.afterDisplay()}};this.getUploads=function(){var D=[];var C=[];
$.each(A.uploads,function(F,E){if(E){D.push(F);C.push(E)}});return[D.join(B),C.join(B)]};this.rnd=function(){return String((new Date()).getTime()).replace(/\D/gi,"")
}};IXIGO.OfflineProperties=function(){var B=null;var A,C;var D;this.init=function(){B=this;D=$("table.ixiGrid");
IXIGO.Alert.init();this.form=document.forms.form;A=$("#propertyMsgBox");C=$("#propertyMsg");if(C.html()){A.show()
}D.find("thead th:first input.checkBox").click(function(){var E=this.checked;D.find("tbody tr").each(function(){$(this).find("td:first input.checkBox")[0].checked=E
})});D.find("tbody tr").click(function(E){B.onClickProperty(this,E)}).end().find(".ixi-paynow").each(function(){var E=$(this);
E.mouseover(function(){IXIGO.buttonHover("#"+this.id,"","")}).mouseout(function(){IXIGO.buttonHover("#"+this.id,"","")
})});$("#addProperty").click(function(){window.location.href="/secure/hotel/registerOfflineHotels.ixi"
}).mouseover(function(E){IXIGO.buttonHover("#addProperty","","")}).mouseout(function(E){IXIGO.buttonHover("#addProperty","","")
});$("#delProperty").click(function(E){B.onClickDelete(E)}).mouseover(function(E){IXIGO.buttonHover("#delProperty","","")
}).mouseout(function(E){IXIGO.buttonHover("#delProperty","","")});$("#buySubscription").click(function(E){B.onClickBulkBuy(E)
}).mouseover(function(E){IXIGO.buttonHover("#buySubscription","","")}).mouseout(function(E){IXIGO.buttonHover("#buySubscription","","")
})};this.showInfo=function(E){C.html(E);A.css({"background-color":"#FAD55A","color":"#444"}).show()};
this.showError=function(E){C.html(E);A.css({"background-color":"#FBE3D4","color":"#D12E18"}).show()};
this.resetError=function(){A.hide();D.find("tbody tr").each(function(){$(this).removeClass("error")})
};this.onClickProperty=function(I,G){var E=G.target;while(E!==I&&!E.getAttribute("invoke")){E=E.parentNode
}var F=E.getAttribute("invoke");if(F){this.resetError();args=E.id.split("-");if(F=="delete"){IXIGO.Alert.show({type:"warn",msg:"your property will be deleted permanently?",buttons:["ok","cancel"]},function(J){if(J=="ok"){window.location.href="/secure/offline?q=delete-"+args[1]
}})}else{if(F=="pay"){var H=E.id.substring(6);IXIGO.Alert.show({type:"info",msg:B.getPrePayConfirmMsg([{"name":E.getAttribute("propName"),"city":E.getAttribute("ct"),"country":E.getAttribute("cc")}]),buttons:["ok","cancel"],width:"520px"},function(J){if(J=="ok"){window.location.href="/secure/offline?q=pay-"+H
}})}}}G.stopPropagation()};this.onClickDelete=function(G){this.resetError();var F=[];var E=D.find("td input:checkbox[@checked]");
if(E.length>0){E.each(function(){F[F.length]=this.value});IXIGO.Alert.show({type:"warn",msg:"your "+(F.length==1?"property":"properties")+" will be deleted permanently?",buttons:["ok","cancel"]},function(H){if(H=="ok"){window.location.href="/secure/offline?q=delete-"+F.join("-")
}})}else{this.showError("no property selected to delete")}G.stopPropagation()};this.onClickBulkBuy=function(I){this.resetError();
var H=[];var F=[];var G=D.find("td input:checkbox[@checked]");if(G.length>0){var E=0;G.each(function(){var J=parseInt(this.getAttribute("status"),10);
if(!isNaN(J)&&J>2){$(this).parent().parent().addClass("error");E++}else{H[H.length]=this.value;F[F.length]={"name":this.getAttribute("propName"),"city":this.getAttribute("ct"),"country":this.getAttribute("cc")}
}});if(E===0){IXIGO.Alert.show({type:"info",msg:B.getPrePayConfirmMsg(F),buttons:["ok","cancel"],width:"520px"},function(J){if(J=="ok"){window.location.href="/secure/offline?q=pay-"+H.join("-")
}})}else{this.showError("you have already subscribed to the following selected "+(E==1?"property":"properties")+".")
}}else{this.showError("no property selected to subscribe")}I.stopPropagation()};this.getPrePayConfirmMsg=function(F){var E=F.length;
var G=""+'<table id="propertiesInvoice" cellspacing="0" cellpadding="0">'+'<tr><th></th><th>Description</th><th class="txt-r">Amount in INR</th></tr>'+'<tr class="spacer"><td colspan="3"></td></tr>'+'<tr class="sep-b"><td>&#160;</td><td>Subscription Fee to list below mentioned '+(E>1?"properties":"property")+" on iXiGO.com for a period of 12 months</td><td>&#160;</td></tr>";
var I=0;for(var H=0;H<E;H++){G+='<tr class="spacer"><td colspan="3"></td></tr>'+"<tr"+(F[H].country=="IN"?"":' class="sep-b"')+"><td>"+(H+1)+".</td><td><strong>"+F[H].name+", "+F[H].city+'</strong></td><td class="sep-r txt-r">5000</td></tr>';
I+=5000;if(F[H].country=="IN"){G+='<tr class="sep-b"><td>&#160;</td><td class="txt-r">Service Tax</td><td class="sep-r txt-r">515</td></tr>';
I+=515}}G+=""+'<tr class="spacer"><td colspan="3"></td></tr>'+'<tr class="sep-b"><td>&#160;</td><td><strong>Total</strong></td><td class="txt-r"><strong>'+I+"</strong></td></tr>"+'<tr><td colspan="3">note: 10.3% service tax applicable for hotels within India</td></tr>'+"</table>";
return G}};