var isInitialCandidatesShown = false; var availableCandidateList = null; var intervalID = 0; var timeoutID = 0; var candidateCounter = 0; var lastCandidateId = 0; var clearImageCount = 100; var imageCount = 0; var ajaxrunning = 0; var mapReload = false; var markerCount = 0; var mapPersonasCount = 20; var candidateDetailsTemplatePath = 'Templates/CandidateDetails.htm'; var topicId = 0; var topicHubId = 0; var map; var geocoder; var infowindow; var MapStyle; var needToReload = false; function characters_followTwitterPersona(userName) { var followImage = $('#imgFollow_' + userName); if (followImage.length != 0) { if (followImage[0].src.indexOf("Disabled") > -1) { return;}
}
var followButton = $('#uxFollow_' + userName); var imgLoading = $('#imgLoading_' + userName); followButton.hide(); imgLoading.show(); twitter.follow(userName, characters_handlefollowTwitterPersonaResponse, characters_handleFollowTwitterPersonaError);}
function characters_handlefollowTwitterPersonaResponse(result) { var values = new Array(); values = result.split(","); if (values.length < 4) { return;}
var response = values[0]; var PersonaID = values[1]; var PersonUserName = values[2]; var loggedUserName = values[3]; if (response != "" && PersonaID == "" && PersonUserName == "" && loggedUserName == "") { parent.location = "TwitterAuthorized.aspx?TopicHubID=" + $("#" + hdnTopicHubID_ClientID).val() + "&TopicHubUrlType=" + $("#" + hdnTopicHubUrlType_ClientID).val();}
var spanMsg = $("#spanMsg_" + PersonUserName); var divMsg = $("#divMsg_" + PersonUserName); if (spanMsg.length > 0 && divMsg.length > 0) { spanMsg[0].innerHTML = ""; if (response == "true") { spanMsg.append("Now you are following " + PersonUserName);} else if (response == "false") { spanMsg.append("Problem occured in following the persona");} else if (response == "Twitter friendship already exists") { spanMsg.append("You are already following " + PersonUserName);}
var image = $('#uxFollow_' + PersonUserName); var imgLoading = $('#imgLoading_' + PersonUserName); imgLoading.hide(); if (response != "false") { var followImage = $('#imgFollow_' + PersonUserName); if (followImage.length != 0) { followImage[0].src = "http://static.socialapproach.com/TopicHub/Images/FollowTwitterDisabled.png"; followImage[0].title = "You are already following " + PersonUserName;}
}
image.show(); divMsg.fadeIn("slow"); setTimeout("characters_hideTwitterPersonaFollowResponse('" + PersonUserName + "')", 5000)
}
}
function characters_handleFollowTwitterPersonaError(error) { return true;}
function characters_hideTwitterPersonaFollowResponse(userName) { $("#divMsg_" + userName).fadeOut("slow");}
function AddToFeaturedUsers() { uxAddToFeaturedUsers.SetEnabled(false); $.ajax({ type: "POST", url: "Default.aspx", data: { TopicHubID: $("#" + hdnTopicHubID_ClientID).val(), Action: 'AddToFeaturedUsers'
}, success: HandleAddToFeaturedUsersResponse, error: HandleAddToFeaturedUsersError
});}
function HandleAddToFeaturedUsersResponse(result) { if (!handleSessionTimeout(result)) { if (result == "SESSION_EXPIRED") { showAlertBeforeRedirection(); parent.location = "TwitterAuthorized.aspx?TopicHubID=" + $("#" + hdnTopicHubID_ClientID).val() + "&TopicHubUrlType=" + $("#" + hdnTopicHubUrlType_ClientID).val();}
if (result == "ADDED" || result == "ALREADY_ADDED") { needToReload = true; $('#characters_Tweet').trigger('click');}
uxAddToFeaturedUsers.SetEnabled(true);}
}
function HandleAddToFeaturedUsersError(error) { uxAddToFeaturedUsers.SetEnabled(true);}
function setFancyBox_Characters() { $(".fancyBoxNoZoom_Characters").fancybox({ 'hideOnContentClick': false, 'zoomSpeedIn': 500, 'zoomSpeedOut': 0, 'overlayShow': true, 'zoomOpacity': false, 'frameHeight': 415, 'frameWidth': 450, 'callbackOnClose': reload, 'callbackOnStart': closeFancyPopup
});}
function reload() { if (needToReload) { needToReload = false; CallbackPanel.PerformCallback();}
}
function initializeVariables() { topicId = $("#" + hdnTopicID_ClientID).val(); topicHubId = $("#" + hdnTopicHubID_ClientID).val();}
$(document).ready(function () { setFancyBox(); var DisableMap = $("#" + hdnDisableMap_ClientID); MapStyle = $("#" + hdnMapDisplayStyle_ClientID).val(); if (MapStyle == "" || MapStyle == null) { MapStyle = "terrain";}
if (DisableMap.length > 0) { if (DisableMap.val() == "False") { infowindow = new google.maps.InfoWindow({ maxWidth: 500
}); var mapVisibility = readCookie('MapVisibility'); if (mapVisibility != "Hidden") { initialize();}
resizeMap(); setMapVisibilty();}
initializeVariables(); getTweetsMapCandidateDetails();}
var influenceFactor = $("#" + hdnInfluence_ClientID); if (influenceFactor.length > 0) { $("#ulInfluence").append(influenceFactor[0].value); influenceFactor[0].value = "";}
var isSuperCandidate = $("#" + hdnIsSuperCandidate_ClientID); if (isSuperCandidate.length > 0) { if (isSuperCandidate.val() == "true") { var tabHotTopic = $("#divHotTopicTab"); if (tabHotTopic.length > 0) { unsetTab(); setTab(tabHotTopic);}
}
}
}); function initialize() { if ($("#map").length > 0) { geocoder = new google.maps.Geocoder(); var mapstyle = MapStyle.toUpperCase(); var MapStyleTypeID = google.maps.MapTypeId.TERRAIN; if (mapstyle == 'MAP') { MapStyleTypeID = google.maps.MapTypeId.ROADMAP;} else if (mapstyle == 'SAT') { MapStyleTypeID = google.maps.MapTypeId.SATELLITE;} else if (mapstyle == 'TERRAIN') { MapStyleTypeID = google.maps.MapTypeId.TERRAIN;} else if (mapstyle == 'HYBRID') { MapStyleTypeID = google.maps.MapTypeId.HYBRID;}
var myLatlng = new google.maps.LatLng(-34.397, 150.644); var myOptions = { zoom: 4, center: myLatlng, mapTypeId: MapStyleTypeID
}
map = new google.maps.Map(document.getElementById("map"), myOptions);}
}
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 setMapVisibilty() { var mapVisibility = readCookie('MapVisibility'); if (mapVisibility == "Hidden") { $("#mapWrapper").slideUp("fast"); document.getElementById("imgMapVisibility").title = "Show Map"; document.getElementById("imgMapVisibility").src = "http://static.socialapproach.com/TivotHome/images/RightArrowOption.png"; mapReload = true;}
}
$(window).resize(function () { resizeMap();}); function setMapBTOff(flag) { $('.TweetsMapBt').btOff(); if (flag) { if (intervalID != 0) { window.clearInterval(intervalID); intervalID = 0;}
if (timeoutID != 0) { window.clearInterval(timeoutID); timeoutID = 0;}
timeoutID = window.setTimeout(function () { showTweetsMapCandidateDetails(), intervalID = window.setInterval(function () { showTweetsMapCandidateDetails()
}, 3000);}, 5000);}
}
function setToolTip(candidateID) { if (candidateID == '') { return;}
var className = "TweetsMapBt"; $("#imgTweetsMap_" + candidateID).bt(decHTMLifEnc($("#divPopup_" + candidateID).html()), { width: 300, fill: 'white', cornerRadius: 20, padding: 5, strokeWidth: 1, shadow: true, shadowOffsetX: 6, shadowOffsetY: 6, shadowBlur: 5, shadowColor: 'rgba(0,0,0,.6)', shadowOverlap: false, noShadowOpts: { strokeStyle: '#999', strokeWidth: 2
}, textzIndex: 9996, boxzIndex: 9995, wrapperzIndex: 9994, activeClass: className, positions: ['top', 'bottom'], preHide: function (box) { if ($('.active').length > 0) { $('.active').btOff(); $('.bt-active').btOff();}
}, showTip: function (box) { var $content = $('.bt-content', box).hide(); var $canvas = $('canvas', box).hide(); var origWidth = $canvas[0].width; var origHeight = $canvas[0].height; $(box).show(); $canvas.css({ width: origWidth * .5, height: origHeight * .5, left: origWidth * .25, top: origHeight * .25, opacity: .1
}).show().animate({ width: origWidth, height: origHeight, left: 0, top: 0, opacity: 1
}, 400, 'easeOutBounce', function () { $content.show()
});}, hoverIntentOpts: { interval: 0, timeout: 0
}, trigger: ['mouseover', 'click'], cssStyles: { fontFamily: '"Arial", Helvetica, sans-serif', fontSize: '9pt'
}
});}
function resizeMap() { var height = getHeight(); var width = getWidth(); $("#map").css("height", height + "px"); $("#map").css("width", width + "px"); var browser = navigator.appVersion; if (browser.indexOf("MSIE") == -1) { try { parent.scroll(1, 12);}
catch(exp) {}
}
}
function addImage(image) { imageCount = $("li[class^='listItem']").length; if (imageCount >= (clearImageCount + 1)) { ClearDivWithPersonaImages();}
imageCount++; setMapBTOff(false); removeImage(); $("li[class^='listItem']:first").before('<li style="width: 49px; height: 50px;" class="listItem"><div>' + image + '</div></li>'); $("li[class^='listItem']:first:div").hide(); $("li[class^='listItem']:first:div").fadeIn("2000");}
function setAndPlaceTweetsMapCords(address, details) { if (geocoder && map != undefined) { geocoder.geocode({ 'address': address
}, function (results, status) { if (status == google.maps.GeocoderStatus.OK) { map.panTo(results[0].geometry.location); var marker = new google.maps.Marker({ map: map, position: results[0].geometry.location
}); infowindow.setContent(decHTMLifEnc(details)); infowindow.open(map, marker); google.maps.event.addListener(marker, "click", function () { if (infowindow) infowindow.close(); infowindow.setContent(decHTMLifEnc(details)); infowindow.open(map, marker);});}
});}
}
function ClearDivWithPersonaImages() { var PersonaImages = $("#personaImageContainer"); if (PersonaImages.length == 0) { if ($("#def3PersonaImageContainer").length > 0) { PersonaImages = $("#def3PersonaImageContainer");} else { PersonaImages = $("#" + ribbonPersonaImageContainer_ClientID);}
}
if (PersonaImages.length > 0) { PersonaImages[0].innerHTML = '<ul class="list"><li  style="width: 49px; height: 50px;" class="listItem"><div></div></li></ul>'; imageCount = 0;}
}
function removeImage() { var displayImageCounter = 19; if ($("#personaImageContainer").length > 0) { displayImageCounter = 13;}
if (imageCount > displayImageCounter) { var imgDiv = $("li[class^='listItem']:last:div"); if (imgDiv.length > 0) { imgDiv.remove(); imageCount--;}
}
}
function decHTMLifEnc(str) { if (isEncHTML(str)) return str.replace(/&amp;/g, '&').replace(/&lt;/g, '<').replace(/&gt;/g, '>').replace(/&quot;/g, '"').replace(/&#39;/g, "'"); return str;}
function isEncHTML(str) { if (str.search(/&amp;/g) != -1 || str.search(/&lt;/g) != -1 || str.search(/&gt;/g) != -1 || str.search(/&quot;/g) != -1 || str.search(/&#39;/g) != -1) return true; else return false;}; function placeCords(location, details) { try { if (map != undefined) { map.panTo(location); var marker = new google.maps.Marker({ position: location, map: map
}); infowindow.setContent(decHTMLifEnc(details)); infowindow.open(map, marker); google.maps.event.addListener(marker, "click", function () { if (infowindow) infowindow.close(); infowindow.setContent(decHTMLifEnc(details)); infowindow.open(map, marker);});}
}
finally {}
}
function handleSessionTimeout(result) { if (result == "Timedout") { window.location = "SessionExpired.aspx?RedirectUrl=" + $("#" + hdnTopicHubReturnUrl_ClientID).val();} else { return false;}
}
function handleAjaxError(error) { ajaxrunning = 0;}
function handleMapReload(result) { if (result == "Reload Map") { window.location.reload();} else { return false;}
}
function getHeight() { var mapHeight = $("#divOuter").height(); if (mapHeight <= 0) { return 300;}
return mapHeight;}
function getWidth() { var mapWidth; mapWidth = $("#divOuter").width(); if (mapWidth <= 0) { return 300;}
return mapWidth;}
function ToggleMapVisibility(image) { if (image == null) { return;}
if (image.title == "Hide Map") { $("#mapWrapper").slideUp("slow"); image.src = "http://static.socialapproach.com/TivotHome/images/RightArrowOption.png"; image.title = "Show Map"; SetCookie('MapVisibility', 'Hidden', 365);} else { $("#mapWrapper").slideDown("slow"); image.title = "Hide Map"; image.src = "http://static.socialapproach.com/TivotHome/images/DownArrowOption.png"; SetCookie('MapVisibility', 'Visible', 365); if (mapReload == true) { $("#map").css("display", "block"); initialize(); resizeMap();}
}
}
function closeAdBanner() { $.ajax({ type: "POST", url: "Default.aspx", data: { TopicHubID: $("#" + hdnTopicHubID_ClientID).val(), Action: 'HideAdBanner'
}, success: HideAdBannerSuccess, error: handleAjaxError
});}
function HideAdBannerSuccess(result) { if (result == 'true') { var objDivAd = $("#" + divAdBanner_ClientID); if (objDivAd.length > 0) { objDivAd.slideUp("slow");}
}
}
function BannerTrack(imgSrc, navUrl) { $.ajax({ type: "POST", url: "Default.aspx", data: { TopicHubID: $("#" + hdnTopicHubID_ClientID).val(), ImageURL: imgSrc, NavigationURL: navUrl, Action: 'TrackBanner'
}, success: TrackBannerSuccess, error: handleAjaxError
});}
function TrackBannerSuccess(result) { handleSessionTimeout(result);}
function HotTopics_followTwitterPersona(PersonaUserName, CandidateID) { var image = $('#personafollow_HotTopic' + CandidateID); var imgLoading = $('#imgLoading_HotTopic' + CandidateID); if (image.length > 0 && imgLoading.length > 0) { image.hide(); imgLoading.show();}
twitter.follow(PersonaUserName, HotTopics_followTwitterPersonaResponse, HotTopics_followTwitterPersonaError, CandidateID);}
function HotTopics_followTwitterPersonaResponse(result) { var values = new Array(); values = result.split(","); if (values.length < 5) { return;}
var response = values[0]; var PersonaID = values[1]; var PersonUserName = values[2]; var loggedUserName = values[3]; var candidateID = values[4]; if (response != "" && PersonaID == "" && PersonUserName == "" && loggedUserName == "") { parent.location = "TwitterAuthorized.aspx?TopicHubID=" + $("#" + hdnTopicHubID_ClientID).val() + "&TopicHubUrlType=" + $("#" + hdnTopicHubUrlType_ClientID).val();}
var spanMsg = $("#spanTwitterFollowMsg_HotTopic" + candidateID); var divTwitterFollow = $("#divTwitterFollow_HotTopic" + candidateID); if (spanMsg.length > 0 && divTwitterFollow.length > 0) { spanMsg[0].innerHTML = ""; if (response == "true") { spanMsg.append("Now you are following " + PersonUserName);} else if (response == "false") { spanMsg.append("Problem occured in following the persona");} else if (response == "Twitter friendship already exists") { spanMsg.append("You are already following " + PersonUserName);}
HotTopics_resetPersonaFollowImage(candidateID); divTwitterFollow.fadeIn("slow"); setTimeout('HotTopics_HideTwitterPersonaFollowResponse(' + candidateID + ')', 20000)
}
}
function HotTopics_followTwitterPersonaError(error) { return true
}; function HotTopics_resetPersonaFollowImage(CandidateID) { var image = $('#personafollow_HotTopic' + CandidateID); var imgLoading = $('#imgLoading_HotTopic' + CandidateID); if (image.length > 0 && imgLoading.length > 0) { imgLoading.hide(); image.show();}
}
function HotTopics_HideTwitterPersonaFollowResponse(candidateID) { $("#divTwitterFollow_HotTopic" + candidateID).fadeOut("slow")
}
function setToolTipForHotTopic(candidateID, userName, connectionCountOut, connectionCountIn) { var objDesc = $("#divDescHotTopic_" + candidateID); if (objDesc.length > 0) { var objLocation = $("#divLocationHotTopic_" + candidateID); $(document).ready(function () { $("#img_" + candidateID).bt(getContentsForHotTopic(objDesc, userName, connectionCountOut, connectionCountIn, objLocation), { width: 200, fill: 'rgba(204,204,204,.9)', cornerRadius: 20, padding: 7, strokeWidth: 1, cssStyles: { fontFamily: '"Arial", Helvetica, sans-serif', fontSize: '9pt'
}, shadow: true, shadowOffsetX: 6, shadowOffsetY: 6, shadowBlur: 5, shadowColor: 'rgba(0,0,0,.6)', shadowOverlap: false, noShadowOpts: { strokeStyle: '#999', strokeWidth: 2
}, showTip: function (box) { var $content = $('.bt-content', box).hide(); var $canvas = $('canvas', box).hide(); var origWidth = $canvas[0].width; var origHeight = $canvas[0].height; $(box).show(); $canvas.css({ width: origWidth * .5, height: origHeight * .5, left: origWidth * .25, top: origHeight * .25, opacity: .1
}).show().animate({ width: origWidth, height: origHeight, left: 0, top: 0, opacity: 1
}, 400, 'easeOutBounce', function () { $content.show()
});}, hoverIntentOpts: { interval: 0, timeout: 0
}
});});}
}
function getContentsForHotTopic(objDesc, userName, connectionCountOut, connectionCountIn, objLocation) { var description = objDesc[0].innerHTML; var location = trim(objLocation[0].innerHTML);; var locationHtml = ""; if (location != "" && location.length > 0) { locationHtml = "<div align='left' style='width:100%;; clear:both;float:left'><div class='LabelSmallMediumBold' style='width:30%;float:left'>Location :</div><div style='padding-left: 0px;float:left ;width:70%'>" + location + "</div></div>";}
var contents = "<div style='width:100%'><div style='padding-bottom: 5px'><div class='titleMedium'>" + userName + "</div></div><div style='padding-bottom: 5px'><div class='LabelSmallMedium'>" + description + "</div></div>" + locationHtml + "</div>"; return contents;}
function setFancyBox_Photos() { $(".fancyBoxPhotos").fancybox({ 'hideOnContentClick': false, 'zoomSpeedIn': 500, 'zoomSpeedOut': 0, 'overlayShow': true, 'zoomOpacity': false, 'frameHeight': 477, 'frameWidth': 477, 'callbackOnStart': closeFancyPopup
});}
$(document).ready(function () { var GoogleBotCrawling = $("#" + hdnGoogleBot_ClientID); var GoogleBotCrawlingFlag = false; if (GoogleBotCrawling.length > 0) { if (GoogleBotCrawling.val() == "true") { $("#divSimple").hide(); $("#divLnk").show(); GoogleBotCrawlingFlag = true;}
}
var DefaultTab = $("#" + hdnDefaultTab_ClientID); var tabDiv; if (DefaultTab.length > 0) { if (DefaultTab.val() == "0") { if (GoogleBotCrawlingFlag == true) { tabDiv = $("#divWhosTalkingLnk"); $("#lnkwhoTalking").css("color", "white");} else { tabDiv = $("#divWhosTalking");}
unsetTab(); var divSelected = $(tabDiv); setTab(divSelected, 0);} else if (DefaultTab.val() == "1") { if (GoogleBotCrawlingFlag == true) { tabDiv = $("#divHotTopicTabLnk"); unsetTab(); var divSelected = $(tabDiv); $("#lnkhotTopics").css("color", "white"); setTab(divSelected, 1);} else { tabDiv = $("#divHotTopicTab"); selectTab(tabDiv, 1);}
} else if (DefaultTab.val() == "2") { if (GoogleBotCrawlingFlag == true) { tabDiv = $("#divVideosAndPhotosLnk"); unsetTab(); var divSelected = $(tabDiv); $("#lnkVideosAndPhotos").css("color", "white"); setTab(divSelected, 2);} else { tabDiv = $("#divVideosAndPhotos"); selectTab(tabDiv, 2);}
} else if (DefaultTab.val() == "3") { if (GoogleBotCrawlingFlag == true) { tabDiv = $("#divOtherMediaLnk"); unsetTab(); var divSelected = $(tabDiv); $("#lnkOtherMedia").css("color", "white"); setTab(divSelected, 3);} else { tabDiv = $("#divOtherMedia"); selectTab(tabDiv, 3);}
} else if (DefaultTab.val() == "4") { if (GoogleBotCrawlingFlag == true) { tabDiv = $("#divCustomTabLnk"); unsetTab(); var divSelected = $(tabDiv); $("#lnkCustomTab").css("color", "white"); setTab(divSelected, 4);} else { tabDiv = $("#divCustomTab"); selectTab(tabDiv, 4);}
} else { if (GoogleBotCrawlingFlag == true) { tabDiv = $("#divWhosTalkingLnk"); $("#lnkwhoTalking").css("color", "white");} else { tabDiv = $("#divWhosTalking");}
unsetTab(); var divSelected = $(tabDiv); setTab(divSelected, 0);}
}
}); function setCancelImageVisibility(txtSearchTextBox) { var obj = $("#" + txtSearchTextBox)[0]; if (obj.className != "waterMarkedTextBox" && obj.value.length != 0) { $("#imgCancel").show();}
}
function selectTab(tabDiv, tabIndex) { if (uxTopicHub.activeTabIndex != tabIndex) { uxTopicHub.ChangeActiveTab(tabIndex, false); unsetTab();}
var divSelected = $(tabDiv); setTab(divSelected, tabIndex);}
function setTab(divSelected, tabIndex) { var divLeft = $("#TabLeft"); var divRight = $("#TabRigth"); if (tabIndex == 0) { divLeft.addClass("menu_tabLeftSelected");} else if (tabIndex == 4) { divRight.addClass("menu_tabRightSelected");}
var divCount = divSelected.children().length; if (divCount > 0) { var count = 0; for (count = 0; count <= divCount - 1; count++) { var className = divSelected.children()[count].className; var div = $(divSelected.children()[count]); switch (className) { case "menu_tabMiddle":
{ div.removeClass("menu_tabMiddle"); div.addClass("menu_tabMiddleSelected"); break;}
}
}
}
}
function unsetTab() { $(".menu_tabMiddleSelected").each(function () { $(this).removeClass("menu_tabMiddleSelected"); $(this).addClass("menu_tabMiddle");}); var divLeft = $("#TabLeft"); var divRight = $("#TabRigth"); divLeft.addClass("menu_Left"); divLeft.removeClass("menu_tabLeftSelected"); divRight.addClass("menu_Right"); divRight.removeClass("menu_tabRightSelected");}
function followHighInfluencePersona() { var link = $("#" + hlnkFollow_ClientID); var image = $("#imgFollow"); var PersonaUserName = $("#" + hdnPersonaUserName_ClientID); if (PersonaUserName.length > 0 && link.length > 0) { if (link[0].innerHTML.toLowerCase() == "follow") { link.hide(); image.show(); image.attr({ title: "Following"
}); twitter.follow(PersonaUserName[0].value, followHighInfluencePersonaResponse, followHighInfluencePersonaError);} else if (link[0].innerHTML.toLowerCase() == "unfollow") { link.hide(); image.show(); image.attr({ title: "Unfollowing"
}); twitter.unfollow(PersonaUserName[0].value, followHighInfluencePersonaResponse, followHighInfluencePersonaError);}
}
}
function followHighInfluencePersonaResponse(result) { var values = new Array(); values = result.split(","); if (values.length < 5) { return;}
var response = values[0]; var PersonaID = values[1]; var PersonUserName = values[2]; var loggedUserName = values[3]; var action = values[4]; var link = $("#" + hlnkFollow_ClientID); var image = $("#imgFollow"); if (response != "" && PersonaID == "" && PersonUserName == "" && loggedUserName == "") { showAlertBeforeRedirection(); parent.location = "TwitterAuthorized.aspx?TopicHubID=" + $("#" + hdnTopicHubID_ClientID).val() + "&TopicHubUrlType=" + $("#" + hdnTopicHubUrlType_ClientID).val();}
var spanMsg = $("#spanHighInfuenceScoreTwitterFollowMsg"); var divTwitterFollow = $("#divHighInfuenceScoreTwitterFollow"); if (spanMsg.length > 0 && divTwitterFollow.length > 0) { spanMsg[0].innerHTML = ""; link.show(); image.hide(); if (response == "true" && action == "Follow") { spanMsg.append("Now you are following " + PersonUserName); getFriendShipResponse("UnFollow");} else if (response == "true" && action == "UnFollow") { spanMsg.append("Now you are unfollowing " + PersonUserName); getFriendShipResponse("Follow");} else if (response == "false") { spanMsg.append("Problem occured in following the persona");} else if (response == "Twitter friendship already exists") { spanMsg.append("You are already following " + PersonUserName);}
divTwitterFollow.fadeIn("slow"); setTimeout('TopInfluencer_HideTwitterFollowResponse()', 10000)
}
}
function followHighInfluencePersonaError(error) { return true;}; function TopInfluencer_HideTwitterFollowResponse() { $("#divHighInfuenceScoreTwitterFollow").fadeOut("slow")
}
$(document).ready(function () { var PersonaUserName = $("#" + hdnPersonaUserName_ClientID); if (PersonaUserName.length > 0) { twitter.getFriendShip(PersonaUserName[0].value, getFriendShipResponse, followHighInfluencePersonaError);}
}); function getFriendShipResponse(result) { var lnkFollow = $("#" + hlnkFollow_ClientID); if (lnkFollow.length > 0) { if (result == "Follow") { lnkFollow[0].innerHTML = "follow"
} else if (result == "UnFollow") { lnkFollow[0].innerHTML = "unfollow"
}
}
}
var txtSearch_ClientID = ''; var chkRefresh_ClientID = ''; $(document).ready(function () { setTimeAgo(); setFancyBox(); setCheckboxValue();}); function setFancy() { setTimeAgo(); setFancyBox();}
function Tweets_followTwitterPersona(PersonaUserName, CandidateID) { var image = $('#personafollow_' + CandidateID); var imgLoading = $('#imgLoading_' + CandidateID); if (image.length > 0 && imgLoading.length > 0) { image.hide(); imgLoading.show();}
twitter.follow(PersonaUserName, Tweets_HandlefollowTwitterPersonaResponse, Tweets_HandlefollowTwitterPersonaError, CandidateID);}
function Tweets_HandlefollowTwitterPersonaResponse(result) { if (!handleSessionTimeout(result)) { var values = new Array(); values = result.split(","); if (values.length < 5) { return;}
var response = values[0]; var PersonaID = values[1]; var PersonUserName = values[2]; var loggedUserName = values[3]; var candidateID = values[5]; if (response != "" && PersonaID == "" && PersonUserName == "" && loggedUserName == "") { showAlertBeforeRedirection(); parent.location = "TwitterAuthorized.aspx?TopicHubID=" + $("#" + hdnTopicHubID_ClientID).val() + "&TopicHubUrlType=" + $("#" + hdnTopicHubUrlType_ClientID).val();}
var spanMsg = $("#spanTwitterFollowMsg_" + candidateID); var divTwitterFollow = $("#divTwitterFollow_" + candidateID); if (spanMsg.length > 0 && divTwitterFollow.length > 0) { spanMsg[0].innerHTML = ""; if (response == "true") { spanMsg.append("Now you are following " + PersonUserName);} else if (response == "false") { spanMsg.append("Problem occured in following the persona");} else if (response == "Twitter friendship already exists") { spanMsg.append("You are already following " + PersonUserName);}
Tweets_resetFollowImage(candidateID); divTwitterFollow.fadeIn("slow"); setTimeout('Tweets_HideTwitterFollowResponse(' + candidateID + ')', 20000)
}
}
}
function Tweets_HandlefollowTwitterPersonaError(error) { return true;}; function Tweets_resetFollowImage(CandidateID) { var image = $('#personafollow_' + CandidateID); var imgLoading = $('#imgLoading_' + CandidateID); if (image.length > 0 && imgLoading.length > 0) { imgLoading.hide(); image.show();}
}
function Tweets_HideTwitterFollowResponse(candidateID) { $("#divTwitterFollow_" + candidateID).fadeOut("slow")
}
function RefreshGrid() { Tweets.PerformCallback("databind");}
function setToolTipForTweets(candidateID, userName, connectionCountOut, connectionCountIn) { var objDesc = $("#divDesc_" + candidateID); if (objDesc.length > 0) { var objLocation = $("#divLocation_" + candidateID); $(document).ready(function () { $("#img_" + candidateID).bt(getContents(objDesc, userName, connectionCountOut, connectionCountIn, objLocation), { width: 200, fill: 'rgba(204,204,204,.9)', cornerRadius: 20, padding: 7, strokeWidth: 1, cssStyles: { fontFamily: '"Arial", Helvetica, sans-serif', fontSize: '9pt'
}, shadow: true, shadowOffsetX: 6, shadowOffsetY: 6, shadowBlur: 5, shadowColor: 'rgba(0,0,0,.6)', shadowOverlap: false, noShadowOpts: { strokeStyle: '#999', strokeWidth: 2
}, showTip: function (box) { var $content = $('.bt-content', box).hide(); var $canvas = $('canvas', box).hide(); var origWidth = $canvas[0].width; var origHeight = $canvas[0].height; $(box).show(); $canvas.css({ width: origWidth * .5, height: origHeight * .5, left: origWidth * .25, top: origHeight * .25, opacity: .1
}).show().animate({ width: origWidth, height: origHeight, left: 0, top: 0, opacity: 1
}, 400, 'easeOutBounce', function () { $content.show()
});}, hoverIntentOpts: { interval: 0, timeout: 0
}
});});}
}
function getContents(objDesc, userName, connectionCountOut, connectionCountIn, objLocation) { var description = objDesc[0].innerHTML; var location = trim(objLocation[0].innerHTML); var locationHtml = ""; if (location != "" && location.length > 0) { locationHtml = "<div align='left' style='width:100%;; clear:both;float:left'><div class='LabelSmallMediumBold' style='width:30%;float:left'>Location :</div><div style='padding-left: 0px;float:left ;width:70%'>" + location + "</div></div>";}
var contents = "<div style='width:100%'><div style='padding-bottom: 5px'><div class='titleMedium'>" + userName + "</div></div><div style='padding-bottom: 5px'><div class='LabelSmallMedium'>" + description + "</div></div>" + locationHtml + "</div>"; return contents;}
function LTrim(value) { var re = /\s*((\S+\s*)*)/; return value.replace(re, "$1");}
function RTrim(value) { var re = /((\s*\S+)*)\s*/; return value.replace(re, "$1");}
function trim(value) { return LTrim(RTrim(value));}
function setRefreshTimer(refresh, search) { txtSearch_ClientID = search; setCancelImageVisibility(txtSearch_ClientID); chkRefresh_ClientID = refresh; window.setInterval('autoRefreshGrid()', 60000);}
function autoRefreshGrid() { try { var objCheck = $("#" + chkRefresh_ClientID); if (objCheck.length > 0) { if (objCheck[0].checked) { RefreshGrid(); SetCookie('IsCheckedAutoRefresh', 'true', 1);} else { SetCookie('IsCheckedAutoRefresh', 'false', 0);}
}
}
catch(exp) {}
}
function setCheckboxValue() { try { var value = readCookie('IsCheckedAutoRefresh'); if (value != null) { var objCheck = $("#" + chkRefresh_ClientID); if (value == "true") { objCheck[0].checked = true;} else { objCheck[0].checked = false;}
}
}
catch(exp) {}
}
function Search() { var obj = $("#" + txtSearch_ClientID)[0]; if (obj.className == "waterMarkedTextBox" || (obj.className != "waterMarkedTextBox" && obj.value.length == 0)) { return;}
Tweets.PerformCallback("search=" + obj.value); $("#imgCancel").show();}
function cancelSearch() { $("#imgCancel").hide(); var obj = $("#" + txtSearch_ClientID)[0]; obj.value = ""; Blur(obj.id, 'Search'); Tweets.PerformCallback("removeSearchText");}
function Focus(objname, waterMarkText) { obj = document.getElementById(objname); if (obj.value == waterMarkText) { obj.value = ""; obj.className = "normalTextBox";}
}
function Blur(objname, waterMarkText) { obj = document.getElementById(objname); if (obj != null) { if (obj.value == "") { obj.value = waterMarkText; obj.className = "waterMarkedTextBox";} else { if ((obj.value != waterMarkText) && (obj.className != "waterMarkedTextBox")) { obj.className = "normalTextBox";} else if ((obj.value != waterMarkText) && (obj.className == "waterMarkedTextBox")) { obj.className = "normalTextBox";}
}
}
}
function checkEnter(e) { var characterCode; if (e && e.which) { e = e; characterCode = e.which;} else { e = event; characterCode = e.keyCode;}
if (characterCode == 13) { Search(); return false;} else { return true;}
}
var twitter = {}; twitter.follow = function (personaUserName, sucessCallback, errorCallback, uniqueID) { if (uniqueID == null || uniqueID == undefined) { uniqueID = "";}
$.ajax({ type: "POST", url: "Twitter.aspx", data: { TopicHubID: $("#" + hdnTopicHubID_ClientID).val(), PersonaUserName: personaUserName, UniqueID: uniqueID, Action: 'FollowTwitterPersona'
}, success: sucessCallback, error: errorCallback
});}
twitter.unfollow = function (personaUserName, sucessCallback, errorCallback, uniqueID) { if (uniqueID == null || uniqueID == undefined) { uniqueID = "";}
$.ajax({ type: "POST", url: "Twitter.aspx", data: { TopicHubID: $("#" + hdnTopicHubID_ClientID).val(), PersonaUserName: personaUserName, UniqueID: uniqueID, Action: 'UnFollowTwitterPersona'
}, success: sucessCallback, error: errorCallback
});}
twitter.getFriendShip = function (personaUserName, sucessCallback, errorCallback, uniqueID) { if (uniqueID == null || uniqueID == undefined) { uniqueID = "";}
$.ajax({ type: "POST", url: "Twitter.aspx", data: { TopicHubID: $("#" + hdnTopicHubID_ClientID).val(), PersonaUserName: personaUserName, UniqueID: uniqueID, Action: 'GetFriendShip'
}, success: sucessCallback, error: errorCallback
});}
function pagerAction(action, callbackPanel) { callbackPanel.PerformCallback(action);}
function showTweetNow(element) { var img = $(element); var divTweetNow = $("#divTweetNow"); if (divTweetNow.length > 0) { divTweetNow.hide(); divTweetNow.css("top", img.offset().top - 5); divTweetNow.css("left", img.offset().left - 48); divTweetNow.slideDown();}
}
function hideTweetNow() { var divTweetNow = $("#divTweetNow"); if (divTweetNow.length > 0) { divTweetNow.slideUp("slow");}
}
function showTwitterLoginPrompt() { var hdnTwitterPromptDelay = $("#" + hdnTwitterPromptDelay_ClientID); if (hdnTwitterPromptDelay.val() != "0") { twitterPromptDelay = hdnTwitterPromptDelay.val() * 1000; setTimeout(showLoginPopup, twitterPromptDelay);}
}
function followModeratorPersona() { var link = $("#" + hlnkModeratorFollow_ClientID); var image = $("#imgModeratorFollow"); var PersonaUserName = $("#" + hdnModeratorPersonaUserName_ClientID); if (PersonaUserName.length > 0 && link.length > 0) { if (link[0].innerHTML.toLowerCase() == "follow") { link.hide(); image.show(); image.attr({ title: "Following"
})
twitter.follow(PersonaUserName[0].value, followModeratorPersonaResponse, followModeratorPersonaError);} else if (link[0].innerHTML.toLowerCase() == "unfollow") { link.hide(); image.show(); image.attr({ title: "Unfollowing"
})
twitter.unfollow(PersonaUserName[0].value, followModeratorPersonaResponse, followModeratorPersonaError);}
}
}
function followModeratorPersonaResponse(result) { var values = new Array(); values = result.split(","); if (values.length < 5) { return;}
var response = values[0]; var PersonaID = values[1]; var PersonUserName = values[2]; var loggedUserName = values[3]; var action = values[4]; var link = $("#" + hlnkModeratorFollow_ClientID); var image = $("#imgModeratorFollow"); if (response != "" && PersonaID == "" && PersonUserName == "" && loggedUserName == "") { showAlertBeforeRedirection(); parent.location = "TwitterAuthorized.aspx?TopicHubID=" + $("#" + hdnTopicHubID_ClientID).val() + "&TopicHubUrlType=" + $("#" + hdnTopicHubUrlType_ClientID).val();}
var spanMsg = $("#spanModeratorTwitterFollowMsg"); var divTwitterFollow = $("#divModeratorTwitterFollow"); if (spanMsg.length > 0 && divTwitterFollow.length > 0) { spanMsg[0].innerHTML = ""; link.show(); image.hide(); if (response == "true" && action == "Follow") { spanMsg.append("Now you are following " + PersonUserName); getModeratorFriendShipResponse("UnFollow");} else if (response == "true" && action == "UnFollow") { spanMsg.append("Now you are unfollowing " + PersonUserName); getModeratorFriendShipResponse("Follow");} else if (response == "false") { spanMsg.append("Problem occured in following the persona");} else if (response == "Twitter friendship already exists") { spanMsg.append("You are already following " + PersonUserName);}
divTwitterFollow.fadeIn("slow"); setTimeout('Moderator_HideTwitterFollowResponse()', 10000)
}
}
function followModeratorPersonaError(error) { return true;}; function Moderator_HideTwitterFollowResponse() { $("#divModeratorTwitterFollow").fadeOut("slow")
}
function getModeratorFriendShipResponse(result) { var lnkFollow = $("#" + hlnkModeratorFollow_ClientID); if (lnkFollow.length > 0) { if (result == "Follow") { lnkFollow[0].innerHTML = "follow"
} else if (result == "UnFollow") { lnkFollow[0].innerHTML = "unfollow"
}
}
}
function OnGridContextMenu(evt) { var PopupMenu = uxFavoriteSitesPopupMenu; PopupMenu.ShowAtPos(evt.clientX + DXGetDocumentScrollLeft(), evt.clientY + DXGetDocumentScrollTop()); if (DXsafari) evt.stopPropagation(); else if (DXns) evt.preventDefault(); evt.cancelBubble = true; return false;}
function getTweetsMapCandidateDetails() { try { if (ajaxrunning == 0) { ajaxrunning = 1; $.ajax({ type: "POST", url: "DiscoveryMap.aspx/getNextCandidates", data: "{lastCandidateId:" + lastCandidateId + ",topicID:" + topicId + ",ShowReferralLinks:true,TopicHubID:" + topicHubId + ",mapPersonasCount:" + mapPersonasCount + "}", contentType: "application/json; charset=utf-8", dataType: "json", success: handleTweetsMapCandidateDetails, error: handleAjaxError
});}
}
catch(exp) {}
}
function handleTweetsMapCandidateDetails(candidateList) { try { ajaxrunning = 0; if (intervalID != 0) { window.clearInterval(intervalID); intervalID = 0;}
if (timeoutID != 0) { window.clearTimeout(timeoutID); timeoutID = 0;}
if (candidateList != null && candidateList.d.length > 0) { availableCandidateList = candidateList; lastCandidateId = candidateList.d[candidateList.d.length - 1].CandidateID; if ((typeof(initialPersonasCount) != 'undefined') && (!isInitialCandidatesShown)) { ShowInitialTweetsMapCandidateDetails(initialPersonasCount);} else { showTweetsMapCandidateDetails(); intervalID = window.setInterval(function () { showTweetsMapCandidateDetails();}, 3000);}
} else { candidateCounter = 0; availableCandidateList = null; intervalID = window.setInterval(function () { getTweetsMapCandidateDetails()
}, 30000);}
}
catch(exp) {}
}
function ShowInitialTweetsMapCandidateDetails(totalCandidateCount) { isInitialCandidatesShown = true; if (availableCandidateList == null) { return;}
if (availableCandidateList.d.length > 0) { for (var candidateCount = 0; candidateCount < totalCandidateCount; candidateCount++) { showCandidate(availableCandidateList.d[candidateCount]); candidateCounter++;}
intervalID = window.setInterval(function () { showTweetsMapCandidateDetails();}, 3000);}
}
function showTweetsMapCandidateDetails() { if (availableCandidateList == null || availableCandidateList.d == null) { if (intervalID != 0) { window.clearInterval(intervalID); intervalID = 0;}
if (timeoutID != 0) { window.clearTimeout(timeoutID); timeoutID = 0;}
getTweetsMapCandidateDetails(); return;}
showCandidate(availableCandidateList.d[candidateCounter++]); if (candidateCounter == availableCandidateList.d.length) { candidateCounter = 0; availableCandidateList = null;}
}
function showCandidate(candidateData) { try { if (candidateData.CandidateID > 0) { $('#tempTweetsMapContent').setTemplateURL(candidateDetailsTemplatePath); $('#tempTweetsMapContent').processTemplate(candidateData); if ($('#tempTweetsMapContent').html() != '') { setTimeAgo(); var details = $("#divDetails").html(); if (candidateData.Location != "") { setAndPlaceTweetsMapCords(candidateData.Location, details);} else if (candidateData.Coordinate1 != '' && candidateData.Coordinate2 != '') { var myLatlng = new google.maps.LatLng(candidateData.Coordinate1, candidateData.Coordinate2)
placeCords(myLatlng, details);}
var divPopup = "<div id='divPopup_" + candidateData.CandidateID + "' style='display:none;background-color:White;position:static;'>" + details + "</div>"; var image = $("#divImageDetails").html(); $('#des_Map_divPopupDetails').append(divPopup); addImage(image);}
$('#tempTweetsMapContent').html("");}
}
catch(exp) {}
}
function setMediaToolTip(candidateID) { if (candidateID == '') { return;}
var className = "mediaBt"; $("#mediaImg_" + candidateID).bt( decHTMLifEnc($("#divPopup_" + candidateID).html()), { width: 300, fill: 'white', cornerRadius: 20, padding: 5, strokeWidth: 1, shadow: true, shadowOffsetX: 6, shadowOffsetY: 6, shadowBlur: 5, shadowColor: 'rgba(0,0,0,.6)', shadowOverlap: false, noShadowOpts: { strokeStyle: '#999', strokeWidth: 2
}, textzIndex: 9996, boxzIndex: 9995, wrapperzIndex: 9994, activeClass: className, positions: ['top', 'bottom'], closeWhenOthersOpen: true, preHide: function(box) { if ($('.active').length > 0) { $('.active').btOff(); $('.bt-active').btOff();}
}, showTip: function(box) { var $content = $('.bt-content', box).hide(); var $canvas = $('canvas', box).hide(); var origWidth = $canvas[0].width; var origHeight = $canvas[0].height; $(box).show(); $canvas.css({ width: origWidth * .5, height: origHeight * .5, left: origWidth * .25, top: origHeight * .25, opacity: .1
}).show().animate({ width: origWidth, height: origHeight, left: 0, top: 0, opacity: 1
}, 400, 'easeOutBounce', function() { $content.show()
});}, hoverIntentOpts: { interval: 0, timeout: 0}, trigger: ['mouseover', 'click'], cssStyles: { fontFamily: '"Arial", Helvetica, sans-serif', fontSize: '9pt' }
} );}
