﻿// JScript File

var intWid;
var intY;
var scrollX, scrollY;

// Feature add comment
function ActionAddComment() 
{
    sstchur_SmartScroller_GetCoords();
    IsSignedIn(AddComment);
}

function AddComment() 
{
    document.getElementById("divComments").style.display='block';
    window.scrollTo(0,scrollY);
    return false;
}    


// Feature add to favorites
function ActionAddToFavorites() 
{
    sstchur_SmartScroller_GetCoords();
    IsSignedIn(AddToFavorites);
}

function AddToFavorites() 
{
    WebService.AddToFavorites(intWid, 'W',AddToFavoritesSucceededCallback);
}

function AddToFavoritesSucceededCallback(result, eventArgs)
{
    var objElem = document.getElementById("divWsResult");
    objElem.innerHTML = result;
    document.getElementById("divWsResult").style.display='block';
    window.scrollTo(0,scrollY);
}

// Feature printer friendly version
function ActionPrint() 
{
    var obj=document.getElementById('pnlLoginImg');
    if(obj) obj.style.display='block';
    IsSignedIn(PrinterFriendlyVersion);
}

function PrinterFriendlyVersion() 
{
    window.open('../Exercise_Video_Library/Workouts_Video_Print.aspx?wID=' + intWid,'Print','scrollbars=yes, width=640, height=420');
}

            function ShowExercise(strName) {
                window.location = strName;
            }
            
            function calcHeight()
            {
                //find the height of the internal page
                var the_height=document.getElementById('FrameComments').contentWindow.
                document.body.scrollHeight;
    
                //change the height of the iframe
                document.getElementById('FrameComments').height = the_height;
                document.getElementById('CellFrameComments').height = the_height;
            }

   function sstchur_SmartScroller_GetCoords()
   {
      
      if (document.all)
      {
         if (!document.documentElement.scrollLeft)
            scrollX = document.body.scrollLeft;
         else
            scrollX = document.documentElement.scrollLeft;
               
         if (!document.documentElement.scrollTop)
            scrollY = document.body.scrollTop;
         else
            scrollY = document.documentElement.scrollTop;
      }   
      else
      {
         scrollX = window.pageXOffset;
         scrollY = window.pageYOffset;
      }

}


