function getURLParameter(name) { return unescape( (RegExp(name + '=' + '(.+?)(&|$)').exec(location.search)||[,null])[1] ); } function ratingstarshover(parent, value){ var starslocation = 'http://zwelangola.com/znoticias/images/'; for(i=1; i<=5; i++){ if(value < i){ document.getElementById(parent+'_stars_'+i).src = starslocation + 'stars_6.png'; }else{ document.getElementById(parent+'_stars_'+i).src = starslocation + 'stars_7.png'; } } } function ratearticle(parent, rating){ $(document).ready(function() { $(function() { $.ajax({ type : "POST", url: "http://www.zwelangola.com/znoticias/addrating.php", data : "parent=" + parent + "&ratingvalue=" + rating, success: function(html){ alert(html); return false; }, error:function (xhr, ajaxOptions, thrownError){ alert(xhr.status); alert(thrownError); } }); }); }); } $(document).ready(function() { $(function() { $('#commentsform').submit(function(){ var id = getURLParameter('id'); var name = $('#name').val(); var email = $('#email').val(); var message = $('#message').val(); var skey = $('#skey').val(); var cachekey = $('#cachekey').val(); var location = $('#location').val(); var recaptcha_response_field = document.getElementById('recaptcha_response_field').value; var recaptcha_challenge_field = document.getElementById('recaptcha_challenge_field').value; $.ajax({ type : "POST", url: "http://www.zwelangola.com/znoticias/addcomment.php", data : "id="+id+"&name="+name+"&location="+location+"&email="+email+"&message="+message+"&skey="+skey+"&recaptcha_response_field="+recaptcha_response_field+"&recaptcha_challenge_field="+recaptcha_challenge_field+"&cachekey="+cachekey, success: function(html){ alert(html); window.location.reload(); if(document.getElementById('skey')){ document.getElementById('skeyimage').src = document.getElementById('skeyimage').src + '#' + (new Date()).getTime(); }else if(document.getElementById('recaptcha_div')){ Recaptcha.create("6Lc8JgwAAAAAAI5NI_jBvrXrcgysIijSoKDa-UHx", "recaptcha_div", { callback: Recaptcha.focus_response_field }); } return false; }, error:function (xhr, ajaxOptions, thrownError){ alert(xhr.status); alert(thrownError); } }); return false; }); }); });