///////////////////////////////////////////////////////////////////////////////////
//  do stuff when DOM ready
///////////////////////////////////////////////////////////////////////////////////
	$(document).ready(function(){
		wrapIt();
		addId();
		tabClick();
		parentLinkInit();
		mouseOvr();
		showIt();
 	});

///////////////////////////////////////////////////////////////////////////////////
//	and wrap content for hide/display
///////////////////////////////////////////////////////////////////////////////////
function wrapIt() {
	var mySlice = $('#panes > *');
	mySlice.slice(0,2).wrapAll("<div></div>");
	mySlice.slice(2,4).wrapAll("<div></div>");
	mySlice.slice(4,6).wrapAll("<div></div>");
};
	
///////////////////////////////////////////////////////////////////////////////////
//	works on class parentUpdate
//	if window opener exists open URL in parent window and close child window
//	if no window open exists return true and open the href
///////////////////////////////////////////////////////////////////////////////////
function parentLinkInit() {
	$('a.parentUpdate').click(function(){
		var myLink = $(this).attr('href');
		if ( window.opener != undefined | window.opener != null ) {
			if (opener.blur)opener.focus();
			window.opener.parent.location=myLink;
			self.close();
			return false;
		}
		else {
			return true;
		}
	});		
};

///////////////////////////////////////////////////////////////////////////////////
//	show page when script has finished running
///////////////////////////////////////////////////////////////////////////////////	
function showIt() {
	$('div#center').show(); 
};

///////////////////////////////////////////////////////////////////////////////////
//	add ids to tab anchors, add id to wrappers, add class external plus target_blank
// 	attribute to footer links
///////////////////////////////////////////////////////////////////////////////////	
function addId() {
	$('div#tab ul li a ').each(function(n) {
		$(this).attr('id', 'link'+n);
	});

	$('div#panes > div ').each(function(n) {
		$(this).attr('id', 1+n);
	});

	$('div#foot  a ').each(function(n) {
		$(this).addClass('ext');
		$(this).attr('target','_blank');
	});
};

///////////////////////////////////////////////////////////////////////////////////
//	hide and display tabs
///////////////////////////////////////////////////////////////////////////////////	
function tabClick() {
		var tabContainers = $('div#panes > div');
		$('div#tab ul a').mouseover(function () {
			tabContainers.hide().filter(this.hash).show();
			$('div#tab ul li').removeClass('active');
			$(this).parent().addClass('active'); 
			return false;
		}).filter(':first').mouseover();
};

///////////////////////////////////////////////////////////////////////////////////
//	hover effect for button
///////////////////////////////////////////////////////////////////////////////////	
function mouseOvr() {
	$("#buttonHover").hover(function() {   
		$(this).attr('src','images/btn_orange.png');   
			}, function() {   
		$(this).attr('src','images/btn_blue.png');   
	});   
};
	




