$(document).ready(function(){
  $('.menu-header ul li a').hover(function(){
    $(this).parent().animate({'padding-top':'12px','height':'43px','border-bottom':'2px solid #000'},50);
    $(this).parent().addClass('selected');
  },function(){
    $(this).parent().animate({'padding-top':'15px','height':'40px'},50);
    $(this).parent().removeClass('selected');
  });
  
  
  $('.sidebar_menu ul li').hover(function(){
    $(this).addClass('selected');
  },function(){
    $(this).removeClass('selected');
  });
  
  
	$(".scroll").click(function(event){
		//prevent the default action for the click event
		event.preventDefault();

		//get the full url - like mysitecom/index.htm#home
		var full_url = this.href;

		//split the url by # and get the anchor target name - home in mysitecom/index.htm#home
		var parts = full_url.split("#");
		var trgt = parts[1];

		//get the top offset of the target anchor
		var target_offset = $("#"+trgt).offset();
		var target_top = target_offset.top;

		//goto that anchor by setting the body scroll top to anchor top
		$('html, body').animate({scrollTop:target_top}, 500);
	});
});


$(document).ready(function(){
  $('.video_thumbs div:even').addClass('light_thumb');
});

$(document).ready(function(){
    //colorbox
    $(".video_popup").colorbox({inline:true, innerWidth:560, innerHeight:385});
    $("a[rel='image']").colorbox();
    $(".quarters .quarter .unit:last-child").each(function(){
      $(this).addClass("last_unit");
    })
    
});



var calc_type_flag =1;
function formvalue(theForm)
{
  if (theForm.heightcm.value == "")
  {
  if (theForm.heightft.value == "")
    {
    alert("Please enter a value for heightft"); 
    theForm.heightcm.focus();
    return (false);
    }
    else 
    return (true); 
  }
    if (theForm.weightkg.value == "")
  {
  if (theForm.weightpd.value == "")
    {
    alert("Please enter a value for weight"); 
    theForm.weightkg.focus();
    return (false);
    }
  } 
  return (true); 
} 
function show_calc_type(mode) {
	cm = document.getElementById('div_calc_cm');
	ft = document.getElementById('div_calc_ft');
	if(mode == 1) {
		cm.style.display = '';
		ft.style.display = 'none';
		calc_type_flag   = 1;
	}
	if(mode ==2) {
		cm.style.display = 'none';
		ft.style.display = '';	
		calc_type_flag   = 2;
	}
}
function calc_weight() {
	if(calc_type_flag == 1) {
		h = document.forms['Form_calc'].heightcm.value/100;
		w = document.forms['Form_calc'].weightkg.value;
	}else{
		h = document.forms['Form_calc'].heightft.value/3.3;
		w = document.forms['Form_calc'].weightpd.value/2.2;
	}
	 //alert("w:"+w);
	 //alert("h:"+h);
	y = w / (h * h);
	//alert("y:"+y);
	y = Math.round(y);
	//alert("y:"+y);
	document.forms['Form_calc'].BMIvalue.value = y	
}
