function doBlink() {
var blink = document.all.tags("BLINK")
for (var i=0; i<blink.length; i++)
blink[i].style.visibility = blink[i].style.visibility == "" ? "hidden" : "" 
}
function startBlink() {
if (document.all)
setInterval("doBlink()",500)
}
window.onload = startBlink;
// -->
<!--
/* Trim function  used for removing the spaces from begining and end of all non-empty textfield and text area of entire  document irrespective  forms. Prefred to call this method at first of each validation functions. This function calls the Trim() method described next .This method doesn't return anything*/
function getTrimed()
{
var formNo=document.forms.length;
for (j=0;j<formNo;j++)
{
var max = document.forms[j].elements.length;
for(var i=0; i< max; i++)
{
if (document.forms[j].elements[i].type =="textarea" || document.forms[j].elements[i].type =="text" || document.forms[j].elements[i].type == "password")
{
trim(document.forms[j].elements[i]);
}
}
}
}
/* This method is for removing the white spaces from the begining and end of a given Object . Doesn't return anything */
<!--Pass the input objet reference-->
function trim(item) {
var tmp = "";
var item_length = item.value.length;
var item_length_minus_1 = item.value.length - 1;
for (index = 0; index < item_length; index++){
if (item.value.charAt(index) != ' '){
tmp += item.value.charAt(index);
}else {
if (tmp.length > 0){
if (item.value.charAt(index+1) != ' ' && index != item_length_minus_1){
tmp += item.value.charAt(index);
}
}
}
}
item.value = tmp;
}
function isAlphaNumericWithSpace(theString)
{
pat=/[^A-Za-z 0-9_-]/
return (!(pat.test(theString)))
}
/* Empty check. This will check whether the passed field Empty or not. Returns  true if the field is empty  */
function isEmpty(theField)
{
if (theField.value.length==0)
{
return true
}
return false
}
/*This function validates many fields at a time and shows the list of required fields as an alert.For calling this function pass the text field and and a corresponding string for displaying in alert. For example if you want validates 2 form fields function call will like [ isEmptyAll(this.form.text1,'name',this.form.text2,'Age')] */
function isEmptyAll()
{
var emptyFlag=false
var msg="The Following fields are required."
var len=arguments.length
for (var i=0;i<len ; i=i+2)
{
if (isEmpty(arguments[i]))
{
msg=msg+"\n * "+arguments[i+1]
if(!emptyFlag)
{
arguments[i].focus();
}
emptyFlag=true
}
}
if(emptyFlag)
{
alert(msg);		
}
return emptyFlag;
}
/* Date validation--> Call the function passing Day, Month and Year respectively. It shows alert message and returns boolean.  */
function LeapYear(intYear) {
if (intYear % 100 == 0) {
if (intYear % 400 == 0) { return true; }
}
else {
if ((intYear % 4) == 0) { return true; }
}
return false;
}
function isValidDate(intDay, intMonth, intYear){
if ((!isFinite(intDay)) || (intDay > 31) || (intDay == ""))
{
	alert("The days entered is incorrect. Please enter correct number for days.");
	return false;
}
if ((!isFinite(intMonth)) || (intMonth > 12) || (intMonth == ""))
{
	alert("The months entered is incorrect. Please enter correct number for months.");
	return false;
}
if ((!isFinite(intYear)) || (intYear < 1900) || (intYear == ""))
{
	alert("The years entered is incorrect. Please enter correct number for years.");
	return false;
}
if ((intMonth == 4 || intMonth == 6 || intMonth == 9 || intMonth == 11) && (intDay > 30 || intDay < 1)) {
	alert("Specify a valid date. Maximum date should be 30 for correspnding to month you have selected");
	return false;
}
if (intMonth == 2){
	if (LeapYear(intYear) == true && intDay > 29){
	alert("Invalid date. Maximum date should be 29 for  corresponding month!");
	return false;
	}
	else if (LeapYear(intYear) != true && intDay > 28){
	alert("Invalid date. Maximum date should be 28 for  corresponding month!");
	return false;
	}
}
return true;
}
/* Email Validation ---> Pass the string to the function for validation. It show alert message and returns true if the email address is valid returns false otherwise*/
function emailCheck(emailStr) {
var checkTLD=1;
var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;
var emailPat=/^(.+)@(.+)$/;
var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
var validChars="\[^\\s" + specialChars + "\]";
var quotedUser="(\"[^\"]*\")";
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
var atom=validChars + '+';
var word="(" + atom + "|" + quotedUser + ")";
var	userPat=new RegExp("^" + word + "(\\." + word + ")*$");
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
var matchArray=emailStr.match(emailPat);
if (matchArray==null) 
{
alert("Email address seems incorrect (check @ and .'s)");
return false;
}
var user=matchArray[1];
var domain=matchArray[2];
for (i=0; i<user.length; i++) 
{
if (user.charCodeAt(i)>127) 
{
alert("Ths username contains invalid characters.");
return false;
}
}
for (i=0; i<domain.length; i++) 
{
if (domain.charCodeAt(i)>127) 
{
alert("Ths domain name contains invalid characters.");
return false;
}
}
if (user.match(userPat)==null) 
{
alert("The username doesn't seem to be valid.");
return false;
}
var IPArray=domain.match(ipDomainPat);
if (IPArray!=null) 
{
for (var i=1;i<=4;i++) 
{
if (IPArray[i]>255)
{
alert("Destination IP address is invalid!");
return false;
}
}
return true;
}
var atomPat=new RegExp("^" + atom + "$");
var domArr=domain.split(".");
var len=domArr.length;
for (i=0;i<len;i++) 
{
if (domArr[i].search(atomPat)==-1) 
{
alert("The domain name does not seem to be valid.");
return false;
}
}
if (checkTLD && domArr[domArr.length-1].length!=2 &&	domArr[domArr.length-1].search(knownDomsPat)==-1) 
{
alert("The address must end in a well-known domain or two letter " + "country.");
return false;
}
if (len<2) 
{
alert("This address is missing a hostname!");
return false;
}
return true;
}
/* Checking Integer */
function isInteger(theValue)
{
pat=/\D/
if (pat.test(theValue))
{
return false
}
return true;
}
/* Checking double-->  */ 
function isDouble(TheNumber)
{
var valid = true
var GoodChars = "0123456789."
var i = 0
if (TheNumber==".")return false
ary=TheNumber.split(".")
if ((ary!=null)&&(ary.length>2)) return false
for (i =0; i <= TheNumber.length -1; i++) 
{
if (GoodChars.indexOf(TheNumber.charAt(i)) == -1)
{
return false
} 
} 
return true
}
/*     This function checks whether the passed string is a alpha numeric or not. returns fale if it is not an alphanumeric */
function isAlphaNumeric(theString)
{
pat=/\W/
if (pat.test(theString))
{
return false
}
return true
}
/*  This function checks whether passed string is valid phone number or not */ 
function CheckPhoneNumber(TheNumber)
{
var valid = true
var GoodChars = "0123456789()-+,/ "
var i = 0
for (i =0; i <= TheNumber.length -1; i++) 
{
if (GoodChars.indexOf(TheNumber.charAt(i)) == -1)
{
valid = false
} 
} 
return valid
}
function capitalize(theField)
{
var textValue=theField.value
if(textValue.charCodeAt(0)>96 && textValue.charCodeAt(0)<123)
{
var replaceChar=String.fromCharCode(textValue.charCodeAt(0)-32)
temp=textValue.substring(2,textValue.length)
textValue=replaceChar+temp
theField.value=textValue
}
function test(){
alert('test function');
}
}
function isAlphabetsOnly(theString)
{
pat=/[^A-Za-z]/
return (!(pat.test(theString)))
}
function isAlphabetsWithSpace(theString)
{
pat=/[^A-Z a-z]/
return (!(pat.test(theString)))
}
function isBig(theField,maxSize)
{
var str=theField.value;
if(str.length > maxSize)
{
alert("Feedback Message can not be more than "+(maxSize+1)+" characters ");
theField.focus();
return true;
}
else
{
return false;
}
}

function isValidPostcode(postCode)
{
	pat=/([G][I][R][ ][0][A][A])|((([A-PR-UWYZa-pr-uwyz][0-9][0-9]?)|([A-PR-UWYZa-pr-uwyz][A-HK-Ya-hk-y][0-9][0-9]?)|([A-PR-UWYZa-pr-uwyz][0-9][A-HJKSTUWa-hjkstuw])|([A-PR-UWYZa-pr-uwyz][A-HK-Ya-hk-y][0-9][ABEHMNPRVWXYabehmnprvwxy]))[ ][0-9][ABD-HJLNP-UW-Zabd-hjlnp-uw-z][ABD-HJLNP-UW-Zabd-hjlnp-uw-z])/;
	return (postCode.search(pat))
}
/*
///// usage of how to call the different scripts. //////
function validated()
{
getTrimed();
if(isEmptyAll(document.Call.name,'Name Label in form ',document.Call.phoneNumber,'Phone Number ',document.Call.message,'Main interest / What information would you like? '))
{
return false;
}
if(!isAlphabetsWithSpace(document.Call.name.value))
{
alert("Name Label in form  requires alphabet only");
document.Call.name.focus();
document.Call.name.select();
return false;
}
if(!CheckPhoneNumber(document.Call.phoneNumber.value))
{
alert("Phone Number  requires 0123456789 ()-+,/ only");
document.Call.phoneNumber.focus();
document.Call.phoneNumber.select();
return false;
}
if(document.Call.email.value!="")
{
if(!emailCheck(document.Call.email.value))
{
document.Call.email.focus();
document.Call.email.select();
return false;
}
}
if(document.Call.company.value!="" && !isAlphaNumericWithSpace(document.Call.company.value))
{
alert('Company  requires alphanumeric  only');
document.Call.company.focus();
document.Call.company.select();
return false;
}
if(document.Call.country.value==" ")
{
alert('Country  ' +" is required" );
document.Call.country.focus();
return false;
}
if(document.Call.whenCall.value==" ")
{
alert('When would you like us to call  ' +" is required" );
document.Call.whenCall.focus();
return false;
}
//if(isBig(document.call.message,254)) return false;
return true;
}
*/
