urlBase="http://www.linkws.com";var linkIndicID=13;function resizeWindow(width,height,centralized){window.resizeTo(width,height);if(centralized!=false){var top=(screen.height/2)-(height/2);var left=(screen.width/2)-(width/2);}window.moveTo(left,top);}function openWindow(url,name,width,height,centralized,params){var position="";if(params==null){params="";}else {params=","+params;}if(centralized!=false){var top=(screen.height/2)-(height/2);var left=(screen.width/2)-(width/2);position="top="+top+",left="+left;}params=position+",width="+width+",height="+height+params;return window.open(url,name,params);}function putAnItem(theList,name,value,index){var option=new Option(name,value);if(index==null) index=theList.length;theList.options[index]=option;}function multiSelect(select,i){for (var j=0;j<i.length;j++)select.options[j].selected=i[j];}function swap(s1,from,to){var option1=s1.options[from];var option2=s1.options[to];putAnItem(s1,option1.value,option1.value,to);putAnItem(s1,option2.value,option2.value,from);}function sync(select1,select2){var i=new Array(select1.options.length);for (var j=0;j<i.length;j++)i[j]=select1.options[j].selected;multiSelect(select1,i);multiSelect(select2,i);}function selItem(select,i){var selIndex=new Array(select.options.length);selIndex[i]=true;multiSelect(select,selIndex);}function deleteAnItem(theList,itemNo){theList.options[itemNo]=null}function insertAnItem(theList,item){var option=new Option(item,item);theList.options[theList.length]=option;}function isCheckGroup(element){return (element.checked+""=="undefined");}function showLinkIndic_1(id){var LI=window.open(urlBase+'/webservices/li/link_indic.jsp?userProductID='+id+"&url="+escape(location.href),'link_Indic','height=340,width=402,scrolling=no');}function showLinkComunic(){openWindow(urlBase+'/webservices/lc/teste.htm','link_Comunic',600,350);}function checkAll(checksInput,isToCheck){if(checksInput.checked==null){for (var i=0;i<checksInput.length;i++){checksInput[i].checked=isToCheck;}}else {checksInput.checked=isToCheck;}}function updateChecks(checksInput,allCheckInput){var allChecked=true;if(checksInput.checked==null){for(var i=0;i<checksInput.length;i++){if(!checksInput[i].checked){allChecked=false;break;}}}else {allChecked=checksInput.checked;}if(allCheckInput!=null){allCheckInput.checked=allChecked;}return allChecked;}function selectAll(element){if(element.options==null){element.select();}else {for (var j=0;j<element.options.length;j++)element.options[j].selected=true;}}function Validator(preMsg){this.firstErrorField=null;if(preMsg!=null){this.msg=preMsg;}else {this.msg="Há informações erradas ou incompletas no formulário. Erros:\n\n";}this.validateSimpleTextField=validateSimpleTextField;this.validateVariableField=validateVariableField;this.validateNumberTextField=validateNumberTextField;this.validateUrlTextField=validateUrlTextField;this.validateEmailField=validateEmailField;this.validateComboField=validateSimpleTextField;this.validateCheckGroup=validateCheckGroup;this.doLog=doLog;this.processLog=processLog;}function validateSimpleTextField(element,errorMsg){if(element.value==""){this.doLog(element,errorMsg);return false;}return true;}function validateVariableField(element,errorMsg){var str=element.value;if(str==""||!isNaN(str.charAt(0))){this.doLog(element,errorMsg);return false;}for (var i=0;i<str.length;i++){if(!((str.charAt(i) >= 'a'&&str.charAt(i) <= 'z')||(str.charAt(i) >= 'A'&&str.charAt(i) <= 'Z') ||(str.charAt(i) >= '0'&&str.charAt(i) <= '9') ||(str.charAt(i)=='_'))){this.doLog(element,errorMsg);return false;}}return true;}function validateNumberTextField(element,maxValue,minValue,errorMsg){if(element.value!=""&&(isNaN(element.value)||(maxValue!=null&&element.value>maxValue)||(minValue!=null&&element.value<minValue))){this.doLog(element,errorMsg);return false;}return true;}function validateUrlTextField(element,errorMsg){var httpUrl=element.value;if(httpUrl==""){this.doLog(element,errorMsg);return false;}if(httpUrl.length<"http://".length){this.doLog(element,"URL inválida. Ela provavelmente não possui http://");return false;}if(httpUrl.substring(0,"http://".length)!="http://" ){this.doLog(element,"URL inválida. Ela deve conter http://");return false;}if(httpUrl.length<"http://".length+1){this.doLog(element,"URL inválida. Ela tem que conter algum dado além de http://");return false;}var dotPos=httpUrl.indexOf(".");if(dotPos==-1){this.doLog(element,"URL inválida. Ela tem que conter um ponto.");return false;}if(!(dotPos>"http://".length&&dotPos<httpUrl.length-1)){this.doLog(element,"URL inválida. O caminho não existe ou está incorreto.");return false;}return true;}function validateEmailField(element,errorMsg){var email=element.value;var atPos=email.indexOf("@");var dotPos=email.indexOf(".");if(email!=""){if(atPos<1||dotPos<1||dotPos==email.length-1||atPos==email.length-1 ||email.length<6||email.indexOf(' ')!=-1 ||dotPos==atPos+1||dotPos==atPos-1||atPos!=email.lastIndexOf("@")||email.indexOf("..")!=-1){this.doLog(element,errorMsg);return false;}}return true;}function validateCheckGroup(element,errorMsg){var ok=false;if(isCheckGroup(element)){for (var i=0;i<element.length;i++){if( element[i].checked){ok=true;}}}else {ok=element.checked;}if(!ok){this.doLog(element,errorMsg);return false;}return true;}function doLog(element,newMsg){if(this.firstErrorField==null){this.firstErrorField=element;}else {this.msg += "\n";}this.msg += "- "+newMsg;}function processLog(){if(this.firstErrorField!=null){alert(this.msg);if(!isCheckGroup(this.firstErrorField)){this.firstErrorField.focus();this.firstErrorField.select();}}return (this.firstErrorField==null);}function strReplace(text,searchFor,replaceStr){var re=new RegExp(searchFor,'gi');text=text.replace(re,replaceStr);return text;}function limitTextArea(mf,cf,m){if(mf.value.length>m){mf.value=mf.value.substring(0,m);}else{if(cf!=null){cf.value=m-mf.value.length;}}}