

$(document).ready
(
	
	function()
	{
		
		$('a:not(.exempt)[href^="http://"]').attr("target", "_blank");//opens links to other websites in new windows (unless they have class exempt)
		$('a[href$=".pdf"]').attr("target", "_blank");//open pdfs in a new window
		
		
		$("div.header ul.nav li a").hover( 
			function() {
				showActiveNav($(this).parent(),'on',true);
			}, 
			function () {
				showActiveNav($(this).parent(),'on',false); 
			}
		);
			
		$("img.thumb_swap").hover( 
			function() {
				var src = $(this).attr('src');
				var swp = src.replace(/bw_/, "col_")
				$(this).attr('src',swp);				
			},
			function() {
				var src = $(this).attr('src');
				var swp = src.replace(/col_/, "bw_")
				$(this).attr('src',swp);					
			}
		);//hover
		
		var gallery_count = $('a[rel="gallerybox"]').length;
		if(gallery_count > 0)
		{
			//alert(testimonials_count);	
			$('a[rel="gallerybox"]').each(
			function(index)
			{
				var href = $(this).attr('href');
				href += '&jsv=true';
				$(this).attr('href',href);
			}//function
		);//each
			
		}//gallery_count
		$("img.thumbnail").hover( 
			function() {
				var thid = $(this).attr('id');
				var index = thid.replace(/th_/, "");//alert(thid);
				var swp = thumbs_on[index];
				$(this).attr('src',swp);				
			},
			function() {
				var thid = $(this).attr('id');
				var index = thid.replace(/th_/, "");
				var swp = thumbs_off[index];
				$(this).attr('src',swp);					
			}
		);//hover
		
			
	}//doc ready function
	
);

if(!Array.indexOf){//index of breaks ie
	Array.prototype.indexOf = function(obj){
		for(var i=0; i<this.length; i++){
			if(this[i]==obj){
				return i;
			}
		}
		return -1;
	}
}

try {//ie6 image swap cache problem
  document.execCommand("BackgroundImageCache", false, true);
} catch(err) {}

function isset( variable )
{

	return( typeof( variable ) != 'undefined' );

}

function showActiveNav(obj,css_class,active)
{
	var js_active_class = 'js_active';
	if(!$(obj).hasClass(css_class) && active)
	{
		$(obj).addClass(css_class);
		$(obj).addClass(js_active_class);
	}//
	else if(!active && $(obj).hasClass(js_active_class))
	{
		$(obj).removeClass(css_class);
		$(obj).removeClass(js_active_class);
		
	}
	
}//


