// xramp_cert_image.js // by Max Kanat-Alexander // Displays the xramp certification image in all modern browsers. // Locate where an object is on the page, x-wise. function ppk_findPosX(obj) { var curleft = 0; if (obj.offsetParent) { while (obj.offsetParent) { curleft += obj.offsetLeft obj = obj.offsetParent; } } else if (obj.x) { curleft += obj.x; } return curleft; } //Locate where an object is on the page, y-wise. function ppk_findPosY(obj) { var curtop = 0; if (obj.offsetParent) { while (obj.offsetParent) { curtop += obj.offsetTop obj = obj.offsetParent; } } else if (obj.y) { curtop += obj.y; } return curtop; } // Get the full height of the object, even if it's larger than the browser. function ppk_getFullHeight(fromObj) { var scrollY; // All but Mac IE if (fromObj.scrollHeight > fromObj.offsetHeight) { scrollY = fromObj.scrollHeight; // Mac IE } else { scrollY = fromObj.offsetHeight; } return scrollY; } // Get the full width of the object, even if it's larger than the browser window. function ppk_getFullWidth(fromObj) { var scrollX; // All but Mac IE if (fromObj.scrollWidth > fromObj.offsetWidth) { scrollX = fromObj.scrollWidth; // Mac IE } else { scrollX = fromObj.offsetWidth; } return scrollX; } // Get an object in a cross-browser compatible way function ppk_getObj(name) { var obj; // DOM-compliant if (document.getElementById) { obj = document.getElementById(name); //obj.style = document.getElementById(name).style; // Older IE } else if (document.all) { obj = document.all[name]; //obj.style = document.all[name].style; // Old NS } else if (document.layers) { obj = document.layers[name]; obj.style = document.layers[name]; } return obj; } // Get the current width of the current browser viewport. function ppk_getViewWidth() { var viewX; // Non-IE Browsers if (self.innerHeight) { viewX = self.innerWidth; // IE 6 Strict } else if (document.documentElement && document.documentElement.clientWidth) { viewX = document.documentElement.clientWidth; // Other IE } else if (document.body) { viewX = document.body.clientWidth; } return viewX; } // Get the current height of the current browser viewport. function ppk_getViewHeight() { var viewY; // Non-IE Browsers if (self.innerHeight) { viewY = self.innerHeight; // IE 6 Strict } else if (document.documentElement && document.documentElement.clientHeight) { viewY = document.documentElement.clientHeight; // Other IE } else if (document.body) { viewY = document.body.clientHeight; } return viewY; } // Get how far over to the right the window is scrolled. function ppk_windowScrollX() { var x; // All except IE if (self.pageYOffset) { x = self.pageXOffset; // IE 6 Strict } else if (document.documentElement && document.documentElement.scrollTop) { x = document.documentElement.scrollLeft; // All other IE } else if (document.body) { x = document.body.scrollLeft; } return x; } // Get how far down the page the window is scrolled function ppk_windowScrollY() { var y; // All except IE if (self.pageYOffset) { y = self.pageYOffset; // IE 6 Strict } else if (document.documentElement && document.documentElement.scrollTop) { y = document.documentElement.scrollTop; // All other IE } else if (document.body) { y = document.body.scrollTop; } return y; } var xramp_inImage = false; var xramp_inDiv = false; var xramp_divShowing = false; function xramp_hide_cert(block) { // We should hide the cert if: // o The div is NOT showing, and we mouseout of the image. // o The div is showing, and we mouseout of both the div and the image. if ((!xramp_inImage && !xramp_inDiv)) { block.style.display = 'none'; xramp_divShowing = false; } } function xramp_show_cert(block, xrampIframe, xrampImage) { xrampIframe.src = 'https://sitedata.xramp.com/popupseal.asp'; var iframeHeight = 220; var iframeWidth = 258; // The width and height of the actual image. var imgWidth = ppk_getFullWidth(xrampImage); var imgHeight = ppk_getFullHeight(xrampImage); // The size of the window var windowHeight = ppk_getViewHeight(document.body); var windowWidth = ppk_getViewWidth(document.body); // Where we've scrolled the window to on the page. var windowScrollX = ppk_windowScrollX(); var windowScrollY = ppk_windowScrollY(); // The position of the image in the document. var imageX = ppk_findPosX(xrampImage); var imageY = ppk_findPosY(xrampImage); // Attempt to place the iframe to the upper-right of the image. var x = imageX + ( imgWidth/2 ); var y = imageY - ( iframeHeight - imgHeight/2 ); // If we're too high (out of the window), move us back into the window. if (y < windowScrollY) y = windowScrollY + 10; // If we're too far over to the right, put us to the upper-left instead. if ((x + iframeWidth) > (windowWidth + windowScrollX)) x -= iframeWidth; // And if we moved off the window to the left, move us back on. if (x < windowScrollX) x = windowScrollX + 10; // Now set the position and size of the div. block.style.left = x + 'px'; block.style.top = y + 'px'; block.style.width = iframeWidth + 'px'; block.style.height = iframeHeight + 'px'; block.style.display = 'block'; // Added to keep the cert on top! block.style.zIndex = 999; } function xramp_toggle_cert(show_window) { window.status = show_window ? 'SSL Verification by XRamp Security Services, Inc.' : ''; //Find our div, iframe, and image in the DOM. var xramp_block = ppk_getObj('xramp_divshow'); var xramp_iframe = ppk_getObj('xramp_popupseal_iframe'); var xramp_image = ppk_getObj('xramp_seal_image'); //If we found them, then display/hide the layer. if(xramp_block && xramp_iframe && xramp_image) { if(show_window) { xramp_show_cert(xramp_block, xramp_iframe, xramp_image); } else { xramp_hide_cert(xramp_block); } } } function xramp_write_seal() { // Alter the mechanism for popping up to work with tabbed browers. newtarget = 'https://sitedata.xramp.com/siteseal.asp?type=E&ref=www.mmovp.com'; newwindow = '_Seal'; newwindowoptions = 'location=1,resizeable=1,height=500,width=500,scrollbars=0,status=0,menubar=0,toolbar=0'; document.write(''); document.write(' Verified by XRamp'); document.write(''); // Only write these if it's possible to hide them. if (document.body.style) { document.write(''); } if (navigator.appName == 'Microsoft Internet Explorer') { var ver=-1; var ua = navigator.userAgent; var re = new RegExp("Windows NT ([0-9]{1,}[\.0-9]{0,})"); if (re.exec(ua) != null) ver = parseFloat( RegExp.$1 ); if (ver >= 5.1) { try { document.write(''); } catch (e) {} } } } xramp_write_seal();