// function to switch the blackberrys pictures
function changePicture(platform_id)
{
	document.getElementById('phonepicture').src				= 'images/'+platform_id+'.jpg';
	document.getElementById('platform_id_selected').value	= platform_id;
}

function tryDisplayAllGames()
{
	// if a platform id has been selected
	if(document.getElementById('platform_id_selected') && document.getElementById('platform_id_selected').value!='')
	{
		platform_id = document.getElementById('platform_id_selected').value;
		// Top download :
//		document.location.href = "http://www.gameloft.com/category.php?cat_id=global_top_downloads&cat_name=global_top_downloads&validatedplatform="+platform_id;
//		// Top reviews :
//		document.location.href = "http://www.gameloft.com/category.php?cat_id=global_topreviews&cat_name=global_topreviews&validatedplatform="+platform_id;
//		// All games
		document.location.href = "http://www.gameloft.com/category.php?cat_id=global_allgames&cat_name=global_allgames&validatedplatform="+platform_id;
	}
	// if a platform id has not been selected
	else
	{
		document.location.href = "http://www.gameloft.com/handsets.php?manu_id=38";
	}
}

// function that checks first if the user has selected a model, then if the user entered a phone number
function trySubmitForm()
{
	// if the user did not select any model
	if(document.getElementById('platform_id').selectedIndex == '0')
	{
		alert('Please select a model');
		return false;
	}
	
	// if the user did not entered a phone number
	if(document.getElementById('phonenumber').value == '')
	{
		alert('Please enter your phone number');
		return false;
	}
	
	// if we are here, it means everything is correct
	document.getElementById('form_promo_bb').submit();
	return true;
}
