
$(document).ready(function(){ /// the DOM-ready thing covers the first three snippets

//================== manually and automatically designated internal and external links with icons
$(function(){
$('a[href^="http://"]').addClass('external').attr('target','_blank');
$('a[href^="https://"]').addClass('external').attr('target','_blank');
$('.external').attr('target','_blank');
$('a[href$=pdf]').addClass('pdfLink').attr('target','_blank');
$('a[href$=doc]').addClass('wordLink').attr('target','_blank');
});

// ================= Last list items of simple list within the text area to add a class of lastBullet
// Engage
$(function(){
$("ul.simple_list li:last").addClass("lastBullet");
});

// ================= MULTI-CLASS FAQ Professional with up and down arrow but problem with p tag
// http://www.webdesignerwall.com/demo/jquery/accordion2.html
	$(".FAQContainer h3").eq(3).addClass("active");
	//$(".accordion2 p").eq(3).show();
	$(".FAQContainer h3").click(function(){
		$(this).next("p").slideToggle("slow")
		.siblings("p:visible").slideUp("slow");
		$(this).toggleClass("active");
		$(this).siblings("h3").removeClass("active");
	});

// ================= MULTI-CLASS FAQ Simple and Clean
// http://css-tricks.com/snippets/jquery/simple-jquery-accordion/
       $('#accordion dd').hide();
       $('#accordion dt a').click(function(){
               $('#accordion dd').slideUp();
               $(this).parent().next().slideDown();
               return false;
       });

// ====================  Popupwindow plugin for jQuery by Tony Petruzzi
// homepage: http://rip747.wordpress.com
// plugin download: http://rip747.wordpress.com/2007/03/02/the-return-of-popupwindow-jquery-plugin

jQuery.fn.popupwindow = function(p)
{
	var profiles = p || {};
	return this.each(function(index){
		var settings, parameters, mysettings, b, a;
		// for overrideing the default settings
		mysettings = (jQuery(this).attr("rel") || "").split(",");
		settings = {
			height:600, // sets the height in pixels of the window.
			width:600, // sets the width in pixels of the window.
			toolbar:0, // determines whether a toolbar (includes the forward and back buttons) is displayed {1 (YES) or 0 (NO)}.
			scrollbars:0, // determines whether scrollbars appear on the window {1 (YES) or 0 (NO)}.
			status:0, // whether a status line appears at the bottom of the window {1 (YES) or 0 (NO)}.
			resizable:1, // whether the window can be resized {1 (YES) or 0 (NO)}. Can also be overloaded using resizable.
			left:0, // left position when the window appears.
			top:0, // top position when the window appears.
			center:0, // should we center the window? {1 (YES) or 0 (NO)}. overrides top and left
			createnew:1, // should we create a new window for each occurance {1 (YES) or 0 (NO)}.
			location:0, // determines whether the address bar is displayed {1 (YES) or 0 (NO)}.
			menubar:0 // determines whether the menu bar is displayed {1 (YES) or 0 (NO)}.
		};

		// if mysettings length is 1 and not a value pair then assume it is a profile declaration
		// and see if the profile settings exists

		// if(mysettings.length == 1 && mysettings[0].split(":").length == 1)
//		{
//			a = mysettings[0];
//			// see if a profile has been defined
//			if(typeof profiles[a] != "undefined")
//			{
//				settings = jQuery.extend(settings, profiles[a]);
//			}
//		}
//		else
		{
			// overrides the settings with parameter passed in using the rel tag.
			for(var i=0; i < mysettings.length; i++)
			{
				b = mysettings[i].split(":");
				if(typeof settings[b[0]] != "undefined" && b.length == 2)
				{
					settings[b[0]] = b[1];
				}
			}
		}
		// center the window if the REL parameters aren't qualified
		if (settings.center == 1)
		{
			settings.top = (screen.height-(settings.height + 110))/2;
			settings.left = (screen.width-settings.width)/2;
		}
		
		parameters = "location=" + settings.location + ",menubar=" + settings.menubar + ",height=" + settings.height + ",width=" + settings.width + ",toolbar=" + settings.toolbar + ",scrollbars=" + settings.scrollbars  + ",status=" + settings.status + ",resizable=" + settings.resizable + ",left=" + settings.left  + ",screenX=" + settings.left + ",top=" + settings.top  + ",screenY=" + settings.top;
		
		jQuery(this).bind("click", function(){
			var name = settings.createnew ? "PopUpWindow" + index : "PopUpWindow";
			window.open(this.href, name, parameters).focus();
			return false;
		});
	});

};




}); /// the DOM ready thing covers all the snippets