function formCheck() {
	if (document.form.r_domain_name.value.length == 0) {
		alert("Isilah bagian Nama domain");
		document.form.r_domain_name.focus();
		return false;
		}
	if (document.form.r_domain_name.value.length >0) {
		j=document.form.r_domain_name.value.indexOf(".")
		k=document.form.r_domain_name.value.indexOf(",")
		kk=document.form.r_domain_name.value.indexOf(" ")
		jj=document.form.r_domain_name.value.lastIndexOf(".")+1
		len=document.form.r_domain_name.value.length

	if ( (j>1) && (k==-1) && (kk==-1) &&
		(len-jj >=2) && (len-jj<=3)) {
		
	} else {
		alert("Periksa kembali nama domain yang Anda masukkan.\n" + document.form.r_domain_name.value + " kelihatannya tidak valid.")
		document.form.r_domain_name.select();
		return false;
		}
		}
	if (document.form.r_first_name.value.length == 0) {
		alert("Isilah bagian nama depan dengan nama depan Anda");
		document.form.r_first_name.focus();
		return false;
		}
	if (document.form.r_last_name.value.length == 0) {
		alert("Isilah bagian nama belakang dengan nama belakang Anda");
		document.form.r_last_name.focus();
		return false;
		}
	if (document.form.r_company_name.value.length == 0) {
		alert("Isilah bagian Nama perusahaan");
		document.form.r_company_name.focus();
		return false;
		}
	if (document.form.r_address.value.length == 0) {
		alert("Isilah bagian Alamat");
		document.form.r_address.focus();
		return false;
		}
	if (document.form.r_city.value.length == 0) {
		alert("Isilah bagian Kota");
		document.form.r_city.focus();
		return false;
		}
	if (document.form.r_province.value.length == 0) {
		alert("Isilah bagian Provinsi");
		document.form.r_province.focus();
		return false;
		}
	if (document.form.rd_zip_code.value.length == 0) {
		alert("Isilah bagian Kode pos");
		document.form.rd_zip_code.focus();
		return false;
		}
	for (var i = 0; i < document.form.rd_zip_code.value.length; i++) {
		if (document.form.rd_zip_code.value.charAt(i) < "0" ||
			document.form.rd_zip_code.value.charAt(i) > "9") {
		alert("Periksa kembali kode pos yang Anda masukkan.\n" + document.form.rd_zip_code.value + " kelihatannya tidak valid.");
		document.form.rd_zip_code.select();
		return false;
        }
        }		
	if (document.form.r_country.value.length == 0) {
		alert("Isilah bagian Negara");
		document.form.r_country.focus();
		return false;
		}
	if (document.form.r_phone_number.value.length == 0) { 
		alert("Isilah bagian Telepon");
		document.form.r_phone_number.focus();
		return false;
		}
	if (document.form.r_phone_number.value.length < 6) { 
		alert("Periksa kembali nomor telepon yang Anda masukkan.\n" + document.form.r_phone_number.value + " kelihatannya tidak valid.");
		document.form.r_phone_number.focus();
		return false;
		}
	if (document.form.re_email.value.length == 0) {
		alert("Isilah bagian Alamat e-mail.");
		document.form.re_email.focus();
		return false;
		}
	if (document.form.re_email.value.length >0) {
		i=document.form.re_email.value.indexOf("@")
		j=document.form.re_email.value.indexOf(".",i)
		k=document.form.re_email.value.indexOf(",")
		kk=document.form.re_email.value.indexOf(" ")
		jj=document.form.re_email.value.lastIndexOf(".")+1
		len=document.form.re_email.value.length

	if ((i>0) && (j>(1+1)) && (k==-1) && (kk==-1) &&
		(len-jj >=2) && (len-jj<=3)) {
		
	} else {
		alert("Periksa kembali alamat e-mail yang Anda masukkan.\n" + document.form.re_email.value + " kelihatannya tidak valid.")
		document.form.re_email.select();
		return false;
		}
		}
	if (document.form.r_term.checked == 0) {
		alert("Anda harus setuju dengan Syarat Penggunaan kami sebelum melangkah lebih lanjut.");
		return false;
		}
	
	return true;
}	
	
function billing() {
	var b, d, f, h, p, r;
	var ie = document.all ? true : false;
	
	if (document.form.r_domain_name.value.length == 0) {
		alert("Isilah bagian Nama domain");
		document.form.r_domain_name.focus();
		return false;
		}
	if (document.form.r_domain_name.value.length >0) {
		j=document.form.r_domain_name.value.indexOf(".")
		k=document.form.r_domain_name.value.indexOf(",")
		kk=document.form.r_domain_name.value.indexOf(" ")
		jj=document.form.r_domain_name.value.lastIndexOf(".")+1
		len=document.form.r_domain_name.value.length

	if ( (j>1) && (k==-1) && (kk==-1) &&
		(len-jj >=2) && (len-jj<=3)) {
		
	} else {
		alert("Periksa kembali nama domain yang Anda masukkan.\n" + document.form.r_domain_name.value + " kelihatannya tidak valid.")
		document.form.r_domain_name.select();
		return false;
		}
		}
		
	text = "<table width=\"80%\" border=\"0\" cellspacing=\"2\" cellpadding=\"2\" class=\"maintext\" valign=\"top\">\r\n<tr>";
	
	if (document.form.r_hosting_plan.options[document.form.r_hosting_plan.selectedIndex].value == "Registrasi Domain") {
		document.form.r_mfpe.selectedIndex = 1;
		document.form.r_billing_cycle.selectedIndex = 1;
		document.form.r_domain_status.selectedIndex = 0;
		if ((document.form.r_domain_name.value.indexOf(".co.id") > 0) || (document.form.r_domain_name.value.indexOf(".or.id") > 0) 
	      || (document.form.r_domain_name.value.indexOf(".web.id") > 0 ) || (document.form.r_domain_name.value.indexOf(".ac.id") > 0) 
	      || (document.form.r_domain_name.value.indexOf(".sch.id") > 0) || (document.form.r_domain_name.value.indexOf(".go.id") > 0)) {
	   		text += "<tr><td class=\"maintext\" nowrap>Registrasi Domain ccTLD-ID "+ document.form.r_domain_name.value + " untuk 1 tahun</td>\r\n"
			text += "<td class=\"maintext\" nowrap align=\"right\">Rp.</td><td class=\"maintext\" nowrap align=\"right\">185000,-</td></tr>\r\n";
		} else {
			text += "<td class=\"maintext\" nowrap>Registrasi Domain "+ document.form.r_domain_name.value + " untuk 1 tahun</td>\r\n";
			text += "<td class=\"maintext\" nowrap align=\"right\">Rp.</td><td class=\"maintext\" nowrap align=\"right\">120000,-</td>\r\n";
		}
		text += "</tr>\r\n</table>\r\n";
	} else if (document.form.r_hosting_plan.options[document.form.r_hosting_plan.selectedIndex].value == "Domain Forwarding") {
		document.form.r_mfpe.selectedIndex = 1;
		document.form.r_billing_cycle.selectedIndex = 1;
		document.form.r_domain_status.selectedIndex = 0;
		if ((document.form.r_domain_name.value.indexOf(".co.id") > 0) || (document.form.r_domain_name.value.indexOf(".or.id") > 0) 
	      || (document.form.r_domain_name.value.indexOf(".web.id") > 0 ) || (document.form.r_domain_name.value.indexOf(".ac.id") > 0) 
	      || (document.form.r_domain_name.value.indexOf(".sch.id") > 0) || (document.form.r_domain_name.value.indexOf(".go.id") > 0)) {
	   		text += "<tr><td class=\"maintext\" nowrap>Domain Registration ccTLD-ID & Forwarding "+ document.form.r_domain_name.value + " untuk 1 tahun</td>\r\n"
			text += "<td class=\"maintext\" nowrap align=\"right\">Rp.</td><td class=\"maintext\" nowrap align=\"right\">285000,-</td></tr>\r\n";
		} else {
			text += "<td class=\"maintext\" nowrap>Domain Registration & Forwarding "+ document.form.r_domain_name.value + " untuk 1 tahun</td>\r\n";
			text += "<td class=\"maintext\" nowrap align=\"right\">Rp.</td><td class=\"maintext\" nowrap align=\"right\">220000,-</td>\r\n";
		}
		text += "</tr>\r\n</table>\r\n";
	} else {
	b = 120000;
	if (document.form.r_hosting_plan.options[document.form.r_hosting_plan.selectedIndex].value == "Starter") {
		document.form.r_mfpe.selectedIndex = 1;
		r = 19000;
	} else if (document.form.r_hosting_plan.options[document.form.r_hosting_plan.selectedIndex].value == "Mini") {
		r = 35000;
	} else if (document.form.r_hosting_plan.options[document.form.r_hosting_plan.selectedIndex].value == "Iron") {
		r = 45000;
	} else if (document.form.r_hosting_plan.options[document.form.r_hosting_plan.selectedIndex].value == "Silver") {
		r = 70000;
	} else if (document.form.r_hosting_plan.options[document.form.r_hosting_plan.selectedIndex].value == "Gold") {
		r = 135000;
	} else if (document.form.r_hosting_plan.options[document.form.r_hosting_plan.selectedIndex].value == "Platinum") {
		r = 265000;
	}
    
	if (document.form.r_billing_cycle.options[document.form.r_billing_cycle.selectedIndex].value == "1 bulan") {
		d = 0;
		h = r;
	} else if (document.form.r_billing_cycle.options[document.form.r_billing_cycle.selectedIndex].value == "3 bulan") {
		d = 0;
		h = r*3;
	} else if (document.form.r_billing_cycle.options[document.form.r_billing_cycle.selectedIndex].value == "6 bulan") {
		d = 0;
		h = r*6;
	} else if (document.form.r_billing_cycle.options[document.form.r_billing_cycle.selectedIndex].value == "1 tahun") {
		d = 1;
		h = r*12;
	} else if (document.form.r_billing_cycle.options[document.form.r_billing_cycle.selectedIndex].value == "2 tahun") {
		d = 3;
		h = r*24;
	} 
	p = h;
	if (document.form.r_domain_status.options[document.form.r_domain_status.selectedIndex].value != "Baru") {
		text += "<td class=\"maintext\" nowrap>Biaya hosting untuk "+ document.form.r_billing_cycle.options[document.form.r_billing_cycle.selectedIndex].value +"@ Rp. "+ r + ",-/bulan</td>";
	    text += "<td class=\"maintext\" nowrap align=\"right\">Rp.</td><td class=\"maintext\" nowrap align=\"right\">"+ h +",-</td></tr>\r\n";
    } else {
	   text += "<td class=\"maintext\" nowrap>Biaya setup :</td><td class=\"maintext\" nowrap align=\"right\">Rp.</td><td class=\"maintext\" nowrap align=\"right\">"+ b +",-</td></tr>\r\n";
	   p += b;
	   text += "<tr><td class=\"maintext\" nowrap>Biaya hosting untuk "+ document.form.r_billing_cycle.options[document.form.r_billing_cycle.selectedIndex].value +"@ Rp. "+ r + ",-/bulan</td>";
	   text += "<td class=\"maintext\" nowrap align=\"right\">Rp.</td><td class=\"maintext\" nowrap align=\"right\">"+ h +",-</td></tr>\r\n";
	   if ((document.form.r_domain_name.value.indexOf(".co.id") > 0) || (document.form.r_domain_name.value.indexOf(".or.id") > 0) 
	      || (document.form.r_domain_name.value.indexOf(".web.id") > 0 ) || (document.form.r_domain_name.value.indexOf(".ac.id") > 0) 
	      || (document.form.r_domain_name.value.indexOf(".sch.id") > 0) || (document.form.r_domain_name.value.indexOf(".go.id") > 0)) {
	   	p += 65000;
		text += "<tr><td class=\"maintext\" nowrap>Biaya pendaftaran nama domain ccTLD-ID baru :</td><td class=\"maintext\" nowrap align=\"right\">Rp.</td><td class=\"maintext\" nowrap align=\"right\">65000,-</td></tr>\r\n";
		}
    } 
	f = r*d;
	p -= f;
	if (f) text += "<tr><td class=\"maintext\" nowrap>Penawaran khusus bebas biaya hosting untuk "+ d + " bulan :</td><td class=\"maintext\" nowrap align=\"right\">-Rp.</td><td class=\"maintext\" nowrap align=\"right\">"+ f +",-</td></tr>\r\n";
	text += "<tr><td class=\"maintext\" nowrap align=\"center\">TOTAL :</td><td class=\"maintext\" nowrap align=\"right\">Rp.</td><td class=\"maintext\" nowrap align=\"right\">"+ p +",-</td></tr>\r\n</table>\r\n";
	}
	if (ie) {
		price.innerHTML = text;
	} else if (document.layers) {
		document.price.pageX = document.price1.pageX;//pos.x
		document.price.pageY = document.price1.pageY;//pos.y
		document.price.document.write(text);
		document.price.document.close();
	}
}

function check() {
	if ((document.form.r_hosting_plan.options[document.form.r_hosting_plan.selectedIndex].value == "Starter") || 
		(document.form.r_hosting_plan.options[document.form.r_hosting_plan.selectedIndex].value == "Registrasi Domain") ||
		(document.form.r_hosting_plan.options[document.form.r_hosting_plan.selectedIndex].value == "Domain Forwarding")) {
		document.form.r_mfpe.selectedIndex = 1;
	}
	if ((document.form.r_hosting_plan.options[document.form.r_hosting_plan.selectedIndex].value == "Registrasi Domain") ||
		(document.form.r_hosting_plan.options[document.form.r_hosting_plan.selectedIndex].value == "Domain Forwarding")) {
		document.form.r_billing_cycle.selectedIndex = 1;
		document.form.r_domain_status.selectedIndex = 0;
	}
}

function init() {
	if (document.form.r_domain_name.value.length == 0) {
		document.form.r_domain_name.focus();
		return false;
	} else {
		billing();
	}
}