﻿
$(document).ready(function(){
    $(".MP3").click(function(event){
        
         if(isDownLoadOk())
         {
                 var selected = $("#txtSelected").attr("value");
                if(selected == '')
                 {
                    alert("Please select at least one entry.");
                    return false;
                }
         }
         else{
             alert("Please call Heavy Hitters Music at (818)246-1250 to enable downloading.");
             return false;      
         }
     
      
    });

    $(".AIFF").click(function(event){
       if(isDownLoadOk())
       {
             var selected = $("#txtSelected").attr("value");
             if(selected == '')
             {
                 alert("Please select at least one entry.");
                return false;
             }
       }else
       {
             alert("Please call Heavy Hitters Music at (818)246-1250 to enable downloading.");
             return false;
       }
     
    });
    
    function isDownLoadOk()
    {
        
            var downLoadValue = $("#txtDownload").val()
            if(downLoadValue > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
    };
});




var modalWindow = {
    parent: "body",
    windowId: null,
    content: null,
    width: null,
    height: null,
    close: function() {
        $(".modal-window").remove();
        $(".modal-overlay").remove();
    },
    open: function() {
        var modal = "";
        modal += "<div class=\"modal-overlay\">";
        modal += "<div id=\"" + this.windowId + "\" class=\"modal-window\" style=\"width:" + this.width + "px; height:" + this.height + "px; margin-top:-" + (this.height / 2) + "px; margin-left:-" + (this.width / 2) + "px;\">";
        modal += this.content;
        modal += "</div></div>";

        $(this.parent).append(modal);

        $(".modal-window").append("<a class=\"close-window\"></a>");
        $(".close-window").click(function() { modalWindow.close(); });
        $(".modal-overlay").click(function() { modalWindow.close(); });
    }

};

var openMyModal = function(source) {
    
    modalWindow.windowId = "myModal";
    modalWindow.width = 480;
    modalWindow.height = 405;
    //modalWindow.content = "<div><img src=\"images/cubes_384x158.jpg\"></div>";
    modalWindow.content = "<iframe width='480' height='405' frameborder='0' scrolling='no' allowtransparency='true' src='" + source + "'></iframe>";
    modalWindow.open();
};
