﻿//window.onload = initializeMenu;
var albumPlaying = "";
var filePlaying = "";

//sfHover = function() {

//	    var sfEls = document.getElementById("nav").getElementsByTagName("LI");
//	    for (var i=0; i<sfEls.length; i++) {
//		    sfEls[i].onmouseover=function() {
//			    this.className+=" sfhover";
//		    }
//		    sfEls[i].onmouseout=function() {
//			    this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
//		    }
//	    }
//    }
//    
// if (window.attachEvent) window.attachEvent("onload", sfHover);
 
 function Play (albumId, file) {
        if(albumPlaying != "" || filePlaying != "")
            Stop(albumPlaying, filePlaying);
            
		var path = '<embed src="Media/Content/'+ albumId + '/' + file + '" autostart="true" loop="false" hidden="true" height="0" width="0">';
		albumPlaying = albumId;
		filePlaying = file;
		document.getElementById (file).innerHTML = '<span class="small_text">   Playing....</span>' + path + '<img src="UI/Images/stop.gif" style="cursor:pointer;vertical-align:middle;" onclick="Stop(' + "'" + albumId + "','" + file + "'" + ')">';
		
		
		
		}
		
function Stop (albumId, file) {
		filePlaying = "";
		albumPlaying = "";
		document.getElementById (file).innerHTML = '<img src="UI/Images/listen_icon.gif" style="cursor:pointer;" onclick="Play(' + "'" + albumId + "','" + file + "'" + ')">';

}

function getDownloadLink(link){ 

        var elementId = link.split(',')[0];
        var link = link.split(',')[1];
        
        var el = document.getElementById("download" + elementId);
        el.className = 'download';
        el.innerHTML = "<a href='" + link + "' target='_blank'>Download File</a>";
        
}
