// Javascript

// $('html').addClass('js'); // Flash of content fix (.js class hidden in CSS) - this now included inline header.php

$(document).ready(function() {
	
	
	/*
	==============================================================
		General DOM Manipulation
	==============================================================
	*/
	
	$('#mce-EMAIL').focus(function () { 
		e = $('#mce-EMAIL'); 
		if (e.val() == 'Enter your email') e.val(''); 
	});
	
	$('#mce-EMAIL').blur(function () { 
		e = $('#mce-EMAIL'); 
		if (e.val() == '') e.val('Enter your email'); 
	});
	
	$('.page-id-28 .username').focus(function () { 
		e = $(this); 
		if (e.val() == 'Username') e.val(''); 
	});
	
	$('.page-id-28 .username').blur(function () { 
		e = $(this); 
		if (e.val() == '') e.val('Username'); 
	});
	
	$('.page-id-28 .password').focus(function () { 
		e = $(this); 
		if (e.val() == 'Password') e.val(''); 
	});
	
	$('.page-id-28 .password').blur(function () { 
		e = $(this); 
		if (e.val() == '') e.val('Password'); 
	});
	
	$('.key-features').show().insertAfter('#content hr');
	$('.key-features img').each(function(){
		if ( $(this).width() == 240 || $(this).hasClass('size-thumbnail') ) {
			$(this).wrap('<div class="thumb">');
		}
	});
	
	$('.key-features .thumb').append('<span>');
	$('.key-features .thumb').parent().addClass('fancybox');
	
	// Support page form
	$('.page-id-28 input[type=submit]').click(function(){
		$('.page-id-28 input[type=text], .page-id-28 input[type=password]').addClass('error');
		$('.page-id-28 .error-box').fadeIn();
		return false;
	});
	
	
	/*
	==============================================================
		FancyBox
	==============================================================
	*/
	$(".fancybox").fancybox();
	$(".key-features .thumb").parent('a').fancybox();
	
	$('.view-video').fancybox({
		'width': 640,
		'height': 426,
		'type': 'ajax',
		'ajax': {
			dataFilter: function(data) {
				return $(data).find('#video')[0];
			}
		}
	});
	
	
	/*
	==============================================================
		Remove No-Script Styles
	==============================================================
	*/
	
	$('html').removeClass('js'); // Flash of content fix (when doc is ready, pull the .js class)
	
	
	/*
	==============================================================
		Block Element to Link
	==============================================================
	*/
	
	$('.link').click(function(){
		window.location = $(this).find("a").attr("href");
		return false;
	});
	
	
	/*
	==============================================================
		Toggle Slider
	==============================================================
	*/
	
	$('.slider').each(function(){
		
		// Kill empty DOM elements
		$(this).children(':empty').remove();
		
		// Add title class to first DOM element
		$(this).children(':first').addClass('slider-title');
		
		// Wrap all DOM elements except title
		$(this).children().not('.slider-title').wrapAll('<div class="slider-content"></div>');
	
	});
	
	$('.slider-content').each(function(){
		
		// Pull top/bottom margins off slider content to avoid animation jump
		$(this).children(':first').css('margin-top', '0');
		$(this).children(':last').css('margin-bottom', '0');
	
	});
	
	// Add +/- symbols
	$('.slider-title').append('<span class="plus">+</span><span class="minus">-</span>');
	
	// Slide toggle function
	$('.slider-title').click(function() {
		$(this).toggleClass('active');
		$(this).siblings('.slider-content').slideToggle();
		$(this).children('.plus, .minus').toggle();
	});
	
		
});
















