var web_root = 'http://' + document.domain;

function goToNextBox(max_chars,current_box,next_box_ID){

	if (current_box.value.length == max_chars){
		document.getElementById(next_box_ID).focus();
	}	
}

function submitCategory(category_id,format_id){
	
	document.getElementById('h_search_mobile_format_id').value = format_id;
	document.getElementById('h_search_mobile_id').value = category_id;
	document.getElementById('form_search_category').submit();
}

function submitKeywords(){
	
	var search_by = document.getElementById('search_by').value;
	
	if (search_by == 'wallpaper'){
		document.getElementById('h_search_format_id').value = '3';
	}
	
	document.getElementById('h_search_mobile_keywords').value = document.getElementById('search_keywords').value;
	document.getElementById('h_search_mobile_by').value = search_by;
	document.getElementById('form_search_keywords').submit();
}

var last_pid;
var flash_mp3_player;

function ecouteSonnerie(product_id){

	if (last_pid){
		document.getElementById('div_ecoute_flash_' + last_pid).innerHTML = '';
		document.getElementById('div_ecoute_flash_' + last_pid).style.display = 'none';
		document.getElementById('div_ecoute_image_' + last_pid).style.display = 'block';
	}
	last_pid = product_id;
	
	flash_mp3_player = new SWFObject(web_root + "/flash/mobile_player.swf", "f_mp3_player", "43", "17", "7", "#336699");
	flash_mp3_player.addParam("quality", "high");
	flash_mp3_player.addParam("bgcolor", "#000000");
	flash_mp3_player.addParam("wmode", "transparent");
	flash_mp3_player.addParam("allowScriptAccess", "sameDomain");
	flash_mp3_player.addParam("FlashVars", "product_id=" + product_id + "&langue=fr");	
	flash_mp3_player.write("div_ecoute_flash_" + product_id);
	
	document.getElementById('div_ecoute_image_' + product_id).style.display = 'none';
	document.getElementById('div_ecoute_flash_' + product_id).style.display = 'block';
	
}