$(document).ready(function() { if (jQuery.browser.msie && jQuery.browser.version < "7.0") { $('body').addClass('ie6'); if ($('.nav-item') != null) { $('.nav-item').children('.tier-2').not('#partners, #communities').css('width', '770px') } } if ($('.nav-item') != null) { $('.nav-item').children('.tier-2').not('#partners, #contact').css('left', '0'); } if ($('#partners') != null) { $('#partners').css('right', '0'); } if ($('#contact') != null) { $('#contact').css('right', '1px'); } if ($('#partners') != null) { $('#partners').css('width', '210px'); } if ($('#contact') != null) { $('#contact').css('width', '220px'); } if ($(".nav-item") != null) { $(".nav-item").hover(function() { $('div:first', this).css('display', 'block'); $(this).addClass('active'); $(this).siblings().addClass('inactive'); if ($(this).children('#communities')) $('#communities').parent('li').css('position', 'relative'); if ($(this).children('#partners')) $('#partners').parent('li').css('position', 'relative'); if ($(this).children('#contact')) $('#contact').parent('li').css('position', 'relative') }, function() { $('div:first', this).css('display', 'none'); $(this).removeClass('active'); $(this).siblings('li').removeClass('inactive') }) } });   function sameSize(c) { if ($(c).length > 0) { var maxHeight = 0; $(c).each(function() { if ($(this).innerHeight() > maxHeight) maxHeight = $(this).innerHeight() }); $(c).each(function() { var topPad = parseInt($(this).css("padding-top")); var botPad = parseInt($(this).css("padding-bottom")); $(this).height(maxHeight - topPad - botPad) }); if ($(c).children('.bottom').size() > 0) $(c).children('.bottom').css('position', 'absolute'); if ($(c).children('#page-tools2').size() > 0) $(c).children('#page-tools2').css('position', 'absolute') } } function SubmitFormForSearch() { var v1 = document.getElementById('borderInput').value; v1 = v1.replace(/javascript/gi, ''); var u1 = location.href; u1 = u1.replace(location.search, ''); u1 = u1.replace(location.protocol + '//' + location.hostname, ''); var parseurl = u1.split('/'); var xlocale = ''; for (x = 0; x < parseurl.length; x++) { if (parseurl[x].length == 2) { xlocale = xlocale + '/' + parseurl[x] } } var url2 = location.protocol + '//' + location.hostname + xlocale + '/search/default.aspx?q=' + v1 + '&sk=ca.com'; var whereami = location.href; var findme = whereami.indexOf("/search/"); if (findme < 0) { url2 += '&backUrl=' + encodeURIComponent(location.href) } else { var searchString = document.location.search; searchString = searchString.substring(1); var nvPairs = searchString.split("&"); for (i = 0; i < nvPairs.length; i++) { var nvPair = nvPairs[i].split("="); var name = nvPair[0]; var value = nvPair[1]; if ((name.indexOf("backURL") > -1)) { value = value.replace(/javascript/gi, ''); value = value.toLowerCase(); if (value.indexOf('ca.com') > -1) { url2 += '&backUrl=' + value } } } } window.location.href = url2 } function getKeyCode(event, btnID) { if (document.all) { if (window.event) { if (window.event.keyCode == 13) GetWindowSubmitEvent(event, btnID) } else { if (event.keyCode == 13) GetEventSubmitEvent(event, btnID) } return false } else if (document.getElementById) { if (window.event) { if (window.event.keyCode == 13) GetWindowSubmitEvent(event, btnID) } else { if (event.keyCode == 13) GetEventSubmitEvent(event, btnID) } return false } else if (document.layers) { if (window.event) { if (window.event.keyCode == 13) GetWindowSubmitEvent(event, btnID) } else { if (event.keyCode == 13) GetEventSubmitEvent(event, btnID) } return false } return false } function GetWindowSubmitEvent(event, btnID) { var btn = btnID; window.event.cancelBubble = true; window.event.returnValue = false; window.event.cancel = true; document.getElementById(btn).onclick(); return false } function GetEventSubmitEvent(event, btnID) { var btn = btnID; event.cancelBubble = true; event.returnValue = false; event.preventDefault(); event.cancel = true; document.getElementById(btnID).onclick(); return false } function GetCookie(name) { var start = document.cookie.indexOf(name + "="); var len = start + name.length + 1; if ((!start) && (name != document.cookie.substring(0, name.length))) { return null } if (start == -1) return null; var end = document.cookie.indexOf(";", len); if (end == -1) end = document.cookie.length; return unescape(document.cookie.substring(len, end)) } function SetCookie(name, value) { document.cookie = name + "=" + escape(value) + ";path=/;domain=.ca.com" } function openPopup(popURL, popHeight, popWidth) { var popLeft = (screen.width / 2) - (popWidth / 2); var popTop = (screen.height / 2) - (popHeight / 2); var popSettings = 'height=' + popHeight + ',width=' + popWidth + ',top=' + popTop + ',left=' + popLeft + ',titlebar=no,toolbar=no,resizable=no,scrollbars=no,menubar=no,resize=no'; window.open(popURL, 'popWin', popSettings) } function getHeadCkValue(c_name) { if (document.cookie.length > 0) { c_start = document.cookie.indexOf(c_name + "="); if (c_start != -1) { c_start = c_start + c_name.length + 1; c_end = document.cookie.indexOf(";", c_start); if (c_end == -1) c_end = document.cookie.length; return document.cookie.substring(c_start, c_end) } } return "" } function getLink() { var showlink = false; if (getHeadCkValue("SMSESSION").length > 0) { if (getHeadCkValue("SMSESSION") != "LOGGEDOFF") { if (getHeadCkValue("pcSSO").length > 0) { if (getHeadCkValue("pcSSO") == "true") { if (getHeadCkValue("pcID").length > 0) { showlink = true } } } } } var inputs = document.getElementsByTagName('input'); if (inputs != null) if (inputs.length == 0) { } var prepend = ''; var returnto = ''; var login = ''; var register = ''; var myCA = ''; var welcome = ''; var mode = ''; for (var i = 0; i < inputs.length; i++) { if (inputs[i].getAttribute('type') == "hidden") { if (inputs[i].getAttribute('name').indexOf("hidReturn") > 0 || inputs[i].getAttribute('name') == "hidReturn") returnto = inputs[i].getAttribute('value'); if (inputs[i].getAttribute('name').indexOf("hidPrepend") > 0 || inputs[i].getAttribute('name') == "hidPrepend") { prepend = inputs[i].getAttribute('value'); if (prepend == "/us/na") prepend = "/us" } if (inputs[i].getAttribute('name').indexOf("hidWelcome") > 0 || inputs[i].getAttribute('name') == "hidWelcome") welcome = inputs[i].getAttribute('value'); if (inputs[i].getAttribute('name').indexOf("hidmode") > 0 || inputs[i].getAttribute('name') == "hidmode") mode = inputs[i].getAttribute('value'); if (inputs[i].getAttribute('name').indexOf("hidMyCA") > 0 || inputs[i].getAttribute('name') == "hidMyCA") myCA = inputs[i].getAttribute('value'); if (showlink) { if (inputs[i].getAttribute('name').indexOf("hidLogout") > 0 || inputs[i].getAttribute('name') == "hidLogout") login = inputs[i].getAttribute('value'); if (inputs[i].getAttribute('name').indexOf("hidUpdate") > 0 || inputs[i].getAttribute('name') == "hidUpdate") register = inputs[i].getAttribute('value') } else { if (inputs[i].getAttribute('name').indexOf("hidLogin") > 0 || inputs[i].getAttribute('name') == "hidLogin") login = inputs[i].getAttribute('value'); if (inputs[i].getAttribute('name').indexOf("hidRegister") > 0 || inputs[i].getAttribute('name') == "hidRegister") register = inputs[i].getAttribute('value') } } } if (prepend == null) prepend = ''; if (returnto == null) returnto = ''; if (mode == null) mode = 'true'; if (myCA == null) myCA = 'MyCA'; if (showlink) { if (login == null) login = 'login'; if (register == null) register = 'register'; if (welcome == null) welcome = 'Welcome back,' } else { if (login == null) login = 'log out'; if (register == null) register = ''; if (welcome == null) welcome = '' } if (prepend == "null") prepend = ''; if (returnto == "null") returnto = ''; if (mode == "null") mode = 'true'; if (myCA == "null") myCA = 'MyCA'; if (showlink) { if (login == "null") login = 'login'; if (register == "null") register = ''; if (welcome == "null") welcome = 'Welcome back,' } else { if (login == "null") login = 'log out'; if (register == "null") register = ''; if (welcome == "null") welcome = '' } var go; var go1; if (returnto.length == 0) { var location = window.location.pathname; if (location.indexOf("default.aspx") > 0) returnto = window.location.pathname } if (prepend.length == 6) { if (prepend.substr(0, 3) == prepend.substr(3, 3)) { prepend = prepend.substr(0, 3) } } if (showlink) { if (document.getElementById("divLogin") != null) { if (getHeadCkValue("pcFNAME").length > 0) { go1 = prepend + '/register/updateprofile.aspx?returnURL=' + returnto; var fname = decodeURI(getHeadCkValue("pcFNAME")); if (fname != null) if (fname.indexOf('+')) fname = fname.replace('+', ' ') } document.getElementById("divLogin").innerHTML = welcome + '&nbsp;' + "<a href='" + go1 + "' >" + fname + "</a>&nbsp;" } if (document.getElementById("divRegister") != null) { go1 = prepend + '/register/logout.aspx?returnURL=' + returnto; document.getElementById("divRegister").innerHTML = "<a href='" + go1 + "' >" + login + "</a>&nbsp;" } if (document.getElementById("divMyCA") != null) { if (mode == "true") document.getElementById("divMyCA").innerHTML = "<a href='https://communities.ca.com/web/myca/' >" + myCA + "</a>&nbsp;"; else document.getElementById("divMyCA").innerHTML = "<a href='https://communities-qa2.ca.com/web/myca/' >" + myCA + "</a>&nbsp;" } } else { if (document.getElementById("divLogin") != null) { go = prepend + '/register/login.aspx?returnURL=' + returnto; document.getElementById("divLogin").innerHTML = "<a href='" + go + "' >" + login + "</a>&nbsp;" } if (document.getElementById("divRegister") != null) { go1 = prepend + '/register/createprofile.aspx?returnURL=' + returnto; document.getElementById("divRegister").innerHTML = "<a href='" + go1 + "' >" + register + "</a>&nbsp;" } if (document.getElementById("divMyCA") != null) { if (mode == "true") document.getElementById("divMyCA").innerHTML = "<a href='https://communities.ca.com/c/portal/login?p_l_id=10141' >" + myCA + "</a>&nbsp;"; else document.getElementById("divMyCA").innerHTML = "<a href='https://communities-qa2.ca.com/c/portal/login?p_l_id=10141' >" + myCA + "</a>&nbsp;" } } }
