function remixDownload (memberId, remixId, sURL)
{
    if (memberId<=0)
    {
        popupLoginFirst();
        return ;
    }
    popupRemixDownloadAlert(memberId, remixId, sURL)
}

YAHOO.namespace("example.container");

function remixDownloadInit(memberId, remixId, sURL) {
	
	// Define various event handlers for Dialog
    var handleYes = function(memberId, remixId, sURL) {
	    if(typeof(from) != 'undefined' && from == 'pdvd') {
	    	remixAction.addDownloadRemixFromPDVD(this.remixId, this.memberId);
	    }
	    else {
	    	remixAction.addDownloadRemix(this.remixId, this.memberId);
	    }
		this.hide();
	var u = "http://static.moovielive.com" + this.sURL;
    	window.open(unescape(u));

		return true;
	};
	var handleNo = function() {
		this.hide();
		return false;
	};
	// Instantiate the Dialog
	YAHOO.example.container.simpledialog1 = new YAHOO.widget.SimpleDialog("simpledialog1", 
																			 { width: "300px",
																			   fixedcenter: true,
																			   visible: false,
																			   draggable: false,
																			   close: false,
																			   text: remixDownloadAlert,
																			   icon: YAHOO.widget.SimpleDialog.ICON_INFO,
																			   constraintoviewport: true,
																			   buttons: [ { text:ok, handler:handleYes, isDefault:true },
																			   	   { text:cancel, handler:handleNo, isDefault:false }]
																			 } );
	YAHOO.example.container.simpledialog1.memberId=memberId;
	YAHOO.example.container.simpledialog1.remixId=remixId;
	YAHOO.example.container.simpledialog1.sURL=sURL;
	
	// Render the Dialog
	YAHOO.example.container.simpledialog1.render("yui_container");
}
function downloadRemixCallBack(nothing) {
	alert("back");
}
function popupRemixDownloadAlert(memberId, remixId, sURL){

    createAlertDiv();

    var div = document.getElementById("yui_container");

    remixDownloadInit(memberId, remixId, sURL);
    var popdiv = document.getElementById("simpledialog1");
    var iframe = document.createElement("iframe");
    iframe.className="menu_iframe";
    popdiv.appendChild(iframe);

	YAHOO.example.container.simpledialog1.show();
}

function createAlertDiv() {
	var theBody = document.getElementsByTagName("body")[0];
	var theAlertDiv = document.createElement("div");
	theAlertDiv.setAttribute('id','yui_container');
	theAlertDiv.setAttribute('class','yui-skin-sam');
	theAlertDiv.className='yui-skin-sam';
	theAlertDiv.style.visibility = 'hidden';
	theBody.appendChild(theAlertDiv);
}

