function extractPageName(hrefString)
{
	var arr = hrefString.split('/');
	var oldString = (arr.length < 2) ? hrefString : arr[arr.length-2].toLowerCase() + arr[arr.length-1].toLowerCase();
	var newString = oldString.replace("cascadiagames","");
	return  newString;
}

function iPhoneCheck()
{
	var hrefString = document.location.href ? document.location.href : document.location;
	
	if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)))
	{
		//location.replace("iphone" + "/" + extractPageName(hrefString));
		location.replace("http://www.cascadiagames.com/iphone/");
	}
	return;
}
