

	function isEmail(ID)
	{			
		var EmailIdvalue = document.getElementById(ID).value;
		if(EmailIdvalue == "")
		{				
			return true;
		}
		if (EmailIdvalue.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
		{
			return true;
		}
		else
		{
			alert("Invalid E-mail Address!");
			//document.getElementById(ID).select();
			document.getElementById(ID).focus();
			document.getElementById(id).style.backgroundColor = "#ffff99";
			return false;
		}			
	}
	
	function Numeric(e)
	{ 
		var keyASCII =BrowserCheck(e);
		
		var keyValue = String.fromCharCode(keyASCII); 
		
		if (!(keyASCII >= '48' && keyASCII <= '57') ) 
		{
			return BrowserCorrection(e)
		} 
	}
	
	function PhoneValidation(e)
	{ 
		var keyASCII =BrowserCheck(e);
		var keyValue = String.fromCharCode(keyASCII); 
		
		if (!(keyASCII >= '48' && keyASCII <= '57')&& !(keyASCII >= '44' && keyASCII <= '45')) 
		{
			return BrowserCorrection(e);
		} 
	}
	function isNumeric(val)
			{
				var dig="";
				var strst="";var strend="";
				var strsub="";
				for( i1=0;i1<100;i1++)
				{
					strst="";
					strend="";
					strsub="";
					dig=document.getElementById(val).value;
					for( i=0;i<dig.length;i++)
					{
						strsub=dig.substring(i,i+1);
						if(parseFloat(strsub,10)==(strsub*1))
						{
							
						}
						else
						{
							strst=dig.substring(0,i);
							strend=dig.substring(i+1,dig.length)
							dig=dig.substring(0,dig.length) ; 
							document.getElementById(val).value=strst+strend;
						}
					}
				}
			}
			
			function isAlpha(val)
			{
				var dig="";
				var strst="";var strend="";
				var strsub="";
				for( i1=0;i1<100;i1++)
				{
					strst="";
					strend="";
					strsub="";
					dig="";
					dig=document.getElementById(val).value;
					for( i=0;i<dig.length+1;i++)
					{
						strsub=dig.substring(i,i+1);
						if(parseFloat(strsub,10)==(strsub*1))
						{
							strst=dig.substring(0,i);
							strend=dig.substring(i+1,dig.length)
							dig=dig.substring(0,dig.length) ; 
							document.getElementById(val).value=strst+strend;
							
						}
						else
						{
							
						}
					}
				}
			}

	

	function Decimal(e)
	{		
		var keyASCII =BrowserCheck(e);
		var keyValue = String.fromCharCode(keyASCII); 
		
		if((keyASCII >= '48' && keyASCII <= '57') || (keyASCII == '46'))
		{
			return BrowserCorrection(e)
		}
	}
		 
	function Alpha(e)
	{ 
		var keyASCII =BrowserCheck(e);
		var keyValue = String.fromCharCode(keyASCII); 
	
		if (!(keyASCII >= '97' && keyASCII <= '122') ) 
		{ 
			return BrowserCorrection(e)
		} 
	}
	
	function AlphawithCaps(e,id)
	{ 
		var keyASCII =BrowserCheck(e);
		var keyValue = String.fromCharCode(keyASCII); 
		//alert(keyASCII);
		//alert(id);
		if(keyASCII==17)
		{
			
			alert("this content not copy allowed")
			
			//document.getElementById(id).value="";
			return false;
		}
		if (!(keyASCII >= '97' && keyASCII <= '122') && !(keyASCII >= '65' && keyASCII < '91')  ) 
		{ 
			return BrowserCorrection(e)
		} 
	}

	function AlphaCaps(e)
	{ 
		var keyASCII =BrowserCheck(e);
		var keyValue = String.fromCharCode(keyASCII); 
		
		if (!(keyASCII >= '65' && keyASCII <= '91') ) 
		{ 
			return BrowserCorrection(e)
		}
	} 
	

	function AlphaNumeric(e)
	{ 
		var keyASCII =BrowserCheck(e);
		var keyValue = String.fromCharCode(keyASCII); 
		
		if (!(keyASCII >= '97' && keyASCII <= '122') && !(keyValue >= '0' && keyValue <= '9') ) 
		{ 
			return BrowserCorrection(e)
		} 
	}
	
	function AlphawithCapsNumeric(e)
	{ 
		var keyASCII =BrowserCheck(e);
		var keyValue = String.fromCharCode(keyASCII); 
		
		if (!(keyASCII >= '48' && keyASCII <= '57') && !(keyASCII >= '97' && keyASCII <= '122') && !(keyASCII >= '65' && keyASCII <= '91') && !(keyASCII >= '0' && keyASCII <= '9') ) 
		{ 
		
			return BrowserCorrection(e)
		} 
	}

	
	function confirm_delete()
	{
		if(confirm("Are you sure want to Delete?")==true)
		{
			return true;
		}
		else
		{
			return false;
		}
	}
	
	function Popupwindow(FormName,FormTitle,Attribute)
	{
		window.open(FormName,FormTitle,Attribute)
	}
	
	function AlertMessagewithcolor(msg,id)
	{
		document.getElementById(id).focus();
		document.getElementById(id).style.backgroundColor = "#ffff99";
		alert(msg);
		return false;
	}
	
	
	
	function AlertCount(id,length,msg,e)
	{
	    var keyASCII =BrowserCheck(e);
		var keyValue = String.fromCharCode(keyASCII); 
		
		if(document.getElementById(id).value.length >= length)
		{
		    if(msg!="")
		    {  
		       alert(msg);
		      
		    }
		    document.getElementById(id).value= document.getElementById(id).value.substring(0, length)
		    return BrowserCorrection(e)
		}
	}

	function AlertMessage(msg)
	{
		alert(msg);
		return false;
	}
	
	function iFrameHeightRegistration(name)
	{
		if(document.getElementById && !(document.all)) 
		{
			h=document.getElementById(name).contentDocument.body.scrollHeight;
			document.getElementById(name).height = h+20;		
		}
		else if(document.all) 
		{
			h = document.frames(name).document.body.scrollHeight;
			document.all.name.height = h+20;
		}
		
	}
	
	function Right(str, n)
	{
		if (n == 0)
		return "";
		else if (n >String(str).length)
		return str;
		else {
		var iLen = String(str).length;
		return String(str).substring(0,n);
		}
	}
	
	function Left(str, n)
	{
		if (n = 0)
		return "";
		else if (n > String(str).length)
		return str;
		else
		return String(str).substring(str.length,n+1);
	}
			
			
			function formValidator(ID,strElements)
			{
				//alert(ID);
				
				var stringArray = strElements.split(',');
				for (var iLoop=0; iLoop < stringArray.length ; iLoop++)
				{
					var strCurrElement = stringArray[iLoop];				
					var theForm = document.getElementById(ID);			
					var allvalid = true;
					var alertstr = "";
					var validstr = "All form data is correct.\n\n";
					var num_of_elements = theForm.length;
					var radio_selected = false;
					var checkbox_selected = false;			
					for (var i=0; i<num_of_elements; i++) 
					{
						var theElement = theForm.elements[i];
						var element_type = theElement.type;				
						var element_name = theElement.name;
						var element_value = theElement.value;
						
						if(strCurrElement == element_name)			
						{	
							// Check Text Box ...
							if (element_type == "text") 				
							{	
	

								if (document.getElementById(element_name).value.length ==0) 
								{			
									alert("Enter the Mandatory Fields !");
									theElement.focus();
									theElement.style.backgroundColor = "#ffff99";
									return false;
								}
								else
								{
									theElement.style.backgroundColor = "#ffffff";
								}
							}
							
							
							
							// Check Drop-down lists ...
							if (element_type.indexOf("select") > -1) 
							{						
								var index = theElement.selectedIndex;					
								if (index == "0") 
								{
									alert("Select Value!");
									theElement.focus();
									theElement.style.backgroundColor = "#ffff99";
									return false;
								}
								else
								{
									theElement.style.backgroundColor = "#ffffff";
								}
							}
							// Check Textarea boxes ...
							if (element_type == "textarea") 
							{
								if (element_value.length == 0) 
								{					
									alert("Empty not allowed!");
									theElement.focus();
									theElement.style.backgroundColor = "#ffff99";
									return false;
								}
								else
								{
									theElement.style.backgroundColor = "#ffffff";
								}
							}
							
							// Check List Box...
							if (element_type.indexOf("multiple") > -1) 
							{										
								var index = theElement.selectedIndex;					
								if (index < 1) 
								{
									alert("Select Value!");
									theElement.focus();
									theElement.style.backgroundColor = "#ffff99";
									return false;
								}
								else
								{
									theElement.style.backgroundColor = "#ffffff";
								}
							}
							
							// Check File Browser...
							if (element_type.indexOf("file") > -1) 
							{										
								if (trim(element_value).length == 0) 
								{					
									alert("Empty field not allowed!");
									theElement.focus();
									theElement.style.backgroundColor = "#ffff99";
									return false;
								}
								else
								{
									theElement.style.backgroundColor = "#ffffff";
								}
							}
							
							// Check Radio buttons ...
							if (element_type == "radio" ) 
							{
								if (theElement.checked == true) 
								{
									radio_selected = true;
									validstr += "From form element '" + element_name + 
									"' you selected the \"" + element_value + "\" button.\n\n";
								}
							}
														
							// Check Checkboxes ...
							if (element_type == "checkbox") 
							{
								if (theElement.checked == true) 
								{
									checkbox_selected = true;
									validstr += "From form element '" + element_name + 
									"' you selected the \"" + element_value + "\" checkbox.\n\n";
								}
							}
						}
					}
				}
			}		



	function BrowserCheck(e)
	{
		var keyASCII ; 
		
		if(window.event) // IE
		{
			keyASCII = e.keyCode
		}
		else if(e.which) // Netscape/Firefox/Opera
		{
			keyASCII = e.which
		}
		return keyASCII;
	}
	
	function BrowserCorrection(e)
	{
		if(window.event) // IE
		{
			e.keyCode=0;
			return false;
		}
		else if(e.which) // Netscape/Firefox/Opera
		{
			if(e.which!='8')
			{
				return false;
			}
			
		}
	}

