function open_popup(c,b,d,a){window.open(c,b,"toolbar=0,status=0,resizeable=0,width="+d+",height="+a)}function externalLinks(){if(!document.getElementsByTagName){return}var c=document.getElementsByTagName("a");for(var b=0;b<c.length;b++){var a=c[b];if(a.getAttribute("href")&&a.getAttribute("rel")=="external"){a.target="_blank"}}}function bookmark(a,c){if((navigator.appName=="Microsoft Internet Explorer")&&(parseInt(navigator.appVersion)>=4)){window.external.AddFavorite(a,c)}else{var b="Windows:\nPrima CRTL+D para adicionar aos favoritos.\n\n";b+="Mac:\nCommand+D para adicionar aos favoritos.";alert(b)}}function stopScroll(){clearTimeout(scrolldelay)}function pageScroll(){window.scrollBy(0,-50);if(window.pageYOffset==0){scrolldelay=setTimeout("pageScroll()",1);document.getElementById("go-to-top").blur();stopScroll()}else{if(document.documentElement.scrollTop==0&&navigator.appName=="Microsoft Internet Explorer"){scrolldelay=setTimeout("pageScroll()",1);document.getElementById("go-to-top").blur();stopScroll()}else{scrolldelay=setTimeout("pageScroll()",1)}}}function searchBlur(b){var a=document.getElementById(b);if(a.value.strip()==""){a.value="Pesquisar..."}else{a.value=a.value.strip()}a.blur()}function searchFocus(b){var a=document.getElementById(b);if(a.value=="Pesquisar..."){a.value=""}}function searchSubmit(a){if($("sType").value=="0"){loadAlertMessageBox("oops","Para pesquisar escolha o tipo de pesquisa.");return false}else{if($("searchInputField").value.strip()==""||$("searchInputField").value.strip()=="Pesquisar..."){loadAlertMessageBox("oops","Para pesquisar introduza um critério de pesquisa.");return false}}if(a==0){return true}else{$("searchForm").submit()}}function linkBlur(b){var a=document.getElementById(b);if(a.value.indexOf("http://")==-1&&a.value!=""){a.value="http://"+a.value}}function linkFocus(b){var a=document.getElementById(b);if(a.value.indexOf("http://")!=-1){a.value=a.value.replace("http://","")}}function timeBlur(b){var a=document.getElementById(b);if(a.value==""){a.value="00"}if(a.value.length==1){a.value="0"+a.value}}function timeFocus(b){var a=document.getElementById(b);if(parseInt(a.value)==0){a.value=""}}function priceBlur(b){var a=document.getElementById(b);if(a.value==""){a.value="0"}}function priceFocus(b){var a=document.getElementById(b);if(parseInt(a.value)==0){a.value=""}}function priceDecimalBlur(b){var a=document.getElementById(b);if(a.value==""){a.value="00"}if(a.value.length==1){a.value="0"+a.value}}function priceDecimalFocus(b){var a=document.getElementById(b);if(parseInt(a.value)==0){a.value=""}}function onlyNumbers(b){var a;var c;if(window.event){a=window.event.keyCode}else{if(b){a=b.which}else{return true}}c=String.fromCharCode(a);if((a==null)||(a==0)||(a==8)||(a==9)||(a==13)||(a==27)){return true}else{if(("0123456789").indexOf(c)>-1){return true}else{return false}}}function notSpaces(b){var a;var c;if(window.event){a=window.event.keyCode}else{if(b){a=b.which}else{return true}}c=String.fromCharCode(a);if((a==null)||(a==0)||(a==8)||(a==9)||(a==13)||(a==27)){return true}else{if(!((" ").indexOf(c)>-1)){return true}else{return false}}}function textCharsLimit(e,b,d){var c=document.getElementById(d);var a=document.getElementById(e);if(a.value.length>b){a.value=a.value.substring(0,b)}else{c.innerHTML=b-a.value.length}}function inputBlur(a){a.style.backgroundColor="#FFF";a.style.borderColor="#D9D9D9"}function inputFocus(a){a.style.backgroundColor="#CCFF00";a.style.borderColor="#749100"}function inputTextBlur(c,b){var a=document.getElementById(c);if(a.value.strip()==""){a.value=b}else{a.value=a.value.strip()}a.blur()}function inputTextFocus(c,b){var a=document.getElementById(c);if(a.value==b){a.value=""}}function htmlspecialcharsToString(a){while(a.indexOf("&amp;")!=-1){a=a.replace("&amp;","&")}while(a.indexOf("&quot;")!=-1){a=a.replace("&quot;",'"')}while(a.indexOf("&#039;")!=-1){a=a.replace("&#039;","'")}while(a.indexOf("&lt;")!=-1){a=a.replace("&lt;","<")}while(a.indexOf("&gt;")!=-1){a=a.replace("&gt;",">")}return a}function StringTohtmlspecialchars(a){while(a.indexOf("&")!=-1){a=a.replace("&","&amp;")}while(a.indexOf('"')!=-1){a=a.replace('"',"&quot;")}while(a.indexOf("'")!=-1){a=a.replace("'","&#039;")}while(a.indexOf("<")!=-1){a=a.replace("<","&lt;")}while(a.indexOf(">")!=-1){a=a.replace(">","&gt;")}return a};