mh_lnk_divElem = "";
var MH_lnk_link = new Array();
MH_lnk_link[0] = new Array('mh_lnk_popup_item_add','mh_lnk_getHotel','mh_lnk_span_add','Add','0px 0px');
MH_lnk_link[1] = new Array('mh_lnk_popup_item_share','mh_lnk_getHotelShare','mh_lnk_span_share','Share','0px -16px');
MH_lnk_link[2] = new Array('mh_lnk_popup_item_register','mh_lnk_makeRegisterUser','mh_lnk_span_register','Register','0px -32px');
MH_lnk_link[3] = new Array('mh_lnk_popup_item_info','mh_lnk_moreInfo','mh_lnk_span_info','More Info','0px -48px');
MH_lnk_link[4] = new Array('mh_lnk_popup_item_hotelprices','mh_lnk_hotelPrices','mh_lnk_span_hotelprices','Hotel Prices','0px -64px');
MH_lnk_link[5] = new Array('mh_lnk_popup_item_logout','mh_lnk_logoutUser','mh_lnk_span_logout','Logout','0px -80px');
MH_lnk_link[6] = new Array('mh_lnk_popup_item_contact','mh_lnk_hotelContact','mh_lnk_span_contact','Contact Hotel','0px -96px');
MH_lnk_link[7] = new Array('mh_lnk_popup_item_mynote','mh_lnk_userNote','mh_lnk_span_mynote','My Notes','0px -112px');
//----------------------------------------------------
var mh_code_hotel = 'c96a3966d65b452275a3830e495e15e1';
var mh_type = 'lnk'; var menu_lnk_options = "
";
menu_lnk_options += "Register Guest ";
menu_lnk_options += "Login ";
menu_lnk_options += "Close ";
menu_lnk_options += "
";
//----------------------------------------------------
function mh_lnk_getHotel() {
mh_lnk_removeMenu();
mh_lnk_getData('mh_lnk_showAdded','add');
}
//----------------------------------------------------
function mh_lnk_getHotelShare() {
mh_lnk_removeMenu();
var contact = "Insert email addresses separated by a comma
";
var close_div = "";
mh_lnk_divElem.innerHTML = contact+close_div;
}
//----------------------------------------------------
function mh_lnk_sendShare() {
shared_user=document.getElementById("mh_lnk_shared_user").value;
mh_lnk_getData('mh_lnk_showAdded','share',shared_user,'')
}
//----------------------------------------------------
function mh_lnk_makeRegisterUser() {
mh_lnk_removeMenu();
var register = "";
var close_div = "Close
";
mh_lnk_divElem.innerHTML = register+close_div;
document.getElementById("mh_lnk_email_register").focus();
}
//----------------------------------------------------
function mh_lnk_registerUser() {
email_register=document.getElementById("mh_lnk_email_register").value;
var validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i;
var send = true;
if (email_register == "" || email_register == null || !isNaN(email_register) || email_register.charAt(0) == ' '){
alert("\"Email\" is a mandatory field.\nPlease retry.")
send = false;
}
// check valid email
if (email_register.search(validRegExp) == -1) {
alert('A valid email address is required.\nPlease retry');
send = false;
}
if (send == true)
mh_lnk_getData('mh_lnk_showAdded','register',email_register,'')
}
//----------------------------------------------------
function mh_lnk_makeLoginUser() {
var register = "";
var close_div = "Close
";
mh_lnk_divElem.innerHTML = register+close_div;
}
//----------------------------------------------------
function mh_lnk_loginUser() {
username=document.getElementById("mh_lnk_username").value;
password=document.getElementById("mh_lnk_password").value;
mh_lnk_getData('mh_lnk_restoreMenu','login',username,password)
}
//----------------------------------------------------
function mh_lnk_logoutUser() {
mh_lnk_removeMenu();
mh_lnk_getData('mh_lnk_showAdded','logout','','')
}
//----------------------------------------------------
function mh_lnk_moreInfo() {
mh_lnk_removeMenu();
var info = 'Keep useful, updated information about your favorite hotels in one easy-to-use place.
Memohotel ';
var close_div = "Close
";
mh_lnk_divElem.innerHTML = info+close_div;
}
//----------------------------------------------------
function mh_lnk_hotelPrices() {
mh_lnk_removeMenu();
mh_lnk_getData('mh_lnk_showPrice','prices');
}
//----------------------------------------------------
function mh_lnk_hotelContact() {
mh_lnk_removeMenu();
var contact = "Type a message to hotel
";
contact += " ";
contact += " ";
contact += " ";
var close_div = "Close
";
mh_lnk_divElem.innerHTML = contact+close_div;
}
//----------------------------------------------------
function mh_lnk_sendContact() {
contact_hotel=document.getElementById("mh_lnk_contact_hotel").value;
mh_lnk_getData('mh_lnk_showAdded','contact','','','',contact_hotel)
}
//----------------------------------------------------
function mh_lnk_userNote() {mh_lnk_getData('mh_lnk_showNote','note');}
//----------------------------------------------------
function mh_lnk_getData(callback,action,username,password,note_user_match_trip,message_to_hotel) {
var dt = new Date();
var request = 'http://www.memohotel.com/GiveHotel.php?mh_code_hotel=' + mh_code_hotel + '&action=' + action + '&callback=' + callback + "&username=" + username + "&password=" + password + "¬e_user_match_trip=" + note_user_match_trip + "&message_to_hotel=" + message_to_hotel + '&random=' + dt.getTime();
var oScript = document.getElementById("dynamic_script_injection_node");
var head = document.getElementsByTagName("head").item(0);
if (oScript) {
head.removeChild(oScript);
}
//----------------------------------------------------
script = document.createElement("script");
script.setAttribute("id", "dynamic_script_injection_node");
script.setAttribute("type", "text/javascript");
script.setAttribute("src", request);
head.appendChild(script);
}
//----------------------------------------------------------------
function mh_lnk_restoreMenu() {
mh_lnk_divElem.innerHTML = '';
mh_lnk_menuDiv();
}
//----------------------------------------------------------------
function mh_lnk_showAdded(Hotel) {
if(Hotel.status != "error"){
var message = ""+Hotel.message+" ";
var name_hotel = ""+Hotel.name_hotel+"
";
var close_div = "Close
";
mh_lnk_divElem.innerHTML = message+name_hotel+close_div;
}else{
var message = ""+Hotel.message+" ";
var close_div = "Close
";
if (Hotel.name_hotel != 'disable')
mh_lnk_divElem.innerHTML = message+menu_lnk_options;
else
mh_lnk_divElem.innerHTML = message+close_div;
}
}
//----------------------------------------------------------------
function mh_lnk_updateNote() {
document.getElementById("mh_lnk_send_update").disabled = true;
mh_lnk_getData('mh_lnk_updatedNote','update_note','','',encodeURIComponent(document.getElementById("note_user_match_trip").value));
}
function mh_lnk_updatedNote() {
alert('Note Saved Saccesfully!');
document.getElementById("mh_lnk_send_update").disabled = false;
}
//----------------------------------------------------------------
function mh_lnk_removeMenu() {
if (!document.getElementById("mh_lnk_innerpopup_head"))
return;
for (i=7; i>=0; i--){
var oHead = document.getElementById(MH_lnk_link[i][0]);
var oScript = document.getElementById(MH_lnk_link[i][2]);
oHead.removeChild(oScript);
}
for (i=7; i>=0; i--){
if (i < 4)
oHead = document.getElementById("mh_lnk_popup_leftcol");
else
oHead = document.getElementById("mh_lnk_popup_rightcol");
oScript = document.getElementById(MH_lnk_link[i][0]);
oHead.removeChild(oScript);
}
oHead = document.getElementById("mh_lnk_innerpopup_body");
oHead.removeChild(document.getElementById("mh_lnk_popup_rightcol"));
oHead.removeChild(document.getElementById("mh_lnk_popup_leftcol"));
oHead.removeChild(document.getElementById("mh_lnk_div_clear"));
oHead = document.getElementById("mh_lnk_mainmenu");
oHead.removeChild(document.getElementById("mh_lnk_div_footer"));
oHead.removeChild(document.getElementById("mh_lnk_innerpopup_body"));
oHead.removeChild(document.getElementById("mh_lnk_innerpopup_head"));
}
//----------------------------------------------------------------
function mh_lnk_showNote(Note) {
mh_lnk_removeMenu();
if(Note.status != "error"){
var note_user_match_trip = ""
note_user_match_trip += ""+Note.note_user_match_trip+" ";
note_user_match_trip += " ";
note_user_match_trip += " ";
var close_div = "Close
";
mh_lnk_divElem.innerHTML = note_user_match_trip+close_div;
}else{
var message = ""+Note.message+" ";
var close_div = "Close
";
if (Note.name_hotel != 'disable')
mh_lnk_divElem.innerHTML = message+menu_lnk_options;
else
mh_lnk_divElem.innerHTML = message+close_div;
}
}
//----------------------------------------------------------------
function mh_lnk_showPrice(Price) {
if(Price.status != "error"){
var price_single = "Single "+Price.price_single_hotel+" " + Price.symbol_currency + " Your price: "+Price.price_single_match_trip+" " + Price.symbol_currency + "
";
var price_double = "Double "+Price.price_double_hotel+" " + Price.symbol_currency + " Your price: "+Price.price_double_match_trip+" " + Price.symbol_currency + "
";
var price_suite = "Suite "+Price.price_suite_hotel+" " + Price.symbol_currency + " Your price: "+Price.price_suite_match_trip+" " + Price.symbol_currency + "
";
var close_div = "Close
";
mh_lnk_divElem.innerHTML = price_single+price_double+price_suite+close_div;
}else{
var message = ""+Price.message+" ";
mh_lnk_divElem.innerHTML = message+menu_lnk_options;
}
}
//---------------------------------------------------------------
function mh_lnk_showPopup(){
document.getElementById("mh_lnk_innerpopup").style.display='block';
obj_container = document.getElementById("mh_lnk_divPopup_container");
height_container = document.getElementById("mh_lnk_divPopup_container").offsetHeight;
height_popup = document.getElementById("mh_lnk_innerpopup").offsetHeight;
heightBrowser = document.documentElement.clientHeight;
var curtop = 0;
if (obj_container.offsetParent) {
do {
curtop += obj_container.offsetTop;
} while (obj_container = obj_container.offsetParent);
}
if((curtop + height_container + height_popup) >= heightBrowser){
var new_pos = curtop-height_popup;
document.getElementById("mh_lnk_innerpopup").style.top = new_pos + 'px';
}
} //---------------------------------------------------------------
function mh_lnk_hidePopup(){
document.getElementById("mh_lnk_innerpopup").style.display='none';
}
//-------------------------------------------------------------
function mh_lnk_mainDiv(){
var divPopup_container = document.getElementById("mh_lnk_divPopup_container");
divPopup_container.style.width = "250px";
divPopup_container.style.height = "10px";
divPopup_container.style.cursor = "pointer";
divPopup_container.style.zIndex = '9999999';
divPopup_container.innerHTML = " Add this hotel to memohotel";
divPopup_container.onmouseover = mh_lnk_showPopup;
divPopup_container.onmouseout = mh_lnk_hidePopup;
//----------------------------------------------------
var innerpopup = document.createElement("div");
innerpopup.id = "mh_lnk_innerpopup";
innerpopup.style.font = "10pt tahoma";
innerpopup.style.lineHeight = "1em";
innerpopup.style.outlineStyle = "none";
innerpopup.style.border = "1px solid rgb(204, 204, 204)";
innerpopup.style.margin = "0px";
innerpopup.style.padding = "1px";
innerpopup.style.background = "rgb(255, 255, 255) none repeat scroll 0% 0%";
innerpopup.style.overflow = "visible";
innerpopup.style.color = "rgb(76, 76, 76)";
innerpopup.style.cssFloat = "none";
innerpopup.style.styleFloat = "none";
innerpopup.style.lineHeight = "1em";
innerpopup.style.textAlign = "left";
innerpopup.style.width = "270px";
innerpopup.style.height = "140px";
innerpopup.style.position = "absolute";
innerpopup.style.display = "none";
document.getElementById("mh_lnk_divPopup_container").appendChild(innerpopup);
mh_lnk_divElem = document.getElementById ("mh_lnk_innerpopup");
}
//----------------------------------------------------
var mh_lnk_mainmenu = document.createElement("div");
function mh_lnk_menuDiv(){
mh_lnk_mainmenu.id = "mh_lnk_mainmenu";
mh_lnk_mainmenu.style.width = "270px";
mh_lnk_mainmenu.style.height = "140px";
document.getElementById("mh_lnk_innerpopup").appendChild(mh_lnk_mainmenu);
var innerpopup_head = document.createElement("div");
innerpopup_head.id = "mh_lnk_innerpopup_head";
innerpopup_head.style.borderBottom = "1px solid rgb(229, 229, 229)";
innerpopup_head.style.padding = "4px";
innerpopup_head.style.background = "rgb(242, 242, 242) none repeat scroll 0% 0%";
innerpopup_head.style.position = "relative";
innerpopup_head.innerHTML = "Add to your Memohotel";
document.getElementById("mh_lnk_mainmenu").appendChild(innerpopup_head);
//----------------------------------------------------
var innerpopup_body = document.createElement("div");
innerpopup_body.id = "mh_lnk_innerpopup_body";
innerpopup_body.style.padding = "4px";
document.getElementById("mh_lnk_mainmenu").appendChild(innerpopup_body);
//----------------------------------------------------
var popup_leftcol = document.createElement("div");
popup_leftcol.id = "mh_lnk_popup_leftcol";
popup_leftcol.style.width = "130px";
popup_leftcol.style.cssFloat = "left";
popup_leftcol.style.styleFloat = "left";
document.getElementById("mh_lnk_innerpopup_body").appendChild(popup_leftcol);
//----------------------------------------------------
var popup_rightcol = document.createElement("div");
popup_rightcol.id = "mh_lnk_popup_rightcol";
popup_rightcol.style.width = "130px";
popup_rightcol.style.cssFloat = "right";
popup_rightcol.style.styleFloat = "right";
document.getElementById("mh_lnk_innerpopup_body").appendChild(popup_rightcol);
//----------------------------------------------------
for (i=0; i<8; i++){
//----------------------------------------------------
var popup_item_add = document.createElement("div");
popup_item_add.id = MH_lnk_link[i][0];
popup_item_add.style.margin = "1px";
popup_item_add.style.padding = "2px 3px";
popup_item_add.style.width = "115px";
popup_item_add.style.border = "1px solid rgb(255, 255, 255)";
popup_item_add.style.backgroundColor = "rgb(255, 255, 255)";
popup_item_add.style.color = "rgb(76, 76, 76)";
if (i < 4)
document.getElementById("mh_lnk_popup_leftcol").appendChild(popup_item_add);
else
document.getElementById("mh_lnk_popup_rightcol").appendChild(popup_item_add);
document.getElementById(MH_lnk_link[i][0]).onmouseover = function(){
this.style.border = "1px solid rgb(229, 229, 229)";
this.style.backgroundColor = "rgb(242, 242, 242)";
this.style.color = "rgb(0, 0, 0)";
}
document.getElementById(MH_lnk_link[i][0]).onmouseout = function(){
this.style.border = "1px solid rgb(255, 255, 255)";
this.style.backgroundColor = "rgb(255, 255, 255)";
this.style.color = "rgb(76, 76, 76)";
}
popup_item_add.onclick = eval(MH_lnk_link[i][1]);
//----------------------------------------------------
var span_add = document.createElement("span");
span_add.id = MH_lnk_link[i][2];
span_add.innerHTML = MH_lnk_link[i][3];
span_add.style.background = "transparent url(http://s4.memohotel.com/widget/images/widget_mh.png) no-repeat scroll left center";
span_add.style.display = "block";
span_add.style.height = "16px";
span_add.style.lineHeight = "16px";
span_add.style.paddingLeft = "20px";
span_add.style.backgroundPosition = MH_lnk_link[i][4];
span_add.style.cursor = "pointer";
document.getElementById(MH_lnk_link[i][0]).appendChild(span_add);
}
//----------------------------------------------------
var div_clear = document.createElement("div");
div_clear.id = "mh_lnk_div_clear";
div_clear.style.clear = "both";
document.getElementById("mh_lnk_innerpopup_body").appendChild(div_clear);
//----------------------------------------------------
var div_footer = document.createElement("div");
div_footer.id = "mh_lnk_div_footer";
div_footer.innerHTML = "Memohotel ";
div_footer.style.overflow = "hidden";
div_footer.style.display = "block";
div_footer.style.outlineStyle = "none";
div_footer.style.cssFloat = "right";
div_footer.style.styleFloat = "right";
div_footer.style.marginRight = "3px";
div_footer.style.outlineWidth = "medium";
div_footer.style.outlineColor = "rgb(76, 76, 76)";
document.getElementById("mh_lnk_mainmenu").appendChild(div_footer);
}
document.write('');
mh_lnk_mainDiv();mh_lnk_menuDiv();