/**
 * @author Nathan Kelly - http://www.nathan-kelly.com/
 *  my email address is my first name @nathan-kelly.com
 * @copyright 2010 Nathan Kelly
 * @package nk-iphonealert
 * @version 1.0.0
 * @dependencies 
 * 	prototype.js 1.6.0.2+ (http://www.prototypejs.org/)
 * @license
 *	Creative Commons Attribution 2.5 Australia License
 *	http://creativecommons.org/licenses/by/2.5/au/
 */

 // this works fine but I really need to set a cookie if the user confirms so it doesn't
 // popup on each page load... if they canceled I might add a link to the page that takes
 // them to the iphone site...

var nk_iphonealert = Class.create({	
	initialize: function()
	{
		if ( ( navigator.userAgent.match(/iPhone/i) ) || ( navigator.userAgent.match(/iPod/i) ) )
		{
			var question = confirm("Would you like to view the iPhone-optimized version of this site?");
			if ( question )
			{
				window.location = "http://i.nathan-kelly.com";
			}
		}
	}
});

document.observe('dom:loaded', function () { new nk_iphonealert(); });

