 function hideRadioButtons()
		 {
				document.getElementById('answer').style.display="Block";
				 document.getElementById('formMessage').style.display="none";
				var radioGroup = document.form2.radiobutton;
				
				for (var b = 0; b < radioGroup.length; b++)
			  radioGroup[b].disabled = true;
		 }
	function CheckEmail(tempstr,field,a) {
		len=tempstr.length;
		var s="";
		
		
		for(jInd=0;jInd< len;jInd++) {
			ind=tempstr.indexOf('@')
			
			if(tempstr.indexOf('@')==-1 || tempstr.indexOf('.')==-1 || tempstr.indexOf('@')==0 || tempstr.lastIndexOf('.')+3 > len || tempstr.charAt(ind+1)=='.' ) {	
				
				if(a == 1)
				{
					
					document.getElementById('CorFrndemail').style.display="Block";
				}
				else
					
				{

					document.getElementById('CorYouremail').style.display="Block";
				}
				return;
				s="yes"
			}
		}
		if(s=="yes") {
			return false; 
		} 
		else {
			return true;
		}
	}		 
function Trim(str) {
		var start;
		var last;
		var i=0;
		start=0;
		last=str.length;
		j=last;
		while(str.charAt(i)==' ')
			i++;
			start=i;
			while(str.charAt(j-1)==' ')
				j--;
				last=j;
				if( (i>=j) ||(i>=str.length) )
					str="";
				else
					str=str.substring(start,last);
		return str;
	}	
	
	
	
	/*  Tell a Friend  Page Script */
		 
	 function Frnd()
		 {
			 document.getElementById('Frndemail').style.display="none";
			 document.getElementById('CorFrndemail').style.display="none";
			 document.getElementById('Youremail').style.display="none";
			 document.getElementById('CorYouremail').style.display="none";

			 	if (Trim(document.form1.friendEmail.value) == "") {
					document.getElementById('Frndemail').style.display="Block";
					document.form1.friendEmail.focus();
					return;
				}
				else
				{
					if (!CheckEmail(document.form1.friendEmail.value,"friendEmail",1))
					{
							
							return;
					}
					
				}
				if (Trim(document.form1.email.value) == "") {
					 document.getElementById('Youremail').style.display="block";
					 return;
				
				}
				else
				{
					if (!CheckEmail(document.form1.email.value,"email",2)) 			
					{
						
						return;
					}
											
				}
			
			if(document.getElementById('CorFrndemail').style.display="none")
			 {
				if(document.getElementById('CorYouremail').style.display="none")
				 {
					document.getElementById('tellFrnd').style.display="none";
					document.getElementById('results').style.display="block";
				 }
			 }
		
			}
			
		/*  Sleep Test  */
		function SleepTest()
		{
			 var j=1;	
			 var chosen, chosen1, chosen2, chosen4;
			for (var a=0; a<document.sleeptest.snoreregularly.length; a++)
			{
			if((document.sleeptest.snoreregularly[a].checked ))				
					{
						j=j+1;
					 chosen = document.sleeptest.snoreregularly[a].value;
					if (chosen =="yes")
					{	
						document.getElementById('snoreregularlyno').style.background='';
						document.getElementById('snoreregularlyyes').style.background='#CCCCCC';
					}
					else
					{
						document.getElementById('snoreregularlyno').style.background='#CCCCCC';
						document.getElementById('snoreregularlyyes').style.background='';
					}
				}
					
				
			}
	
	for (var b=0; b<document.sleeptest.excessivlytired.length; b++)
					{	
					if((document.sleeptest.excessivlytired[b].checked ))				
						{
							j=j+1;
							 chosen1 = document.sleeptest.excessivlytired[b].value;
					
							if (chosen1 == "yes")
							{	
								document.getElementById('excessivlytiredno').style.background='';
								document.getElementById('excessivlytiredyes').style.background='#CCCCCC';
							}
							else
							{
								document.getElementById('excessivlytiredyes').style.background='';
								document.getElementById('excessivlytiredno').style.background='#CCCCCC';
							}
							
						}
					}


		for (var c=0; c<document.sleeptest.stopbreathing.length; c++)
					{	
					if((document.sleeptest.stopbreathing[c].checked ))				
						{
							j=j+1;
							 chosen2 = document.sleeptest.stopbreathing[c].value;
					

							if (chosen2 =="yes")
							{	
								document.getElementById('stopbreathingno').style.background='';
								document.getElementById('stopbreathingyes').style.background='#CCCCCC';
							}
							else
							{
								document.getElementById('stopbreathingno').style.background='#CCCCCC';
								document.getElementById('stopbreathingyes').style.background='';
							}
							
						}
					}
					
					
		for (var d=0; d<document.sleeptest.highbloodpressure.length; d++)
					{	
					if((document.sleeptest.highbloodpressure[d].checked ))				
						{
							j=j+1;
							 chosen3 = document.sleeptest.highbloodpressure[d].value;
					
							if (chosen3 =="yes")
							{	
								document.getElementById('highbloodpressureno').style.background='';
								document.getElementById('highbloodpressureyes').style.background='#CCCCCC';
							}
							else
							{
								document.getElementById('highbloodpressureyes').style.background='';
								document.getElementById('highbloodpressureno').style.background='#CCCCCC';
							}
							
						}
					}
		for (var e=0; e<document.sleeptest.bigneck.length; e++)
					{	
					
					if((document.sleeptest.bigneck[e].checked ))				
						{
							j=j+1;
							 chosen4 = document.sleeptest.bigneck[e].value;
							if (chosen4 =="yes")
							{	
								document.getElementById('bigneckno').style.background='';
								document.getElementById('bigneckyes').style.background='#CCCCCC';
							}
							else
							{
								document.getElementById('bigneckno').style.background='#CCCCCC';
								document.getElementById('bigneckyes').style.background='';
							}
							
						}
					}	
				
		if(j==6)
		{
			document.getElementById('validation').style.display="none";
			document.getElementById('tersresult').style.display="block";
			document.getElementById('content').style.display="none";
			document.getElementById('submit').style.display="none";
			document.getElementById('continue').style.display="block";
			javascript:scroll(0,0)
		}
		else
		{

			document.getElementById('validation').style.display="block";
			document.getElementById('tersresult').style.display="none";
			document.getElementById('content').style.display="block";
			document.getElementById('submit').style.display="block";
			document.getElementById('continue').style.display="none";
			
		}
	
		}

		
		
