var nowLeavingUrl = ''; var popUpWin = 0; function popUpWindow(URLStr, left, top, width, height) { if(popUpWin) { if(!popUpWin.closed) popUpWin.close(); } popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+''); } function popUpWindowNoScroll(URLStr, left, top, width, height) { if(popUpWin) { if(!popUpWin.closed) popUpWin.close(); } popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+''); } function getPageSizeWithScroll(){ if (window.innerHeight && window.scrollMaxY) {// Firefox yWithScroll = window.innerHeight + window.scrollMaxY; xWithScroll = window.innerWidth + window.scrollMaxX; } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac yWithScroll = document.body.scrollHeight; xWithScroll = document.body.scrollWidth; } else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari yWithScroll = document.body.offsetHeight; xWithScroll = document.body.offsetWidth; } arrayPageSizeWithScroll = new Array(xWithScroll,yWithScroll); //alert( 'The height is ' + yWithScroll + ' and the width is ' + xWithScroll ); return arrayPageSizeWithScroll; } function assignUtilities() { $('div#sub-navigation div#utilites img.over').each(function() { $(this).hover( function() { var newImage = $(this).attr('src').replace('-off', '-on'); $(this).attr('src', newImage); }, function() { var newImage = $(this).attr('src').replace('-on', '-off'); $(this).attr('src', newImage); } ); }); } function validateShareSite() { var name = $('#s_name').val(); var email = $('#s_email').val(); var friendName = $('#s_friendName').val(); var friendEmail = $('#s_friendEmail').val(); var url = $('#url').val(); var errorWatch = false; $('#error-message').hide(); if (!name) { // set the label to red $("label[@for='s_name']").addClass('error'); $("label[@for='s_name']").html('*Your name:'); errorWatch = true; } else { $("label[@for='s_name']").removeClass('error'); $("label[@for='s_name']").html('Your name:'); } if (!friendName) { // set the label to red $("label[@for='s_friendName']").addClass('error'); $("label[@for='s_friendName']").html('*Colleague\'s name:'); errorWatch = true; } else { $("label[@for='s_friendName']").removeClass('error'); $("label[@for='s_friendName']").html('Colleague\'s name:'); } if (!email) { // set the label to red $("label[@for='s_email']").addClass('error'); $("label[@for='s_email']").html('*Your email address:'); errorWatch = true; } else { if (!((email.indexOf(".") > 2) && (email.indexOf("@") > 0))) { // set the label to red $("label[@for='s_email']").addClass('error'); $("label[@for='s_email']").html('*Your email address:'); errorWatch = true; } else { $("label[@for='s_email']").removeClass('error'); $("label[@for='s_email']").html('Your email address:'); } } if (!friendEmail) { // set the label to red $("label[@for='s_friendEmail']").addClass('error'); $("label[@for='s_friendEmail']").html('*Colleague\'s email address:'); errorWatch = true; } else { if (!((friendEmail.indexOf(".") > 2) && (friendEmail.indexOf("@") > 0))) { // set the label to red $("label[@for='s_friendEmail']").addClass('error'); $("label[@for='s_friendEmail']").html('*Colleague\'s email address:'); errorWatch = true; } else { $("label[@for='s_friendEmail']").removeClass('error'); $("label[@for='s_friendEmail']").html('Colleague\'s email address:'); } } if (!errorWatch) { // do Ajax work here $.ajax({ type: "GET", url: "/hcp/subpages/share-thank-you.jsp", data: "name="+name+"&email="+email+"&friendName="+friendName+"&friendEmail="+friendEmail+"&url="+url, success: function(msg) { $('#share-this-site').hide(); $('#share-this-site-thank-you').html(msg); $('#share-this-site-thank-you').show(); } }); //alert('Success!'); } else { $('#error-message').show(); } } function showShareThisSite() { $.ajax({ type: "GET", url: "/hcp/subpages/share-this-site.jsp", data: "url="+location.href, success: function(msg) { $('#share-this-site').html(msg); } }); dcsMultiTrack('DCS.dcsuri' , '/link/global/colleague.html', 'WT.ti', 'Send to a Colleague Link'); self.scrollTo(0, 0); $('#share-this-site-thank-you').hide(); $('#fade').css('height', getPageSizeWithScroll()[1] + 'px'); $('#fade').show(); $('#share-this-site').css('left', ($('body').width() / 2) - (309 / 2) + 'px'); $('#share-this-site').show(); } function hideShareThisSite() { $('#share-this-site').hide(); $('#share-this-site-thank-you').hide(); $('#references').hide(); $('#fade').hide(); } function hideLightBox() { $('#share-this-site').hide(); $('#share-this-site-thank-you').hide(); $('#references').hide(); $('#now-leaving').hide(); $('#fade').hide(); } function printThisPage() { dcsMultiTrack('DCS.dcsuri' , '/link/global/print.html', 'WT.ti', 'Print Link'); window.print(); } function hideReferenceWindow() { $('#fade').hide(); $('#references').hide(); } function showReferenceWindow() { $.ajax({ type: "GET", url: "/hcp/subpages/references.jsp", success: function(msg) { $('#references').html(msg); } }); self.scrollTo(0, 0); $('#fade').css('height', getPageSizeWithScroll()[1] + 'px'); $('#fade').show(); $('#references').css('left', ($('body').width() / 2) - (612 / 2) + 'px'); $('#references').show(); return false; } function assignNowLeaving() { $("a[@rel='external']").each(function() { $(this).click(function() { nowLeavingUrl = $(this).attr('href'); showNowLeaving(); return false; }); }); } function showNowLeaving() { $.ajax({ type: "GET", url: "/hcp/subpages/now-leaving.jsp", success: function(msg) { $('#now-leaving').html(msg); } }); self.scrollTo(0, 0); $('#fade').css('height', getPageSizeWithScroll()[1] + 'px'); $('#fade').show(); $('#now-leaving').css('left', ($('body').width() / 2) - (444 / 2) + 'px'); $('#now-leaving').show(); } function closeNowLeaving() { $('#fade').hide(); $('#now-leaving').hide(); } function assignReferences() { $('sup a').each(function() { $(this).click(function() { return showReferenceWindow(); }); }); } $(document).ready(function() { assignUtilities(); assignReferences(); assignNowLeaving(); });