YAHOO.namespace("yui.farolatino");

function initTTCreditoWarning_onLoad() {

	//if(!usaPlayerB()) {
	if(external == null || external.DownloadManager == null) {
		return;
	}
	
	listids.each(function(id,index){
		
		var caller = $('rowDescargaR_'+id);
		
		if(caller.TTCreditoWarning && caller.TTCreditoWarning!=null) {
			return;
		}
		
		var text = $('presionarParaComprar').innerHTML;
		
		var costos = " ";
		try{
			costos = getCurrency(id)
		} catch(e){
			costos = "";
		}
		
		costos += " " + $("costoDescDigital_" + id).value;
		
		try{
			text = text.replace('$1',$("nombreDescDigital_" + id).value);
			text = text.replace('$2',costos);
		} catch(e){}	
			
		caller.TTCreditoWarning = new YAHOO.widget.Tooltip(caller.id+"tt1", { context:caller.id, text:text });
		
	});
}

function getCurrency(id) {
	var cs = $('currencySymbol_'+ $('rowID_'+id).value)
	if(!cs) {
		return "";
	}
	
	return cs.innerHTML;
}

YAHOO.util.Event.addListener(window, "load", initTTCreditoWarning_onLoad);
