$(function()
{
	// external link warnings
	$('a[rel~=external]').each(function()
	{
		var $target = $(this);
		$target.attr('target','_blank');
		$target.click(function()
		{
			var leave = window.confirm('You are now departing from the Property Investor Partnership website. Property Investor Partnership is not responsible for the accuracy of information contained within the linked site.');
			if (leave) return true
			else return false;
		});
	});
	
	// cycle images
	var imgs = $("#imagecycle").children();
	if (imgs.length > 1){
		$("#imagecycle").cycle({
			fx:      'fade',
			speed:    1000,
			timeout:  5000
		});
	}
	
	// cycle testimonials
	$("#home .left .testimonials").cycle({
			fx:      'fade',
			speed:    1000,
			timeout:  8000
	});
	$("#home .right .testimonials").cycle({
			fx:      'fade',
			speed:    1000,
			timeout:  12000
	});
	
	// lightbox
	$('.gallery a').fancybox();
	
	// rel externals into new windows
	$("a[rel=external]").each(function(){
		$(this).attr("target","_blank");
	});
});

// popup window
function popUp(URL)
{
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=800,height=780');");
}

