var xmlFeed=false; var gecko= (document.implementation && document.implementation.createDocument) ? true:false; var ie= (window.ActiveXObject && document.all) ? true:false; // FIX MIMETYPES/DOCUMENT HEADERS FOR GECKO // By Vladdy from CodingForums.com function fixXmlMimeType(filename) { oxmlhttp = null; try { oxmlhttp = new XMLHttpRequest(); oxmlhttp.overrideMimeType("text/xml"); } catch(e) { try { oxmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { return null; } } if (!oxmlhttp) return null; try { oxmlhttp.open("GET", filename, false); oxmlhttp.send(null); } catch(e) { return null; } return oxmlhttp.responseXML; } // IMPORT XML DOCUMENT // Code from the Public Domain function importXML(FeedParserRSSFile) { // For Gecko Browsers if (gecko) { xmlFeed = document.implementation.createDocument("", "", null); xmlFeed.async=false; xmlFeed = fixXmlMimeType(FeedParserRSSFile); } // For IE/Win else if (ie) { xmlFeed = new ActiveXObject("Microsoft.XMLDOM"); xmlFeed.async=false; xmlFeed.load(FeedParserRSSFile); } // If a browser doesn't support this, do nothing. else return false; // If it's all good, return the object. if (typeof xmlFeed != "undefined") return xmlFeed; else return false; } function rating(id,rate) { result = importXML('rate.php?id='+id+'&rate='+rate); document.getElementById('rating').innerHTML = 'Average grade: ' + result.getElementsByTagName('rating')[0].firstChild.data; document.getElementById('rating-title').innerHTML = 'Grade (vote casted)'; }