
var IE=new Number(document.all?1:0);function error_handler(msg,url,line){var str_error="Javascript error:\n\n"+msg+"\nLine "+line+"\n"+url+"\n\n";if(IE==1)event.returnValue=null;return 1;};function getEl(id){var el;try{el=document.getElementById(id);return el;}catch(e){}};function add_propertie(id,prop,value,doc){if(!doc)doc=document;doc.getElementById(id)[prop]+=value;};function set_propertie(id,prop,value,doc){if(!doc)doc=document;try{doc.getElementById(id)[prop]=value;}catch(e){}};function get_propertie(id,prop,doc){if(!doc)doc=document;return doc.getElementById(id)[prop];};function set_display(id,value,doc){if(!doc)doc=document;var el=doc.getElementById(id);try{el.style.display=value;}catch(e){if(value=='table')el.style.display='block';}};function get_display(id,doc){if(!doc)doc=document;return doc.getElementById(id).style.display;};function set_visibility(id,value,doc){if(!doc)doc=document;try{doc.getElementById(id).style.visibility=value;}catch(e){}};function get_visibility(id,doc){if(!doc)doc=document;return doc.getElementById(id).style.visibility;};function change_src(objeto,nsrc,doc){if(IE==0)set_propertie(objeto,'src','',doc);set_propertie(objeto,'src',nsrc,doc);};function cancelEvent(e){if(e){e.returnValue=0;e.cancelBubble=1;if(typeof(e.stopPropagation)!='undefined')e.stopPropagation();if(typeof(e.preventDefault)!='undefined')e.preventDefault();}return 0;};
function isValidSize(formname,fieldname,onsizechange){var width=document.forms[formname][fieldname+'_width'].value;var height=document.forms[formname][fieldname+'_height'].value;if(!isInteger(width,350)){document.forms[formname][fieldname+'_width'].focus();return 0;}else if(!isInteger(height,350)){document.forms[formname][fieldname+'_height'].focus();return 0;}document.forms[formname][fieldname].value=width+'x'+height;try{eval(onsizechange+'();');}catch(e){}return 1;}function isInteger(value,minvalue){var ok=(parseInt(value)==value);if(!ok)return 0;if(minvalue)return(value>=minvalue);}function isemail(email){var result=((email.indexOf("@")> 0)&&(email.indexOf(".")> 0));return result;}function freegroup_select(formname,fieldname){var ck=document.forms[formname]['checkbox'+fieldname].checked;if(ck){document.forms[formname]['text'+fieldname].style.display="block";document.forms[formname]['select_'+fieldname].style.display="none";document.forms[formname][fieldname].value=document.forms[formname]['text'+fieldname].value;}else{document.forms[formname]['text'+fieldname].style.display="none";document.forms[formname]['select_'+fieldname].style.display="block";document.forms[formname][fieldname].value=get_select_value(document.forms[formname]['select_'+fieldname]);}}function freegroup_onchange(formname,fieldname){if(!document.forms[formname]['text'+fieldname].value){document.forms[formname]['checkbox'+fieldname].checked=0;}else{document.forms[formname]['checkbox'+fieldname].checked=1;document.forms[formname][fieldname].value=document.forms[formname]['text'+fieldname].value;}freegroup_select(formname,fieldname);}function is_radio_selected(formname,fieldname){if(!document.forms[formname][fieldname].length){return document.forms[formname][fieldname].checked;}for(var x=0;x<document.forms[formname][fieldname].length;x++){if(document.forms[formname][fieldname][x].checked &&(document.forms[formname][fieldname][x].value && document.forms[formname][fieldname][x].value!=0)){return 1;}}return 0;}function force_submit(formname,new_action){document.forms[formname].onsubmit="";document.forms[formname].action=new_action;document.forms[formname].submit();}function total_checkbox_selected(formname,fieldname,options){var checkedfound=0;options=options.split(",");for(var index in options){var obj=document.forms[formname][fieldname+"["+options[index]+"]"];if(!obj)return;if(obj.checked){checkedfound++;}}return checkedfound;}function get_select_value(obj){var selectedIndex=obj.selectedIndex;return obj.options[selectedIndex].value;}function is_select_selected(formname,fieldname){var selectedIndex=document.forms[formname][fieldname].selectedIndex;if(selectedIndex<0){return 0;}else{if(!document.forms[formname][fieldname].options[selectedIndex].value || document.forms[formname][fieldname].options[selectedIndex].value==0){return 0;}}return 1;}function update_date(formname,fieldname){var day=0,month=0,year=0;var selectedIndex=document.forms[formname]["day_"+fieldname].options.selectedIndex;if(selectedIndex){day=document.forms[formname]["day_"+fieldname].options[selectedIndex].value;}var selectedIndex=document.forms[formname]["month_"+fieldname].options.selectedIndex;if(selectedIndex){month=document.forms[formname]["month_"+fieldname].options[selectedIndex].value;}var selectedIndex=document.forms[formname]["year_"+fieldname].options.selectedIndex;if(selectedIndex){year=document.forms[formname]["year_"+fieldname].options[selectedIndex].value;}if(year==0 || month==0 || day==0)document.forms[formname][fieldname].value="";else document.forms[formname][fieldname].value=year+"-"+month+"-"+day;}function update_time(formname,fieldname){var hour=0,minute=0;var selectedIndex=document.forms[formname]["hour_"+fieldname].options.selectedIndex;if(selectedIndex){hour=document.forms[formname]["hour_"+fieldname].options[selectedIndex].value;}var selectedIndex=document.forms[formname]["minute_"+fieldname].options.selectedIndex;if(selectedIndex){minute=document.forms[formname]["minute_"+fieldname].options[selectedIndex].value;}document.forms[formname][fieldname].value=hour+":"+minute;}function image_onchange(formname,fieldname){var src=document.forms[formname][fieldname].value;change_src("_image_type"+fieldname,src);}function blink_validation_field(formname,fieldname,counter){var bgcolor=document.getElementById("label_validation_"+fieldname).style.color;bgcolor=(bgcolor=='black')?'red':'black';if(counter>=14){bgcolor='black';}else{setTimeout("blink_validation_field('"+formname+"','"+fieldname+"',"+(counter+1)+")",180);}document.getElementById("label_validation_"+fieldname).style.color=bgcolor;}function listen_maxlength(formname,fieldname,max){var event=(IE==1)?event:e;var value=document.forms[formname][fieldname].value;var total=value.length;var limite=(total>max);if(limite){value=value.substring(0,max);document.forms[formname][fieldname].value=value;}var msg=(total>=max)?"Número máximo de letras chegou ao fim":"Você ainda pode digitar <b>"+(max-total)+"</b> letras";set_propertie("_label_maxlength"+fieldname,"innerHTML",msg);}
var chatwindowresized=0;function resizeChatWindow(w,h,title){if(chatwindowresized)return;try{var data={w:parseInt(w)+10,h:parseInt(h)+90,sw:window.screen.width || screen.availWidth,sh:window.screen.height || screen.availHeight};window.resizeTo(data.w,data.h);window.moveTo((data.sw/2)-(data.w/2),(data.sh/2)-(data.h/2));}catch(e){}chatwindowresized=1;if(title){window.document.title=title+"-Atendimento Online";}};function close_this_window(){try{window.opener.focus();}catch(e){};window.close();};function SaveDialogByEmail(){var email=document.getElementById('txtSaveByEmail');if(email){send_save_dialog_by_email(email.value);PopupSaveDialog.hide();}};