/*  DO MOUSEOVERS  */
function mo(state,image)
{
	var src = image.src, ext = src.substring(src.lastIndexOf('.'),src.length);
	image.src = state ? src.replace(ext,'-mo' + ext) : src.replace('-mo' + ext,ext); return;
}

/*  GET AN ELEMENT  */
if(typeof $ != 'function') { function $(element) { return document.getElementById(element); } }

/**************************************************/
/*					BMI CALCULATOR                     */
/**************************************************/

function calculate_bmi(weight,feet,inches)
{
	var total_inches = parseInt(parseInt((feet.value*12)) + parseInt(inches.value));
	var bmi = (((weight.value*704.5) / total_inches) / total_inches);
	
	document.bmi_form.bmi_score.value = 'Your BMI:  ' + bmi.toFixed(2);
	if(isNaN(bmi) || bmi==0)
	{
		$('bmi_score').style.display='none';
	}
	else
	{
		$('bmi_score').style.display='block';
	}
}


/**************************************************/
/*					SIMPLE POPUP                       */
/**************************************************/
function PopupPic(sPicURL,height,width,name,url) 
{
	go_to_url = "../includes/image-popup.php?"+sPicURL;
	window.open(go_to_url, name, "resizable=0,HEIGHT="+height+",WIDTH="+width);
}

/**************************************************/
/*					REGISTRATION FORM ADDER            */
/**************************************************/
function addIt(){
	var price1 = (document.registration_form.price_1.value-0);
	var price2 = (document.registration_form.price_2.value-0);
	var price3 = (document.registration_form.price_3.value-0);
	var total_price = "0.00";
	
	total_price = price1 + price2 + price3;
	total_price = total_price+"";
	
	var dotpos = total_price.indexOf(".");
	
	if(dotpos != -1){
		var total_length = total_price.length;
		if(total_length - dotpos > 3){
			total_price = total_price.substring(0,dotpos+3);
		} else if(total_length - dotpos < 3){
			total_price += "0";
		}
	} else {
		total_price += ".00";
	}
	document.registration_form.total_price.value = total_price;
}

/**************************************************/
/*					VOICE EXPANDER                     */
/**************************************************/
var faq = new Array(100)

function show_voice(id)
{
	//hide the answer
	if(faq[id]==1)
	{
		faq[id] = 0;
		new_class = 'hide';
		change=$(id);
		change.className=new_class;
		$('exp_ret_'+id).src="graphics/voice-expand.jpg";
	}
	//else, show the answer
	else
	{
		faq[id] = 1;
		new_class = 'show';
		change=$(id);
		change.className=new_class;
		$('exp_ret_'+id).src="graphics/voice-retract.jpg"
	}
}

