	
	$(window).load(function(){

		var menuBoxItems = $("a.menu-box-item")
			menuBoxItems.click(function(){
				if($(this).hasClass("on"))
					return false;
				var index = menuBoxItems.index(this);
				menuBoxItems.removeClass("on");
				$(this).addClass("on");
				$("div.menu-box").hide().eq(index).fadeIn();
				return false;
			}).eq(0).trigger("click");
		
		var form = $("form#contact-us");
	        form.validate({
	        	submitHandler: function(form) {
		        	var data = $(form).serialize();
				    var allFields = $(form).addClass("opacity").find("input,textarea,button").attr("disabled", "disabled");
				    var button = $(form).find(".button").html("Sending...");
				    $.ajax({
				    	url: "x.php?do=contact",
				        type: "POST",
				        data: data,
				        dataType: "json",
				        success: function(response){
				    		 if($.browser.msie)
							    	button.find("b").html("Send");
							    else button.html("Send");
				        	if(!response.result[0]){
				        		$(form).removeClass("opacity");
				        		allFields.attr("disabled", "");  		
				        	}else{
				        		$(form).find("table").slideUp("slow");
				        		$(form).find("div.msg").addClass("msg-success");
				        	}
				        	$(form).find("div.msg").html(response.result[1]).slideDown("fast");
				        }
				    });
	        	}
	        });
	        form.find("input:first").trigger("focus");
	        
	    $("a.jump").click(function(){
	    	$('html,body').animate({ scrollTop: $(this.href.match(/(\#(.+)$)/)[1]).offset().top - 10 }, 1000);
	    	return false;
	    });
		
		$("a.back").click(function(){
	    	history.back();
	    	return false;
	    });
		
		$("div.boxed:not(.aff):even").addClass("bg-dark")
	    
	    flowplayer("a.video-player", "widgets/flowplayer/flowplayer-3.2.4.swf", {
			clip: {
				autoPlay: true,
				scaling: "scale"
			},
			onFinish: function(){
				
			}
		});
	    
		if($("#about-flash").length){
			var flashvars = {};
			var params = {};
			var attributes = {};
			swfobject.embedSWF("images/about.swf", "about-flash", "488", "222", "9.0.0", "expressInstall.swf", flashvars, params, attributes);
		}
		
		if($("#home-flash").length){
			var flashvars = {};
			var params = {};
			var attributes = {};
			swfobject.embedSWF("images/home.swf", "home-flash", "733", "220", "9.0.0", "expressInstall.swf", flashvars, params, attributes);
		}
		
		$("div.video-view form button").click(function(){
			$(this).parents("form")[0].submit()
		});
		
		var allVideos = jQuery("div.video a.preview")
			allVideos.click(function(){
				var div = $(this).parents("div.video");
				if(div.hasClass("on"))
					return false;
				allVideos.parents("div.video").removeClass("on");
				div.addClass("on");
				//$("div.video-view form input[name='product_id']").val(this.id);
				$("div.video-view h2").html(div.find("p").html());
				var url = this.href;
				$("div.video-view").slideDown("slow", function(){
					flowplayer(
						"video", 
						"widgets/flowplayer/flowplayer-3.2.4.swf", 
						url
					);
				});
				return false;
			}).eq(0).trigger("click");
		jQuery("div.video a.buy").click(function(){
			jQuery(this).prev().submit();
			return false;
		});
			
		$("#top-bar li:last-child a").css({border: "none !important"});
		$("#bottom-bar li:last-child a").css({border: "none !important"});
			
	});
	
	var expand = function(){
		$("div.home-flash").delay(1000).slideUp("slow", function(){
			$("div.home-video").slideDown("slow", function(){
				flowplayer(
					"home-video", 
					"widgets/flowplayer/flowplayer-3.2.4.swf", 
					"http://www.burnhammarketing.com/videofiles/the_economic_report.flv"
				);
			});
		});
		$("div.home-video a").click(function(){
			$("div.home-video").slideUp("slow", function(){
				$("div.home-flash").slideDown("slow");
			});
			return false;
		});
	}
	
	var Utils = {
			
	
			
	}
	
