function totalCost()
{

var totCost = 0;
var tutorial=0;
var tutorialPrice = 0;
var tutorialDiscount = 0;
var tutCost= 0;
var eventType = "";

for( i = 0; i < document.casos_register.eventReg.length; i++ )
{
		if( document.casos_register.eventReg[i].checked == true )
		{
		eventType = document.casos_register.eventReg[i].value;
		break;
		}
}

for (var i=0; i < document.casos_register.member.length; i++)
   {
   if (document.casos_register.member[i].checked)
      {
      var member = document.casos_register.member[i].value;
      }
   }
   
   
for (var i=0; i < document.casos_register.group1.length; i++)
   {
   if (document.casos_register.group1[i].checked)
      {
      var group1 = document.casos_register.group1[i].value;
      }
   }
    
for (var i=0; i < document.casos_register.group2.length; i++)
   {
   if (document.casos_register.group2[i].checked)
      {
      var group2 = document.casos_register.group2[i].value;
      }
   }
   
for (var i=0; i < document.casos_register.group3.length; i++)
   {
   if (document.casos_register.group3[i].checked)
      {
      var group3 = document.casos_register.group3[i].value;
      }
   }
        
for (var i=0; i < document.casos_register.memberType.length; i++)
   {
   if (document.casos_register.memberType[i].checked)
      {
      var memberType = document.casos_register.memberType[i].value;
      }
   }

if(member == "current")
	{
		switch(memberType)
		{
		case 'faculty':

		
			totCost = 175;
		
			tutorialPrice = 100;
			tutorialDiscount = 50;
			break
		
		case 'student':
		
			totCost = 100;
		
			tutorialPrice = 80;
			tutorialDiscount = 45;
			break
		case 'other':
			totCost = 250;
			tutorialPrice = 150;
			tutorialDiscount = 100;
			break	
		}
	}
	else
	
	{
		switch(memberType)
		{
		case 'faculty':
			totCost = 275;
			tutorialPrice = 100;
			tutorialDiscount = 50;
			break
		
		case 'student':
			totCost = 150;
			tutorialPrice = 80;
			tutorialDiscount = 45;
			break
		case 'other':
			totCost = 350;
			tutorialPrice = 150;
			tutorialDiscount = 100;
			break	
		}
	}
if(group1 != "not interested")
{
	tutorial = tutorial + 1;
}

if(group2 != "not interested")
{
	tutorial = tutorial + 1;
}

if(group3 != "not interested")
{
	tutorial = tutorial + 1;
}


if(tutorial > 1)
{
	tutCost = (tutorialPrice + (tutorialDiscount *(tutorial - 1)));
	confCost = totCost;
	totCost = totCost + tutCost;
}
else
{	
	tutCost = (tutorialPrice * tutorial);
	confCost = totCost;
	totCost = totCost + tutCost;
}

switch(eventType)
{
	case 'conference':
		document.casos_register.totCost.value = confCost;
		document.casos_register.tutCost.value = 0.00;
		document.getElementById("cost").innerHTML = "$" + confCost.toString() + ".00";
		break
	case 'conference and workshops':
		document.casos_register.totCost.value = totCost;
		document.casos_register.tutCost.value = tutCost;
		document.getElementById("cost").innerHTML = "$" + totCost.toString() + ".00";
		break
	case 'workshops':
		document.casos_register.totCost.value = tutCost;
		document.casos_register.tutCost.value = tutCost;
		document.getElementById("cost").innerHTML = "$" + tutCost.toString() + ".00";
		break
}

	if(eventType != "conference")
	{
		for(i=0;i< document.casos_register.eventReg.length;i++)
		{
		document.casos_register.group1[i].disabled = false
		document.casos_register.group2[i].disabled = false
		document.casos_register.group3[i].disabled = false
		}
	}
	else
	{
		for(i=0;i< document.casos_register.eventReg.length;i++)
		{
		document.casos_register.group1[i].disabled = true
		document.casos_register.group2[i].disabled = true
		document.casos_register.group3[i].disabled = true
		}
		
		document.casos_register.group1[2].checked= true
		document.casos_register.group2[2].checked = true
		document.casos_register.group3[2].checked = true
}
}


function confirmation() {
	if(document.article_submit.phdcomp[0].checked == true)
	{
		var answer = confirm("Submit paper for Ph.D. competition?")
		if (answer){
			document.article_submit.competition.value = "PAPER IS BEING SUBMITTED FOR COMPETITION"
		}
		else
		{
			
		document.article_submit.phdcomp[1].checked =true
		}
	}
	
}
