/* What: Common Marketing Website Funtions When: January 2007 Who: Paul Legan */ function leaveSite( newURL ) { var result = confirm('Please Note: You are now leaving a Boehringer Ingelheim Pharmaceuticals, Inc. site. Boehringer Ingelheim Pharmaceuticals, Inc. has not reviewed the contents of all the pages and sites that may be linked to this site. Boehringer Ingelheim Pharmaceuticals, Inc. is not responsible and disclaims any liability to the content of any other page or site or for any viruses or similar harmful programs that may be present on such pages or sites. Linking to any other page or site is at your own risk.'); if (result) window.open(newURL); return false; } var url = "none"; function fixExternalLinks() { $("a").each(function(i) { if (this.getAttribute('rel') == 'external') { this.onclick = function() { return leaveSite(this.href); } } }); } // cookie functions http://www.quirksmode.org/js/cookies.html function createCookie(name,value,days) { if (days) { var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); var expires = "; expires="+date.toGMTString(); } else var expires = ""; document.cookie = name+"="+value+expires+"; path=/"; } function readCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); } return null; } function eraseCookie(name) { createCookie(name, "", -1); } function setWebTrendsCookie() { var webtrends = readCookie('WEBTRENDS_BI'); var title = webtrends ? webtrends : createCookie('WEBTRENDS_BI', hexIt()+hexIt()+hexIt()+hexIt()+hexIt()+hexIt()+hexIt()+hexIt(), 365); } function hexIt() { return (((1+Math.random())*0x10000)|0).toString(16).substring(1); } function attachRollovers() { $('img.rollover').each(function() { $(this).hover( function() { //over var newImage = $(this).attr('src').replace('.gif', '-active.gif'); $(this).attr('src', newImage); }, function() { //out var newImage = $(this).attr('src').replace('-active.gif', '.gif'); $(this).attr('src', newImage); } ); }); $('img.active').each(function() { var newImage = $(this).attr('src').replace('.gif', '-active.gif'); $(this).attr('src', newImage); }); } function setNav(navImage, navItem) { $('#'+navImage).removeClass('rollover'); $('#'+navImage).addClass('active'); if (navItem) { if (navItem == 'c2' || navItem == 'c3' || navItem == 'c4' || navItem == 'c5') { $('#clinical').show(); $('#'+navItem).addClass('selected'); } else if (navItem == 'p1') { $('#glossary').show(); } else { $('#'+navItem).parent().show(); $('#'+navItem).addClass('selected'); } } $('img.active').each(function() { var newImage = $(this).attr('src').replace('.gif', '-active.gif'); $(this).attr('src', newImage); $(this).hover( function() { //over var newImage = $(this).attr('src').replace('-active.gif', '.gif'); $(this).attr('src', newImage); }, function() { //out var newImage = $(this).attr('src').replace('.gif', '-active.gif'); $(this).attr('src', newImage); } ); }); } $(document).ready(function(){ attachRollovers(); setWebTrendsCookie(); fixExternalLinks(); });