// cell phone Detection


//**************************
//Initialize some global variables
var uagent = navigator.userAgent.toLowerCase();
var isPhone				= false;
var phoneType				= "unknown";


//**************************
//Check if it's a handset
function DetectPhone() {
	//************************************************************
	// Detects if the current device is an iPhone or iPod Touch
	//************************************************************
	if ( ( uagent.search( "iphone" ) > -1 || uagent.search( "ipod" ) > -1 ) ) {
		isPhone 		= true;
		phoneType 		= "iPhone";
		return;
	}

	//************************************************************
	// Detects if the current device is a Windows Mobile device
	//************************************************************
	if ( uagent.search( "windows ce" ) > -1 ) {
		isPhone 		= true;
		phoneType 		= "WindowsMobileDevice";
		return;
	}

	//************************************************************
	// Detects if the current device is a BlackBerry device
	//************************************************************
	if ( uagent.search( "blackberry" ) > -1 ) {
		isPhone 		= true;
		phoneType 		= "BlackBerry";
		return;
	}

	//************************************************************
	// Detects if the current device is a PalmOS device
	//************************************************************
	if ( uagent.search( "palm" ) > -1 ) {
		isPhone 		= true;
		phoneType 		= "Palm";
		return;
	}

	if ( uagent.search( "webkit" ) > -1 ) {
	//************************************************************
	// Detects if the current device is a Symbian S60 Smartphone
	//************************************************************
		if ( ( uagent.search( "series60" ) > -1 || uagent.search( "symbian" ) > -1 ) ) {
			isPhone 	= true;
			phoneType 	= "Series60";
			return;
		}


	//************************************************************
	// Detects if the current device is an Android OS-based device
	//************************************************************
		if ( uagent.search( "android" ) > -1 ) {
			isPhone 	= true;
			phoneType 	= "Android";
			return;
		}
	}
}
