
function txt_blink(tag)
{
	spe=1000;
	NameOfYourTags=tag;
	swi=1;
	na=document.getElementsByName(NameOfYourTags);
	bringBackBlinky();
}

function bringBackBlinky() 
{
	if (swi == 1) {
		sho="visible";
		swi=0;
		spe=2000;
	}
	else {
		sho="hidden";
		swi=1;
		spe=700;
	}
	for(i=0;i<na.length;i++) {
		na[i].style.visibility=sho;
	}
	setTimeout("bringBackBlinky()", spe);
}

//---------------pincode----------------	
function valid_pin(nn)
{
	if(nn.value!="")
	{	
		ss=nn.value.substr(0,1);
		if( ss=="0" | ss=="9")
		{
			Show(nn,'Pincode should not start with  0 or 9')
			nn.value="";
			nn.focus();
			return false;
		}
		else if(isNaN(nn.value)==true)
		{
			Show(nn,'Pincode should be in number');
			nn.value="";
			nn.focus();
			return false;
		}
		else if(nn.value.length<6)
		{
			Show(nn,'Pincode should be six digits');
			nn.value="";
			nn.focus();
			return false;
		}		
	}
}

//---------------Name,..----------------	
function valid_alpha(nn)
{
	if(nn.value!="")
	{	
		if(isNaN(nn.value)==false)
		{
			if (document.getElementById("disp")) document.getElementById("disp").innerHTML="No Numbers are allowed";
			else Show(nn,'No Numbers are allowed');
			nn.value="";
			nn.focus();
			return false;
		}
	}
}

//---------------address,..----------------	
function valid_addr(nn)
{
	if(nn.value!="")
	{	
		if(nn.value.length<=10)
		{
			Show(nn,'Enter complete address');
			nn.value=""; nn.focus(); return false;
		}
		else if(nn.value.indexOf(" ")==-1)
		{
			Show(nn,'Please enter address in right format')
			nn.value=""; nn.focus(); return false;			
		}
	}
}

//---------------std----------------
function valid_std(nn)
{
	if(nn.value!="")
	{
		ss=nn.value.substr(0,1);
		if(ss!="0")
		{
			Show(nn,'STD code should start with 0')			
			nn.value="";
			nn.focus();
			return false;
		}			
		else if(!((nn.value.length==3) || (nn.value.length==4) || (nn.value.length==5)))
		{
			Show(nn,'Enter a valid STD code')
			nn.value="";
			nn.focus();
			return false;
		}		
	}
}

//---------------phone----------------
function valid_phone(std,nn)
{
	if(nn.value!="")
	{
		if(std.value=="")
		{
			Show(nn,'Enter the STD code')
			nn.value="";
			std.focus();
			return false;
		}
		ss=nn.value.substr(0,1);
		if( ss=="0")
		{
			Show(nn,'Phone Number should not start with 0')
			nn.value="";
			nn.focus();
			return false;
		}			
		else if((std.value.length+nn.value.length)!=11)
		{
			Show(nn,'Enter a valid Phone Number')
			nn.value="";
			nn.focus();
			return false;
		}		
	}
}
//-----------------------Pan card Validation
function valid_pan(a,b)
{	
	if(a.value!="")
	{
		if (!(isNaN(a.value.substr(0,1))==true && isNaN(a.value.substr(1,1))==true && isNaN(a.value.substr(2,1))==true && isNaN(a.value.substr(3,1))==true && isNaN(a.value.substr(4,1))==true && isNaN(a.value.substr(9,1))==true && isNaN(a.value.substr(5,4))==false ))
		{
			Show(a,'Enter Valid Pan Card Number')
			a.value="";
			a.focus()
			return false;
		}
	}
}
//----------------------------valid mobile number-------------------------
function valid_mob(m)
{
	mob=m.value;
	if (mob=="")return false;
	if ((!(((mob.indexOf("9")==0 || mob.indexOf("8")==0) && mob.length==10))) || isNaN(mob))
	{
		Show(m,'Enter Valid Mobile Number')
		with(m){value="";focus()}
	}
	var chk=mob.substr(1,1)
	var j=0;
	for (var i=2;i<10;i++)
	{
		if(chk==mob.substr(i,1))
		{var j=j+1};
		if(j>=7){var exists="NO";}
	}
	if(exists=="NO")
	{
		Show(m,'Enter Valid Mobile Number')
		m.value="";
		m.focus();
	}		
}

// -----------------------------valid email id--------------------------------
function emailvalidation(entered, alertbox)
{
with (entered)
{
	mails=value.length;
	if (mails >=1)
		{	               
			firstpos=value.indexOf("@"); 
			dotpos=value.lastIndexOf(".");
			lastpos=value.length-1;
			val=entered.value
			if (firstpos<1 || dotpos-firstpos<2 || lastpos-dotpos>4 || lastpos-dotpos<2 ) 
			{
				if (alertbox) 
				{
					Show(entered,alertbox);
					value=""; focus();
				} 
			return false;
			}
		}	
	}
}

//----TEXT MAX ENTRY
function txt_max(Obj, Objmax) 
{
	var maxnum = Obj.value.length;
	if(Obj.value.length >= Objmax) {
		Show(Obj,"Character limit reached.")
		Obj.value = Obj.value.substring(0, Objmax);
	}
}

<!--FUNCTION USED FOR HELP-->
/*function Hide_help()
{
  help.style.display="none";
}
function help_view()
{
	x=event.clientX+document.body.scrollLeft;
	y=event.clientY+document.body.scrollTop+5;
	help.style.display="block"
	help.style.left=x;
	help.style.top=y;
}*/

//-----------------------FUNCTION USED FOR PAGE DIM
function page_dim(val)
{
	if(val=="1")
	{
		document.getElementById('dim_obj').style.display='';
		document.getElementById('dim_obj').style.width=document.body.scrollWidth;
		document.getElementById('dim_obj').style.height=document.body.scrollHeight;
		document.getElementById('dim_obj').style.ZIndex="10";
		document.getElementById("dim_obj").style.filter = 'alpha(opacity=' + 70 + ')';	
	}
	else
	{
		document.getElementById("dim_obj").style.display='none';
	}
}


function page_dim1(val)
{
	if(val=="1")
	{
		document.getElementById('dim_obj').style.display='';
		document.getElementById('dim_obj').style.width=document.body.scrollWidth;
		document.getElementById('dim_obj').style.height=document.body.scrollHeight;
		document.getElementById('dim_obj').style.ZIndex="5";
		document.getElementById("dim_obj").style.filter = 'alpha(opacity=' + 85 + ')';	
		//Tween(object,property,easing,start,end,duration,suffixe);
		if (document.getElementById('dim_c'))
		{
			document.getElementById('dim_c').style.display='';
			hg=document.body.scrollHeight/2;
			t1=new Tween(document.getElementById('dim_c').style,'top',Tween.bounceEaseOut,0,hg,1,'px')
			t1.start();
		}	
	}
	else
	{
		document.getElementById("dim_obj").style.display='none';
		if (document.getElementById('dim_c'))
		{
			document.getElementById("dim_c").style.display='none';
		}	
	}
}

function con_hide()
{
	document.getElementById("dim_obj").style.display='none'
		if (document.getElementById('dim_c'))
		{
			document.getElementById("dim_c").style.display='none';
		}	
}
//-----------------------FUNCTION USED FOR PAGE DIM ENDS


<!--IMAGE PRELOAD FUCNTIONS-->
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

//===============CREATE COOKIE
function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

//==============READ COOKIE
function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}
function Show(ErrorElement,txt,sp)
{
	ErrorPosX = ErrorElement.offsetLeft   
	ErrorPosY = ErrorElement.offsetTop;   
	ErrorWidth = ErrorElement.clientWidth;   
	if(!ErrorWidth){ErrorWidth = ErrorElement.offsetWidth;}   
	TheElement = ErrorElement.offsetParent;   
	while(TheElement != null)
	{   
		ErrorPosX += TheElement.offsetLeft    
		ErrorPosY += TheElement.offsetTop;   
		TheElement = TheElement.offsetParent;   
	}
	if(sp!=1){sp=270}
	else{sp=180}
	Popup.style.display="block";
	Popup.style.left = ErrorPosX+sp;
	Popup.style.top = ErrorPosY;
	Popup1.innerHTML = txt
	ErrorElement.focus()
}
function show_element(obj,val)
{
	if(obj.value!=""){document.getElementById("img"+val).style.display="";Popup.style.display="none";}
	else{document.getElementById("img"+val).style.display="none"}
}
function show_element2()
{
	Popup.style.display="none";
}
function help_view(w,h)
{
	page_dim('1')
	var left = (screen.width/2)-(w/2);
	var top = (screen.height/2)-(h/2);
	help.style.display="block";
	help.style.left=left;
	help.style.top=top;
} 
function Hide_help(){help.style.display="none";	page_dim('2')}
function Trim(STRING)
{
	STRING = LTrim(STRING);
	return RTrim(STRING);
}

function RTrim(STRING)
{
	while(STRING.charAt((STRING.length -1))==" " || STRING.charCodeAt((STRING.length -1))==13 || STRING.charCodeAt((STRING.length -1))==10)
	{
		STRING = STRING.substring(0,STRING.length-1);
	}
	return STRING;
}


function LTrim(STRING)
{
	while(STRING.charAt(0)==" " || STRING.charCodeAt(0)==13 || STRING.charCodeAt(0)==10)
	{
		STRING = STRING.replace(STRING.charAt(0),"");
	}
	return STRING;
}



