
function TransferToPage(response)
{window.location=response;return false;}
function RefreshPage()
{window.location=$("form").attr("action");return false;}
function AnthemError(strSourcePage,strErrorMessage)
{}
function GetCookieValue()
{var strCookieName="AuthCheck=";var strValue="";var arCookies;var cookie;if(document.cookie.length>0)
{arCookies=document.cookie.split(';');for(var i=0;i<arCookies.length;i++)
{cookie=arCookies[i];while(cookie.charAt(0)==' ')
cookie=cookie.substring(1,cookie.length);if(cookie.indexOf(strCookieName)==0)
{strValue=cookie.substring(strCookieName.length,cookie.length);}}}
return strValue;}
function p(i)
{return Math.floor(i/10)+""+i%10;}
function trunc(i)
{var j=Math.round(i*100);return Math.floor(j/100)+(j%100>0?"."+p(j%100):"");}
function GetTimeDifference(strDateTime,intFormsTimeout)
{var dtCurrentDateTime;var dtCurrentDateTimeUTC;var dtLastDateTimeUTC;var intTimeDifferenceInSeconds=0;var intElapsedTimeInSeconds=0;var intElapsedTimeInMinutes=0;dtCurrentDateTime=new Date();dtCurrentDateTimeUTC=new Date(dtCurrentDateTime.getUTCFullYear(),dtCurrentDateTime.getUTCMonth(),dtCurrentDateTime.getUTCDate(),dtCurrentDateTime.getUTCHours(),dtCurrentDateTime.getUTCMinutes(),dtCurrentDateTime.getUTCSeconds(),dtCurrentDateTime.getUTCMilliseconds());dtLastDateTimeUTC=new Date(strDateTime);intTimeDifferenceInSeconds=dtCurrentDateTimeUTC.getTime()-dtLastDateTimeUTC.getTime();if(isNaN(intTimeDifferenceInSeconds))
{return true;}
if(intTimeDifferenceInSeconds<0)
{return true;}
var second=1000;var minute=60*second;var hour=60*minute;var day=24*hour;intElapsedTimeInSeconds=trunc(intTimeDifferenceInSeconds/second);intElapsedTimeInMinutes=trunc(intTimeDifferenceInSeconds/minute)
if(Math.ceil(intElapsedTimeInMinutes)>parseInt(intFormsTimeout))
{return false;}
else
{return true;}}
function Anthem_PreCallBack()
{var strValue="";var strBoolContinueCallback="true";var strDateTime="";var intFormsTimeout="";strValue=GetCookieValue();if(strValue.length>0)
{strValue=$.trim(strValue);var mySplitResult=strValue.split("-");strBoolContinueCallback=$.trim(mySplitResult[0]);strDateTime=$.trim(mySplitResult[1]);intFormsTimeout=$.trim(mySplitResult[2]);}
if(strBoolContinueCallback==='false')
{return false;}
else
{if(strDateTime.length>0)
{return GetTimeDifference(strDateTime,intFormsTimeout);}
else
{return true;}}
return true;}
function Anthem_CallBackCancelled()
{TransferToPage('SessionExpired.aspx');}
function Anthem_Error(result)
{Anthem_InvokeMasterPageMethod
('ValidateUserSession',null,null);}
function InternalError()
{window.location='Error.aspx';return false;}
function SessionExpired()
{window.location='SessionExpired.aspx';return false;}
function SessionExpiredModal()
{tb_remove();window.location='SessionExpired.aspx';return false;}
function CaptureEnter(e)
{var keynum;var keychar;if(window.event)
{keynum=e.keyCode;}
else if(e.which)
{keynum=e.which;}
if(keynum===13)
{keynum.cancelBubble=true;keynum.returnValue=false;}}
function ResetErrorMessage()
{$(".message").html("");$(".message").hide();}
function PopupErrorMessage(response)
{alert(response);return false;}
function DisplayErrorMessage(response)
{$(".message").html(response);$(".message").show();}
function ResetModalErrorMessage()
{$(".modalmessage").html("");$(".modalmessage").hide();}
function DisplayModalErrorMessage(response)
{$(".modalmessage").html(response);$(".modalmessage").show();}
function BusyMessage()
{$.blockUI();location.href="SearchResults.aspx";}
function PopulateQuickSearchCriteria(strTypeID,strSearchText)
{$(".SearchText").val(unescape(strSearchText));$(".SearchType").val(strTypeID);return false;}
function ValidateQuickSearchCallback(response)
{if(response.error!==null)
{AnthemError("Layout.Master",response.error);}
else
{if(response!==null&&response.value!==null)
{BusyMessage();}}
return false;}
function QuickSearch()
{Anthem_InvokeMasterPageMethod
('ValidateQuickSearch',[$(".SearchText").val(),$(".SearchType option:selected").attr("value"),$(".SearchType option:selected").text()],ValidateQuickSearchCallback);return false;}
function ValidateAdvancedSearchPublisherCallback(response)
{if(response.error!==null)
{AnthemError("Layout.Master",response.error);}
else
{if(response!==null&&response.value!==null)
{BusyMessage();}}
return false;}
function PublisherChange(obj)
{var strPublisherID="";strPublisherID=obj.value;if(strPublisherID=='')
{}
else
{Anthem_InvokeMasterPageMethod
('ValidateAdvancedSearchPublisher',[strPublisherID,"6","Publisher"],ValidateAdvancedSearchPublisherCallback);}
return false;}
function ToggleSidePanelDisplaySuccess(response)
{if(response=="TRUE")
{$("#ctl00_container_sidecol").fadeOut
("slow",function()
{$(".maincol_str").css("margin-left",0);$(".SideColumn").text("Show Navigation");});}
if(response=="FALSE")
{$(".maincol_str").css("margin-left",250);$("#ctl00_container_sidecol").fadeIn("slow");$(".SideColumn").text("Hide Navigation");}}
function SaveNavigationToggleCallback(response)
{if(response.error!==null)
{AnthemError("Layout.Master",response.error);}
else
{if(response!==null&&response.value!==null)
{ToggleSidePanelDisplaySuccess(response.value);}}
return false;}
function ToggleSidePanelDisplay()
{Anthem_InvokeMasterPageMethod
('SaveNavigationToggle',null,SaveNavigationToggleCallback);return false;}
function MyAccountTransferPageCallback(response)
{if(response.error!==null)
{AnthemError("Layout.Master",response.error);}
else
{if(response!==null&&response.value!==null)
{TransferToPage(response.value);}}
return false;}
function MyAccountTransferPage()
{Anthem_InvokeMasterPageMethod
('MyAccountTransferPage',null,MyAccountTransferPageCallback);return false;}
function AccessMyAccountCallback(response)
{if(response.error!==null)
{AnthemError("Layout.Master",response.error);}
else
{if(response!==null&&response.value!==null)
{TransferToPage(response.value);}}
return false;}
function AccessMyAccount(strPage)
{Anthem_InvokeMasterPageMethod
('AccessMyAccount',[strPage],AccessMyAccountCallback);return false;}
function MyAccountLogoutCallback(response)
{if(response.error!==null)
{AnthemError("Layout.Master",response.error);}
else
{if(response!==null&&response.value!==null)
{if(response.value.length>0)
{TransferToPage(response.value);}
else
{RefreshPage();}}}
return false;}
function MyAccountLogout()
{Anthem_InvokeMasterPageMethod
('MyUserAccountLogout',null,MyAccountLogoutCallback);return false;}
function LogoutUserCallback(response)
{if(response.error!==null)
{AnthemError("Layout.Master",response.error);}
else
{if(response!==null&&response.value!==null)
{TransferToPage(response.value);}}
return false;}
function LogoutUser()
{Anthem_InvokeMasterPageMethod
('LogoutUser',null,LogoutUserCallback);return false;}
function GatherProductDetailCallback(response)
{if(response.error!==null)
{AnthemError("Layout.Master",response.error);}
else
{if(response!==null&&response.value!==null)
{TransferToPage(response.value);}}
return false;}
function ProductDetail(strSource,intTitleID,blnVerifyOwnership)
{if(blnVerifyOwnership===undefined)
{blnVerifyOwnership=false;}
else if(blnVerifyOwnership===false)
{blnVerifyOwnership=false;}
else if(blnVerifyOwnership===true)
{blnVerifyOwnership=true;}
Anthem_InvokeMasterPageMethod
('GatherProductDetail',[strSource,intTitleID,blnVerifyOwnership],GatherProductDetailCallback);return false;}
function OpenBook(intTitleID,strSource)
{if(typeof(strSource)=="undefined")
strSource=0;var strTitleID=String(intTitleID);strTitleID=strTitleID.replace(/'/g,"");TransferToPage("Open.aspx?id="+strTitleID+"&src="+strSource);return false;}
function OpenBookPageNumber(intTitleID,strPageNumber,strSource,strSearchTerm)
{if(typeof(strSource)=="undefined")
strSource=0;var strTitleID=String(intTitleID);strTitleID=strTitleID.replace(/'/g,"");strPageNumber=strPageNumber.replace(/'/g,"");TransferToPage("Open.aspx?id="+strTitleID+"&loc="+strPageNumber+"&srch="+strSearchTerm+"&src="+strSource);return false;}
function DownloadFile(response)
{try
{setTimeout($.unblockUI,1);}
catch(Err)
{}
var iframe=document.createElement("iframe");if(response!==null&&$.trim(response).length>0)
{iframe.src=response;}
else
{iframe.src="../DownloadFile.aspx";}
iframe.style.display="none";document.body.appendChild(iframe);return false;}
$(document).ready
(function()
{$(".QuickSearch").click
(function(fn)
{QuickSearch();return false;});$(".SearchText").keypress
(function(e)
{var keynum;var keychar;if(window.event)
{keynum=e.keyCode;}
else if(e.which)
{keynum=e.which;}
if(keynum==13)
{keynum.cancelBubble=true;keynum.returnValue=false;QuickSearch();return false;}});$(".SearchType").keypress
(function(e)
{var keynum;var keychar;if(window.event)
{keynum=e.keyCode;}
else if(e.which)
{keynum=e.which;}
if(keynum==13)
{QuickSearch();keynum.cancelBubble=true;keynum.returnValue=false;return false;}});$(".QuickSearch").keypress
(function(e)
{var keynum;var keychar;if(window.event)
{keynum=e.keyCode;}
else if(e.which)
{keynum=e.which;}
if(keynum==13)
{QuickSearch();keynum.cancelBubble=true;keynum.returnValue=false;return false;}});$(".PublisherBrowse").click
(function()
{PublisherBrowse();return false;});$(".MyAccountLogin").click
(function()
{MyAccountTransferPage();return false;});$(".AccessMyAccount").click
(function()
{AccessMyAccount($(this).attr("id"));return false;});$(".MyAccountLogout").click
(function()
{MyAccountLogout();return false;});$("#Logout").click
(function()
{LogoutUser();return false;});});