/*======================================================================*\
|| #################################################################### ||
|| # vBulletin 4.0.0 Alpha 5
|| # ---------------------------------------------------------------- # ||
|| # Copyright ©2000-2009 Jelsoft Enterprises Ltd. All Rights Reserved. ||
|| # This file may not be redistributed in whole or significant part. # ||
|| # ---------------- VBULLETIN IS NOT FREE SOFTWARE ---------------- # ||
|| # http://www.vbulletin.com | http://www.vbulletin.com/license.html # ||
|| #################################################################### ||
\*======================================================================*/
function vB_AJAX_BlogRate_Init(D){var C=fetch_object(D);if(AJAX_Compatible&&(typeof vb_disable_ajax=="undefined"||vb_disable_ajax<2)&&C){for(var B=0;B<C.elements.length;B++){if(C.elements[B].type=="submit"){var E=C.elements[B];var A=document.createElement("input");A.type="button";A.className=E.className;A.value=E.value;A.onclick=vB_AJAX_BlogRate.prototype.form_click;E.parentNode.insertBefore(A,E);E.parentNode.removeChild(E)}}}}function vB_AJAX_BlogRate(A){this.formobj=A;this.pseudoform=new vB_Hidden_Form("blog.php");this.pseudoform.add_variable("ajax",1);this.pseudoform.add_variable("s",fetch_sessionhash());this.pseudoform.add_variable("securitytoken",SECURITYTOKEN);this.pseudoform.add_variables_from_object(A);this.output_element_id="blograting_current"}vB_AJAX_BlogRate.prototype.handle_ajax_response=function(E){if(E.responseXML){var B=E.responseXML.getElementsByTagName("error");if(B.length){if(vBmenu.activemenu=="blograting"){vBmenu.hide()}alert(B[0].firstChild.nodeValue)}else{var F=E.responseXML.getElementsByTagName("voteavg");if(F.length&&F[0].firstChild&&F[0].firstChild.nodeValue!=""){fetch_object(this.output_element_id).innerHTML=F[0].firstChild.nodeValue}if(vBmenu.activemenu=="blograting"){vBmenu.hide()}var C=YAHOO.util.Dom.get("rating_ratedyes");var A=YAHOO.util.Dom.get("rating_ratedno");if(C&&A){A.style.display="none";C.style.display=""}var D=E.responseXML.getElementsByTagName("message");if(D.length){alert(D[0].firstChild.nodeValue)}}}};vB_AJAX_BlogRate.prototype.rate=function(){if(this.pseudoform.fetch_variable("vote")!=null){YAHOO.util.Connect.asyncRequest("POST","blog.php?b="+blogid+"&vote="+PHP.urlencode(this.pseudoform.fetch_variable("vote")),{success:this.handle_ajax_response,failure:this.handle_ajax_error,timeout:vB_Default_Timeout,scope:this},this.pseudoform.build_query_string())}};vB_AJAX_BlogRate.prototype.handle_ajax_error=function(A){vBulletin_AJAX_Error_Handler(A);this.formobj.submit()};vB_AJAX_BlogRate.prototype.form_click=function(){var A=new vB_AJAX_BlogRate(this.form);A.rate();return false};