var xmlHttp

function showHint(str)
{
if (str.length != 7)
{
document.getElementById("o-nomer").style.background = "#FBC0C6";
document.getElementById("div").innerHTML = '';
document.getElementById("div2").innerHTML = '';
return
}
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Браузер не поддерживает запросы HTTP")
return
}
var tz, d = new Date();
  tz = d.getTimezoneOffset();
document.getElementById("umc").value = tz;

var url="../gethint.php"
url=url+"?q="+str
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChanged
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}

function stateChanged()
{
if (xmlHttp.readyState>0 && xmlHttp.readyState<4)
{text='<img border="0" align = "center" src="../img/ajax-loader.gif" style="margin-top:3px;margin-bottom:3px;"><br>';
 document.getElementById("div").innerHTML = text;
}
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{
var orderHistoryText = xmlHttp.responseText;

color ="#FBC0C6"; // Исходный цвет фона текстового поля

// Цвет фона, если введено не число
//if (!isDigit(f.value)) color = "#FBE7C0";

// Цвет фона, если добавлен пробел
if (orderHistoryText == 1||orderHistoryText == 3) color = "white";

// Цвет фона, если введено больше 10 символов
if (orderHistoryText == 0) color = "#FBC0C6";

// Меняем цвет фона
document.getElementById("o-nomer").style.background = color;



//text='<span class="pincode"><b>PIN-код</b></span> &nbsp;&nbsp;&nbsp;<input size="9" type="password" name = "password" class="textboxind">';
//text1='<span class="pincode"><b>Фамилия</b></span> &nbsp;&nbsp;&nbsp;<input size="15" type="text" name = "last_name"  class="textboxind">';



text='<li style="margin: 0px auto; padding: 0px; list-style: none; font-size:10pt; font-family:arial; color:#fff; line-height:140%;"><ul style=" margin: 0px auto; padding:0px;">Пароль:</ul><ul style=" margin: 0px auto; padding:0px;"><input  tabindex="2" size="9" type="password" name="password" style="border:1px solid #000;"></ul><ul style="margin: 0px; padding:0px;" id="lost_ul">&nbsp;</ul></li>';
text1='<li style="margin: 0px auto; padding: 0px; list-style: none; font-size:10pt; font-family:arial; color:#fff; line-height:140%;"><ul style=" margin: 0px auto; padding:0px;">Ваша фамилия:</ul><ul style=" margin: 0px auto; padding:0px;"><input  tabindex="2" size="9" type="text" name="last_name" style="border:1px solid #000;"></ul><ul style=" margin: 0px auto; padding:0px;">&nbsp;</ul></li>';

text6='<input type="submit" value="Войти">'


if (orderHistoryText == 3)document.getElementById("div").innerHTML = text;
if (orderHistoryText == 1)document.getElementById("div").innerHTML = text1;

if (orderHistoryText == 3)document.getElementById("div2").innerHTML = text6;
if (orderHistoryText == 1)document.getElementById("div2").innerHTML = text6;


if (orderHistoryText == 0)document.getElementById("div").innerHTML = '<span style="color:#9b0d1d; font-family:arial; font-weight:bold;">О-номер указан не верно</span>';


}
}




function GetXmlHttpObject()
{
var objXMLHttp=null
if (window.XMLHttpRequest)
{
objXMLHttp=new XMLHttpRequest()
}
else if (window.ActiveXObject)
{
objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
}
return objXMLHttp
}




function hideme(hideid)
{
var hide = document.getElementById (hideid);
if (hide) hide.style.display = hide.style.display == 'none' ? 'block' : 'none';
}

