// JavaScript Document

$(document).ready(function() {
		
		if ($(document.body).hasClass('wider_discover_bg')) {
			// Do Nothing 
		} else {
			$(document.body).addClass('wider_discover_bg narrow_page');
		}
		
		var $product_menu = $('#products');
		var $facts_menu = $('#what');
		var $about_menu = $('#about');
		var $goals_menu = $('#six_goals');
		var $recipes_menu = $('#recipes_section');
		var $products_link = $('.v2-blockcategoriestop li a.Products');
		var $facts_link = $('.v2-blockcategoriestop li a.Hemp.Protein.Facts');
		var $about_link = $('.v2-blockcategoriestop li a.About.Good');
		var $goals_link = $('.v2-blockcategoriestop li a.Your.Goals');
		var $recipes_link = $('.v2-blockcategoriestop li a.Recipes');
		var $narrow_page = $('.narrow_page');
		var $discover_more_button = $('#discover_more a ');
		var $why_hemp_explained = $('#why_hemp_explained');
		var $gym = $('.gym_bodybuilding');
		var $vegan = $('li.vegans');
		var $dieting = $('li.dieting');
		var $changeTitle = $('.why_explained h2 a');
		var $changeDesc = $('.why_explained p');
		var $gym_title = "Gym & Bodybuilding";
		var $vegan_title = "Vegan and Vegetarians";
		var $dieting_title = "Hemp Protein for Weightloss";
		var $product_img = $('#product_window img');
		var $gym_desc = "Protein is extremely important for gym goers & body builders as it is key in aiding muscles to repair, recover and increase mass after  	 	         				training. See what hemp protein can do for you.";
		var $vegan_desc = "Hemp protein is the only plant protein which has a similar nutritional profile to milk, meat and eggs, as it contains 20 amino acids 				 						  including all 10 essential amino acids.";
		var $dieting_desc = "A balanced diet which focuses on the right type of protein and not too much carbohydrates, combined with exercise is a great way for 		 							women to sculpt and tone their bodies, while losing any unwanted pounds.";
		var $product_title = $(".product_title");
		var $product_features = $(".product_features");
		var $product_price = $(".product_price span");
		var $fit_shake_title = "GOOD Fit Shake with Hemp Protein 500gr";
		var $fit_shake_desc = "100% Natural Ingredients, only 110 calories per serving.  Source of Omega 3 (EFAs)";
		var $fit_shake_price = "16.99";
		var $hemp_natural_title = "GOOD GYM Shake with Hemp Protein 1kg";
		var $hemp_natural_desc = "With all the Essential Amino Acids (EAAs). Rich in Omega 3 (EFA) - Chocolate flavour";
		var $hemp_natural_price = "29.99";
		var $vegan_hemp_natural_title = "GOOD Hemp Protein Powder Natural 500g";
		var $vegan_hemp_natural_desc = "47% Protein - All the Essential Amino Acids. Rich in Omega 3 (with SDA) - Naturally";
		var $vegan_hemp_natural_price = "10.99";
		
		var $ambassador_quote = $('.ambassador_quote span');
		var $ambassador_name = $('.ambassador_name');
		var $gym_ambassador = "GOOD Hemp is currently the best non-animal protein for building muscle with it being a complete protein.";
		var $gym_ambassador_name = "Mark Hughes";
		var $vegan_ambassador = "The omega 3 content in GOOD Hemp is high which is important to me as a vegetarian who doesn't eat fish.";
		var $vegan_ambassador_name = "Mark Hughes";
		var $ambassador_img = $('#ambassador_window img');
		var $dieting_ambassador = "GOOD Hemp is an eco-friendly protein. There is no pesticides used in production and none of the plant is wasted."
		var $dieting_ambassador_name = "Mark Hughes";
		var $v2_signin = $('.sign_in_width');
		var $add_border = $('.border_signin');
		var $v2_contact_help = $('#contact_help');
		var $block_myaccount = $('.block.myaccount');
		var $link_up_icons = $('.more_hemp a');
		var $product_cost = $('#product_window a.add_product_basket');
		var $add_basket = $('#js_add_cart');
		
		$v2_contact_help.css('margin-right', $v2_signin.width() + 10);
		$add_border.css('background', 'url(http://www.goodhempnutrition.com/themes/ghn/img/images/sign_in_arrow_down.png) left no-repeat'); 
		$add_border.css('padding-left', 30);
		
		$block_myaccount.hide();
		
		$('#social_sidebar').html();
		$('#social_sidebar').load('http://www.goodhempnutrition.com/js/social_sidebar.html');
		
		console.log($v2_signin.width());
		
		if ($v2_signin.width() >= 120) {
			$v2_contact_help.css('margin-right', $v2_signin.width() + 40);
		} else {
			$v2_contact_help.css('margin-right', $v2_signin.width() + 10);
		}
		
		$add_border.hover(function() {
			$block_myaccount.show();
			$add_border.css('background', 'url(http://www.goodhempnutrition.com/themes/ghn/img/images/sign_in_arrow_up.png) left no-repeat'); 
			$add_border.mouseleave(function() {
				$block_myaccount.hide();
				$add_border.css('background', 'url(http://www.goodhempnutrition.com/themes/ghn/img/images/sign_in_arrow_down.png) left no-repeat');
				$block_myaccount.hover(function() {
					$block_myaccount.show();
					$add_border.css('background', 'url(http://www.goodhempnutrition.com/themes/ghn/img/images/sign_in_arrow_up.png) left no-repeat');
						$block_myaccount.mouseleave(function() {
							$block_myaccount.hide();
							$add_border.css('background', 'url(http://www.goodhempnutrition.com/themes/ghn/img/images/sign_in_arrow_down.png) left no-repeat');
					});
				});
			});
		});
		
		$gym.hover(function() {
			$why_hemp_explained.css('background-image', 'url(themes/ghn/img/images/why_hemp_gym.png)');
			$changeTitle.text($gym_title);
			$changeDesc.text($gym_desc);
			$('li.why_explained p').css('width', 262);
			$('.why_explained h2').css('width',300);
		});
		
		$product_img.addClass('gym_product');
		
		$gym.mouseenter(function() {
			if ($product_img.hasClass('gym_product')) {
				$product_img.attr('src', 'themes/ghn/img/images/gym_shake_product_feature.png');
				$product_img.removeClass('dieting');
				$product_cost.attr('href', 'http://www.goodhempnutrition.com/product.php?id_product=11');
				$ambassador_img.attr('src', 'themes/ghn/img/images/ambassador_mark_hughes.png');
				$link_up_icons.attr('href', 'cms.php?id_cms=43');
				$changeTitle.attr('href', 'cms.php?id_cms=43');
			} else {
				$product_img.fadeOut(function() {
   					$product_img.attr('src', 'themes/ghn/img/images/gym_shake_product_feature.png').fadeIn();
					$ambassador_img.attr('src', 'themes/ghn/img/images/ambassador_mark_hughes.png').fadeIn();
					$ambassador_quote.text($gym_ambassador);
					$ambassador_name.text($gym_ambassador_name);
					$product_title.text($hemp_natural_title).fadeIn();
					$product_features.text($hemp_natural_desc).fadeIn();
					$product_price.text($hemp_natural_price).fadeIn();
					$product_cost.attr('href', 'http://www.goodhempnutrition.com/product.php?id_product=11');
					$link_up_icons.attr('href', 'cms.php?id_cms=43');
					$changeTitle.attr('href', 'cms.php?id_cms=43');
					$product_img.addClass('gym_product');
					$product_img.removeClass('dieting');
					$product_img.removeClass('vegan_product');
  				});							
			};
		});
		

		
		$vegan.mouseenter(function() {
			if ($product_img.hasClass('vegan_product')) {
				$product_img.attr('src', 'themes/ghn/img/images/product_feature.png');
				$product_img.removeClass('dieting');
				$product_img.removeClass('gym_product');
				$product_cost.attr('href', 'http://www.goodhempnutrition.com/product.php?id_product=10');
				$link_up_icons.attr('href', 'cms.php?id_cms=44');
				$changeTitle.attr('href', 'cms.php?id_cms=44');
				$ambassador_img.attr('src', 'themes/ghn/img/images/ambassador_mark_hughes.png');
			} else {
				$product_img.fadeOut(function() {
				$product_img.attr('src', 'themes/ghn/img/images/product_feature.png').fadeIn();
				$ambassador_img.attr('src', 'themes/ghn/img/images/ambassador_mark_hughes.png').fadeIn();
				$ambassador_quote.text($vegan_ambassador);
				$ambassador_name.text($vegan_ambassador_name);
				$product_title.text($vegan_hemp_natural_title).fadeIn();
				$product_features.text($vegan_hemp_natural_desc).fadeIn();
				$product_price.text($vegan_hemp_natural_price).fadeIn();
				$product_cost.attr('href', 'http://www.goodhempnutrition.com/product.php?id_product=10');
				$link_up_icons.attr('href', 'cms.php?id_cms=44');
				$changeTitle.attr('href', 'cms.php?id_cms=44');
				$product_img.addClass('vegan_product');
				$product_img.removeClass('dieting');
				$product_img.removeClass('gym_product');
				});
			};
		});
		
		$dieting.mouseenter(function() {
			if ($product_img.hasClass('dieting')) {
				$product_img.attr('src', 'themes/ghn/img/images/fit_shake_product.png');
				$product_img.removeClass('gym_product');
				$product_cost.attr('href', 'http://www.goodhempnutrition.com/product.php?id_product=16');
				$link_up_icons.attr('href', 'cms.php?id_cms=50');
				$changeTitle.attr('href', 'cms.php?id_cms=50');
				$ambassador_img.attr('src', 'themes/ghn/img/images/ambassador_mark_hughes.png');
			} else {
				$product_img.fadeOut(function() {
   					$product_img.attr('src', 'themes/ghn/img/images/fit_shake_product.png').fadeIn();
					$ambassador_img.attr('src', 'themes/ghn/img/images/ambassador_mark_hughes.png').fadeIn();
					$ambassador_quote.text($dieting_ambassador).fadeIn();
					$ambassador_name.text($dieting_ambassador_name).fadeIn();
					$product_title.text($fit_shake_title).fadeIn();
					$product_features.text($fit_shake_desc).fadeIn();
					$product_price.text($fit_shake_price).fadeIn();
					$product_cost.attr('href', 'http://www.goodhempnutrition.com/product.php?id_product=16');
					$link_up_icons.attr('href', 'cms.php?id_cms=50');
					$changeTitle.attr('href', 'cms.php?id_cms=50');
					$product_img.addClass('dieting');
					$product_img.removeClass('gym_product');
					$product_img.removeClass('vegan_product');
  				});							
			};
		});
		
		$vegan.hover(function() {
			$why_hemp_explained.css('background-image', 'url(themes/ghn/img/images/why_hemp_vegan.png)');
			$changeTitle.text($vegan_title);
			$changeDesc.text($vegan_desc);
			$('.why_explained h2').css('width', 345);
			$('li.why_explained p').css('width', 262);
			$('.why_explained h2').css('text-align','center');
		});
		
		$dieting.hover(function() {
			$why_hemp_explained.css('background-image', 'url(themes/ghn/img/images/why_hemp_dieting.png)');
			$changeTitle.text($dieting_title);
			$changeDesc.text($dieting_desc);
			$('.why_explained h2').css('width', 429);
			$('li.why_explained p').css('width', 300);
			$('.why_explained h2').css('text-align','center');
		});
		
		
		$dieting.hover(function() {
			$why_hemp_explained.css('background-image', 'url(themes/ghn/img/images/why_hemp_dieting.png)');				  
		});
		
		$narrow_page.css({'top': -111});
		
		$discover_more_button.click(function() {
				if ($narrow_page.hasClass('dropped_down')) {
					$narrow_page.animate({top: -111}, 500, function() {
							$narrow_page.removeClass('dropped_down');
							$('#discover_more a').css('background-image', 'url(http://www.goodhempnutrition.com/themes/ghn/img/images/discover_more_down.png)');
					});
				}
				else {
					$narrow_page.animate({top: 0}, 500, function() {
							$narrow_page.addClass('dropped_down');
							$('#discover_more a').css('background-image', 'url(http://www.goodhempnutrition.com/themes/ghn/img/images/discover_more_arrow.png)');
					});
				}
		});
		
		
		$products_link.hover(function() {
				$product_menu.show();
				$products_link.css({'background': '#e0dee4', 'color': '#595959', 'text-shadow': '0px 1px 0px #fff', 'filter': 'dropshadow(color=#fff, offx=0, offy=1)'});
					$products_link.mouseleave(function() {
						$product_menu.hide();
						$products_link.css({'background': '#595959', 'color': 'white', 'text-shadow': 'none'});
						$product_menu.hover(function() {
							$product_menu.show();
							$products_link.css({'background': '#e0dee4', 'color': '#595959', 'text-shadow': '0px 1px 0px #fff', 'filter': 'dropshadow(color=#fff, offx=0, offy=1)'});
							$product_menu.mouseleave(function() {
								$product_menu.hide();
								$products_link.css({'background': '#595959', 'color': 'white', 'text-shadow': 'none'});
							});
						});
					});
		 });
		
		$facts_link.hover(function() {
				$facts_menu.show();
				$facts_link.css({'background': '#e0dee4', 'color': '#595959', 'text-shadow': '0px 1px 0px #fff', 'filter': 'dropshadow(color=#fff, offx=0, offy=1)'});
					$facts_link.mouseleave(function() {
						$facts_menu.hide();
						$facts_link.css({'background': '#595959', 'color': 'white', 'text-shadow': 'none'});
						$facts_menu.hover(function() {
							$facts_menu.show();
							$facts_link.css({'background': '#e0dee4', 'color': '#595959', 'text-shadow': '0px 1px 0px #fff', 'filter': 'dropshadow(color=#fff, offx=0, offy=1)'});
							$facts_menu.mouseleave(function() {
								$facts_menu.hide(); 
								$facts_link.css({'background': '#595959', 'color': 'white', 'text-shadow': 'none'});
							});
						});
					});
		 });
		
		$about_link.hover(function() {
				$about_menu.show();
				$about_link.css({'background': '#e0dee4', 'color': '#595959', 'text-shadow': '0px 1px 0px #fff', 'filter': 'dropshadow(color=#fff, offx=0, offy=1)'});
					$about_link.mouseleave(function() {
						$about_menu.hide();
						$about_link.css({'background': '#595959', 'color': 'white', 'text-shadow': 'none'});
						$about_menu.hover(function() {
							$about_menu.show();
							$about_link.css({'background': '#e0dee4', 'color': '#595959', 'text-shadow': '0px 1px 0px #fff', 'filter': 'dropshadow(color=#fff, offx=0, offy=1)'});
							$about_menu.mouseleave(function() {
								$about_menu.hide();
								$about_link.css({'background': '#595959', 'color': 'white', 'text-shadow': 'none'});
							});
						});
					});
		 });
		
		$goals_link.hover(function() {
				$goals_menu.show();
				$goals_link.css({'background': '#e0dee4', 'color': '#595959', 'text-shadow': '0px 1px 0px #fff', 'filter': 'dropshadow(color=#fff, offx=0, offy=1)'});
					$goals_link.mouseleave(function() {
						$goals_menu.hide();
						$goals_link.css({'background': '#595959', 'color': 'white', 'text-shadow': 'none'});
						$goals_menu.hover(function() {
							$goals_menu.show();
							$goals_link.css({'background': '#e0dee4', 'color': '#595959', 'text-shadow': '0px 1px 0px #fff', 'filter': 'dropshadow(color=#fff, offx=0, offy=1)'});
							$goals_menu.mouseleave(function() {
								$goals_menu.hide();
								$goals_link.css({'background': '#595959', 'color': 'white', 'text-shadow': 'none'});
							});
						});
					});
		 });
		
		$recipes_link.hover(function() {
				$recipes_menu.show();
				$recipes_link.css({'background': '#e0dee4', 'color': '#595959', 'text-shadow': '0px 1px 0px #fff', 'filter': 'dropshadow(color=#fff, offx=0, offy=1)'});
					$recipes_link.mouseleave(function() {
						$recipes_menu.hide();
						$recipes_link.css({'background': '#595959', 'color': 'white', 'text-shadow': 'none'});
						$recipes_menu.hover(function() {
							$recipes_menu.show();
							$recipes_link.css({'background': '#e0dee4', 'color': '#595959', 'text-shadow': '0px 1px 0px #fff', 'filter': 'dropshadow(color=#fff, offx=0, offy=1)'});
							$recipes_menu.mouseleave(function() {
								$recipes_menu.hide();  
								$recipes_link.css({'background': '#595959', 'color': 'white', 'text-shadow': 'none'});
							});
						});
					});
		 });
		
		
});
