var xmlhttp;

function blindsubmit2()
{
xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
  {
  alert ("Browser does not support HTTP Request");
  return;
  }
	var fab = document.getElementById('fabric').value;
	var col = document.getElementById('colour').value;
	var width=document.getElementById('width').value;
	var drop=document.getElementById('drop').value;
	var cc=document.getElementById('cc').value;
	var cs=document.getElementById('cs').value;
	var r=document.getElementById('r').value;
	var dorp=document.getElementById('dorp').value;
	var a = document.getElementById('quote').innerHTML;
	var temp = new Array();
	temp = a.split('>');
	temp = temp[1].split('<');
	var b = temp[0];
	var c = b.charAt(0)
	
	document.getElementById("warning").innerHTML="";
	document.getElementById("width").style.border="2px solid #CCC";
	document.getElementById("drop").style.border="2px solid #CCC";

	if (b == "Maximum width:"){
			document.getElementById("warning").innerHTML="<div class='warning'>The width entered is too wide for this fabric. Please contact us for large blinds.</div>";
			document.getElementById("width").style.border="2px solid red";
	}
	if (b == "Minimum width:"){
			document.getElementById("warning").innerHTML="<div class='warning'>The width entered is too short for this fabric. Please contact us for small blinds.</div>";
			document.getElementById("width").style.border="2px solid red";
	}
	if (b == "Maximum drop:"){
			document.getElementById("warning").innerHTML="<div class='warning'>The drop entered is too large for this fabric. Please contact us for large blinds.</div>";
			document.getElementById("drop").style.border="2px solid red";
	}
	if (b == "Minimum drop:"){
			document.getElementById("warning").innerHTML="<div class='warning'>The drop entered is too short for this fabric. Please contact us for small blinds.</div>";
			document.getElementById("drop").style.border="2px solid red";
	}
	if (c == "£"){
			var url="ajaxincludes/updatebag.php?";
			url=url+"add=ESB,"+fab+","+col+","+width+","+drop+","+cc+","+cs+","+r+","+dorp;
			url=url+"&sid="+Math.random();
			xmlhttp.onreadystatechange=changebag;
			xmlhttp.open("GET",url,true);
			xmlhttp.send(null);
	}
}
function changebag()
{
if (xmlhttp.readyState==4) {
	alertme();
	updatebag();
	}
}

function GetXmlHttpObject()
{
if (window.XMLHttpRequest) {return new XMLHttpRequest();}
if (window.ActiveXObject) {return new ActiveXObject("Microsoft.XMLHTTP");}
return null;
}