// culturedstone.js -- Javascript behaviors for Cultured Stone site

function popup(target, name, width, height, scrollbars) {
	popupURL = target.href;
	scrollbars = scrollbars ? 'yes' : 'no';
	name = (name == '') ? 'popup' : name;
	popupParams = 'scrollbars=' + scrollbars + ',width=' + width + ',height=' + height;
	newWin = window.open(popupURL, name, popupParams);
	if (focus) { newWin.focus(); }
	return false;
}

function popupForPrint(target, name, width, height, scrollbars) {
	popupURL = target.href;
	scrollbars = scrollbars ? 'yes' : 'no';
	name = (name == '') ? 'popup' : name;
	popupParams = 'scrollbars=' + scrollbars + ',width=' + width + ',height=' + height + ',titlebar=yes,menubar=yes,resizable=yes';
	newWin = window.open(popupURL, name, popupParams);
	if (focus) { newWin.focus(); }
	return false;
}

function pack() {
	dims = getPopupDimensions();
	
	window.resizeTo(dims.x, dims.y + 57);
	
}

function fixExternalLinks() {
	//alert(this);
	if (element.getAttribute("rel") == "external") {
		//alert('external link found');
		element.target = "_blank";
	}
}


if (typeof(Behaviour) == 'object') { 
//Behaviour.addLoadEvent(function() { fixExternalLinks(); }); 
	var myrules = {
		'a' : function() { fixExternalLinks(); },
		'area' : function() { fixExternalLinks(); }
	};
			
	Behaviour.register(myrules);
}

