function chbold(id, value) {
	if(value == 'bold') document.getElementById('alertarea').innerHTML = '<div class="ct_text1">Name : </div>';
	if(value == 'normal') document.getElementById('alertarea').innerHTML = '<div class="ct_text">Name : </div>';
}
function chcolor(colour) {
	document.getElementById('ttt').style.color = colour;
}
function setVisibility(id, visibility, idpos) {
	if(idpos == 'middle') {
		document.getElementById('sub3').style.left = '465px';
		document.getElementById('sub3').style.top = '464px';
	}
	else if(idpos == 'top') {
		document.getElementById('sub3').style.left = '72%';
		document.getElementById('sub3').style.top = '68px';
	}	
	document.getElementById(id).style.display = visibility;
	document.getElementById(id).style.zIndex = "1";
}

function formvalue() {

	var msg = 'Please fill the following Fields : ';
	
	var l1=document.contact.c_name.value.length;
	var v1=document.contact.c_name.value;
	var f1=document.contact.c_name;

	var f2=document.contact.c_mail;
	var v2=document.contact.c_mail.value;

	var v3=document.contact.c_fone.value;
	var l3=document.contact.c_fone.value.length;
	var f3=document.contact.c_fone;

	if(v1=='') msg = msg + 'Name, ';
	if(v2=='') msg = msg + 'Email, ';
	if(v3=='') msg = msg + 'Phone ';

	if(msg != 'Please fill the following Fields : ') {
		document.getElementById('alertarea').innerText = msg;
		return false;
	}
	else{
		document.getElementById('alertarea').innerText = '';
		
		if(v1=='') {
			alert("Enter your  Name");
			f1.select();
			return false;
		}   
		
		for(var i=0; i<l1-1; i++)
		{
			q=v1.substring(i, i+2);
			if(q=="  " || q==".." || q=="''")
				{
				alert("Invalid name, Please re-enter")
				f1.select();
				return false;
				}
		} 
		
		for (var i=0; i<l1; i++)
			{
			var q=v1.substring(i, i + 1);
			if (((q < "a" || "z" < q) && (q < "A" || "Z" < q)) && q != ' ' && q!='.' && q!="'") {
				alert("\nThe Name field only accepts letters & spaces.\n\nPlease re-enter your Name.");
				f1.select();
				return false;
			}
		}



		
		
		if ((v2==null)||(v2=="")){
			alert("Please Enter your Email ID")
			f2.select()
			return false
		}
		if (echeck(v2)==false){
			alert('Please enter valid email ID');
			f2.select();
			return false;
		}
		function echeck(str) {
			at = str.indexOf("@");
			dot = str.lastIndexOf(".");
			lengt = str.length;
			con1 = str.substring(0,at);
			con2 = str.substring(at+1,dot);
			con3 = str.substring(dot+1,lengt);

			if(con1=='' || con2=='' || con3=='') return false;

			if(str.indexOf("  ") > -1 || str.indexOf("..") > -1 || str.indexOf("__") > -1 || str.indexOf("--") > -1) return false;
			
			if(at==-1 || dot==-1) return false;

			x = con1.substring(0,1);
			if ((x < "a" || "z" < x) && (x < "A" || "Z" < x) && isNaN(x)) return false;

			x = con1.substring((con1.length)-1,(con1.length));
			if ((x < "a" || "z" < x) && (x < "A" || "Z" < x) && isNaN(x)) return false;

			x = con1.substring(1,(con1.length)-1);
			for(i=0, y=0; i<con1.length-2; i++, y=x.substring(i, i+1)) if ((y < "a" || "z" < y) && (y < "A" || "Z" < y) && isNaN(y) && y!='.' && y!='_' && y!='-') return false;
			
			x = con2.substring(0,1);
			if ((x < "a" || "z" < x) && (x < "A" || "Z" < x) && isNaN(x)) return false;

			x = con2.substring((con2.length)-1,(con2.length));
			if ((x < "a" || "z" < x) && (x < "A" || "Z" < x) && isNaN(x)) return false;
			
			x = con2.substring(1,(con2.length)-1);
			for(i=0, y=0; i<con2.length-2; i++, y=x.substring(i, i+1)) if ((y < "a" || "z" < y) && (y < "A" || "Z" < y) && isNaN(y) && y!='.' && y!='_' && y!='-') return false;		
			
			for(i=0, x=0; i<con3.length; i++, x = con3.substring(i, i+1)) if ((x < "a" || "z" < x) && (x < "A" || "Z" < x)) return false;
			if ((con3.length)<2 || (con3.length)>4)  return false;
		}
		
		
		
		if(v3=='') {
			alert("Enter your Phone No");
			f3.select();
			return false;
		}
		 
		
		
	}
}