function checkValue(value){
	if (value < 510000){
		document.formmain.data4.style.display = "";
		document.formmain.data5.style.display = "";
		document.formmain.data6.style.display = "";
		document.formmain.data4.value = "";
		document.formmain.data5.value = "";
		document.formmain.data6.value = "";
		document.getElementById("data4_l1").style.display = "block";
		document.getElementById("data5_l1").style.display = "block";
		document.getElementById("data6_l1").style.display = "block";
	} else{
		document.formmain.data4.style.display = "none";
		document.formmain.data5.style.display = "none";
		document.formmain.data6.style.display = "none";
		document.getElementById("data4_l1").style.display = "none";
		document.getElementById("data5_l1").style.display = "none";
		document.getElementById("data6_l1").style.display = "none";
	}
}

function sendform(step){
	var dir = "preview.php";
	var parameters="";
	if (step >0){
		for (i=1; i<=7; i++){
			try{
			eval("parameters += \"data[" + (i-1) + "]=\" + document.formmain.data"+i+".value + \"&\";");} 
			catch (IsNull){}
		}
		document.getElementById("message").style.display = "block";
	}
	if (step == 3){
		if (document.formmain.data8.selectedIndex == 0){
			window.alert("You must select a item from the list");
			document.getElementById("message").style.display = "none";
			return;
		} else {
			parameters += "data[7]=\"" + document.formmain.data8.options[document.formmain.data8.selectedIndex].value + "\"&";
		}
	}
	
	parameters += "stepd=" + step;
	AJAXPostRequest(dir,"formframe_1",parameters);
}

function AJAXPostRequest(direccion, vaciar, parametros) {
	var ajax;
	if (window.XMLHttpRequest)
		ajax = new XMLHttpRequest;
	else
		ajax = new ActiveXObject("MSXML2.XMLHTTP");
	if (ajax) {
		var obj = document.getElementById(vaciar);
		if (ajax.readyState == 0 || ajax.readyState == 4){
			ajax.open("POST", direccion);
			ajax.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
			ajax.onreadystatechange = function()
				{
					if (ajax.readyState == 4 && ajax.status == 200) {
						obj.innerHTML = ajax.responseText;
						delete ajax;
					}
				};
			ajax.send(parametros);
		}
	}
	else {
		alert("Turn On Javascript into Browser, for use this form");
		return false;
	}
	return true;
}