function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//******************************************************************************
function MibJumpMenu(targ,selObj,restore){
  // Somente muda de pgina se o atributo value estiver preenchido
  if(selObj.options[selObj.selectedIndex].value!='')
  {
    eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
    if (restore) selObj.selectedIndex=0;
  }
}
//******************************************************************************

//******************************************************************************
function new_window(w, h, url)
{
    window.open(url,'_blank','width='+w+',height='+h+',top=30,location=no,status=no,menubar=no,scrollbars=yes,resizable=no,directories=no,toolbar=no');
}
//******************************************************************************


//******************************************************************************
function new_popup(w, h, url)
{
    window.open(url,'_blank','width='+w+',height='+h+',top=250,left=350,location=no,status=no,menubar=no,scrollbars=no,resizable=no,directories=no,toolbar=no');
}
//******************************************************************************

//******************************************************************************
function tick() {
  var hours, minutes, seconds, ap;
  var intHours, intMinutes, intSeconds;
  var today;

  today = new Date();

  intHours = today.getHours();
  intMinutes = today.getMinutes();
  intSeconds = today.getSeconds();

  if (intHours == 0) {
     hours = "12:";
     ap = "PM";
  } else if (intHours < 12) {
     hours = intHours+":";
     ap = "AM";
  } else if (intHours == 12) {
     hours = "12:";
     ap = "PM";
  } else {
     intHours = intHours - 12
     hours = intHours + ":";
     ap = "PM";
  }

  if (intMinutes < 10) {
     minutes = "0"+intMinutes+":";
  } else {
     minutes = intMinutes+":";
  }

  if (intSeconds < 10) {
     seconds = "0"+intSeconds+" ";
  } else {
     seconds = intSeconds+" ";
  }

  timeString = hours +  minutes+ seconds + ap;
  Clock.innerHTML = timeString;
  window.setTimeout("tick();", 100);
}
//******************************************************************************
function high(which2){
    theobject=which2
    highlighting=setInterval("highlightit(theobject)",50)
}

function low(which2)
{
    clearInterval(highlighting)

    if (which2.style.MozOpacity)
        which2.style.MozOpacity=10.3
    else if (which2.filters)
        which2.filters.alpha.opacity=50

}

function highlightit(cur2)
{
    if (cur2.style.MozOpacity<1)
        cur2.style.MozOpacity=parseFloat(cur2.style.MozOpacity)+0.1
    else if (cur2.filters&&cur2.filters.alpha.opacity<100)
        cur2.filters.alpha.opacity+=10
    else if (window.highlighting)
        clearInterval(highlighting)
}

function Combo_Countries_Redirect()
{
	if(document.frmCombo.combo_countries.selectedIndex != 0)
	{
		window.location= document.frmCombo.combo_countries.options[document.frmCombo.combo_countries.selectedIndex].value;
	}
}


function Combo_Links_Redirect()
{
	if(document.frmCombo.combo_quicklinks.selectedIndex != 0)
	{
		window.location= document.frmCombo.combo_quicklinks.options[document.frmCombo.combo_quicklinks.selectedIndex].value;
	}
}

function MM_jumpMenu(targ,selObj,restore){
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

// Função js para verificar e-mail
function VerificaEmail(email) {
	if (!email) return false;
	var  BadChars = "*|,\":<>[]{}`\';()&$#% ";
	var  GoodChars = "@.";
	for (var i = 0; i < email.length; i++) {
		if (BadChars.indexOf(email.charAt(i)) != -1) {
			return false;
		}
	}
	for (var i = 0; i < GoodChars.length; i++) {
		if (email.indexOf(GoodChars.charAt(i)) == -1) {
			return false;
		}
	}
 	if (email.indexOf ('@.',0) != -1 || email.indexOf ('.@',0) != -1) {
		return false;
	}
   return true;
}

function trim (inputStringTrim) 
{
	fixedTrim = "";
	lastCh = " ";
	for (x=0; x < inputStringTrim.length; x++) {
	ch = inputStringTrim.charAt(x);
	if ((ch != " ") || (lastCh != " ")) { fixedTrim += ch; }
	lastCh = ch;
	}
	if (fixedTrim.charAt(fixedTrim.length - 1) == " ") {
	fixedTrim = fixedTrim.substring(0, fixedTrim.length - 1); }
	return fixedTrim
}

function trim_me(text)
{
	text.value = trim(text.value)
}

function ValidDate(pDate)
{
	if (isNaN(Date.parse(pDate)))
	{
	window.alert("Data Inválida!")
	return false;
	}
}

//******************************************************************************
// Funções usadas pelo form de representantes
//******************************************************************************
function ExcluirTrajetoria( trajetoria )
{
	document.Form2.Trajetoria.value = trajetoria;
	document.Form2.submit();
}

function ExcluirIdioma( idioma )
{
	document.Form4.Idioma.value = idioma;
	document.Form4.submit();
}

function ExcluirCurso( curso )
{
	document.Form5.Curso.value = curso;
	document.Form5.submit();
}
