var Order = {
	check: function() {
		
		if($('check0')) {
			if($('check0').checked == false) {
				$('product0').className = 'item';
			}
			else {
				$('product0').className = 'item orderSelect';			
			}
		}
		
		if($('check1')) {
			if($('check1').checked == false) {
				$('product1').className = 'item';
			}
			else {
				$('product1').className = 'item orderSelect';			
			}
		}
		
	},
	
	collectionCheck: function() {
		var go = false;

		if($('check0') && $('check0').checked == true) {
			go = true;
		}
		else {
			if($('check1') && $('check1').checked == true) {
				go = true;
			}
			else {
				window.alert('You need to select at least one item!');
			}
		}
			
		return go;
	},
	
	sizeCheck: function () {
		var go = true;
		if(document.orderForm1.color && document.orderForm1.color.length != undefined) {
			// set var radio_choice to false
			var radio_choice = false;
			// Loop from zero to the one minus the number of radio button selections
			for (counter = 0; counter < document.orderForm1.color.length; counter++)
			{
				if (document.orderForm1.color[counter].checked) {
					radio_choice = true;
				}
			}
			if(radio_choice == false) {
				go = false;
			}
		}
		
		if(document.orderForm1.color1 && document.orderForm1.color1.length != undefined) {
			// set var radio_choice to false
			var radio_choice = false;
			// Loop from zero to the one minus the number of radio button selections
			for (counter = 0; counter < document.orderForm1.color1.length; counter++)
			{
				if (document.orderForm1.color1[counter].checked) {
					radio_choice = true;
				}
			}
			if(radio_choice == false) {
				go = false;
			}
		}
		
		if(go == false) {
			window.alert('You need to choose a color!');
		}
		else {
			if($('size0') && $('size0').value == '#') {
				go = false;
			}

			if($('size1') && $('size1').value == '#')
				go = false;
			
			if(go == false) {
				window.alert('You need to choose a size, for extra information check the measurement advice!');
			}
		
			if(go) {
				if($('stlength') && $('stlength').value == '#') {
					go = false;
				}
			
				if($('stlength1') && $('stlength1').value == '#') {
					go = false;
				}

				if(go == false) {
					window.alert('You need to choose a stylelength, for extra information check the measurement advice!');
				}			
			}
		}
		return go;
	},
	
	personalCheck: function() {
		var go = true;

		if(personal.name.value.length < 3) {
			go = false;
			alert("Invalid name! Please re-enter.");
			personal.name.focus();
		}

		if(go && personal.address.value.length < 3) {
			go = false;
			alert("Invalid address! Please re-enter.");
			personal.address.focus();
		}		

		if(go && personal.postal.value.length < 4) {
			go = false;
			alert("Invalid postal! Please re-enter.");
			personal.postal.focus();
		}		

		if(go && personal.city.value.length < 4) {
			go = false;
			alert("Invalid city! Please re-enter.");
			personal.city.focus();
		}		

		if(go && personal.country.value.length < 3) {
			go = false;
			alert("Invalid country! Please re-enter.");
			personal.country.focus();
		}				

		if(go && personal.telephone.value.length < 10) {
			go = false;
			alert("Invalid phonenumber! Please re-enter.");
			personal.telephone.focus();
		}		

		if (go && !(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(personal.email.value))) {
			go = false;
			alert("Invalid E-mail Address! Please re-enter.");
			personal.email.focus();
		}
		
		if(go && $('agreement').checked == false) {
			go = false;
			alert('You have to agree to the standard terms of sale!');			
		}
		
		return go;
	}
}