$(document).ready(function(){
	$(".scroll").click(function(event){
		//prevent the default action for the click event
		event.preventDefault();

		//get the full url - like mysitecom/index.htm#home
		var full_url = this.href;

		//split the url by # and get the anchor target name - home in mysitecom/index.htm#home
		var parts = full_url.split("#");
		var trgt = parts[1];

		//get the top offset of the target anchor
		var target_offset = $("#"+trgt).offset();
		var target_top = target_offset.top;

		//goto that anchor by setting the body scroll top to anchor top
		$('html, body').animate({scrollTop:target_top}, 400);
	});

	//When page loads...
	$(".tab_content").hide(); //Hide all content
	$("ul.tabs li:first").addClass("active").show(); //Activate first tab
	$(".tab_content:first").show(); //Show first tab content

	//On Click Event
	$("ul.tabs li").click(function() {

		$("ul.tabs li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".tab_content").hide(); //Hide all tab content

		var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active ID content
		return false;
	});

	// Click to Expand
	// Set default open/close settings
	$('.acc-container').hide(); //Hide/close all containers
	$('.acc-trigger').click(function(){
			$(this).toggleClass('active').next().slideUp(); //Add .acc_trigger class to clicked trigger and slide down the immediate next container
			$('.acc-trigger').find('a').html('Read More');
			$(this).find('a').html('Read More');
			return false; //Prevent the browser jump to the link anchor
	});
	
	// On Click
	$('.acc-trigger').click(function(){
		if( $(this).next().is(':hidden') ) { //If immediate next container is closed...
			$('.acc-trigger').removeClass('active').next().slideUp(); //Remove all .acc_trigger classes and slide up the immediate next container
			$(this).toggleClass('active').next().slideDown(); //Add .acc_trigger class to clicked trigger and slide down the immediate next container
			$('.acc-trigger').find('a').html('Read More');
			$(this).find('a').html('Read Less');
		}
		return false; //Prevent the browser jump to the link anchor
	});
});

/* Print Page */
function printPage() {
	if (window.print)
		window.print()
	else
		alert("Sorry, your browser doesn't support this feature.");
}

/* Forms for focus and blur */
function myFocus(element) {
	if (element.value == element.defaultValue) {
		element.value = '';
	}
}

function myBlur(element) {
	if (element.value == '') {
		element.value = element.defaultValue;
	}
}
