﻿function display(elementID)
{
    $(elementID).style.top = getScroll().t + 200 + "px";
    $(elementID).style.visibility = 'visible';
    //window.onscroll = function(){window.scrollTo(0,0);};
}
function hide(elementID)
{
    $(elementID).style.visibility = 'hidden';
    //window.onscroll = null;
}
function windowOpen(id,buy)
{
    if(arguments[2])
    {
        openDemoWindow(id + "&SongID=" + arguments[2] , buy);
    }
    else
    {
        openDemoWindow(id,buy);
    }
    //display('trans_mask');
    display('popWindowContainer');
    return false;
}
function windowClose()
{
    clear_product();
    //hide('trans_mask');
    hide('popWindowContainer');
    return false;
}
function openDemoWindow(id,buy)
{
    var myAjax = new Ajax.Request(
    'DemoWindow.aspx?ID=' + id + '&BUY=' + buy,
    {
    method: 'get',
    onComplete: show_product
    });
}
function show_product(getRequest)
{
    $('popWindowContainer').innerHTML = getRequest.responseText;
    //SET_DHTML("popWindowContainer");
}
function clear_product()
{
    $('popWindowContainer').innerHTML = '';
}

/**/
function getScroll() {     
var t, l, w, h;          
if (document.documentElement && document.documentElement.scrollTop) {           

t = document.documentElement.scrollTop; 
l = document.documentElement.scrollLeft;        
w = document.documentElement.scrollWidth;         
   h = document.documentElement.scrollHeight;     
} else if (document.body) {         
   t = document.body.scrollTop;       
   l = document.body.scrollLeft;         
   w = document.body.scrollWidth;         
   h = document.body.scrollHeight;     
}
     
return { t: t, l: l, w: w, h: h }; 
}
