function hilite(elem)
{
	elem.setAttribute("className","highlight");
	elem.setAttribute("class","highlight");
}

function unhilite(elem)
{
	elem.setAttribute("className","");
	elem.setAttribute("class","");
}

function refreshPage(url,item)
{
	var myID = item.getAttribute("id");
	var myVal = item.value;

	url += "&" + myID + "=" + myVal;
	//alert("loading url: " + url);
	document.location = url;
}

function appendURL(url,ids)
{
	var rand = Math.random();

	for(var i=0;i<ids.length;i++)
	{
		var id = ids[i];
		var myElem = document.getElementById(id);
		var myVal = myElem.value;

		//check familyname
		if(id == "familyname") {
			if(!myVal) {
				alert("Please enter your family name");
				return;
			}
		}

		//check firstname
		if(id == "firstname") {
			if(!myVal) {
				alert("Please enter your first name");
				return;
			}
		}


		if(id == "email")
		{
			//validate email address
			if(!emailCheck(myVal))
			{
				alert("Please enter a valid email address");
				return;
			}
			//make sure email address is the same as 2nd email address
			var checkElem = document.getElementById("email2");
			if(checkElem.value != myVal)
			{
				alert("Email addresses do not match. Please try again.");
				return;
			}
			
			//verify agb
			var checkElem = document.getElementById("acceptagb");
			if(!checkElem.checked)
			{
				alert("Please accept our AGB / Bitte die AGB akzeptieren.");
				return;
			}
			
		}
		url += "&" + id + "=" + myVal;
	}
	url +=  "&randVal=" + rand;
	url = encodeURI(url);
	//alert(url);
	location.replace(url);
}


function hidediv(id) {
	//safe function to hide an element with a specified id
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'none';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'none';
		}
		else { // IE 4
			document.all.id.style.display = 'none';
		}
	}
}

function showdiv(id) {
	//safe function to show an element with a specified id
		  
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'block';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'block';
		}
		else { // IE 4
			document.all.id.style.display = 'block';
		}
	}
}
