/** * Create a picture link that opens a popup * with a svarbox * @param int id The Svarbox Id * @param string alt Optional alt/title text for link * @param string divName The div to append this to, if skipped then written out * on the spot */ function sb_openPicture (id, alt, divName) { sb_openTextNoBreak (id, sb_getImage (id, alt), alt, divName ); } /** * Create a text link that opens a popup * with Svarbox * @param int id The svarbox id * @param string text The text to be embedded into (note: can be html) * @param string alt Optional alt/title text for link * @param string divName The div to append this to, if skipped then written out * on the spot */ function sb_openText (id, text, alt, divName) { sb_outDiv ( sb_getLinkPopup (id, text, alt)+" ", divName ); } /** * Create a text link with different text when someone * is around or not * @param int id The Svarbox id * @param string textOn The text to display when online * @param string textOff The text to display when offline * @param string alt Optional alt/title text for link */ function sb_openTextOffline (id, textOn, textOff, alt, divName) { var isOn = sb_isOn (id); if (isOn === undefined) { // Warning: this should not // happen if javascript is fetched // correctly isOn = true; } var text = (isOn) ? textOn : textOff; sb_openText (id, text, alt, divName); } function sb_openTextNoBreak (id, text, alt, divName) { sb_outDiv ( sb_getLinkPopup (id, text, alt), divName ); } /** * Internal stuff * Please don't use anything below externally as * they can change without notice. * Contact gsm@modernus.is for changes. */ var isOnArr = new Array(); isOnArr[1030] = false; var sb_baseUrl = "http://svarbox.teljari.is/"; var sb_baseUrlSecure = "https://svarbox.teljari.is/"; /** * @param int id The svarbox id * @return boolean True if on, False if off and undefined * if not known. Note: pass ?c=id to the javascript file * to make sure that id is known. */ function sb_isOn (id) { return isOnArr[id]; } function sb_out (text) { document.write (text); } function sb_outDiv (text, divName) { var el = sb_getElement (divName); if (el === null) { sb_out (text); } else { el.innerHTML = text; } } function sb_getPath (id) { return sb_baseUrl + "?c="+id; } function sb_getLinkPopup (id, embed, alt) { if (alt == undefined) { alt = "Svarbox"; } return "" + embed + ""; } function sb_getImage (id, alt) { if (alt == undefined) { alt = "Svarbox"; } return "\""+"; } function sb_getImagePath (id) { return sb_baseUrl + "/customer/button/?c="+id; } function sb_popupPage (popurl, w, h) { var windowprops = "location=no,scrollbars=yes,menubars=no," + "toolbars=no,resizable=yes" + ",left=50,top=50,width=" + w + ",height=" + h; popup = window.open (popurl,"MenuPopup",windowprops); } function sb_getElement (el) { if (document.getElementById){ return document.getElementById (el); } else if (document.all){ return document.all (el); } else { return null; } }