function stn_indicator(field,indicator){
	//alert(fname);
	//fname = 'password';
	alphabets = 'abcdefghijklmnopqrstuvwxyz';
	Alphabets = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
	numbers = '0123456789';
	symbols = ';:-_=+\|//?^&!.@$£#*()%~<>{}[]';
	minimum = 6;	
	//indicator = 'pass_indicator';
	img = new Array('pass_indicator_0.jpg','pass_indicator_1.jpg','pass_indicator_2.jpg','pass_indicator_3.jpg','pass_indicator_4.jpg');
	pw = document.getElementById(field).value;
	strength = 0;
	//alert(pw);	
	if(doesContain(pw,alphabets)>0){
		strength += doesContain(pw,alphabets)*0.5;
	}
	if(doesContain(pw,Alphabets)>0){
		strength += doesContain(pw,Alphabets)*1;
	}
	if(doesContain(pw,numbers)>0){
		strength += doesContain(pw,numbers)*1.5;
	}
	if(doesContain(pw,symbols)>0){
		strength += doesContain(pw,symbols)*2;
	}
	if(pw.length<6 || pw.length==doesContain(pw,Alphabets) || pw.length==doesContain(pw,numbers)){
		strength = 0;
	}
	
	i = Math.floor(strength/4);
	
	/*if(doesContain(pw,alphabets)<0 || doesContain(pw,Alphabets)<0 || doesContain(pw,numbers)<0){
		i = i/200;
	}*/

	if(i>4){
		i=4;
	}
	if(i<0){
		i=0;
	}
	
	document.getElementById('pass_indicator').src = './images/'+img[i];
	//alert('images/'+strength);
	//alert(document.getElementById('password').value.length);
	
}

// Checks a string for a list of characters
function doesContain(strPassword, strCheck){
	nCount = 0;

	for (i = 0; i < strPassword.length; i++)
	{
		if (strCheck.indexOf(strPassword.charAt(i)) > -1)
		{
		nCount++;
		}
	}

	return nCount;
}

// Vaidate Username & Password
function match_password(confirm_value){
	var password = document.getElementById('password').value; 
	var element = document.getElementById('passConfirm');
	element.style.display = '';	
	if(password == "" || password != confirm_value.value){		
		element.src = './images/cross.gif';
		element.title = 'Passwords Do Not Match!'
	}
	else{
		element.src = './images/tick.gif';
		element.title = 'Passwords Match!'
	}
}

// Vaidate Username & Password
function validate_username(f){
	if(f.username.value=="" || f.username.value.indexOf("@")<=0 || f.username.value.indexOf(".")<=0 || f.username.value.length<5){
		alert('Please provide valid Email as the Username.');
		f.username.focus();
		return false;
	}
	else if(f.password.value == "" || f.password.value.length<6){
		alert ('Please fill up the Password.');
		f.password.focus();
		return false;
	}
	else if(f.password.value != f.cpassword.value){
		alert ('Your Passwords Do Not Match.');
		f.cpassword.focus();
		return false;
	}
	else{
		return true;
	}
}

// Validate Password Update
function passchange_verify(f){
	if(f.o_pass.value == "" || f.password.value == "" || f.cpassword.value == "" || f.password.value < 6){
		alert ('Please fill all the fields of the form.');
		f.o_pass.focus();
		return false;
	}
	else if(f.password.value != f.cpassword.value){
		alert ('The New Password doesnot matches your Confirmed Password');
		f.cpassword.focus();
		return false;
	}
	else{
		return true;
	}
}

// Is Numeric Validate
function IsNumeric(sText){
	var ValidChars = "0123456789";
	var IsNumber=true;
	var Char;
	
	for (i = 0; i < sText.length && IsNumber == true; i++) { 
		Char = sText.charAt(i); 
		if (ValidChars.indexOf(Char) == -1) {
		IsNumber = false;
      	}
   	}
   	return IsNumber;
}


function validate_passretrieval(f){
	if(f.r_email.value =="" || f.r_email.value.indexOf('@') <= 0 || f.r_email.value.indexOf('.') <= 0){
		alert ('Please provide a valid Username.');
		f.r_email.focus();
		return false;
	}
	else{
		return true;
	}
}

// Validate Login
function validate_login(f){
	if(f.u_name.value=="" || f.u_name.value.indexOf('@') <= 0 || f.u_name.value.indexOf('.') <= 0 || f.u_name.value.length < 4){
		alert('Please provide valid Username.');
		f.u_name.focus();
		return false;
	}
	else if(f.p_word.value =="" || f.p_word.value.length<6){
		alert ('Please provide a valid Password.');
		f.p_word.focus();
		return false;
	}
	else{
		return true;
	}
}

// Validate Login
function validate_setpassword(f){
	if(f.pWord.value =="" || f.pWord.value.length<6){
		alert ('Please provide atleast a 6 Character long Password.');
		f.pWord.focus();
		return false;
	}
	else{
		return true;
	}
}

// Swap Any Image
function ImgSwap(i,image){    
		i.src=image;
}

// Toggle all
function checkAll(ref,exby) {
	var checks = document.getElementsByName(ref);
	var boxLength = checks.length;
	for ( i=0; i < boxLength; i++ ) {
		checks[i].checked = exby.checked? true:false;
	}
}

function showhide(d){
	//alert(d);
	if(document.getElementById(d).style.display == 'none'){
		document.getElementById(d).style.display = 'block';
	}
	else{		
		//document.getElementById(d).style.display = 'none';
		var shgt = document.getElementById(d).style.height;
		slideup(d,shgt)
	}
}

function slideup(d,startheight){
	//alert(startheight);
	if(startheight > 0){
		startheight--;
		document.getElementById(d).style.height = startheight + "px";
		//alert(startheight);
		setTimeout(slideup(d,startheight));
	}
	else{
		document.getElementById(d).style.display = 'none';
		//document.getElementById(d).style.height = "0px";
		//clearInterval(intID);
	}	
	
}

// Validate Request
function validate_request(f){
	if(f.name.value==""){
		alert('Please provide your Name.');
		f.name.focus();
		return false;
	}
	else if(f.email.value=="" || f.email.value.indexOf('@') <= 0 || f.email.value.indexOf('.') <= 0 || f.email.value.length < 4){
		alert('Please provide your Email.');
		f.email.focus();
		return false;
	}
	else if(f.link.value==""){
		alert('Please select a Link.');
		f.link.focus();
		return false;
	}
	else if(f.txtNumber.value==""){
		alert('Please provide the Image Verification.');
		f.txtNumber.focus();
		return false;
	}
	else{
		return true;
	}
}

// Validate Request
function validate_contact(f){
	if(f.name.value==""){
		alert('Please provide your Name.');
		f.name.focus();
		return false;
	}
	else if(f.email.value=="" || f.email.value.indexOf('@') <= 0 || f.email.value.indexOf('.') <= 0 || f.email.value.length < 4){
		alert('Please provide your Email.');
		f.email.focus();
		return false;
	}
	else if(f.txtNumber.value==""){
		alert('Please provide the Image Verification.');
		f.txtNumber.focus();
		return false;
	}
	else{
		return true;
	}
}
