' + $('#cboxTitle').html()); } getRate(); } }); function showVideo(obj, data) { } $("div[colorbox=true]").css('cursor', 'pointer').colorbox({ transition: "fade", minWidth: 350, title: false }); }); function ajax() { if (typeof window.ActiveXObject != 'undefined') doc = new ActiveXObject("Microsoft.XMLHTTP"); else doc = new XMLHttpRequest(); } function getRate() { ajax(); if (doc) { doc.onreadystatechange = function () { if (doc.readyState == 4) if (doc.status == 200) { rr = eval('(' + doc.responseText + ')'); count_vote = rr.count_vote; estimation = rr.estimation; setBox(count_vote, defaulttext); if (estimation == -1 && authUser && mygender != gender && !myprofile) { $('#rateBoxImg').css('cursor', 'pointer') .click(function () { var rate = Math.round((scrX - getBounds(this).left) / heartwidth); if (rate >= 0 && rate <= 5) { ajax(); if (doc) { doc.onreadystatechange = function () { if (doc.readyState == 4) if (doc.status == 200) { $('#rateBoxImg').css('cursor', 'default') .unbind('click'); getRate(); } } doc.open("GET", "https://" + location.hostname + "/profile.php?com=rate&id_photo=" + uploadid + "&r=" + rate); doc.send(null); } } }); } $('#rateBoxText').html(defaulttext); } } doc.open("GET", "https://" + location.hostname + "/profile.php?com=getrate&id_photo=" + uploadid); doc.send(null); } else { $('rateBoxText').html('Unable to send'); } } function rateMouseMove(obj) { //	alert(scrX); if (estimation == -1) { var rate = Math.round((scrX - getBounds(obj).left) / heartwidth); setBox(rate, 'Rate it: '); } else { setBox(estimation, 'Your vote: '); } } function rateMouseOut() { setBox(count_vote, defaulttext); } function setBox(rate, text) { $('#rateBoxText').html(text); $('#rateBoxBar').css('left', $('#rateBoxImg').position().left + 'px'); $('#rateBoxBar').css('top', $('#rateBoxImg').position().top + 'px'); $('#rateBoxBar').width(Math.round(rate * heartwidth)); } function getBounds(element) { var left = element.offsetLeft; var top = element.offsetTop; for (var parent = element.offsetParent; parent; parent = parent.offsetParent) { left += parent.offsetLeft; top += parent.offsetTop; } return {left: left, top: top, width: element.offsetWidth, height: element.offsetHeight}; }