function trim(str, chars) { return ltrim(rtrim(str, chars), chars); } function ltrim(str, chars) { chars = chars || "\\s"; return str.replace(new RegExp("^[" + chars + "]+", "g"), ""); } function rtrim(str, chars) { chars = chars || "\\s"; return str.replace(new RegExp("[" + chars + "]+$", "g"), ""); } function encodeUrl(url) { if (url.indexOf("?")>0) { encodedParams = "?"; parts = url.split("?"); params = parts[1].split("&"); for(i = 0; i < params.length; i++) { if (i > 0) { encodedParams += "&"; } if (params[i].indexOf("=")>0) { p = params[i].split("="); encodedParams += (p[0] + "=" + escape(encodeURI(p[1]))); } else { encodedParams += params[i]; } } url = parts[0] + encodedParams; } return url; } var myPopupWindow = ''; function openPopupWindow(url, name) { if (screen.width==800||screen.height==600){ alert("Atenção: Sua resolução atual é: 800x600, para utilizar o sistema de ensino à distância, recomendamos o uso da resolução: 1024x768"); var width = 800; var height = 600; } if (screen.width==640||screen.height==480){ alert("Atenção: Sua resolução atual é: 640x480, para utilizar o sistema de ensino à distância, recomendamos o uso da resolução: 1024x768"); var width = 640; var height = 480; } if (screen.width==1024||screen.height==768){ var width = 1024; var height = 768; } name = name.replace(/\/|\-|\./gi, ""); var whitespace = new RegExp("\\s","g"); name = name.replace(whitespace,""); if (!myPopupWindow.closed && myPopupWindow.location) { myPopupWindow.location.href = encodeUrl(url); } else { myPopupWindow= window.open(encodeUrl(url),name, "location=no, scrollbars=yes, resizable=yes, toolbar=no, menubar=no, width=" + width + ", height=" + height); if (!myPopupWindow.opener) myPopupWindow.opener = self; } if (window.focus) {myPopupWindow.focus()} } function execmascara(){ v_obj.value=v_fun(v_obj.value); } function mascara(o,f){ v_obj=o v_fun=f setTimeout("execmascara()",1) } function telefone(v){ v=v.replace(/\D/g,""); v=v.replace(/^(\d\d)(\d)/g,"($1) $2"); v=v.replace(/(\d{4})(\d)/,"$1-$2"); return v; } //------- addEvent() addEvent = function(o, e, f, s){ var r = o[r = '_' + (e = 'on' + e)] = o[r] || (o[e] ? [[o[e], o]] : []), a, c, d; r[r.length] = [f, s || o], o[e] = function(e){ try{ (e = e || event).preventDefault || (e.preventDefault = function(){e.returnValue = false;}); e.stopPropagation || (e.stopPropagation = function(){e.cancelBubble = true;}); e.target || (e.target = e.srcElement || null); e.key = (e.which + 1 || e.keyCode + 1) - 1 || 0; }catch(f){} for(d = 1, f = r.length; f; r[--f] && (a = r[f][0], o = r[f][1], a.call ? c = a.call(o, e) : (o._ = a, c = o._(e), o._ = null), d &= c !== false)); return e = null, !!d; } }; /* ------- ToggleOne() } */ ToggleOne = function(element) { var elements = document.getElementsByTagName('div'); for(i=0;i