//Copyright (c) 2002-2003 Lexabean Consulting, LLC. All Rights Reserved.
//
// This computer software is owned by Lexabean Consulting, LLC and is
// protected by U.S. copyright laws and other laws and by international
// treaties. This computer software is furnished by Lexabean Consulting, LLC,
// pursuant to a written license agreement and may be used, copied,
//transmitted, and stored only in accordance with the terms of such
// license and with the inclusion of the above copyright notice. This
// computer software or any other copies thereof may not be provided or
// otherwise made available to any other person.
//


function ShowPopup(url,popupName)
{
   var bName=navigator.appName;
   var bVer=parseInt(navigator.appVersion);
    var popupWin
   if (bName=="Netscape" && bVer<=3)
   {
      	popupWin = window.open(url, popupName,'toolbar=0,location=0,directories=0,status=0,menubar=1,scrollbars=1,resizable=0,width=200,height=600');
 	popupWin.focus();
   }
   else
   {
      popupWin = window.open(url, popupName,'toolbar=0,location=0,directories=0,status=0,menubar=1,scrollbars=1,resizable=0,width=200,height=600');
     popupWin.focus();
   }

   popupWin.location = url;

}




function crtWBMiles(form)
{
	var SelBikeDist = (form.BikeDistTF.value)
	var SelRunDist = (form.RunDistTF.value)
	
	var SelBikeUnits = (form.BikeDistUnits.options[form.BikeDistUnits.selectedIndex].value)
	var SelRunUnits = (form.RunDistUnits.options[form.RunDistUnits.selectedIndex].value)
	

	var SelSwimHRs = (form.SwimHRs.options[form.SwimHRs.selectedIndex].value)
	var SelSwimMins = (form.SwimMins.options[form.SwimMins.selectedIndex].value)
	var SelSwimSecs = (form.SwimSecs.options[form.SwimSecs.selectedIndex].value)

	var SelBikeHRs= (form.BikeHRs.options[form.BikeHRs.selectedIndex].value)
	var SelBikeMins = (form.BikeMins.options[form.BikeMins.selectedIndex].value)
	var SelBikeSecs = (form.BikeSecs.options[form.BikeSecs.selectedIndex].value)

	var SelRunHRs= (form.RunHRs.options[form.RunHRs.selectedIndex].value)
	var SelRunMins = (form.RunMins.options[form.RunMins.selectedIndex].value)
	var SelRunSecs = (form.RunSecs.options[form.RunSecs.selectedIndex].value)

	var SelElapTime = (form.TimeElapseCB.value)

	crtWBMiles_inp(SelBikeDist,SelRunDist,SelBikeUnits,SelRunUnits,SelSwimHRs,SelSwimMins,SelSwimSecs,SelBikeHRs,SelBikeMins,SelBikeSecs,SelRunHRs,SelRunMins,SelRunSecs,SelElapTime)
}

function crtWBMiles_inp(SelBikeDist,SelRunDist,SelBikeUnits,SelRunUnits,SelSwimHRs,SelSwimMins,SelSwimSecs,SelBikeHRs,SelBikeMins,SelBikeSecs,SelRunHRs,SelRunMins,SelRunSecs,SelElapTime)
{
	var BikeDist="Select Distance..."
	var RunDist="Select Distance..."


	if (SelBikeUnits == 'Miles')
	{
		BikeDist = SelBikeDist
	}
	else
	{
		//convert SelBikeDist from KM to Miles and put into BikeDist
		BikeDist = parseFloat(SelBikeDist)*.62133333;
	}

	if (SelRunUnits == 'Miles')
	{
		RunDist = SelRunDist
	}
	else
	{
		//convert SelRunDist from KM to Miles and put into RunDist
		RunDist = parseFloat(SelRunDist)*.62133333;
	}
		
	


	var Swimtime = SelSwimHRs 


	if (parseInt(SelSwimMins) < 10)
	{
		Swimtime = Swimtime + ":0" + SelSwimMins
	}
	else
	{
		Swimtime = Swimtime + ":" + SelSwimMins
	}

	if (parseInt(SelSwimSecs) < 10)
	{
		Swimtime = Swimtime + ":0" + SelSwimSecs
	}
	else
	{
		Swimtime = Swimtime + ":" + SelSwimSecs
	}

	var cumhrs = 0
	var cummins = 0
	var cumsecs = 0

	if (SelElapTime == 'TimeElapse')
	{
		cumhrs = (parseInt(SelSwimHRs))
		cummins = (parseInt(SelSwimMins))
		cumsecs = (parseInt(SelSwimSecs))
	}


	var url= "http://www.MobileFitnessSoftware.com/tri/triwrband/wristband.html?ST=" + Swimtime + "+UT=M" + "+ET=Biking" 
		+ "+CR=" + cumhrs + "+CN=" + cummins+ "+CC=" + cumsecs
		+ "+H=" + SelBikeHRs + "+M=" + SelBikeMins + "+S=" + SelBikeSecs + "+D=" + BikeDist 

	ShowPopup(url,"BikeBand")

	if (SelElapTime == 'TimeElapse')
	{
		cumhrs = (parseInt(SelSwimHRs) + parseInt(SelBikeHRs))
		cummins = (parseInt(SelSwimMins) + parseInt(SelBikeMins))
		cumsecs = (parseInt(SelSwimSecs) + parseInt(SelBikeSecs))
	}
	else
	{
		cumhrs = 0
		cummins = 0
		cumsecs = 0
	}


	url = "http://www.MobileFitnessSoftware.com/tri/triwrband/wristband.html?ST=" + Swimtime + "+UT=M" + "+ET=Running"  
		+ "+CR=" + cumhrs + "+CN=" + cummins+ "+CC=" + cumsecs
		+ "+H=" + SelRunHRs + "+M=" + SelRunMins + "+S=" + SelRunSecs + "+D=" + RunDist 

	
	ShowPopup(url,"RunningBand")

	return true


}


function crtWBKMs(form)
{
	var SelBikeDist = (form.BikeDistTF.value)
	var SelRunDist = (form.RunDistTF.value)
	var SelBikeUnits = (form.BikeDistUnits.options[form.BikeDistUnits.selectedIndex].value)
	var SelRunUnits = (form.RunDistUnits.options[form.RunDistUnits.selectedIndex].value)

	var SelSwimHRs = (form.SwimHRs.options[form.SwimHRs.selectedIndex].value)
	var SelSwimMins = (form.SwimMins.options[form.SwimMins.selectedIndex].value)
	var SelSwimSecs = (form.SwimSecs.options[form.SwimSecs.selectedIndex].value)

	var SelBikeHRs= (form.BikeHRs.options[form.BikeHRs.selectedIndex].value)
	var SelBikeMins = (form.BikeMins.options[form.BikeMins.selectedIndex].value)
	var SelBikeSecs = (form.BikeSecs.options[form.BikeSecs.selectedIndex].value)

	var SelRunHRs= (form.RunHRs.options[form.RunHRs.selectedIndex].value)
	var SelRunMins = (form.RunMins.options[form.RunMins.selectedIndex].value)
	var SelRunSecs = (form.RunSecs.options[form.RunSecs.selectedIndex].value)
	var SelElapTime = (form.TimeElapseCB.value)

	crtWBKMs_inp(SelBikeDist,SelRunDist,SelBikeUnits,SelRunUnits,SelSwimHRs,SelSwimMins,SelSwimSecs,SelBikeHRs,SelBikeMins,SelBikeSecs,SelRunHRs,SelRunMins,SelRunSecs,SelElapTime)
}

function crtWBKMs_inp(SelBikeDist,SelRunDist,SelBikeUnits,SelRunUnits,SelSwimHRs,SelSwimMins,SelSwimSecs,SelBikeHRs,SelBikeMins,SelBikeSecs,SelRunHRs,SelRunMins,SelRunSecs,SelElapTime)
{
	var BikeDist="Select Distance..."
	var RunDist="Select Distance..."


	if (SelBikeUnits == 'KMs')
	{
		BikeDist = SelBikeDist
	}
	else
	{
		//convert SelBikeDist from Miles to KMs and put into BikeDist
		BikeDist = parseFloat(SelBikeDist)/.62133333;
	}

	if (SelRunUnits == 'KMs')
	{
		RunDist = SelRunDist
	}
	else
	{
		//convert SelRunDist from Miles to KMs and put into RunDist
		RunDist = parseFloat(SelRunDist)/.62133333;
	}
	
	var Swimtime = SelSwimHRs 


	if (parseInt(SelSwimMins) < 10)
	{
		Swimtime = Swimtime + ":0" + SelSwimMins
	}
	else
	{
		Swimtime = Swimtime + ":" + SelSwimMins
	}

	if (parseInt(SelSwimSecs) < 10)
	{
		Swimtime = Swimtime + ":0" + SelSwimSecs
	}
	else
	{
		Swimtime = Swimtime + ":" + SelSwimSecs
	}

	

	var cumhrs = 0
	var cummins = 0
	var cumsecs = 0

	if (SelElapTime == 'TimeElapse')
	{
		cumhrs = (parseInt(SelSwimHRs))
		cummins = (parseInt(SelSwimMins))
		cumsecs = (parseInt(SelSwimSecs))
	}

	var url= "http://www.MobileFitnessSoftware.com/tri/triwrband/wristband.html?ST=" + Swimtime + "+UT=K" + "+ET=Biking" 
		+ "+CR=" + cumhrs + "+CN=" + cummins+ "+CC=" + cumsecs
		+ "+H=" + SelBikeHRs + "+M=" + SelBikeMins + "+S=" + SelBikeSecs + "+D=" + BikeDist 

	ShowPopup(url,"BikeBand")


	if (SelElapTime == 'TimeElapse')
	{
		cumhrs = (parseInt(SelSwimHRs) + parseInt(SelBikeHRs))
		cummins = (parseInt(SelSwimMins) + parseInt(SelBikeMins))
		cumsecs = (parseInt(SelSwimSecs) + parseInt(SelBikeSecs))
	}
	else
	{
		cumhrs = 0
		cummins = 0
		cumsecs = 0
	}

	 url = "http://www.MobileFitnessSoftware.com/tri/triwrband/wristband.html?ST=" + Swimtime + "+UT=K" + "+ET=Running"  
		+ "+CR=" + cumhrs + "+CN=" + cummins+ "+CC=" + cumsecs
		+ "+H=" + SelRunHRs + "+M=" + SelRunMins + "+S=" + SelRunSecs + "+D=" + RunDist 

	
	ShowPopup(url,"RunningBand")


	return true
}



