function Iphone_Test()
{
//This redirects iPhones to the mobile page unless they came from the Mobile Site
//Thus purposefully went to the main site
if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iTouch/i)) || (navigator.userAgent.match(/iPad/i)) || (navigator.userAgent.match(/Android/i))) {
//If the viewer is an iPhone continue or else skip the rest of the script
//Set an array to check where the user came from
//Uses an array for future scalability
var refarray = new Array();
refarray['m.alamostone.org'] = "http://m.alamostone.org";
                                
for (var i in refarray) {
			if (document.referrer.indexOf(i) != -1) {} //if the iPhone came from the mobile site DO NOTHING
			else  if (document.cookie.indexOf("iphone_redirect=false") == -1) window.location.replace(refarray[i]);	} 
			//If the iPhone did not come from the mobile site, then direct it there
			}
}
