function toggleSendToFriend(){if($("sendtofriendform")){$("stfemailfrom").value="";$("stfemailto").value="";Effect.toggle("sendtofriendform","appear",{duration:0.5})}}function sendToFriend(){var C=$("stfemailfrom").value;var B=$("stfemailto").value;var E=$("sftvideo").value;var D=HTTP_MAIN+"Video/ajax/sendtofriend?from="+C+"&to="+B+"&videoId="+E;var A=new Ajax.Request(D,{method:"get",onSuccess:function(G){var F=G.responseText;toggleSendToFriend();$("sendtofriendresponse").update(F)}})}function storeRating(C,D){var B=HTTP_MAIN+"Video/ajax/storerating?r="+C+"&videoId="+D+"";var A=new Ajax.Request(B,{method:"get",onSuccess:function(E){if(E.responseText.length>2){updateMsg=E.responseText;getRating(D);$("ratingresponse").update(updateMsg)}}})}function getRating(C){var B=HTTP_MAIN+"Video/ajax/getrating?&videoId="+C+"";var A=new Ajax.Request(B,{method:"get",onSuccess:function(E){if(E.responseText.length>2){var D=E.responseText.evalJSON(true);if(D[0]!=0){$("ratingTxt").update(D[0]+"/5")}$("ratingGfx").writeAttribute("style","width: "+D[1]+"%")}}})}Event.observe(window,"load",function(){if($("sentofriendtoggle")){Event.observe("sentofriendtoggle","click",toggleSendToFriend)}if($("stfemailclose")){Event.observe("stfemailclose","click",toggleSendToFriend)}if($("stfemailsend")){Event.observe("stfemailsend","click",sendToFriend)}});