// JavaScript Document
function swapImage()
{
	var param="swapImage=yes";
	AlaxForm("http://local.indiantelevision.com/captcha/ajax.captcha.php",param,"yes");	
}
function AlaxForm(url,param,swapImage)
{
	
	var xmlHttp;
	try
	{    // Firefox, Opera 8.0+, Safari    
		xmlHttp=new XMLHttpRequest();    
	}
	catch (e)
	{    // Internet Explorer    
		try
  		{      
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      
		}
		catch (e)
  		{      
			try
			{        
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
			}
  			catch (e)
			{        
					alert("Your browser does not support AJAX!");        
					return false;        
			}      
		}    
	}
	xmlHttp.open("POST",url,true);
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlHttp.setRequestHeader("Content-length", param.length);
    xmlHttp.setRequestHeader("Connection", "close");
	xmlHttp.send(param); 
	
	xmlHttp.onreadystatechange=function()
  	{
				
		/*if(xmlHttp.readyState == 0) { document.getElementById('HtmlRatingCatalog').innerHTML = "Sending Request..."; }
		if(xmlHttp.readyState == 1) { document.getElementById('HtmlRatingCatalog').innerHTML = "Loading..."; }
		if(xmlHttp.readyState == 2) { document.getElementById('HtmlRatingCatalog').innerHTML = "Loading..."; }
		if(xmlHttp.readyState == 3) { document.getElementById('HtmlRatingCatalog').innerHTML = "Loading..."; }*/
		if(xmlHttp.readyState == 4)
		{
			if(xmlHttp.status == 200)
			{
				document.getElementById("captcha").innerHTML=xmlHttp.responseText;
				return true;	
			}
			else
			{
				//alert(xmlHttp.status);
				//document.getElementById('HtmlRatingCatalog').innerHTML = "HTTP " + xmlHttp.status;
			}
		}
  	}
}

function removeSpaces(val) 
{
	while(val.indexOf(" ")!=-1)
	{
		val=val.replace(" ","");
	}
	return val.length;
}
function validatecaptcha(frm)
{
	var Msg='';
	if(frm=='')
	{
		
		if(document.getElementById("confirmation").value=="")
		{
			Msg+="Please enter the Security code ! \n";
		}
		else
		{
		if(document.getElementById("confirmation").value!=document.getElementById("confirmation1").value)
		{
			Msg+="Please enter the Proper Security code ! \n";
		}
		}
	}
	else
	{
		with(frm)
		{
			if(confirmation.value=="")
			{
				Msg+="Please enter the Security code ! \n";
			}
			else
			{
			if(confirmation.value!=confirmation1.value)
			{
				Msg+="Please enter the Proper Security code ! \n";
			}
			}
		}
	}
	return Msg;
}





