function newFreeCap(id,noImageMessage){if(document.getElementById){var theImage=document.getElementById("tx_srfreecap_pi2_captcha_image_"+id);var parts=theImage.src.split("&");var LParameterInUse=(typeof(parts[2])!="undefined")&&(parts[2].indexOf("L=")!=-1);theImage.src=parts[0]+"&"+parts[1]+(LParameterInUse?"&"+parts[2]:"")+"&set="+Math.round(Math.random()*100000);}else{alert(noImageMessage?noImageMessage:"Sorry, we cannot autoreload a new image. Submit the form and a new image will be loaded.");}}
function playCaptcha(id,wavURL,noPlayMessage){if(document.getElementById){var theAudio=document.getElementById("tx_srfreecap_pi2_captcha_playAudio_"+id);var wavURLForOpera=wavURL+"&nocache="+Math.random();while(theAudio.firstChild){theAudio.removeChild(theAudio.firstChild);}
var objectElement=document.createElement("object");objectElement.setAttribute("id","tx_srfreecap_pi2_captcha_playAudio_object"+id);objectElement.setAttribute("type","audio/x-wav");objectElement.setAttribute("data",wavURLForOpera);objectElement.setAttribute("height",0);objectElement.setAttribute("width",0);try{objectElement.innerHTML='<a href="'+wavURLForOpera+'">'+(noPlayMessage?noPlayMessage:'Sorry, we cannot play the word of the image.')+'</a>';}catch(e){objectElement.setAttribute("altHTML",'<a href="'+wavURLForOpera+'">'+(noPlayMessage?noPlayMessage:'Sorry, we cannot play the word of the image.')+'</a>');}
theAudio.appendChild(objectElement);window.setTimeout("addAudioCaptchaParams('"+id+"');",50);}else{alert(noPlayMessage?noPlayMessage:"Sorry, we cannot play the word of the image.");}}
function addAudioCaptchaParams(id){var theAudio=document.getElementById("tx_srfreecap_pi2_captcha_playAudio_"+id);var objectElement=theAudio.firstChild;var url=objectElement.getAttribute("data");var parameters={"type":"audio/x-wav","filename":url,"src":url,"autoplay":true,"autoStart":1,"hidden":true,"controller":false};for(var parameter in parameters){if(parameters.hasOwnProperty(parameter)){var paramElement=document.createElement("param");paramElement.setAttribute("value",parameters[parameter]);paramElement.setAttribute("name",parameter);paramElement=objectElement.appendChild(paramElement);}}}
