function initTooltip() { var items = getElementsByClassName('tooltip', 'SPAN', document); for (var i = 0; i < items.length; i++) { items[i].onclick = function() {return showTooltip(this);} } var option = document.getElementById('show-wizard'); if (option) { option.onclick = function(e) {return switchTipsOption(this);} } var ie_ver = getInternetExplorerVersion(); if (ie_ver != -1 && ie_ver < 8) { xmlhttpPost('/action/a_get_tip/', 'id=23&once=yes', showIEwarning); } } function showIEwarning(resp) { var result = splitEx(resp, ' ', 2); if (result[0] == 'ok') { var tip = splitEx(result[1], ',', 4); configurePopup(tip[0],tip[1],tip[2],tip[3]); openPopup('wizard-popup'); } } function showTooltip(item) { var parts = splitEx(item.id, '-', 2); xmlhttpPost('/action/a_get_tip/', 'id='+parts[1], showInfo); } function showInfo(resp) { var result = splitEx(resp, ' ', 2); if (result[0] == 'ok') { var tip = splitEx(result[1], ',', 4); configurePopup(tip[0],tip[1],tip[2],tip[3]); openPopup('wizard-popup'); } else { alertPopup("No se ha podido cargar la informacion solicitada"); } } function configurePopup(hid, title, image, msg) { var popup = document.getElementById('wizard-popup'); var item = getElementsByClassName('popup', 'SPAN', popup)[0]; item.id = 'hid-' + hid; item = getElementsByClassName('popup-title', 'SPAN', popup)[0]; item.innerHTML = title; item = document.getElementById('mouse'); item.src = image; item = document.getElementById('wizard-message'); item.innerHTML = msg; item = getElementsByClassName('hide-wizard', 'DIV', popup)[0]; item.style.display = "none"; } function myClosePopup(item, name) { closePopup(item); var popup = document.getElementById('autoopen'); if (popup) { popup.id = name; } } function switchTipsOption(item) { var state = item.checked; xmlhttpPost('/action/a_switch_tips/', 'state='+state); } addLoadEvent(initTooltip);