var rt_preview = '';
var currently_playing = '';
var playa_instance = new Array();
var your_mom_has_a_date = new Date();

function rt_play(o, tone, vendor) {
	//alert(navigator.userAgent);
	if (rt_preview == '' || rt_preview != tone) rt_preview = tone;
	else rt_preview = '';
	reset_rtp();
	currently_playing = o;
	if (rt_preview == '') {
		currently_playing = '';
		o.innerHTML = '<img src="/images/buttons/play.png" width="60" height="15" alt="Play" border="0"/>';
		document.getElementById('ball').innerHTML = '';
	} else {
		// set the playa_instance
		if(playa_instance[rt_preview]) {
				playa_instance[rt_preview]++;
		} else {
				playa_instance[rt_preview] = 1;
		}

		o.className = 'rtp-active';
		o.innerHTML = '<img src="/images/buttons/loading.png" width="60" height="15" title="Loading" alt="Loading" border="0"/>';
		document.getElementById('ball').innerHTML = '<div id="fixed-balls"><object type="application/x-shockwave-flash" data="/swf/oasysplaya.swf?toneId='+rt_preview+'&vendor_id='+vendor+'&playa_instance='+your_mom_has_a_date.valueOf()+playa_instance[rt_preview]+'" '
	 				+ 'width="1" height="1" id="'+rt_preview+'" name="playa'+rt_preview+'"> '
					+ '<param name="movie" value="/swf/oasysplaya.swf?toneId='+rt_preview+'&vendor_id='+vendor+'&playa_instance='+your_mom_has_a_date.valueOf()+playa_instance[rt_preview]+'"> '
					+ '<param name="quality" value="high"> '
					+ '<param name="wmode" value="transparent"> '
					+ '</object></div>'; 

	}
}

function reset_rtp()
{
	currently_playing = '';
	var tags = document.getElementsByTagName('a');
	for(var t=0;t<tags.length;t++) {
		if (document.getElementsByTagName('a')[t].className=='rtp-active') {
			document.getElementsByTagName('a')[t].innerHTML='<img src="/images/buttons/play.png" width="60" height="15" alt="Play" border="0"/>';
			document.getElementsByTagName('a')[t].className='rtp';
		}
	}
}

function play_onload() {
	if(currently_playing) {
	currently_playing.innerHTML = '<img src="/images/buttons/stop.png" width="60" height="15" alt="Stop" border="0"/>';
	}
}