function submitingHighScool(form) {
	
	var countryElement = document.getElementById('pais');
	var countryValue    = countryElement.options[countryElement.selectedIndex].value;
	
	var cityElement = document.getElementById('cidade');
	var cityValue    = cityElement.options[cityElement.selectedIndex].value;
	
	if(cityValue != '') {
		form.action = "/highschool/cidade/"+cityValue;
	} else if(countryValue != '') {
		form.action = "/highschool/pais/"+countryValue;
	}

}

function submitingCourse(form, menu) {

	elementId = "curso";
	if (menu != "index") elementId = "curso2";
	
	var courseElement = document.getElementById(elementId);
	var courseValue    = courseElement.options[courseElement.selectedIndex].value;
	
	if(courseValue != '') {
		if (menu == "index") {
			form.action = "/cursos/"+courseValue;
		} else {
			form.action = "/cursos/"+menu+"/"+courseValue;
		}
	}

}

function submitingJob(form, menu) {
	elementId = "curso";
	var jobElement = document.getElementById(elementId);
	var jobValue    = jobElement.options[jobElement.selectedIndex].value;
	
	if(jobValue != '') {
		form.action = "/trabalhos/"+jobValue;
	}

}

function submitingTrip(form, menu) {

	if (menu == "servicos") {
		
		var tripElement  = document.getElementById('viagem');
		var tripValue    = tripElement.options[tripElement.selectedIndex].value;
	
		if(tripValue != '') {
			form.action = "/viagens/servicos/"+tripValue;
		}
		
	} else {
		
		var countryElement  = document.getElementById('pais');
		var countryValue    = countryElement.options[countryElement.selectedIndex].value;

		var cityElement  = document.getElementById('cidade');
		var cityValue    = cityElement.options[cityElement.selectedIndex].value;
		
		if(cityValue != '') {
			if (menu == "index") {
				form.action = "/viagens/cidade/"+cityValue;
			} else {
				form.action = "/viagens/"+menu+"/cidade/"+cityValue;
			}
		} else {
		
			if(countryValue != '') {
				if (menu == "index") {
					form.action = "/viagens/pais/"+countryValue;
				} else {
					form.action = "/viagens/"+menu+"/pais/"+countryValue;
				}
			}
		
		}
	}
}

function submitingCourseInPage(form) {
	elementId = "courses";
	var courseElement = document.getElementById(elementId);
	var courseValue    = courseElement.options[courseElement.selectedIndex].value;
	
	if(courseValue != '') {
		form.action = "/cursos/"+courseValue;
	}

}

/****************************************************
  Author: Eric King
  Url: http://redrival.com/eak/index.shtml
  This script is free to use as long as this info is left in
  Featured on Dynamic Drive script library (http://www.dynamicdrive.com)
****************************************************/
function NewWindow(mypage,myname,w,h,scroll,pos){
	var win=null;
	if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
	if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
	else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
	settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
	win=window.open(mypage,myname,settings);
}

function pollHash(index) {
	var recentHash = window.location.hash;
	var recentHash_array = recentHash.split('#');
	return recentHash_array[index+1];
}