// JavaScript Document


function manageInput()
{
	var value = document.getElementById('email_subscription').value;
	if(value == 'Enter Your Email Here')
	{
		document.getElementById('email_subscription').value = '';
		document.getElementById('email_subscription').style.color = 'black';
	}
}

function manageOnclick()
{
document.getElementById('email_subscription').value = '';	
document.getElementById('email_subscription').style.color = 'black';
}

function manageOnBlour()
{
	var value = document.getElementById('email_subscription').value;
	if(value == '')
	{
		document.getElementById('email_subscription').value = 'Enter Your Email Here';	
		document.getElementById('email_subscription').style.color = 'black';
	}
}

function validateMailingFields()
{
	var check = "clear";
	var str = document.getElementById('email').value;
	var regexp =/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*\.(\w{2}|(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum))$/;
	if(regexp.test(str))
	{
		check = "clear";		
	}else
	{
		check = "Invalid";
	}
	
	
	if(document.getElementById('firstName').value == "")
	{		
		check = "empty";		
	}
	if(document.getElementById('lastName').value == "")
	{		
		check = "empty";		
	}
	if(document.getElementById('email').value == "")
	{		
		check = "empty";		
	}
	

	if(check == "clear")
	{
		return true;	
	}else if(check == "empty")
	{
		document.getElementById('message').innerHTML = 'Required field(s) missing, please provide all the fields with <font color="red">*</font> sign.';
		return false;
	}else if(check == "Invalid")
	{
		document.getElementById('message').innerHTML = 'Invalid Email address, please enter a valid Email.';	
		return false;
	}
}

function validateForm()
{ 
	var regexp =/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*\.(\w{2}|(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum))$/;
	if(document.getElementById('email_subscription').value == '' || document.getElementById('email_subscription').value == 'Enter Your Email Here')
	{
		document.getElementById('email_subscription').value = 'Please provide you Email.';
		document.getElementById('email_subscription').style.color = 'red';
		return false;
	}else if(regexp.test(document.getElementById('email_subscription').value))
	{
		return true;
	}else
	{
document.getElementById('email_subscription').value = 'Invalid Email ID';	
document.getElementById('email_subscription').style.color = 'red';
	return false;
	}
}

function Assessment()
{
	var points = 0;
	for(i=0; i<document.form1.Q1.length; i++)
	{
		if(document.form1.Q1[i].checked == true)
		{
				points = parseInt(document.form1.Q1[i].value);
		}
	}
	
	for(i=0; i<document.form1.Q2.length; i++)
	{
		if(document.form1.Q2[i].checked == true)
		{
				points += parseInt(document.form1.Q2[i].value);
		}
	}
	
	for(i=0; i<document.form1.Q3.length; i++)
	{
		if(document.form1.Q3[i].checked == true)
		{
				points += parseInt(document.form1.Q3[i].value);
		}
	}
	
	for(i=0; i<document.form1.Q4.length; i++)
	{
		if(document.form1.Q4[i].checked == true)
		{
				points += parseInt(document.form1.Q4[i].value);
		}
	}
	
	for(i=0; i<document.form1.Q5.length; i++)
	{
		if(document.form1.Q5[i].checked == true)
		{
				points += parseInt(document.form1.Q5[i].value);
		}
	}
	
	for(i=0; i<document.form1.Q6.length; i++)
	{
		if(document.form1.Q6[i].checked == true)
		{
				points += parseInt(document.form1.Q6[i].value);
		}
	}
	
	for(i=0; i<document.form1.Q7.length; i++)
	{
		if(document.form1.Q7[i].checked == true)
		{
				points += parseInt(document.form1.Q7[i].value);
		}
	}
	
	document.getElementById('TotalPoints').value = points;

}

function increaseSize()
{
	var p = document.getElementsByTagName('p');
	var h = document.getElementsByTagName('h4');
	var h2 = document.getElementsByTagName('h2');
	var li = document.getElementsByTagName('li');
	var h5 = document.getElementsByTagName('h5');
	var div =  document.getElementsByTagName('div');
	var h3 = document.getElementsByTagName('h3');
	
	for(i=0; i<h3.length; i++)
	{

		if(h3[i].style.fontSize)
		{
					
			var s = parseInt(h3[i].style.fontSize.replace("px", ""));			
		}else if(!h3[i].style.fontSize)
		{
			var s = 18;	
		}
		
			if(s<=20)
			{
			s+=1;	
			h3[i].style.fontSize = s+"px";
			}			
	}


		for(i=0; i<div.length; i++)
		{

		if(div[i].style.fontSize)
		{
					
			var s = parseInt(div[i].style.fontSize.replace("px", ""));			
		}else if(!div[i].style.fontSize)
		{
			var s = 17;	
		}
		
			if(s<=18)
			{
			s+=1;	
			div[i].style.fontSize = s+"px";
			}			
	}


	for(i=0; i<h5.length; i++)
	{

		if(h5[i].style.fontSize)
		{
					
			var s = parseInt(h5[i].style.fontSize.replace("px", ""));			
		}else if(!h5[i].style.fontSize)
		{
			var s = 14;	
		}
		
			if(s<=16)
			{
			s+=1;	
			h5[i].style.fontSize = s+"px";
			}			
	}	

	for(i=0; i<li.length; i++)
	{

		if(li[i].style.fontSize)
		{
					
			var s = parseInt(li[i].style.fontSize.replace("px", ""));			
		}else if(!li[i].style.fontSize)
		{
			var s = 17;	
		}
		
			if(s<=18)
			{
			s+=1;	
			li[i].style.fontSize = s+"px";
			}			
	}	
	
	for(i=0; i<h2.length; i++)
	{

		if(h2[i].style.fontSize)
		{	
		var s = parseInt(h2[i].style.fontSize.replace("px", ""));			
		}else if(!h2[i].style.fontSize)
		{
			var s = 20;	
		}
		
			if(s<=21)
			{
			s+=1;	
			h2[i].style.fontSize = s+"px";
			}			
	}	 
	
	
	
	for(i=0; i<h.length; i++)
	{

		if(h[i].style.fontSize)
		{
					
			var s = parseInt(h[i].style.fontSize.replace("px", ""));			
		}else if(!h[i].style.fontSize)
		{
			var s = 17;	
		}
		
			if(s<=18)
			{
			s+=1;	
			h[i].style.fontSize = s+"px";
			}			
	}	
	
	for(i=0; i<p.length; i++)
	{

		if(p[i].style.fontSize)
		{
					
		var s = parseInt(p[i].style.fontSize.replace("px", ""));			
		}else if(!p[i].style.fontSize)
		{
			var s = 17;	
		}
		
			if(s<=18)
			{
			s+=1;	
			p[i].style.fontSize = s+"px";
			}			
	}}

function decreaseSize()
{
	var p = document.getElementsByTagName('p');
	var h = document.getElementsByTagName('h4');
	var h2 = document.getElementsByTagName('h2');
	var li = document.getElementsByTagName('li');
	var h5 = document.getElementsByTagName('h5');
	var h3 = document.getElementsByTagName('h3');
	var div =  document.getElementsByTagName('div');
	
	for(i=0; i<h3.length; i++)
	{

		if(h3[i].style.fontSize)
		{
					
			var s = parseInt(h3[i].style.fontSize.replace("px", ""));			
		}else if(!h3[i].style.fontSize)
		{
			var s = 18;	
		}
		
			if(s>=19)
			{
			s -= 1;	
			h3[i].style.fontSize = s+"px";
			}			
	}	
	
	
	
	for(i=0; i<div.length; i++)
	{

		if(div[i].style.fontSize)
		{
					
			var s = parseInt(div[i].style.fontSize.replace("px", ""));			
		}else if(!div[i].style.fontSize)
		{
			var s = 17;	
		}
		
			if(s>=18)
			{
			s -= 1;	
			div[i].style.fontSize = s+"px";
			}			
	}	
	
	
	for(i=0; i<h5.length; i++)
	{

		if(h5[i].style.fontSize)
		{
					
			var s = parseInt(h5[i].style.fontSize.replace("px", ""));			
		}else if(!h5[i].style.fontSize)
		{
			var s = 14;	
		}
		
			if(s>=15)
			{
			s -= 1;	
			h5[i].style.fontSize = s+"px";
			}			
	}	
	
	for(i=0; i<li.length; i++)
	{

		if(li[i].style.fontSize)
		{
					
			var s = parseInt(li[i].style.fontSize.replace("px", ""));			
		}else if(!li[i].style.fontSize)
		{
			var s = 17;	
		}
		
			if(s>=18)
			{
			s -= 1;	
			li[i].style.fontSize = s+"px";
			}			
	}	
	
	
	for(i=0; i<h2.length; i++)
	{

		if(h2[i].style.fontSize)
		{
					
			var s = parseInt(h2[i].style.fontSize.replace("px", ""));			
		}else if(!h2[i].style.fontSize)
		{
			var s = 20;	
		}
		
			if(s>=21)
			{
			s -= 1;	
			h2[i].style.fontSize = s+"px";
			}			
	}	
	
	for(i=0; i<h.length; i++)
	{

		if(h[i].style.fontSize)
		{
					
			var s = parseInt(h[i].style.fontSize.replace("px", ""));			
		}else if(!h[i].style.fontSize)
		{
			var s = 17;	
		}
		
			if(s>=18)
			{
			s -= 1;	
			h[i].style.fontSize = s+"px";
			}			
	}	
	
	for(i=0; i<p.length; i++)
	{

		if(p[i].style.fontSize)
		{
					
			var s = parseInt(p[i].style.fontSize.replace("px", ""));			
		}else if(!p[i].style.fontSize)
		{
			var s = 17;	
		}
		
			if(s>=18)
			{
			s-=1;	
			p[i].style.fontSize = s+"px";
			}			
	}}

function emailValidation(id, e, lblid)
{

	if(e.keyCode == 9)
	{
		var str = document.getElementById(id).value;
		var regexp =/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*\.(\w{2}|(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum))$/;
		if(regexp.test(str))
		{
			document.getElementById(lblid).innerHTML = "";
			return true;	
		}else
		{
			document.getElementById(lblid).innerHTML = "Invalid email address";			
			return false;	
		}
	}}