function init()
{


}

function showSubmenu(objCaller)
{
	try
	{
		if(objCaller.id == "childs")
		{
			if(objCaller.childNodes[1].style.display == "block")
			{
				/*if(typeof headNode != "undefined")
				{
					objCaller.childNodes[1].style.display = "block";
				}
				else
				{
					objCaller.childNodes[1].style.display = "none";
				}*/
				objCaller.childNodes[1].style.display = "block";
			}
			else
			{
				objCaller.childNodes[1].style.display = "block";
			}
		}
	}
	catch (e)
	{
		//alert(e);
	}
}

function onderdeel(id,obj)
{

	
		o = "onderdeel_"+id;
		p = "price_"+id;
		s = "prijs_"+id;
		r = "rows";
	
		
		//var price = 0;
	
		//update prices
	part = document.getElementById(o).value;
	priceF = document.getElementById(p);
	prijs = document.getElementById(s);
	totalp = document.getElementById("totalprice");
	rows = document.getElementById(r);


		section = document.getElementById('sectie_'+id);
	section.remove(1);
	section.remove(1);
	section.remove(1);
	section.remove(1);



	if(part == '1') 
	{
		price = "50";
		section.options[section.length] = new Option('A', '1');
		section.options[section.length] = new Option('B', '2');
		section.options[section.length] = new Option('C', '3');
		section.options[section.length] = new Option('D', '4');
	}
	if(part == '2')
	{
		price = "30";
		section.options[section.length] = new Option('A', '1');
		section.options[section.length] = new Option('B', '2');
	}
	if(part == "3")
	{
		price = "40";
		section.options[section.length] = new Option('A', '1');
		section.options[section.length] = new Option('B', '2');
		section.options[section.length] = new Option('C', '3');
	}
	if(part == "7")
	{
		price = "25";
		section.options[section.length] = new Option('A', '1');
		section.options[section.length] = new Option('B', '2');
	}	
	if(part == "5" || part == "6" || part == "4")
	{
		price = "15";
		section.options[section.length] = new Option('A', '1');
		section.options[section.length] = new Option('B', '2');
	}




	priceF.value = price;
	prijs.innerHTML = price;
	
	amountRows = rows.value;
	total = 0;
	for(i=1;i<=amountRows;i++)
	{
		
		//alert(total);
		try
		{	
		price = document.getElementById("price_"+i).value;
		if(price == "")
		{
			price = 0;
		}
		total = total + parseInt(price);
		//alert(total);
		totalp.innerHTML = total;
		}
		catch(e)
		{

		}
	}

	
	/*total = parseInt(totalprice.innerHTML) + parseInt(price);

	totalprice.innerHTML = total;*/
}

function jeugdonderdeel(id,obj)
{

	
		o = "onderdeel_"+id;
		p = "price_"+id;
		s = "prijs_"+id;
		i = "instrumenten_"+id;
		r = "rows";
	
		
		//var price = 0;
	
		//update prices
	part = document.getElementById(o).value;
	priceF = document.getElementById(p);
	prijs = document.getElementById(s);
	totalp = document.getElementById("totalprice");
	rows = document.getElementById(r);
	instrumenten = document.getElementById(i);


		section = document.getElementById('sectie_'+id);
	section.remove(1);
	section.remove(1);
	section.remove(1);
	section.remove(1);



	if(part == '1') 
	{
		price = "40";
		section.options[section.length] = new Option('Sectie A', '1');
		section.options[section.length] = new Option('Sectie B', '2');
		instrumenten.style.backgroundColor = "silver";
	}
	if(part == '3')
	{
		price = "20";
		section.options[section.length] = new Option('Solisten', '1');
		instrumenten.style.backgroundColor = "white";
	}
	if(part == "4")
	{
		price = "20";
		section.options[section.length] = new Option('Ensembles', '1');
		instrumenten.style.backgroundColor = "white";
	}
	

	priceF.value = price;
	prijs.innerHTML = price;
	
	amountRows = rows.value;
	total = 0;
	for(i=1;i<=amountRows;i++)
	{
		
		//alert(total);
		try
		{	
		price = document.getElementById("price_"+i).value;
		if(price == "")
		{
			price = 0;
		}
		total = total + parseInt(price);
		//alert(total);
		totalp.innerHTML = total;
		}
		catch(e)
		{

		}
	}

	
	/*total = parseInt(totalprice.innerHTML) + parseInt(price);

	totalprice.innerHTML = total;*/
}



function addDeelnemer()
{
	var r = "rows";
	var l = "lastrow";

	table = document.getElementById("deelnemerarea");
	
	lastr = document.getElementById(l);
	row = document.getElementById(r);

	id = parseInt(lastr.value) + 1;
	
	tr = document.createElement("tr");
	tr.id = "row_"+id;

	/*<th width="120">Onderdeel:</th>
			<th width="75">Naam:</th>
			<th width="65">Klasse:</th>
			<th width="60">Sectie:</th>
			<th width="150">Neemt wel/niet deel aan streetparade</th>
			<th width="80">Prijs</th>*/

	tdOnderdeel = document.createElement("td");
	tdOnderdeel.style.width = "120px";
	tdNaam = document.createElement("td");
	tdNaam.style.width = "75px";
	tdKlasse = document.createElement("td");
	tdKlasse.style.width = "65px";
	tdSectie = document.createElement("td");
	tdSectie.style.width = "60px";
	/*tdStreet = document.createElement("td");
	tdStreet.style.width = "150px";
	tdStreet.style.textAlign = "center";*/
	tdPrijs = document.createElement("td");
	tdPrijs.style.width = "50px";
	tdRemove = document.createElement("td");


	tdOnderdeel.innerHTML = "<div class=\"formfield\"><select name='part[]' id='onderdeel_"+id+"'  onchange=\"onderdeel("+id+",this)\"><option value=\"#\">Onderdeel</option><option value=\"1\">Muziekkorps</option><option value=\"2\">Majorettes Team</option><option value=\"3\">Majorettes Peloton</option><option value=\"4\">Majorettes Solo</option><option value=\"5\">Majorettes Duo</option><option value=\"7\">Majorettes Ensemble</option></select></div>";
	
	tdNaam.innerHTML = "<div class=\"formfield\"><input type=\"text\" name=\"onderdeel_naam[]\" size=\"10\" id=\"naam_"+id+"\" /></div>";
	
	tdKlasse.innerHTML = "<div class=\"formfield\"><select name=\"klasse[]\"><option value=\"#\">Klasse</option><option value=\"1\">Jeugd</option><option value=\"2\">Basis</option><option value=\"3\">Midden</option><option value=\"4\">Top</option></select></div>";
	
	tdSectie.innerHTML = "<div class=\"formfield\"><select name=\"section[]\" id=\"sectie_"+id+"\"><option value=\"\">Sectie</option><option value=\"1\">A</option><option value=\"2\">B</option><option value=\"3\">C</option><option value=\"4\">D</option></select></div>";
	
	tdPrijs.innerHTML = "&euro; <input type=\"hidden\" name=\"price[]\" id=\"price_"+id+"\" /><span id=\"prijs_"+id+"\">0</span>,--";
	
	//tdStreet.innerHTML = "<div class=\"formfield\"><select name=\"streetparade[]\" id=\"street_"+id+"\"><option value=\"1\">Ja</option><option value=\"0\">Nee</option></select></div>";
	
	tdRemove.innerHTML = "<div class=\"formfield\"><input type=\"button\" name=\"remOnderdeel\" value=\"-\" onclick=\"remove("+id+")\" /></div>";

	tr.appendChild(tdOnderdeel);
	tr.appendChild(tdNaam);
	tr.appendChild(tdKlasse);
	tr.appendChild(tdSectie);
	//tr.appendChild(tdStreet);
	tr.appendChild(tdPrijs);
	tr.appendChild(tdRemove);
	table.appendChild(tr);

	lastr.value = id;
	row.value = parseInt(table.rows.length)+4;

}

function addJeugdDeelnemer()
{
	var r = "rows";
	var l = "lastrow";

	table = document.getElementById("deelnemerarea");
	
	lastr = document.getElementById(l);
	row = document.getElementById(r);

	id = parseInt(lastr.value) + 1;
	
	tr = document.createElement("tr");
	tr.id = "row_"+id;

	/*<th width="120">Onderdeel:</th>
			<th width="75">Naam:</th>
			<th width="65">Klasse:</th>
			<th width="60">Sectie:</th>
			<th width="150">Neemt wel/niet deel aan streetparade</th>
			<th width="80">Prijs</th>*/

	tdOnderdeel = document.createElement("td");
	tdOnderdeel.vAlign = "top";
	tdOnderdeel.style.width = "120px";
	tdNaam = document.createElement("td");
	tdNaam.style.width = "75px";
	tdNaam.vAlign = "top";
	tdKlasse = document.createElement("td");
	tdKlasse.style.width = "65px";
	tdKlasse.vAlign = "top";
	tdSectie = document.createElement("td");
	tdSectie.style.width = "60px";
	tdSectie.vAlign = "top";

	tdInstruments = document.createElement("td");
	tdInstruments.style.width = "60px";
	tdInstruments.vAlign = "top";

	/*tdStreet = document.createElement("td");
	tdStreet.style.width = "150px";
	tdStreet.style.textAlign = "center";*/
	tdPrijs = document.createElement("td");
	tdPrijs.style.width = "50px";
	tdPrijs.vAlign = "top";
	tdRemove = document.createElement("td");


	tdOnderdeel.innerHTML = "<div class=\"formfield\"><select name=\"part[]\" id=\"onderdeel_"+id+"\" onchange=\"jeugdonderdeel("+id+",this)\"><option>Onderdeel</option><option value=\"1\">Orkest / Slagwerkgroep</option><option value=\"3\">Solist</option><option value=\"4\">Ensemble</option></select></div>";
	
	tdNaam.innerHTML = "<div class=\"formfield\"><input type=\"text\" name=\"onderdeel_naam[]\" size=\"10\" id=\"naam_"+id+"\" /></div>";
	
	tdKlasse.innerHTML = "<div class=\"formfield\"><select name=\"klasse[]\" id=\"klasse_1\"><option value=\"#\">Klasse</option><option value=\"1\">Beginnend (leerlingniveau)</option><option value=\"2\">Gemiddeld (diploma A/B)</option><option value=\"3\">Gevorderd (diploma C/D)</option></select></div>";
	
	tdSectie.innerHTML = "<div class=\"formfield\"><select name=\"section[]\" id=\"sectie_"+id+"\" style=\"width: 60px;\"><option value=\"\">Sectie</option></div>";
	
	tdInstruments.innerHTML = "<textarea name=\"instrumenten[]\" cols=\"10\" rows=\"1\" id=\"instrumenten_"+id+"\" style=\"background-color: silver;\"></textarea>";

	tdPrijs.innerHTML = "&euro; <input type=\"hidden\" name=\"price[]\" id=\"price_"+id+"\" /><span id=\"prijs_"+id+"\">0</span>,--";
	
	//tdStreet.innerHTML = "<div class=\"formfield\"><select name=\"streetparade[]\" id=\"street_"+id+"\"><option value=\"1\">Ja</option><option value=\"0\">Nee</option></select></div>";
	
	tdRemove.innerHTML = "<div class=\"formfield\"><input type=\"button\" name=\"remOnderdeel\" value=\"-\" onclick=\"remove("+id+")\" /></div>";

	tr.appendChild(tdOnderdeel);
	tr.appendChild(tdNaam);
	tr.appendChild(tdKlasse);
	tr.appendChild(tdSectie);
	//tr.appendChild(tdStreet);
	tr.appendChild(tdInstruments);
	tr.appendChild(tdPrijs);
	tr.appendChild(tdRemove);
	table.appendChild(tr);

	lastr.value = id;
	row.value = parseInt(table.rows.length)+4;

}

function remove(id)
{
	table = document.getElementById("deelnemerarea");
	rij = document.getElementById("row_"+id);

	table.removeChild(rij);
}

function changeYear(objCaller)
{
    var intYear = objCaller.value;

    var objPart = document.getElementById("part");
    var objSection = document.getElementById("section");
    var objKlasse = document.getElementById("klasse");

    if(intYear == "2007" || intYear == "2006")
    {
         objPart.style.display = "none";
         objSection.style.display = "none";
         objKlasse.style.display = "none";
    }
    else
    {
         objPart.style.display = "";
         objSection.style.display = "";
         objKlasse.style.display = "";
    }
}

function changePhotoStateOn(objCaller)
{
    //this.childNodes[1].childNodes[1].className='img2'

    //alert(objCaller.childNodes[1].childNodes[1].tagName);
    //alert(objCaller);

    objImg = objCaller.getElementsByTagName("img");
    objImg[0].className = "img2";
}

function changePhotoStateOff(objCaller)
{
    //this.childNodes[1].childNodes[1].className='img'
    objImg = objCaller.getElementsByTagName("img");
    objImg[0].className = "img";


   // alert(objCaller);
}
