﻿function getContainerHeight() { var divHeight = 0; if (typeof (window.innerHeight) == 'number') { divHeight = window.innerHeight;}
else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) { divHeight = document.documentElement.clientHeight;}
else if (document.body && (document.body.clientWidth || document.body.clientHeight)) { divHeight = document.body.clientHeight;}
return divHeight;}
function getContainerWidth() { var divWidth = 0; if (typeof (window.innerWidth) == 'number') { divWidth = window.innerWidth;} else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) { divWidth = document.documentElement.clientWidth;} else if (document.body && (document.body.clientWidth || document.body.clientHeight)) { divWidth = document.body.clientWidth;}
return divWidth;}
function setFancyLoadingCenter() { var divloading = $("div#fancy_loading").css("display"); if (divloading == 'block') { var containerHeight = getContainerHeight(); var imageHeight = 62; var imageWidth = 108; var containerWidth = getContainerWidth(); $("div#fancy_loading").css("position", "fixed"); $("div#fancy_loading").css("top", (containerHeight / 2) - (imageHeight / 2)); $("div#fancy_loading").css("left", (containerWidth / 2) - (imageWidth / 2));}
}
function underProgress() { alert('not yet implemented');}
function setTimeAgo() { jQuery('abbr[class*=timeago]').timeago(); $('abbr').css("border-bottom", "none");}
function handleError() { return true;}
function setFancyLoading() { $("div#fancy_loading").css("visibility", "visible"); $("div#fancy_loading").css("display", "block"); var containerHeight = getContainerHeight(); var imageHeight = 62; var imageWidth = 108; var containerWidth = getContainerWidth(); $("div#fancy_loading").css("position", "fixed"); $("div#fancy_loading").css("top", (containerHeight / 2) - (imageHeight / 2)); $("div#fancy_loading").css("left", (containerWidth / 2) - (imageWidth / 2));}
function hideFancyNavigation() { $("a#fancy_left").css("visibility", "hidden"); $("a#fancy_right").css("visibility", "hidden");}
function SetCookie(cookieName, cookieValue, nDays) { var today = new Date(); var expire = new Date(); if (nDays == null || nDays == 0)
nDays = 1; expire.setTime(today.getTime() + 3600000 * 24 * nDays); document.cookie = cookieName + "=" + escape(cookieValue) + ";expires=" + expire.toGMTString();}
function readCookie(name) { var cookieName = name + "="; var cookies = document.cookie.split(';'); for (var i = 0; i < cookies.length; i++) { var cookie = cookies[i]; while (cookie.charAt(0) == ' ')
cookie = cookie.substring(1, cookie.length); if (cookie.indexOf(cookieName) == 0)
return cookie.substring(cookieName.length, cookie.length);}
return null;}
function substitutePersonaImage(img, personaUserName, url, size) { if (url.indexOf("blogger") != -1 || url.indexOf("blogspot") != -1) { img.src = 'http://static.socialapproach.com/TopicHub/Images/BlogSpotAnon.png';}
else if (url.indexOf("typepad") != -1) { img.src = 'http://static.socialapproach.com/TopicHub/Images/Typepad.jpg';}
else if (url.indexOf("youtube") != -1) { img.src = 'http://static.socialapproach.com/TopicHub/Images/youtube.png';}
else { substituteImage(img, personaUserName, url, size);}
}
function substituteImage(img, personaUserName, personaURI, size) { if (personaURI.indexOf("twitter.com/") > 0) { var imageUrl = ""; var imgURL = $("#" + hdnAppSpotURL_ClientID); if (size != "bigger") { imageUrl = imgURL[0].value + personaUserName;}
else { imageUrl = imgURL[0].value + personaUserName + "/bigger";}
if (img.src != imageUrl) { img.src = imageUrl;}
else { img.src = 'http://static.socialapproach.com/TopicHub/Images/no_photo_normal.png';}
}
else { img.src = 'http://static.socialapproach.com/TopicHub/Images/no_photo_normal.png';}
}
function setFancyBox() {try { $(".fancyBoxNoZoom").fancybox({ 'hideOnContentClick': false, 'zoomSpeedIn': 500, 'zoomSpeedOut': 0, 'overlayShow': true, 'zoomOpacity': false, 'frameHeight': 415, 'frameWidth': 450, 'callbackOnClose': clearFancyBox, 'callbackOnStart': closeFancyPopup }); $(".fancyBox").fancybox({ 'hideOnContentClick': false, 'zoomSpeedIn': 500, 'zoomSpeedOut': 0, 'overlayShow': true, 'zoomOpacity': false, 'frameHeight': 450, 'frameWidth': 450, 'callbackOnClose': clearFancyBox, 'callbackOnStart': closeFancyPopup }); $(".fancyBoxSiteHelp").fancybox({ 'hideOnContentClick': false, 'zoomSpeedIn': 500, 'zoomSpeedOut': 0, 'overlayShow': true, 'zoomOpacity': false, 'frameHeight': 360, 'frameWidth': 415, 'callbackOnStart': closeFancyPopup }); $(".fancyBoxNoZoom_twitter").fancybox({ 'hideOnContentClick': false, 'zoomSpeedIn': 500, 'zoomSpeedOut': 0, 'overlayShow': true, 'zoomOpacity': false, 'frameHeight': 390, 'frameWidth': 450, 'callbackOnClose': clearFancyBox, 'callbackOnStart': closeFancyPopup }); $(".fancyBoxNoZoom_Characters").fancybox({ 'hideOnContentClick': false, 'zoomSpeedIn': 500, 'zoomSpeedOut': 0, 'overlayShow': true, 'zoomOpacity': false, 'frameHeight': 415, 'frameWidth': 450, 'callbackOnClose': reload, 'callbackOnStart': closeFancyPopup }); } catch (exp) { } }
function clearFancyBox() { var fancy_content = $("#fancy_content"); if (fancy_content != null) { fancy_content.empty();}
}
function hidePopUpFancySides() { var divDef4Tweets = $("#divDef4Tweets"); var divDef4VideoWrapper = $("#divDef4VideoWrapper"); var MoreTweets = $("#MoreTweets"); if (divDef4Tweets.length > 0) { if (divDef4Tweets.css('z-index') != '1') { divDef4Tweets.css('z-index', '1');}
}
if (divDef4VideoWrapper.length > 0) { if (divDef4VideoWrapper.css('z-index') != '1') { divDef4VideoWrapper.css('z-index', '1');}
}
if (MoreTweets.length > 0) { if (MoreTweets.css('z-index') != '1') { MoreTweets.css('z-index', '1');}
}
$(".bt-active").btOff(); setFancyLoading(); hideFancyNavigation();}
function showAlertBeforeRedirection() { alert('To complete this action, you need to log in via Twitter. We will now send you to Twitter where you can complete your login. After that, please retry your action.');}
function setTwitterPromptSession(closeOnReturn) { $.ajax({ type: "POST", url: "Twitter.aspx", data: { Action: 'twitterPromptSession', CloseOnReturn: closeOnReturn }, success: handleSetTwitterPromptSessionResponse, error: handleSetTwitterPromptSessionError
});}
function handleSetTwitterPromptSessionResponse(result) { if (result.indexOf('CLOSE') != -1) { parent.$.fn.fancybox.close(); parent.location = 'TwitterAuthorized.aspx?TopicHubID=' + queryString("TopicHubID") + '&TopicHubUrlType=' + queryString("TopicHubUrlType");}
}
function handleSetTwitterPromptSessionError(error) { return true;}
function closePopUp() { parent.$.fn.fancybox.close();}
function redirectTwitterLogin() { setTwitterPromptSession(true);}
function queryString(key) { var fullQueryString = window.location.search.substring(1); var array = fullQueryString.split("&"); for (i = 0; i < array.length; i++) { var pair = array[i].split("="); if (pair[0] == key) { return pair[1];}
}
return "";}
function closeFancyPopup() {$.fn.fancybox.close();}
