
function newWindow(target,width, height) {
	
	var options = "width=" + width + ", height=" + height + ", scrollbars=no, resizeable=no";  
    window.open(target,'',options);
    }
    
     function validateRegistration(form)
  {
    	fname=form.forename.value;
		if (fname=='') 
		{
			alert('Please type in your forename.');
			form.forename.focus();
			return false;
		}
		
		name=form.name.value;
		if (name=='') 
		{
			alert('Please type in your name.');
			form.name.focus();
			return false;
		}
		
		
		zipcode=form.zipcode.value;
		if(zipcode.length>0){
			if(zipcode.length==5){
				for(var position=0; position<zipcode.length; position++){
					var chr = zipcode.charAt(position);
       				if  ( (chr < "0") || (chr > "9") ) {
       					alert('Please type in a valide zipcode.');
						form.quantity.focus();
						return false;
  					}      
				}
			}else{
			alert('Please type in a valide zipcode.');
			form.zipcode.focus();
			return false;
			}
		}
		
		var region=form.regions.options[form.regions.selectedIndex].value;		
		if (region == 0)
		{
			alert ('Please select the region you wish to join!');
			form.regions.focus();
			return false;
		}
		
		var email=form.email.value;
		if (!(email.indexOf(' ')==-1 && 0<email.indexOf('@') && email.indexOf('@')+1 < email.length))
		{
			alert ('Please type in a valide email!');
			form.email.focus();
			return false;
		}

		return true;
	}
	
	function validateProfile(form)
  {
    	fname=form.forename.value;
		if (fname=='') 
		{
			alert('Please type in your forename.');
			form.forename.focus();
			return false;
		}
		
		name=form.name.value;
		if (name=='') 
		{
			alert('Please type in your name.');
			form.name.focus();
			return false;
		}
		
		var role=form.role.options[form.role.selectedIndex].value;		
		
		if (role == -1)
		{
			alert ('Please select a role!');
			form.role.focus();
			return false;
		}
				
		var region=form.regionid.options[form.regionid.selectedIndex].value;		
		if (region == 0)
		{
			alert ('Please select the region you wish to join!');
			form.regionid.focus();
			return false;
		}
		
		var email=form.email.value;
		if (!(email.indexOf(' ')==-1 && 0<email.indexOf('@') && email.indexOf('@')+1 < email.length))
		{
			alert ('Please type in a valide email!');
			form.email.focus();
			return false;
		}
		
		login=form.login.value;
		if (login=='') 
		{
			alert('Please type in your Login.');
			form.login.focus();
			return false;
		}
		
		pwd1=form.password.value;
		if (pwd1.length <6) 
		{
			alert('Please type in a password with at least 6 characters.');
			form.password.focus();
			return false;
		}
		pwd2 = form.pwd2.value;
		if(pwd1 != pwd2) {
			alert('The confirm-password did not match the password.');
			form.pwd2.focus();
			return false;
		}
		
		return true;
	}
	
	function orderVal(form)
  {
  		fquantity = form.quantity.value;
  		if(fquantity=="") {
			alert('Bitte geben Sie die Anzahl der CDs an.');
			form.quantity.focus();
			return false;
		}else{
  		
  		for(var position=0; position<fquantity.length; position++){
			var chr = fquantity.charAt(position)
        		if  ( (chr < "0") || (chr > "9") ) {
        		alert('Bitte geben Sie die Anzahl der CDs an.');
			form.quantity.focus();
			return false;
  			}      
		}
		}
    	fname=form.forename.value;
		if (fname=='') 
		{
			alert('Bitte geben Sie ihren Vornamen an.');
			form.forename.focus();
			return false;
		}
		
		name=form.name.value;
		if (name=='') 
		{
			alert('Bitte geben Sie ihren Namen an.');
			form.name.focus();
			return false;
		}
	
		street=form.street.value;
		if (street=='') 
		{
			alert('Bitte geben Sie die Straße an.');
			form.street.focus();
			return false;
		}
			
		zipcode=form.zipcode.value;
		if (zipcode=='') 
		{
			alert('Bitte geben Sie ihre Postleitzahl an.');
			form.zipcode.focus();
			return false;
		}else{
			if(zipcode.length==5){
				for(var position=0; position<zipcode.length; position++){
					var chr = zipcode.charAt(position)
       				if  ( (chr < "0") || (chr > "9") ) {
       					alert('Bitte geben Sie eine gültige Postleitzahl an.');
						form.zipcode.focus();
						return false;
  					}      
				}
			}else{
			alert('Bitte geben Sie eine gültige Postleitzahl an.');
			form.zipcode.focus();
			return false;
			}
		}
				
		city=form.city.value;
		if (city=='' || city==' ') 
		{
			alert('Bitte geben Sie den Ort an.');
			form.city.focus();
			return false;
		}
		
		
		var email=form.email.value;
		if (!(email.indexOf(' ')==-1 && 0<email.indexOf('@') && email.indexOf('@')+1 < email.length))
		{
			alert ('Bitte geben Sie eine korrekte email-address an!');
			form.email.focus();
			return false;
		}
		
		if(!form.agbs.checked) {
			
			alert ('Sie müssen die AGBs akzeptieren!');
			return false;
		}
		return true;
	}
	
	function agbs(agb) {
    window.open(agb,'','width=600, height=400, scrollbars=yes, resizeable=no')
  } 