function select_plan(plan){
	/*
	document.getElementById('select_plan').style.display = "none";
	document.getElementById('select_plan1').style.display = "none";
	
	 
	if (plan == 'static') {
		data = 'Linux Hosting - Static Plan';
		document.getElementById('select_plan').style.display = "block";
		
	}else{
		data = 'Linux Hosting - Dynamic Plan';
		document.getElementById('select_plan1').style.display = "block";
	}
	document.getElementById('hosting_plan_change').innerHTML = data;
	*/
}
function validate_plans(form_id){
	success = false;
	myForm = document.getElementById(form_id);
	elements = myForm.hosting_plan;
	for (i = 0; i < elements.length; i++){
		if (elements[i].checked == true){
			success = true;
		}
	}
	if (success){
		myForm.submit();
	}else{
		alert('You must select a plan to proceed to step 2');
	}
	
}

function remove_domain(domain_name){
	if (domain_name != '') {
		myForm = document.getElementById('remove_domain_form');
		myForm.remove_domain.value = domain_name;
		myForm.submit();
	}
}
function update_hosting_plan(hosting_plan){
	new Ajax.Request('/includes/ajax.php',{method:'post',parameters:{
			group:				'hosting',
			hosting_plan:		hosting_plan,
			method_type:		'update_hosting_plan'},
			onSuccess: function(call_this){
				data = call_this.responseText.evalJSON();
				document.getElementById('hosting_name_replace').innerHTML = data.hosting_type;
				document.getElementById('hosting_price_replace').innerHTML = data.amount;
				document.getElementById('setup_fee_replace').innerHTML = data.setup_fee;
				document.getElementById('hosting_total_replace').innerHTML = data.total_amount; 
			}
	});
}
function add_promo(){
	var myForm = document.getElementById('promo_form');
	var error = '';
	if (myForm.promo_code.value == ''){
		error = 'Promo code is invalid';
	}else{
		new Ajax.Request('/includes/ajax.php',{method:'post',parameters:{
			group:				'hosting',
			promo_code: 		myForm.promo_code.value,
			method_type:		'add_promo'},
			onSuccess: function(call_this){
				data = call_this.responseText.evalJSON();
				
				if (data.result == "true"){
					document.getElementById("promo_form").style.display = "none";
					document.getElementById("promo_replace").innerHTML = data.description; 
				}else{
					error = 'Promo code is invalid';
					document.getElementById("promo_error").innerHTML = error;
				}
			}
		});
	}
	if (error != ''){
		document.getElementById("promo_error").innerHTML = error;
	}
}

function service_agreement(){
	var error = '';
	var myForm = document.getElementById('hosting_agreement');
	
	if (!myForm.agreement.checked){
		error = 'You must check the box to agree that you understand the services agreement before continuing.';
	}
	if (error == ''){
		myForm.submit();
	}else{
		alert(error);
	}
}

