function calculate()
{
	
	var TypeCourses = document.getElementById("selectTypeCourses");
	var Time = document.getElementById("selectTime");
	var Residence  = document.getElementById("selectResidence");
	
	var Flight  = document.getElementById("chBoxFlight");
	var Suburban  = document.getElementById("chBoxSuburban");
	
	var TransferIn  = document.getElementById("chBoxTransferIn");
	var TransferOut  = document.getElementById("chBoxTransferOut");
	
	var Result  = document.getElementById("inputResult");
	
	var ResultOfFormula = 0;
	
	TypeCourses = new Number(TypeCourses.value).valueOf();
	Residence = new Number(Residence.value).valueOf();
	Time = new Number(Time.value).valueOf();
	ResultOfFormula = (TypeCourses + Residence) * Time;
	
	if(Flight.checked == true)
	{
		Flight = new Number(Flight.value).valueOf();
		ResultOfFormula = ResultOfFormula + Flight;
	}
	
	if(Suburban.checked == true)
	{
		Suburban = new Number(Suburban.value).valueOf();
		ResultOfFormula = ResultOfFormula + Suburban;
	}
	
	if(TransferIn.checked == true)
	{
		TransferIn = new Number(TransferIn.value).valueOf();
		ResultOfFormula = ResultOfFormula + TransferIn;
	}
	
	if(TransferOut.checked == true)
	{
		TransferOut = new Number(TransferOut.value).valueOf();
		ResultOfFormula = ResultOfFormula + TransferOut;
	}
	Result.value = ResultOfFormula;
}

function ChangeLocation(newLang)
{
  var currLocation, tmp, newLocation;
  currLocation = "" + window.location.href;
  tmp = currLocation.split('_');
		
  
  i = currLocation.lastIndexOf('_');
  
  if(i== -1)
  {
  	i = currLocation.lastIndexOf('html');
  	if(i==-1)
  	{
  		newLocation = currLocation + "index_" + newLang + ".html";
  	}
  	else
  	{
	  	i = currLocation.lastIndexOf('.');
	  	newLocation = currLocation.substring(0, i);
	  	newLocation += "_" + newLang + ".html";
  	}
  }
  else
  {
  	if(tmp.length == 3)
	  {
	  	newLocation = tmp[0] + "_" + tmp[1] + "_" + newLang + ".html";
	  }
  
	  if(tmp.length == 2)
	  {
	  //	newLocation = tmp[0] + "_" + tmp[1].split('.')[0] + '_' + newLang + ".html";
			newLocation = tmp[0] + "_" + newLang + ".html";
	
	  }
  	
  }
  
 
  window.location.href = newLocation;
}
