/*
############################################################
* Origin: www.voiptalk.org
* Name: snvajax.js
* Description AJAX implementation for website
* Autor: Piotr Dziembor, Telappliant Ltd.
* Version: 0.6
* Modified: 16:00 10/10/2007
* Copyright: Telappliant Ltd.
############################################################
*/
var xmlHttp
function showrq(str,prodid)
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
}
if (str.length > 1) {
var url="search_number.php"
url=url+"?q="+str+"&products_id="+prodid+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChanged
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
function stateChanged()
{
if (xmlHttp.readyState==1 || xmlHttp.readyState=="complete")
{
document.getElementById("snumrq").innerHTML='
'
}
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{
document.getElementById("snumrq").innerHTML=xmlHttp.responseText
}
}
function GetXmlHttpObject()
{
var xmlHttp=null;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
//Internet Explorer
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}
}
var flashTimer = null;
var flashState = flashCount = 0;
function checkData()
{
if(document.getElementById("check").value == "invalid")
{
flash("number");
return false;
}
return true;
}
function flash(fname)
{
if(flashState == 1)
{
document.getElementById(fname).style.backgroundColor = "#fff";
flashState = 0;
}
else
{
document.getElementById(fname).style.backgroundColor = "#cee885";
flashState = 1;
}
if(flashCount == 5)
{
document.getElementById(fname).focus();
clearTimeout(flashTimer);
flashCount = flashState = 0;
}
else
{
flashTimer = setTimeout("flash('"+fname+"')",100);
flashCount++;
}
}
function swaptext() {
if (document.getElementById('number').value == "Type in here the city name or prefix") document.getElementById('number').value = '';
}