function safe_encode(str) { if(typeof(encodeURIComponent)=='function') { return encodeURIComponent(str); } else { return escape(str); } } function initialize() { account_id = 101; addImage(); page_url = getURL(); hostname = getHostname(); history_depth = getHistoryLength(); frame_status = clickfacts_isinFrame(); referring_url = referringURL(); if(frame_status) { iframe_coordinates = getIframeCoordinates(); iframe_coordinates = iframe_coordinates.split(',',4); size_y = iframe_coordinates[2]; size_x = iframe_coordinates[3]; } else { clickfacts_finalvar = clickfacts_windowSize(); size_x = clickfacts_finalvar[1];//Width size_y = clickfacts_finalvar[0];//Height } icon_coordinates = getIconCoordinates(); position_x = icon_coordinates[0]; position_y = icon_coordinates[1]; clickfacts_finalvar = clickfacts_windowSize(); var url = 'http://sellsideqa.clickfacts.com/adbuddy/track.buffered.php?account_id='+account_id+'&page_url='+page_url+'&position_x='+position_x+ '&position_y='+position_y+'&history_depth='+history_depth+'&size_x='+size_x+'&size_y='+size_y+'&referring_url='+ referring_url+'&frame_status='+frame_status+'&page_domain='+hostname; clickfacts_payload = new Image(); clickfacts_payload.src = url; } function getURL() { try { var url = top.document.location.href; } catch(e) { try { var url = parent.document.referrer; } catch(e) { var url = window.location.href; } } return safe_encode(url); } function getHostname() { try{ var hostname = parent.hostname; } catch(e) { var hostname = location.hostname; } return safe_encode(hostname); } function getHistoryLength() { return history.length; } function clickfacts_isinFrame() { try { var temp = top.document.location.href; } catch(e) { return 1; } if (document.location.href != top.document.location.href) { return 1; } return 0; } function referringURL() { return encodeURIComponent(document.referrer); } function showStatusBar() { window.status = true; window.status = "X= " + window.event.clientX + " Y= " + window.event.clientY; } function getIconCoordinates() { var curleft = curtop = 0; if(clickfacts_isinFrame()) { var ifrm = get_iframe_element() ; if(ifrm !== null) { var curtop = curleft = 0; if (ifrm.offsetParent) { do { curleft += ifrm.offsetLeft; curtop += ifrm.offsetTop; } while (ifrm = ifrm.offsetParent); } } var imgleft = imgtop = 0; var image_obj = document.getElementById('theImage'); if (image_obj.offsetParent) { do { imgleft += image_obj.offsetLeft; imgtop += image_obj.offsetTop; } while (image_obj = image_obj.offsetParent); } imgleft = imgleft + curleft; imgtop = imgtop + curtop; var icon_coordinates = new Array(imgleft , imgtop); return icon_coordinates; } else { var icon_coordinates = new Array(0,0); return icon_coordinates; } } function addImage() { var body= document.getElementsByTagName('BODY')[0]; var theImage= document.createElement('img'); theImage.id= 'theImage'; theImage.name = 'theImage'; theImage.style.width= '1px'; theImage.style.height= '1px'; theImage.src = 'http://sellsideqa.clickfacts.com/adbuddy/blank.gif'; theImage.alt = ''; body.appendChild(theImage); } function getIframeCoordinates() { var obj = get_iframe_element(); if (obj === null) { var iframe_coordinates = '0,0,0,0'; return iframe_coordinates; } height = obj.height; width = obj.width; var curleft = curtop = 0; if (obj.offsetParent) { do { curleft += obj.offsetLeft; curtop += obj.offsetTop; } while (obj = obj.offsetParent); } iframe_coordinates = curleft + ','+curtop + ',' + height + ',' + width; return iframe_coordinates; } function get_iframe_element() { var curleft = curtop =i = flag = 0; try { elm = parent.document.getElementsByTagName("iframe"); } catch(e) { return null; } for(i=0; i -1) { goOn = false; break; } } if (goOn == true) { initialize(); }