function getXMLHTTPRequest() { BloggXML=null if (window.XMLHttpRequest) { req=new XMLHttpRequest() } else if (window.ActiveXObject) try { req = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { try { req = new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) { req = null; } } return req; } var BloggXML = getXMLHTTPRequest(); function ChangeOpacity(element,opacity) { if(opacity >= 100) { document.getElementById('' + element + '').style.opacity = '1.00'; document.getElementById('' + element + '').style.filter = 'alpha(opacity=100)'; } else { document.getElementById('' + element + '').style.opacity = '0.' + opacity + ''; } document.getElementById('' + element + '').style.filter = 'alpha(opacity=' + opacity + ')'; } function ChangeDisplay(id,show) { if (show == 1) { document.getElementById(id).style.display = 'block'; } else { document.getElementById(id).style.display = 'none'; } } function ShowBloggComments() { ChangeDisplay('BloggCommentsDiv', 1); //ChangeDisplay('BloggCommentFormDiv', 0); //ChangeDisplay('BloggTipsaDiv', 0); //document.getElementById('CommentsButtonDiv').style.background = 'url(/dagboken/bilder/design/kommentarerVisaBg2.gif)'; //document.getElementById('CommentButtonDiv').style.background = 'url(/dagboken/bilder/design/kommenteraBg.gif)'; //document.getElementById('TipsaButtonDiv').style.background = 'url(/dagboken/bilder/design/tipsaenvanBg.gif)'; } function ShowCommentForm() { ChangeDisplay('BloggCommentFormDiv', 1); ChangeDisplay('BloggCommentsDiv', 0); ChangeDisplay('BloggTipsaDiv', 0); document.getElementById('CommentsButtonDiv').style.background = 'url(/dagboken/bilder/design/kommentarerVisaBg.gif)'; document.getElementById('CommentButtonDiv').style.background = 'url(/dagboken/bilder/design/kommenteraBg2.gif)'; document.getElementById('TipsaButtonDiv').style.background = 'url(/dagboken/bilder/design/tipsaenvanBg.gif)'; } function ShowTipsaForm() { ChangeDisplay('BloggTipsaDiv', 1); ChangeDisplay('BloggCommentFormDiv', 0); ChangeDisplay('BloggCommentsDiv', 0); document.getElementById('CommentsButtonDiv').style.background = 'url(/dagboken/bilder/design/kommentarerVisaBg.gif)'; document.getElementById('CommentButtonDiv').style.background = 'url(/dagboken/bilder/design/kommenteraBg.gif)'; document.getElementById('TipsaButtonDiv').style.background = 'url(/dagboken/bilder/design/tipsaenvanBg2.gif)'; } function BloggSendComment(lid){ if(document.getElementById('BloggFormText').value.length >= 1000) { return false } if(document.getElementById('BloggFormName').value == 'Namn...') { alert('Du måste fylla i ditt namn!'); return false } if(document.getElementById('BloggFormName').value == '') { alert('Du måste fylla i ditt namn!'); return false } if(document.getElementById('BloggFormText').value == 'Skriv kommentar här...') { alert('Du har inte skrivit någon kommentar!'); return false } if(document.getElementById('BloggFormText').value == '') { alert('Du har inte skrivit någon kommentar!'); return false } BloggXML.open("GET", "/dagboken/includes/bloggfunktioner_ajax.asp?action=saveComment&lid=" + lid + "&namn=" + escape(document.getElementById('BloggFormName').value) + "&kommentar=" + escape(document.getElementById('BloggFormText').value) + "", true); BloggXML.onreadystatechange = BloggSendComment_action; BloggXML.send(null); document.getElementById('BloggCommentFormDiv').innerHTML = 'Skickar din kommentar...'; } function BloggSendComment_action() { if (BloggXML.readyState==4 || BloggXML.readyState=='complete'){ document.getElementById('BloggCommentFormDiv').innerHTML = 'Tack för din kommentar!'; //document.getElementById('BloggCommentFormDiv').innerHTML = BloggXML.responseText; } } function BloggSendToFriend(lid){ BloggXML.open("GET", "/dagboken/ajax/tipsa.asp?post=ja&lid=" + lid + "&MEpost=" + escape(document.getElementById('MEpost').value) + "&MNamn=" + escape(document.getElementById('MNamn').value) + "&AEpost=" + escape(document.getElementById('AEpost').value) + "&ANamn=" + escape(document.getElementById('ANamn').value) + "&AKommentar=" + escape(document.getElementById('AKommentar').value) + "", true); BloggXML.onreadystatechange = BloggSendToFriend_action; BloggXML.send(null); document.getElementById('BloggTipsaDiv').innerHTML = 'Skickar iväg ett mail till din vän... vänligen vänta.'; } function BloggSendToFriend_action() { if (BloggXML.readyState==4 || BloggXML.readyState=='complete'){ document.getElementById('BloggTipsaDiv').innerHTML = BloggXML.responseText; } } function BloggGetComment(lid){ BloggXML.open("GET", "/dagboken/includes/bloggfunktioner_ajax.asp?action=getComments&lid=" + lid + "", true); BloggXML.onreadystatechange = BloggGetComment_action; BloggXML.send(null); document.getElementById('BloggCommentsDiv').innerHTML = 'Hämtar kommentarer...'; } function BloggGetComment_action() { if (BloggXML.readyState==4 || BloggXML.readyState=='complete'){ text = BloggXML.responseText; document.getElementById('BloggCommentsDiv').innerHTML = text; } } function toggle(arr_elementIDs, link) { var linktext = link.firstChild; var elementToToggle for (var i=0;i