var BookmarkURL = window.location.href;
var BookmarkTitle = "Lostfrog - loads of mobile content for your cellphone !";
var now_playing_id = '';
var submiter_link = "";

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function myOwnPic(lang) {
	window.open('http://www.sonnerie.net/photoperso/index.php?la='+lang+'&a=%%INFO:vhost%%', '_blank', 'toolbar=0, location=0, directories=0, status=1, scrollbars=0, resizable=0, copyhistory=0, menuBar=0, width=640, height=586, left=20, top=20');
}

function Bookmark() {
	if (document.all) window.external.AddFavorite(BookmarkURL,BookmarkTitle)
}

function jsOpenhWnd (u) {
	p = "height=660,width=380,toolbar=no,directories=no,status=no,scrollbars=auto,resizable=no,menubar=no";
	hWnd = window.open (u, "Hwnd", p);
	hWnd.focus();
}

function jsOpenhWndMobile (u) {
	p = "height=800,width=1000,toolbar=no,directories=no,status=no,scrollbars=auto,resizable=no,menubar=no";
	hWnd = window.open (u, "Hwnd", p);
	hWnd.focus();
}

function jsOpenhWndVimPass (u) {
	p = "height=600,width=600,toolbar=no,directories=no,status=no,scrollbars=auto,resizable=no,menubar=no";
	hWnd = window.open (u, "Hwnd", p);
	hWnd.focus();
}
function support(lang, vhost) {
	window.open("http://www.sonnerie.net/external/DrtTop/aide/service_tech.php?la="+lang+"&vhost="+vhost, "", "toolbar=0, location=0, directories=0, status=0, scrollbars=0, resizable=0, copyhistory=0, menuBar=0, width=300, height=150, left=200, top=200");
}
function playPreview (sType, file, id) {

	var sPlayer = '';
	var go = true;
	if (now_playing_id == id) {
		// same play button
		sType = '';
		file = '';
		go = false;
		now_playing_id = '';
		document.getElementById("play_button_"+id).style.color = "blue";
	}
	else {	
	// other play button
		if (now_playing_id != '') {
			document.getElementById("play_button_"+now_playing_id).style.color = "blue";
			now_playing_id = id;
			go = true;
		}
	}
	
	if (go) {
		document.getElementById("play_button_"+id).style.color = "red";
		now_playing_id = id;
	}
	
	
	sPlayer += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="0" height="0" id="player" align="middle">';
	sPlayer += '<param name="movie" value="http://www.sonnerie.net/external/DrtTop/player_v2.swf?sType='+sType+'&file='+file+'&go='+go+'">';
	sPlayer += '<param name="quality" value="high" />';
	sPlayer += '<param name="wmode" value="transparent" />';
	sPlayer += '<param name="menu" value="false" />';
	sPlayer += '<embed src="http://www.sonnerie.net/external/DrtTop/player_v2.swf?sType='+sType+'&file='+file+'&go='+go+'" quality="high" autostart="true" bgcolor="#FFFFFF" width="0" height="0" name="player" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
	sPlayer += '</object>';
	
	document.getElementById("previewPlayer").innerHTML = sPlayer;
	
}

function submiter(sAction){
	
	oForm = document.abo_inscription;
	
	if(sAction == "download"){
	
		if (!oForm.abo_country.value){
			alert('You must enter the country');
		}else if(!oForm.abo_operator.value){
			alert('You must enter the carrier');
		}else if(!oForm.abo_number.value){
			alert('You must enter the phone number');
		}else{
			oForm.action = submiter_link;
			oForm.submit();
		}
	
	}else{
		alert(oForm.abo_country.value);
		oForm.submit();
	}
	return true;
	
};
