$(function(){
	// Current Nav States
	$.getScript('js/jquery.url.pack.js',function(){
		var $file = jQuery.url.attr("file");
		$('#nav_rr_sub li a, #nav_main li a').each(function(){
			var $href = $(this).attr('href');
			if ($file.indexOf($href) > -1) {
				$(this).addClass('on').click(function(){
					return false;
				});
			}
		});
	});

	// Focus & Blur
	if ($('.focus-blur').length > 0){
		$.getScript('js/jquery.valueFx.js',function(){
			// Execute this function once the plugin is loaded
			$('.focus-blur').valueFx();
		});
	}

	// Tabs
	if ($('.tabs').length > 0){
		$('div.tabs > div:not(.default,#content-main-intro)').hide();
		var $href;
		$('#nav-section a').click(function(){
			$href = $(this).attr('href');
			$('div.tabs div:visible:not(#content-main-intro)').hide();
			$($href).fadeIn();
			$('#nav-section a').parent().parent().removeClass('selected');
			$(this).parent().parent().addClass('selected');
			return false;
		});
	}

	// hide those divs
	$('div.slide-sample').hide();
	//Switch the "Open" and "Close" state per click
	$(".slide a").toggle(function(){
		$(this).addClass("expand");
		}, function () {
		$(this).removeClass("expand");
	});

	//Slide up and down on click
	$(".slide a").click(function(){
		$(this).parent().next().slideToggle('fast');
	});

	// Switcher Functions
	if ($('#tab-main').length > 0){
		// Tab Events
		$('#tab-main div:not(.default)').hide();
		var $href;
		$('#tab-nav a').click(function(){
			$href = $(this).attr('href');
			$('#tab-main div:visible').hide();
			$($href).fadeIn();
			$('#tab-nav a').removeClass('selected');
			$(this).addClass('selected');
			return false;
		});
		// Cycle Plugin for Image Rotation
		$('#tab-1,#tab-2,#tab-3,#tab-4').cycle({
			fx:		'fade', /* The transition used */
			speed:	1000, /* 1 second transition speed */
			random:	1, /* Start with a random quote, set to 0 to display quotes in order */
			timeout:	5000 /* Pause on Quote for 8 seconds */
		});
	}
	if ($('div.phone-description').length > 0){
		$('div.phone-description:not(#phone-android)').hide();
	}
});
