function defaultInsertion() { link = document.createElement('a'); link.setAttribute('href', 'http://www.dzmeteo.com'); img = document.createElement('img'); img.setAttribute('alt', 'DzMeteo logo'); img.setAttribute('src', 'http://www.dzmeteo.com/images/logo.png'); img.style.border = 'none'; link.appendChild(img); return link; } function init() { if((document.getElementById('dzmeteosuperid') == null) || (document.getElementById('dzmeteosuperid').getAttribute('href') != 'http://www.dzmeteo.com/')) { var link = defaultInsertion(); document.body.appendChild(link); if(document.getElementById('dzmeteosuperid').getAttribute('href') != 'http://www.dzmeteo.com') { alert(document.getElementById('dzmeteosuperid').getAttribute('href')); } } else { var anchor = document.getElementById('dzmeteosuperid'); if('' == 'error') { var link = defaultInsertion(); anchor.parentNode.insertBefore(link, anchor); } else { var div_info = document.createElement('div'); div_info.setAttribute('id', 'dzmeteosuperdiv'); div_info.style.border = '0px solid #000000'; div_info.style.background = '#FFFFFF'; div_info.style.color = '#000000'; div_info.style.width = '150px'; div_info.style.fontFamily = 'sans'; div_info.style.padding = '5px'; div_info.style.fontSize = '11px'; div_info.onmouseover = function() {this.style.cursor = 'pointer';} div_info.onclick = function() {window.open('http://www.dzmeteo.com');} var text_title = document.createTextNode(''); var title = document.createElement('b'); title.style.color = '#0000FF'; title.style.display = 'block'; title.style.textAlign = 'center'; title.style.textDecoration = 'underline'; title.style.fontSize = '14px'; title.appendChild(text_title); div_info.appendChild(title); var conditions = 'Très nuageux'; var temperature_ressentie = 'Température ressentie: 13 °C'; var icon = 'http://dzmeteo.com/images/93x93/28.png'; var humidite = 'Humidité: 77% %'; var vent = 'Vent: Du sud-ouest à19 km/h Km/h'; var l_soleil = 'Lever du soleil: 07:43'; var c_soleil = 'Coucher du soleil: 18:21'; var all_text = document.createElement('div'); var town = document.createTextNode('Maintenant à Alger'); town_tag = document.createElement('b'); town_tag.appendChild(town); all_text.appendChild(town_tag); all_text.appendChild(document.createElement('br')); if(typeof(icon) != 'undefined') { var image = document.createElement('img'); image.setAttribute('src', icon); image.setAttribute('alt', 'temps qu\il fait'); image.style.display = 'block'; image.style.styleFloat = 'right'; image.style.cssFloat = 'right'; image.style.padding = '0px 30px'; all_text.appendChild(image); } if(typeof(conditions) != 'undefined') { var cond = document.createElement('div'); cond.width = '150px'; cond.appendChild(document.createTextNode(conditions)); all_text.appendChild(cond); all_text.appendChild(document.createElement('br')); } if(typeof(temperature_ressentie) != 'undefined') { all_text.appendChild(document.createTextNode(temperature_ressentie)); all_text.appendChild(document.createElement('br')); } if(typeof(humidite) != 'undefined') { all_text.appendChild(document.createTextNode(humidite)); all_text.appendChild(document.createElement('br')); } if(typeof(vent) != 'undefined') { all_text.appendChild(document.createTextNode(vent)); all_text.appendChild(document.createElement('br')); } if(typeof(l_soleil) != 'undefined') { all_text.appendChild(document.createTextNode(l_soleil)); all_text.appendChild(document.createElement('br')); } if(typeof(c_soleil) != 'undefined') { all_text.appendChild(document.createTextNode(c_soleil)); all_text.appendChild(document.createElement('br')); } all_text.style.width = '150px'; div_info.appendChild(all_text); var clear = document.createElement('div'); clear.style.clear = 'both'; div_info.appendChild(clear); anchor.parentNode.insertBefore(div_info, anchor); } } } window.onload = init;