//==============================================================  turnOff Menu d Contexto ===
function click() {
	if (event.button==2||event.button==3) {
		oncontextmenu='return false';
	}
}
document.onmousedown=click
document.oncontextmenu = new Function("return false;")
//
//
window.defaultStatus='CSP-Conpat Sistemas e Serviços Patrimonias LTDA';
//==============================================================  Mostra caixa d senha ===
function msgBox(tipo) {
 	switch (tipo) {
		case 'atualizacao':
		    document.all.msgLayer.style.visibility="visible";
			document.all.iSenha.focus();
			break;
		default:
		    return true;
	}
return true;
 }


function getCookieVal (offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}
//==============================================================  getCookie ===
// name - name of the desired cookie
// * return string containing value of specified cookie or null if cookie does not exist
function getCookie (name) {
  var arg = name + "=";
  var alen = arg.length;
  var clen = document.cookie.length;
  var i = 0;
  while (i < clen) {
    var j = i + alen;
    if (document.cookie.substring(i, j) == arg)
      return getCookieVal (j);
    i = document.cookie.indexOf(" ", i) + 1;
    if (i == 0) 
      break;
  }
  return null;
}

//==============================================================  setCookie ===
// name - name of the cookie
// value - value of the cookie
// [expires] - expiration date of the cookie (defaults to end of current session)
// [path] - path for which the cookie is valid (defaults to path of calling document)
// [domain] - domain for which the cookie is valid (defaults to domain of calling document)
// [secure] - Boolean value indicating if the cookie transmission requires a secure transmission
// * an argument defaults when it is assigned null as a placeholder
// * a null placeholder is not required for trailing omitted arguments
function setCookie (name, value) {
  var argv = setCookie.arguments;
  var argc = setCookie.arguments.length;
  var expires = (2 < argc) ? argv[2] : null;
  //var path = (3 < argc) ? argv[3] : null;
  var path = "/";
  var domain = (4 < argc) ? argv[4] : null;
  //var domain = "www.csp-conpat.com.br";
  var secure = (5 < argc) ? argv[5] : false;
  document.cookie = name + "=" + escape (value) + 
   ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
   ((path == null) ? "" : ("; path=" + path)) +
   ((domain == null) ? "" : ("; domain=" + domain)) +
   ((secure == true) ? "; secure" : "");
}


//==============================================================  deleteCookie ===
// name - name of the cookie
// [path] - path of the cookie (must be same as path used to create cookie)
// [domain] - domain of the cookie (must be same as domain used to create cookie)
// * path and domain default if assigned null or omitted if no explicit argument proceeds

function deleteCookie(name, path, domain) {
  if (getCookie(name)) {
    document.cookie = name + "=" + 
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}



//==============================================================  fixDate ===
// date - any instance of the Date object
// * hand all instances of the Date object to this function for "repairs"
function fixDate(date) {
  var base = new Date(0);
  var skew = base.getTime();
  if (skew > 0)
    date.setTime(date.getTime() - skew);
}
