// JavaScript Document
function IsNumeric(strString)
{
	var strValidChars = "0123456789";
	var strChar;
	var blnResult = true;
	
	if (strString.length == 0) return true;
	
	//  test strString consists of valid characters listed above
	for (i = 0; i < strString.length && blnResult == true; i++)
	{
		strChar = strString.charAt(i);
		if (strValidChars.indexOf(strChar) == -1)
		{
			blnResult = false;
		}
	}
	return blnResult;
}
function isdigit(keyCode)
{		
	if(keyCode == 35)return true;
	if(keyCode == 36)return true;
	if(keyCode == 37)return true;
	if(keyCode == 39) return true; 
	if(keyCode == 46) return true; 
	if(keyCode == 109) return false; 
	if(keyCode == 110) return false; 
	if(keyCode == 189) return false; 
	if(keyCode == 9) return true; 
	if(keyCode == 8) return true;
	if(keyCode > 95 && keyCode < 106) return true; 
	if(keyCode < 48 || keyCode > 57) return false;	
}	
function IsEmail(string, obj, msgstr)
{
	if(string.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
	{
		return true;
	}
	else
	{
		return false;
	}
}

function getCheckedValue(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}

function validateRequired(eleid,msgid)
{
	if(document.getElementById(eleid).value == "")
	{
		document.getElementById(msgid).innerHTML = "Required";
	}
	else
	{
		document.getElementById(msgid).innerHTML = "";
	}
}

function removeSpaces(string) {
	var tstring = "";
	string = '' + string;
	splitstring = string.split(" ");
	for(i = 0; i < splitstring.length; i++)
	tstring += splitstring[i];
	return tstring;
}

//AJAX Part.............................Starting

function callajax(url,eleid,event_name)
{
	obj = new Ajax(url,'get',eleid,event_name);
}

function Ajax(url,method,eleid,event_name) 
{		

  	var xmlhttp = false;
  	if (window.XMLHttpRequest)
  	{
		xmlhttp = new XMLHttpRequest();
  	}
  	else if (window.ActiveXObject)// code for IE
  	{
		try
		{
		  	xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
	  		try
	  		{
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	  		} catch (E) {
				xmlhttp=false;
	  		}
		}
	}
  	if(xmlhttp)
  	{
		xmlhttp.onreadystatechange=function() 
		{
			if(xmlhttp && xmlhttp.readyState==4)
			{
				if (xmlhttp.status==200)
				{
					document.getElementById(eleid).innerHTML = "";
					document.getElementById(eleid).innerHTML = xmlhttp.responseText;
					callBackFunction(event_name); 
				}
				else
				{
				}
			}
			else
			{
			}
		}
	  	url = "includes/php/"+url;
		xmlhttp.open(method,url,true);
	  	xmlhttp.send(null);
  	}
  	else
  	{
		alert("Unable to creat Ajax Object for this browser");
  	}
}
	
//AJAX Part.............................Ending
