
var steps = ["step0", "step1", "step2", "step3", "step4", "step5", "step6"];

var sel_id = 0;
var sel_name = "step0";

var step_ready = false;

function dob_gender_change()
{
	if (isstart)
	{
		//reset_click ();
		alert('CLICK RESET');
	}
}

function check_fields_selection ()
{
	//alert(sel_id);
	if (sel_id > 0 )
	{
		sel_name = steps[sel_id];
		table = document.getElementById(sel_name);
		is_ready = true;
		for (i=1;i<table.rows.length;i++)
		{
			index  = table.rows[i].cells[1].firstChild.firstChild.selectedIndex;
			if (index < 2)
			{
				is_ready = false;
				break;
			}
		}
		step_ready = is_ready;

		
	}
	
}

function change_step (dir)
{
	if (dir == "next" )
	{
		check_fields_selection ();	
	}
	else
	{
		step_ready = true;
	}
	
	if (sel_id == 0)
	{
		step_ready = true;
	}

   if (isstart && step_ready)
   {
		if (dir == "next")
		{
			if (sel_id < 6)
			{
				sel_id ++;
				sel_name = steps[sel_id];
				update_steps ();
				step_ready = false;
				if (sel_id == 6)
				{
					document.getElementById('next_button').style.display = 'none';
					document.getElementById('restart_end').style.display = 'block';
					
				}
				else
				{
					document.getElementById('next_button').style.display = 'block';
					document.getElementById('restart_end').style.display = 'none';
				}
			}
			
		}
		else
		{
			if (sel_id > 0)
			{
				sel_id --;
				sel_name = steps[sel_id];
				update_steps ();
				step_ready = false;
				document.getElementById('next_button').style.display = 'block';
				document.getElementById('restart_end').style.display = 'none';
				
			}
		}
		if (sel_id > 0)
		{
		document.getElementById("actions_").style.visibility = "hidden";
		}
		else
		{
		document.getElementById("actions_").style.visibility = "visible";
		}
		if (sel_id == steps.length-1)
		{
			document.getElementById("compleate_").style.visibility = "visible";
		}
		else
		{
		document.getElementById("compleate_").style.visibility = "hidden";
		}
		
	}
	else
	{
		if (!isstart)
		{
			alert("ENTER DATE OF BIRTH, GENDER THEN CLICK START ");	
		}
		else if (sel_id != 0) 
		{
			alert("FILL ALL FIELDS THEN CLICK NEXT ");	
		}
		
	}
}

function update_steps ()
{
	for ( i =0 ; i<steps.length;i++ )
	{
	//alert(steps[i]);
		if ( i != sel_id)
		{
			document.getElementById(steps[i]).style.display = "none";
		}
		else
		{
			document.getElementById(steps[i]).style.display = "block";
		}
	}
}
function reset_click ()
{
	isstart=false;
	step_ready=false;
	document.form1.reset();
}



// bottom script 

<!-- //start

function GetCount(){
	return 0
    var input_field = document.getElementById("birthdate");
    var age_field = document.getElementById("expectancy");
    var ages=age_field.value;
    if (ages=="")
       ages="0";
    if (input_field.value=="")
    {
        document.getElementById('countbox').innerHTML="<table border=0 width=200><tr><td>&nbsp;</td></tr></table>";
        return;
    }

    dateFuture = new Date(input_field.value);
    dateFuture.setDate(dateFuture.getDate()+parseInt(ages)*365);
	dateNow = new Date();									//grab current date
	amount = dateFuture.getTime() - dateNow.getTime();		//calc milliseconds between dates
	delete dateNow;

	// time is already past
	if(amount < 0){
		document.getElementById('countbox').innerHTML="Now!";
	}
	// date is still good
	else{
		years=0;days=0;hours=0;mins=0;secs=0;out="";

		amount = Math.floor(amount/1000);//kill the "milliseconds" so just secs

		years=Math.floor(amount/(86400*365));//years
		amount=amount%(86400*365);

		days=Math.floor(amount/86400);//days
		amount=amount%86400;

		hours=Math.floor(amount/3600);//hours
		amount=amount%3600;

		mins=Math.floor(amount/60);//minutes
		amount=amount%60;

		secs=Math.floor(amount);//seconds

		out="<font style=\"font-size:9pt;color: #ffffff;font-weight:bold\">World Life Expectancy</font><br /><br /><table border=0 width=200 cellspacing=0 cellpadding=0><tr>";
		out+="<td bgcolor=black nowrap><font color=red><b>";
		var s=' ';
        if(years !=0){
        	s='00'+years;
        	s=s.substr(s.length-2,2);
        	out+="<img src='images/"+s.substr(0,1)+"c.gif' border=0>";
        	out+="<img src='images/"+s.substr(1,1)+"c.gif' border=0>";
            //out += years;
        }
        out+="</b></font></td><td bgcolor=black><font color=red><b><img src='images/Cc.gif' border=0></b></font></td>";
        out+="<td bgcolor=black nowrap><font color=red><b>";
		if(days != 0){
        	s='000'+days;
        	s=s.substr(s.length-3,3);
        	out+="<img src='images/"+s.substr(0,1)+"c.gif' border=0>";
        	out+="<img src='images/"+s.substr(1,1)+"c.gif' border=0>";
        	out+="<img src='images/"+s.substr(2,1)+"c.gif' border=0>";
		    //out += days ;
		}
        out+="</b></font></td><td bgcolor=black><font color=red><b><img src='images/Cc.gif' border=0></b></font></td>";
        out+="<td bgcolor=black nowrap><font color=red><b>";
		if(days != 0 || hours != 0)
		{
        	s='00'+hours;
        	s=s.substr(s.length-2,2);
        	out+="<img src='images/"+s.substr(0,1)+"c.gif' border=0>";
        	out+="<img src='images/"+s.substr(1,1)+"c.gif' border=0>";
		    //out += hours ;
		}
        out+="</b></font></td><td bgcolor=black><font color=red><b><img src='images/Cc.gif' border=0></b></font></td>";
        out+="<td bgcolor=black nowrap><font color=red><b>";
		if(days != 0 || hours != 0 || mins != 0)
		{
        	s='00'+mins;
        	s=s.substr(s.length-2,2);
        	out+="<img src='images/"+s.substr(0,1)+"c.gif' border=0>";
        	out+="<img src='images/"+s.substr(1,1)+"c.gif' border=0>";
 		    //out += mins ;
		}
        out+="</b></font></td><td bgcolor=black><font color=red><b><img src='images/Cc.gif' border=0></b></font></td>";
        out+="<td bgcolor=black nowrap><font color=red><b>";
      	s='00'+secs;
       	s=s.substr(s.length-2,2);
       	out+="<img src='images/"+s.substr(0,1)+"c.gif' border=0>";
       	out+="<img src='images/"+s.substr(1,1)+"c.gif' border=0>";
		//out += secs ;
		out+="</b></font></td></tr><tr>";
		out+="<td align=center><b><font face='Arial'><font size=2>Yrs</font></font></b></td><td align=center><b><font face='Arial'><font size=2>:</font></font></b></td>";
		out+="<td align=center><b><font face='Arial'><font size=2>Days</font></font></b></td><td align=center><b><font face='Arial'><font size=2>:</font></font></b></td>";
		out+="<td align=center><b><font face='Arial'><font size=2>Hrs</font></font></b></td><td align=center><b><font face='Arial'><font size=2>:</font></font></b></td>";
		out+="<td align=center><b><font face='Arial'><font size=2>Min</font></font></b></td><td align=center><b><font face='Arial'><font size=2>:</font></font></b></td>";
		out+="<td align=center><b><font face='Arial'><font size=2>Sec</font></font></b></td></tr></table>";

		document.getElementById('countbox').innerHTML=out;

		setTimeout("GetCount()", 1000);
	}
}

//GetCount(); //call when everything has loaded

//-->
