//Content Functions

function load_description()
{
	//alert('DESCRIPTION');
	document.getElementById('div_description').style['display'] = "block";
	document.getElementById('screenshots').style['display'] = "none";
	document.getElementById('goodies').style['visibility'] = "hidden";
	document.getElementById('concours').style['display'] = "none";
}

function load_screenshots()
{
	//alert('SCREENSHOTS');
	document.getElementById('screenshots').style['display'] = "block";
	document.getElementById('div_description').style['display'] = "none";
	document.getElementById('goodies').style['visibility'] = "hidden";
	document.getElementById('concours').style['display'] = "none";

}

function load_goodies()
{
	$('#goodies').show();
	document.getElementById('goodies').style['visibility'] = "visible";
	
	
	
	
	


}

function cerrar()
{
	$('#goodies').hide();
	document.getElementById('goodies').style['visibility'] = "hidden";
	
	

}


function load_concours()
{
	//alert('SCREENSHOTS');
	document.getElementById('concours').style['display'] = "block";
	document.getElementById('screenshots').style['display'] = "none";
	document.getElementById('div_description').style['display'] = "none";
	document.getElementById('goodies').style['visibility'] = "hidden";

}


//Form Functions

var PREFIX = [];
PREFIX[222] = '+44';
PREFIX[223] = '+1';
PREFIX[105] = '+39';
PREFIX[73] = '+33';
PREFIX[195] = '+34';
PREFIX[81] = '+49';
PREFIX[107] = '+81';
PREFIX[97] = '+36';
PREFIX[14] = '+43';
var arrOpers = [
[491, ' Alltel', '+1', 'You can download DEATH RACE right from your phone.<br /><br /> <div style="text-align:center"> <table width="100%"> <tr> <td align="center" width="33%"><img src="images/alltel_screen_1.gif" alt="" width="108" height="136"  border="0" /></td> <td align="center" width="34%"><img src="images/alltel_screen_2.gif" alt="" width="108" height="136" border="0" /></td> <td align="center" width="33%"><img src="images/alltel_screen_3.gif" alt="" width="108" height="136" border="0" /></td> </tr> <tr> <td valign="top">1. Select Axcess from the main Menu, then select Shopping Cart</td> <td valign="top">2. Select Catalog.</p></td> <td valign="top">3. Select New Realeases. Download the ones you want to enjoy!</td> </tr> </table> </div> <br /> Axcess Apps have several pricing options:<br /> <ul> <li>Free trial demo so you can try it before you buy it </li> <li>Pay per use </li> <li>Unlimited usage </li> </ul> Most apps take 2-3 minutes to download and will be billed to your  Alltel account. The number of apps you can store on a phone varies by  model. <br /> <br /> All you need is a phone and a plan from Alltel.'],
[40, 'AT&T', '+1', ''],
[490, 'Sprint', '+1', 'Simply text: WEB DEATH RACE to 84149* <br />(Game cost : 3.99$)<br />Wait for an answer and follow the instructions.<br />You will receive afterwards a WAP link to download your game.<br />*US Sprint consumers only. <br />Each game costs $3.99. You will be charged on your mobile phone bill.<br />You will also incur your normal SMS and WAP charges. You must have sufficient credit to receive your order. Please allow 24h to get your sms reply.<br />Text HELP to 84149 for help.'],
[71, 'T-Mobile', '+1', 'Simply text: GET DEATH RACE to 84149*<br />(Game cost : 3.99$)<br />Wait for an answer and follow the instructions.<br />You will receive afterwards a WAP link to download your game.<br />*US T-Mobile consumers only.<br />Each game costs $3.99. You will be charged on your mobile phone bill.<br />You will also incur your normal SMS and WAP charges. You must have sufficient credit to receive your order. Please allow 24h to get your sms reply.<br />Text HELP to 84149 for help.'],
[70, 'Verizon', '+1', 'To get DEATH RACE on your phone, you just have to: <ol> <li>Get your phone, go to the Get It Now menu</li> <li>Select get Fun & Games</li> <li>Select Get New</li> <li>Select a category and choose your game.</li> <li>Choose a pricing option.</li> </ol> After the download has completed, choose \'Get Fun & Games\' from the Main Menu, then select the game to play it.']

];




var ID_TELEPHONE = 'telephone';
var ID_OPERATOR = 'select_operator';


function enableControls() {
//	document.getElementById(ID_SUBMIT).disabled = false;
//	document.getElementById(ID_TELEPHONE).disabled = false;
	//...

}

function disableControls() {
//	document.getElementById(ID_TELEPHONE).style.backgroundColor = 'silver';
//	document.getElementById(ID_TELEPHONE).disabled = true;
	//...
}

function showInstructions() {
	document.getElementById('instructions').style.display = 'block';
}

function hideInstructions() {
	document.getElementById('instructions').style.display = 'none';
	enableControls();
}

function onChangeOperator(e) {
	telephone = document.getElementById(ID_TELEPHONE);	
	operator = document.getElementById(ID_OPERATOR);
	
	
	if( operator.value == 0 ) {
		document.getElementById(ID_TELEPHONE).value = '';
	}
	else {
		document.getElementById(ID_TELEPHONE).value = PREFIX[ID_ACTUAL_COUNTRY];
	}
	
	
	if ( ID_ACTUAL_COUNTRY != 223 ) {//EEUU 
		return;
	}
	
	
	// If EEUU AND JAPAN

	telephone = document.getElementById(ID_TELEPHONE);	
	operator = document.getElementById(ID_OPERATOR);

	if( getOperInstructions(operator.value) != '' ) {
		showInstructions();
		document.getElementById('instructions').innerHTML = '<img src="images/x_1.jpg" title="close instructions" style="cursor:hand;float:right" onclick="reset()" onmouseout="this.src=\'images/x_1.jpg\'" onmouseover="this.src=\'images/x_2.jpg\'" /><div style="padding:10px">' + getOperInstructions(operator.value) + '</div>';
		disableControls();
	}
	else {
		hideInstructions();
		//telephone.value = getOperPrefix(operator.value);
	}
}


function getOperInstructions(id) {

	if( id == 0 ) {
		return '';
	}
	
	for( var i = 0; i < arrOpers.length; i++ ) {
		if( arrOpers[i][0] == id ) {
			return arrOpers[i][3];
		}
	}
	return '<br /><br />Go to the games category on your phone to buy DEATH RACE today!<br /><br />&nbsp;';
}

function reset(e) {
	
	hideInstructions();
	
	var telephone = document.getElementById(ID_TELEPHONE);
	var operator = document.getElementById(ID_OPERATOR);
		
	telephone.value = '';
	operator.value = 0;
}


