function ajax(request)
{
  if (window.XMLHttpRequest) 
    xmlhttp = new XMLHttpRequest()
  // if IE
  else if (window.ActiveXObject){ 
    try {
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP")
    } 
    catch (e){
      try{ xmlhttp = new ActiveXObject("Microsoft.XMLHTTP") }catch (e){}
    }
  }else{
    alert('This Browser do not support AJAX-Technology!');
    return ;
  }
	xmlhttp.open("GET", "/basket/?id="+request);
	xmlhttp.onreadystatechange = checkResultAjax;
	xmlhttp.send("");
	
	function checkResultAjax()
	{
      if (xmlhttp.readyState != 4)return;
        if (xmlhttp.status == 200) {
			document.getElementById("top-card").innerHTML=xmlhttp.responseText;
//		alert(xmlhttp.responseText);
        }
		else
		{
          alert('Запрос обрабатывается');
        }

	}
}

function ajaxForm()
{
  if (window.XMLHttpRequest) 
    xmlhttp = new XMLHttpRequest()
  // if IE
  else if (window.ActiveXObject){ 
    try {
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP")
    } 
    catch (e){
      try{ xmlhttp = new ActiveXObject("Microsoft.XMLHTTP") }catch (e){}
    }
  }else{
    alert('This Browser do not support AJAX-Technology!');
    return ;
  }
	xmlhttp.open("POST", "/form/");
	var request = "fio="+document.getElementById("fio").value+"&tel="+document.getElementById("tel").value+"&email="+document.getElementById("email").value+"&comment="+document.getElementById("comment").value;
	//+document.getElementById("submint").value;
	xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	xmlhttp.onreadystatechange = checkResultAjaxForm;
	xmlhttp.send(request);
	
	
	function checkResultAjaxForm()
	{
      if (xmlhttp.readyState != 4)return;
        if (xmlhttp.status == 200) {
		document.getElementById("reserve").innerHTML=xmlhttp.responseText;
        }
		else
		{
          alert('Ощибка загрузки');
        }

	}
}
function testSend()
{
	var error = document.getElementById("error");
	if (document.getElementById("fio").value.length==0)
	{
		error.innerHTML="Необходимо заполнить поле ФИО с вашими данными";
		error.style.visibility="visible";
		var pole = document.getElementById("fio");
		pole.style.backgroundColor="#FF3";
		pole.focus();
		setTimeout("clearError()",4000);
		return false;
	}
	else if (document.getElementById("tel").value.length==0)
	{
		error.innerHTML="Введите телефон для связи с вами";
		error.style.visibility="visible";
		var pole = document.getElementById("tel");
		pole.style.backgroundColor="#FF3";
		pole.focus();
		setTimeout("clearError()",4000);
		document.getElementById("error").style.visibility="visible";
		return false;
	}
	else 
	{
		ajaxForm();
	}
}
function clearError()
{
	document.getElementById("error").style.visibility="hidden";
	return false;
}
function clearColorForm(id)
{
	document.getElementById(id).style.backgroundColor="#ffffff";
} 

function showObject(id)
{
	document.getElementById(id).style.display="block";
}
function showcamlittle()
{
	(document.getElementById('camlittle').style.display=='none')?document.getElementById('camlittle').style.display='block':document.getElementById('camlittle').style.display='none';
}
