var KC = {};

$(function(){
		   
	jQuery.KC.here('#subNav');
	jQuery.KC.Compactor('#faq', 'h4', 'div');
	jQuery.KC.hiJackVideo('.hiJackVideoLink');
	jQuery.KC.requiredFileds();
	
	// add span tag to the navigation ON button
	$('#navigation').find('a.on').append('<span></span>');
	
	// HARD CODE COMING TO THIS PAGE AND LOAD VIDEO OF STEFAN
	if ( location.hash == '#stefan') {
		$('.hiJackVideoWrap').find('img').remove();
		$('.hiJackVideoWrap').html('<iframe src="http://keyboard.vcisandbox.com/flash/jennifer_video.html" frameborder="0" width="340" height="285"></iframe>');
	}
		
		
		
});

jQuery.KC = {

	here : function(nav)
	{
		$(nav).find("a").each(function() {
			if( location.href.indexOf(this.href) != -1) {
				$(this).addClass("on");
				$(this).append('<span></span>');
			}
		});	
		
	},
	
	tabs : function(wrapper, linkList, section) 
	{
		$(wrapper).find(section).not(':first').css({display: 'none'});
		$(linkList).find('a:first').addClass('select');
		$(linkList).find('a').click(function() { 
			var href = $(this).attr('href');
			$(linkList).find('a').not(this).removeClass("on");
			$(this).addClass(' on');
			$('div' + section +':visible').not(href).css({display: 'none'});
			$(href).css({display: 'block'});
			return false;
		});
											
	},
	
	Compactor : function ( list, trigger, item ) 
	{
		
		$(list).find(item).css({display: "none"});
		$(list).find(item+":first").css({display: "block"});
		$(list).find(trigger+':first').addClass(" linkOn");
		$(list).find(trigger).addClass(" link").hover( function () {
			$(this).addClass(" linkOver");
		}, function () {
			$(this).removeClass("linkOver");
		}).click( function () {
			$(list).find(item+":visible").not(this).slideUp("fast");
			$(list).find(trigger).not(this).removeClass("linkOn");
			$(this).addClass(" linkOn").next(item+":hidden").slideDown("fast");
		});

	},
	
	hiJackVideo : function (link)
	{

			$(link).click(function(){
				var goTo = $(this).attr('href');   
				$('.hiJackVideoWrap').find('img').remove();
				$('.hiJackVideoWrap').html('<iframe src="'+goTo+'" frameborder="0" width="340" height="285"></iframe>');
				return false;
			});
	},
	
	requiredFileds : function()
	{
			$('.required').prev('label').css('cursor', 'help').attr('title','This is a required field').append('<span class="required">*</span>');
	}
	

}