var contentW = 350; //width of ims system content var contentH = 510; //height of ims system content var DivId = 'BannersVertic'; var WrapperId = 'imsWrapper'; var PrevPicId = 'imsPrevPic'; var ControlId = 'imsControl'; var holdWrapper = false; var bannerPopups = new Array(); var verticDiv = ''; ns4 = (document.layers) ? true : false ie4 = (document.all) && !(document.getElementById) ? true : false ie5 = (document.getElementById) && (document.all) ? true : false ns6 = (document.getElementById) && !(document.all) ? true : false /* ie4 = false; ie5 = false; ns6 = false; ns4 = false; */ /* -------------------------------------------------------------------------------------------------------------------------------------*/ var debug_mode = false; /* -------------------------------------------------------------------------------------------------------------------------------------*/ /* alert('Now you use: \n'+ 'ns4: '+ns4+'\n'+ 'ie4: '+ie4+'\n'+ 'ie5: '+ie5+'\n'+ 'ns6: '+ns6 ); //*/ var wrapper = ''; var prevPic = ''; var control = ''; var object = ''; var info_id = ''; var width; var height; var topElement; var left; var mouseX; var mouseY; var holdWrapper = false; var hiddenDIVarray = new Array(); function mouseInit() { document.onmousemove = mouseMove if (ns4) document.captureEvents(Event.MOUSEDOWN | Event.MOUSEMOVE | Event.MOUSEUP) /*if (document.addEventListener) { document.addEventListener("mouseMove", mouseMove, false); } else { document.attachEvent("onmouseMove", mouseMove); }*/ } function mouseMove(e) { var x = (ns4 || ns6) ? e.pageX : event.clientX + document.documentElement.scrollLeft; var y = (ns4 || ns6) ? e.pageY : event.clientY + document.documentElement.scrollTop; mouseX = x; mouseY = y; if (holdWrapper == false) { imsDown(); } return true } function imsUp(id) { if (id != 0) { id = 'ims' + id; wrapper = document.getElementById(WrapperId); if (holdWrapper == false) { info_id = id; object = document.getElementById(id); prevPic = document.getElementById(PrevPicId); control = document.getElementById(ControlId); control.onmousedown = showContentWrapper; topElement = object.offsetTop; width = object.offsetWidth height = object.offsetHeight; left = object.offsetLeft; mouseInit(); prevPic.getElementsByTagName('SPAN')[0].href = object.href; var rootCrl = document.getElementById(DivId); var crlTop = rootCrl.offsetTop + topElement; var crlLeft = rootCrl.offsetLeft; wrapper.style.width = width + 30 + 'px'; wrapper.style.height = height + 5 + 'px'; wrapper.style.top = crlTop - 5 + 'px'; wrapper.style.left = crlLeft - 5 + 'px'; control.style.left = width + 5 + 'px'; control.style.height = height + 'px'; wrapper.style.display = 'inline'; control.getElementsByTagName('IMG')[0].style.top = ((height / 2) - 10) + 'px'; } } } function hiddenBackEl() { var link = verticDiv.getElementsByTagName('DIV'); var start = false; var countDIV = 0; var countMax = 4; hiddenDIVarray = new Array(); for (i = 0; i < link.length; i++) { var link_id = link[i].id; if (start && (countDIV <= countMax)) { link[i].style.visibility = 'hidden' hiddenDIVarray[i] = link_id; countDIV++; } if (link_id == info_id) { start = true; } } } function showContentWrapper() { //info_id if (document.all) e = event; var contentL = parseInt(wrapper.style.left) - (contentW - (parseInt(wrapper.style.width))); verticDiv = document.getElementById(DivId); var DivPosition = verticDiv.offsetLeft; if (DivPosition > (contentW + 100)) { wrapper.style.left = contentL + 'px'; control.style.left = contentW - 23 + 'px'; } wrapper.style.width = contentW + 'px'; wrapper.style.height = contentH + 'px'; wrapper.width = contentW + 'px'; wrapper.height = contentH + 'px'; wrapper.style.background = '#FFFFFF'; hiddenBackEl(); // hidden back DIV!!!! control.onmousedown = hideAndClear; control.style.height = contentH - 10 + 'px'; control.style.top = '5px'; control.getElementsByTagName('IMG')[0].src = bannerOSURL + '/images/arrow_up.gif'; control.getElementsByTagName('IMG')[0].style.top = ((contentH / 2) - 10) + 'px'; if ((ie4) || (ie5)) { control.style.top = '2px'; control.style.height = contentH - 5 + 'px'; } control.style.left = contentW - 25 + 'px'; prevPic.style.width = contentW - 30 + 'px'; prevPic.style.height = contentH - 9 + 'px'; prevPic.style.background = '#FFFFFF'; prevPic.getElementsByTagName('SPAN')[0].style.width = '0%'; prevPic.getElementsByTagName('SPAN')[0].style.height = '0%'; holdWrapper = true; control.title = 'Click for hide'; loadInfoBox(info_id); } function hideAndClear() { wrapper.style.display = 'none'; for (i in hiddenDIVarray) { document.getElementById(hiddenDIVarray[i]).style.visibility = 'visible'; } wrapper.style.background = ''; prevPic.style.background = ''; prevPic.innerHTML = ''; prevPic.getElementsByTagName('SPAN')[0].style.width = '100%'; prevPic.getElementsByTagName('SPAN')[0].style.height = '100%'; control.getElementsByTagName('IMG')[0].src = bannerOSURL + '/images/arrow.gif'; holdWrapper = false; control.title = 'Click for more details'; } function imsDown() { var rootCrl = document.getElementById(DivId); /*alert('mouseX:' + mouseX + ', mouseY:' + mouseY + '\n left:' + left + ', width:' + width + '\n topElement:' + topElement + ', height:' + height + '\n rootCrl.offsetLeft:' + rootCrl.offsetLeft + ', rootCrl.offsetTop:' + rootCrl.offsetTop);*/ var crlTop = rootCrl.offsetTop + topElement; var crlLeft = rootCrl.offsetLeft; if (ns4 || ns6) { if ((mouseY < crlTop - 5) || (mouseY > crlTop + height + 5) || (mouseX < crlLeft - 5) || (mouseX > crlLeft + width + 30)) { wrapper.style.display = 'none'; } } else { if ((mouseY < crlTop - 5) || (mouseY > crlTop + height + 5) || (mouseX < crlLeft - 5) || (mouseX > crlLeft + width + 30)) { //if ((((left - 5) - mouseX) >= 0) || (((left + width + 33) - mouseX) <= 0) || (((topElement) - mouseY) >= 0) || (((topElement + height) - mouseY) <= 0)) { wrapper.style.display = 'none'; /* alert( '1. '+((left-5)-mouseX)+'>=0'+'\n'+ '2. '+((left+width+33)-mouseX)+'<=0'+'\n'+ '3. '+((topElement)-mouseY)+'>=0'+'\n'+ '4. '+((topElement+height)-mouseY)+'<=0'+'\n' ); //*/ } } } function initWrapper() { // var link = document.getElementById(DivId).getElementsByTagName('DIV'); //for(i=0;i" //alert(bannerOSURL+'PopUpBanner.aspx?id='+info_id); // create the element var script_object = document.createElement('SCRIPT'); // NOTE: the URL is connecting to a foreign site (and not a js file either) script_object.src = bannerOSURL + "PopUpBanner.aspx?id=" + info_id + "&Edition=" + bannerOSEdition; //script_object.src = bannerOSURL + 'IncludesJS/test.js'; script_object.type = 'text/javascript'; var head = document.getElementsByTagName('HEAD')[0]; head.appendChild(script_object); document.getElementById('imsPrevPic').innerHTML = 'loading content...'; setTimeout('infoSetOutput()', 100); //infoHttpObject.open("GET", bannerOSURL + "PopUpBanner.aspx?id="+info_id, true); //infoHttpObject.send(null); //infoHttpObject.onreadystatechange = infoSetOutput; } } function infoSetOutput() { //if(infoHttpObject.readyState == 4){ if (holdWrapper) { if (bannerPopups[info_id] == null) setTimeout('infoSetOutput()', 100); document.getElementById('imsPrevPic').innerHTML = bannerPopups[info_id]; } //document.getElementById('imsPrevPic').appendChild(script_object); //}else{ // document.getElementById('imsPrevPic').innerHTML = "
" //} } /*--------------------------------------------------------------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------\ | WEB SERVICE HANDLERS \----------------------------------------------------------------------------*/ function handle_server_success() { debug('handle_server_success'); // we have access to "this" b/c of the assignment we made in the comm class; calling this function outside of the framework // means "this" won't be recognized; display this in debug mode to make the success stand out a bit more if (debug_mode) { display('unbridled enthusiasm [comm_id=' + this.connection_id + '][server_url=' + this.server_url + ']'); } } //web_service.prototype.handle_failure=function( query_param) function handle_server_failure(error_msg) { debug('handle_server_failure'); if (this.display_processing_message) { this.display_processing_message('off'); } display('Connection Error: ' + error_msg); // finish the test complete_test(); } function display_server_processing_message(on_off) { debug('display_server_processing_message'); if (on_off == 'on') { display('ping...'); } // hide/show the div containing the indicator as appropraite var style = (on_off == 'off') ? 'none' : ''; document.getElementById("indicator").style.display = style; } function complete_test() { debug('complete_test'); // connect back with the server one last time to store results... doesn;t matter if we hear back from the server (we won't b/c server won't try) // note the second param so that we don't trigger the display handler debug('sending final update uni-directional'); ws_comm.send_immediate({ query_param: '?mode=test_complete&step3=' + ws_comm.response_ws_start + '&step5=' + ws_comm.response_heartbeat1 + '&step7=' + ws_comm.response_heartbeat2 + '&ua=' + ws_comm.user_agent, no_display: true, uni_directional: true }); // disconnect but send toggle to process one more request display_server_processing_message('off'); ws_comm.disconnect(); display('disconnected'); // feedback for the user complete_test_message(); } function complete_test_message() { var alert_msg = ''; if ((ws_comm.response_heartbeat2) && (!ws_comm.known_ua)) { alert_msg = alert_msg + " Your browser is compatible and we didn't previously know that! So thank you very much for testing. We've updated our records."; } else if (ws_comm.response_heartbeat2) { alert_msg = alert_msg + " Your browser is compatible and we've updated our records."; } else { alert_msg = alert_msg + " Your browser is not compatible"; alert_msg = alert_msg + ((!ws_comm.known_ua) ? " and we didn't previously know that! So thank you very much for testing. We've updated our records." : "."); } display('Test complete. ' + alert_msg + ' Thanks for testing!'); alert('Test complete. ' + alert_msg + ' Thanks for testing!'); } /*----------------------------------------------------------------------------\ | GENERAL FUNCTIONS \----------------------------------------------------------------------------*/ // the onload event calls this function check_compatibility() { // we had hidden things by default for noscript folks, so now unhide it document.getElementById("main_content").style.visibility = ''; // record the user agent string display('checking compatibility for this user agent string:') display('    ' + ws_comm.user_agent); // it's okay to access the object member since this is not an operation the class will normally be doing if (ws_comm.known_ua) { display('    already on compatiblity list'); } else { display("    adding new user agent to the list!"); } // for those we are certain don't make the cut, then don't waste people's time // it's okay to access the object member since this is not an operation the class will normally be doing if (ws_comm.known_exclude) { display('
ATTN: Your user agenet [' + ws_comm.user_agent + '] is known to be incompatiable and will not be processed.
So far this "honor" is limited exclusively to Opera which is overly strict on iframe security.

Thanks anyway!

'); return; } // ws_comm.check_cows_ajax_aware('parent.run_test();', 'parent.not_available();') ; run_test(); } function run_test() { //alert('foo') ; //return ; // if we made it here, then we know what replace method workd for subsequent communications // var replace_method = is_cows_ajax_aware ; // create the comm iframe and make initial connection var unmatched_param = (ws_comm.mismatched_ua) ? '&unmatched_ua=' + ws_comm.js_user_agent : ''; var query_param = '?mode=web_service_start' + '&ua=' + ws_comm.user_agent + unmatched_param; // the "true" will force an alert notification if we can't connect... although we still gotta hang around for the timeout // ws_comm.connect( {query_param: query_param, replace_method: replace_method, failure_alert: true }) ; ws_comm.connect({ query_param: query_param }); // why send the ua again? - we could send an id or something, but good enough for this little exercise ws_comm.send({ query_param: '?mode=heartbeat&beat=1&ua=' + ws_comm.user_agent }); ws_comm.send({ query_param: '?mode=heartbeat&beat=2&ua=' + ws_comm.user_agent }); } function not_available() { complete_test(); } // add a message to the debug window function debug(message) { if (debug_mode) { message = '' + message + ''; var debug_div = document.getElementById('spellingcow_debug'); debug_div.innerHTML = (debug_div.innerHTML == '') ? message : debug_div.innerHTML + '
' + message; } } // add a message to the debug window function display(message) { var debug_div = document.getElementById('spellingcow_debug'); debug_div.innerHTML = (debug_div.innerHTML == '') ? message : debug_div.innerHTML + '
' + message; } // the following is hiding/showing all the FF and IE variants hide_msie = true; hide_ff = true; function show_hide(id) { var hide; if (id == 'show_ie') { hide_msie = !hide_msie; hide = hide_msie; } else { hide_ff = !hide_ff; hide = hide_ff; } if (hide) { document.getElementById(id).style.display = 'none'; } else { document.getElementById(id).style.display = ''; } } /*--------------------------------------------------------------------------------------------------------------------------------*/ //window.onload = initWrapper();