var TimeToFade=2000;var swapInterval=6000;fadeItems=new Array();fadeIdx=0;function initFader(){var a=initFader.arguments;for(var i=0;i<a.length;i++){fadeItems[i]=a[i]}fadeIdx=0;swapItemsTaskID=setInterval("swapFadeItems()",swapInterval)}function swapFadeItems(){var a=fadeIdx==fadeItems.length-1?0:fadeIdx+1;startFade(fadeItems[a],fadeItems[fadeIdx]);fadeIdx=a}function startFade(a,b){var c=document.getElementById(a);var d=document.getElementById(b);if(c==null){return}if(d==null){return}c.style.display="block";c.FadeTimeLeft=TimeToFade;setTimeout("crossFade("+new Date().getTime()+",'"+a+"','"+b+"')",33)}function crossFade(a,b,c){var d=new Date().getTime();var e=d-a;var f=document.getElementById(b);var g=document.getElementById(c);if(f.FadeTimeLeft<=e){f.style.opacity="1";f.style.filter="alpha(opacity = 100)";f.style.display="block";g.style.opacity="0";g.style.filter="alpha(opacity = 0)";g.style.display="none";return}f.FadeTimeLeft-=e;var h=1-f.FadeTimeLeft/TimeToFade;var i=f.FadeTimeLeft/TimeToFade;f.style.opacity=h;f.style.filter="alpha(opacity = "+(h*100)+")";g.style.opacity=i;g.style.filter="alpha(opacity = "+(i*100)+")";setTimeout("crossFade("+d+",'"+b+"','"+c+"')",33)}function stopFade(){clearInterval(swapItemsTaskID)}function pop(a,b,c){var d="new_wnd";var e=1;var f=0;var g=0;var h=0;if(screen){g=(screen.width/2)-(b/2);h=(screen.height/2)-(c/2)}var i=window.open("/pop.html?"+a,d,"height="+c+",width="+b+",status=0,toolbar=0,resizable="+e+",scrollbars="+f+",menubar=0,location=0,directories=0,left="+g+",top="+h+"")}function changeCase(a){inptext=document.getElementById(a).value;outtext="";delim=".?!";punc=",.?!:;)' ";caseflag=1;inptext=inptext.toLowerCase();for(i=0;i<inptext.length;i++){chr=inptext.charAt(i);if(caseflag==1){puncflag=0;for(j=0;j<punc.length;j++){if(chr==punc.charAt(j)){puncflag=1;j=punc.length}}if(puncflag==1){outtext=outtext+chr}else{outtext=outtext+chr.toUpperCase();caseflag=0}}else{delimflag=0;for(j=0;j<delim.length;j++){if(chr==delim.charAt(j)){delimflag=1;j=delim.length}}if(delimflag==1){caseflag=1}outtext=outtext+chr}}document.getElementById(a).value=outtext;return false}function formatCurrency(a){var b=new RegExp("(-?[0-9]+)([0-9]{3})");a=a.toString().replace(/\,/g,"");a=!isNaN(a)?Math.round(a*100)/100:0;a.toString().indexOf(".")==-1?a+=".00":void 0;while(/\.\d{0,1}$/.test(a)){a+="0"}while(b.test(a)){a=a.toString().replace(b,"$1,$2")}return a}function checkClassifieds(){var a=document.getElementById("seller-trd").checked?1:0;var b=3;var c=1;var d=2;if(a==1){document.getElementById("highlightblock").style.display="block";document.getElementById("priceblock").style.display="block";if(document.getElementById("tradephoto").checked){document.getElementById("photoblock").style.display="block"}else{document.getElementById("photoblock").style.display="none"}if(document.getElementById("highlight").checked){b=b+c}if(document.getElementById("tradephoto").checked){b=b+d}document.getElementById("adprice").innerHTML="&pound;"+formatCurrency(b)}else{document.getElementById("highlightblock").style.display="none";document.getElementById("priceblock").style.display="none";document.getElementById("photoblock").style.display="block"}}function wordCount(a,b,c){var d=0;var e=a.value;for(var x=0;x<=e.length;x++){if(e.charAt(x)==" "&&e.charAt(x-1)!=" "){d++}}document.getElementById(c).innerHTML=(b-d);if(d>b){document.getElementById(c).className="toolong"}else{document.getElementById(c).className=""}}function doKeypress(a,b){var c=a.value;if(b&&wordCount(c)>b-1){return false}else{}}
