/*
	One Grey Paw Custom js
	www.onegreypaw.com
	
	Gotta love the jQuery.
*/

$(function() {

	$('a.lightbox').lightBox();
	
	// popping external links in new window
	$('a[rel=external]').attr('target','_blank');
	
	// Google search links, do not pop in new window unnecessarily
	$('a.gs-title').live('click', function() {
		$(this).attr("target","");
		return true;
	});
	
	// styled buttons
	$(".buttonRight, .button").button();
	
});



//----- Validate Email Addresses -----------//
// checks for valid looking email addy
function checkemail(str){
	var filter=/^.+@.+\..{2,3}$/;	
	return (filter.test(str));
}



//----- Trim White Space -----------//
//trim whitespace for validation
function trim(s){
	if((s==null)||(typeof(s)!='string')||!s.length)return'';return s.replace(/^\s+/,'').replace(/\s+$/,'')
}



//----- Open New Window -----------//
//Open a new window with specific width/height/location 
function openWindow(location, width, height) {		
	newWidth = width + 20;
	newHeight = height + 20;
	widthHeight = "width=" + newWidth + ",height=" + newHeight;
	window.open(location,"",widthHeight);		
}
