window.onunload=dounload; // //Modify Survey cookie to match project number var surveyID_LO = "C7849_P101_pop_cookie"; if (surveyID_LO.substring(0,8)=="nocookie") { var surveyID_LO="" } //Modify popup odds. A 1 means 1% of the hits, 10=10%, etc... var popUpOdds_LO = 0; //Modify the URL to either match the Intermediate Popup Window // OR //The URL created in SurveyWriter.com for this project. var popUpURL_LO = "" //Sets popup window configuration options. Height, width, toolbars... var popUpWindow_LO = "height=400,width=400,fullscreen=0,location=0,menubar=0,resizable=1,scrollbars=auto,status=0,toolbar=0,screenY=300,left=300,top=100"; //Sets the total percentage figure. Currently set to work on a 100 scale var popUpScale_LO = 100; //Set delay time var popupDelay_LO=0; //Set default for passSegFlag var passSegFlag=0 if (popupDelay_LO.length=0) {popupDelay_LO = 0;} if (popupDelay_LO < 0) { popupDelay_LO = 0; passSegFlag = 1; } //PopUp Delay Cookie Name var timeCookie_LO = "C7849_P101_pop_cookie_time"; //Seg value fom flash survey var segValue=""; //Member ID value fom flash survey var memID=""; //Gets the current number of seconds have been on site: var elapseTime_LO = getCookie(timeCookie_LO); if (elapseTime_LO==null) {elapseTime_LO = 0;} popupDelay_LO=popupDelay_LO-elapseTime_LO; if (popupDelay_LO < 0) {popupDelay_LO = 0;} var startTime_LO = getCurrentTime(); var varCode=''; function dounload() { if (popupDelay_LO==0) { return false; } var endTime_LO = getCurrentTime(); elapseTime=(endTime_LO - startTime_LO) / 1000; var now = new Date(); fixDate(now); now.setTime(now.getTime() + 182 * 24 * 60 * 60 * 1000); setCookie(timeCookie_LO, elapseTime, now); } function getCurrentTime() { var now = new Date(); fixDate(now); return now.getTime(); } function setCookie(name, value, expires, path, domain, secure) { path="/"; var CurrentDomain=document.domain; if (CurrentDomain.indexOf(".") > -1) { var arCurrentDomain=CurrentDomain.split("."); domain=arCurrentDomain[arCurrentDomain.length-2] + "." + arCurrentDomain[arCurrentDomain.length-1]; } else { domain=""; } var curCookie = name + "=" + escape(value) + ((expires) ? "; expires=" + expires.toGMTString() : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : ""); document.cookie = curCookie; } function getCookie(name) { var dc = document.cookie; var prefix = name + "="; var begin = dc.indexOf("; " + prefix); if (begin == -1) { begin = dc.indexOf(prefix); if (begin != 0) return null; } else begin += 2; var end = document.cookie.indexOf(";", begin); if (end == -1) end = dc.length; return unescape(dc.substring(begin + prefix.length, end)); } function fixDate(date) { var base = new Date(0); var skew = base.getTime(); if (skew > 0) date.setTime(date.getTime() - skew); } function randomRange () { return Math.round(Math.random() * (popUpScale_LO-1)) + 1 } function passSeg(theSeg,theMemID) { segValue=theSeg; memID=theMemID; moveWin("MWJminiwinMAX1","MWJminiwinMIN1",300,100); resizeWin("MWJminiwinMAX1","MWJminiwinMIN1",420,410); showMinWin("MWJminiwinMAX1") } function showInvite(inviteURL) { var inviteURL='http://survey.o.webmd.com/in/survey/survey140/2008028.asp?RID=&data=' + segValue + '~~Segment~1&data=' + memID + '~~MemberID~2'; window.open(inviteURL,'Survey','toolbar=no,directories=no,location=no,status=yes,menubar=no,resizable=yes,scrollbars=yes,width=800,height=500,screenY=50,left=50,top=50'); } var MWJ_winZind = 65535; function createMiniWinLayer(mainContent,oTitle,oLeft,oTop,oWidth,barColour,mainColour,oLogo,oMin,oMax,oClose,oFull,oDrag,oVis,oFullDrag,anyExtra,oScroll) { if( typeof( oFullDrag ) == 'undefined' ) { window.alert( 'New mini window script incompatible.\nPlease see the script source.' ); return; } window.MWJ_MINIWINS = window.MWJ_MINIWINS ? ( window.MWJ_MINIWINS + 1 ) : 1; if( document.layers && !document.childNodes ) { var theDragString = ' onmouseover="this.captureEvents(Event.MOUSEDOWN);this.onmousedown = function () { clickDiv(\'MWJminiwinMAX'+window.MWJ_MINIWINS+'\',\'MWJminiwinMIN'+window.MWJ_MINIWINS+'\',arguments[0]);return false; };"'; document.write( ''+ '
'+ '
'+ ''+(oFullDrag?'':'')+ ''+oTitle+ ''+(oFullDrag?'':'')+''+ ''+ ''+ ''+ 'Close.
'+ '
'+mainContent+'
' ); document.write( ''+ '
'+ '
'+ ''+(oFullDrag?'':'')+ ''+oTitle+ ''+(oFullDrag?'':'')+''+ ''+ ''+ ''+ 'Close.
'+ '
' ); } else { var theDragString = ' onmousedown="clickDiv(\'MWJminiwinMAX'+window.MWJ_MINIWINS+'\',\'MWJminiwinMIN'+window.MWJ_MINIWINS+'\',arguments[0]);return false;" onselectstart="return false;" ondragstart="return false;"'; document.write( '
'+ (document.childNodes?('
'+((oDrag&&!oFullDrag)?' ':'')+ '
'):'')+''+ '
'+ '
'+ ''+ '
'+oTitle+''+ ''+ ''+ ((oFull&&oDrag&&document.childNodes&&!oFullDrag)?''+ '':'')+ ''+ 'Close.
'+ '
'+((anyExtra&&document.childNodes)?anyExtra:'')+''+ '
'+mainContent+'
' ); document.write( '
'+ ''+ '
'+ '
'+ ''+ '
'+oTitle+''+ ''+ ''+ ((oFull&&oDrag&&document.childNodes&&!oFullDrag)?''+ '':'')+ ''+ 'Close.
'+ '
' ); } var tempOb = new Object(); tempOb.maxName = 'MWJminiwinMAX'+window.MWJ_MINIWINS; tempOb.minName = 'MWJminiwinMIN'+window.MWJ_MINIWINS; return tempOb; } function getRefToDivNest( divID, oDoc ) { if( !oDoc ) { oDoc = document; } if( document.layers ) { if( oDoc.layers[divID] ) { return oDoc.layers[divID]; } else { for( var x = 0, y; !y && x < oDoc.layers.length; x++ ) { y = getRefToDivNest(divID,oDoc.layers[x].document); } return y; } } if( document.getElementById ) { return document.getElementById(divID); } if( document.all ) { return document.all[divID]; } return document[divID]; } function winMousePos(e) { //get the position of the mouse if( !e ) { e = window.event; } if( !e || ( typeof( e.pageX ) != 'number' && typeof( e.clientX ) != 'number' ) ) { return [0,0]; } if( typeof( e.pageX ) == 'number' ) { var xcoord = e.pageX; var ycoord = e.pageY; } else { var xcoord = e.clientX; var ycoord = e.clientY; if( !( ( window.navigator.userAgent.indexOf( 'Opera' ) + 1 ) || ( window.ScriptEngine && ScriptEngine().indexOf( 'InScript' ) + 1 ) || window.navigator.vendor == 'KDE' ) ) { if( document.documentElement && ( document.documentElement.scrollTop || document.documentElement.scrollLeft ) ) { xcoord += document.documentElement.scrollLeft; ycoord += document.documentElement.scrollTop; } else if( document.body && ( document.body.scrollTop || document.body.scrollLeft ) ) { xcoord += document.body.scrollLeft; ycoord += document.body.scrollTop; } } } return [xcoord,ycoord]; } function clickDiv(div1,div2,e,isRes) { //make note of starting positions and detect mouse movements if( ( !window.ActiveXObject || navigator.userAgent.indexOf('Mac') == -1 || navigator.__ice_version ) && document.onmousemove == winIsMove ) { document.onmousemove = window.storeMOUSEMOVE; document.onmouseup = window.storeMOUSEUP; return; } if( ( e && ( e.which > 1 || e.button > 1 ) ) || ( window.event && ( window.event.which > 1 || window.event.button > 1 ) ) ) { return; } MWJ_winZind += 2; div1 = getRefToDivNest(div1); div2 = getRefToDivNest(div2); if( !div2 ) { return; } window.msStartCoord = winMousePos(e); div1.currentMWJAction = isRes ? true : false; if( isRes ) { window.lyStartCoord = [div1.offsetWidth,div1.getElementsByTagName('div')[1].parentNode.offsetHeight,div1.offsetHeight-div1.getElementsByTagName('div')[1].parentNode.offsetHeight]; } else { window.lyStartCoord = div1.style?[parseInt(div1.style.left),parseInt(div1.style.top)]:[parseInt(div1.left),parseInt(div1.top)]; } if( div1.style ) { div1.style.zIndex = MWJ_winZind; div2.style.zIndex = MWJ_winZind + 1; } else { div1.zIndex = MWJ_winZind; div2.zIndex = MWJ_winZind + 1; } if( document.captureEvents && Event.MOUSEMOVE ) { document.captureEvents(Event.MOUSEMOVE); document.captureEvents(Event.MOUSEUP); } if( !window.ActiveXObject || navigator.userAgent.indexOf('Mac') == -1 || navigator.__ice_version ) { window.storeMOUSEMOVE = document.onmousemove; window.storeMOUSEUP = document.onmouseup; } window.storeLayer = [div1,div2]; document.onmousemove = winIsMove; document.onmouseup = winIsMove; } function winIsMove(e) { //move the layer to its newest position var msMvCo = winMousePos(e); if( !e ) { e = window.event ? window.event : ( new Object() ); } e.cancelBubble = true; if( e.stopPropagation ) e.stopPropagation(); var newX = window.lyStartCoord[0] + ( msMvCo[0] - window.msStartCoord[0] ); var newY = window.lyStartCoord[1] + ( msMvCo[1] - window.msStartCoord[1] ); //reset the mouse monitoring as before - delay needed by Gecko to stop jerky response (hence two functions instead of one) //as long as the Gecko user does not release one window then click on another within 1ms (!) this will cause no problems if( e.type && e.type.toLowerCase() == 'mouseup' ) { document.onmousemove = window.storeMOUSEMOVE; document.onmouseup = window.storeMOUSEUP; } if( navigator.product == 'Gecko' ) { window.setTimeout('winIsMove2('+newX+','+newY+');',1); } else { winIsMove2(newX,newY); } } function winIsMove2(y,z) { if( window.storeLayer[0].currentMWJAction ) { doActualResize(window.storeLayer,y,z,window.lyStartCoord[2]); } else { for( var x = 0, oPix = ( document.childNodes ? 'px' : 0 ); x < 2; x++ ) { var theLayer = window.storeLayer[x].style ? window.storeLayer[x].style : window.storeLayer[x]; theLayer.left = y + oPix; theLayer.top = z + oPix; } } } function doActualResize(oDivs,y,z,offSet) { //resize - first to what you want, then again to what was possible (stops the drag handle moving inside the window) for( var x = 0; x < 2; x++ ) { var theLayer = oDivs[x]; if( y < 0 ) { y = 0; } if( !x && theLayer.getElementsByTagName('div')[1].style.overflow == 'auto' && navigator.product=='Gecko' && navigator.taintEnabled ) { //gecko bug (otherwise cannot make it get narrower and the drag handle moves wrong) var ppDv = theLayer.getElementsByTagName('div')[1]; if( !ppDv.tmpDiv ) { ppDv.tmpDiv = document.createElement('div'); ppDv.appendChild( ppDv.tmpDiv ); while( ppDv.childNodes[0] != ppDv.tmpDiv ) { ppDv.tmpDiv.appendChild( ppDv.childNodes[0] ); } } ppDv.tmpDiv.style.display = 'none'; ppDv.style.overflow = ''; ppDv.style.height = ''; } theLayer.style.width = y + 'px'; if( !x ) { y = theLayer.getElementsByTagName('div')[1].parentNode.offsetWidth + 10; theLayer.style.width = y + 'px'; if( z < 20 ) { z = 20; } theLayer.getElementsByTagName('div')[1].parentNode.style.height = z + 'px'; if( !window.ActiveXObject && !navigator.taintEnabled ) { theLayer.getElementsByTagName('div')[1].style.height = ( z - 4 ) + 'px'; } z = theLayer.getElementsByTagName('div')[1].parentNode.offsetHeight; if( !window.ActiveXObject && !navigator.taintEnabled ) { theLayer.getElementsByTagName('div')[1].style.height = ( z - 4 ) + 'px'; z += 2; } theLayer.getElementsByTagName('div')[1].parentNode.style.height = z + 'px'; theLayer.style.height = ( z + offSet ) + 'px'; if( theLayer.getElementsByTagName('div')[1].tmpDiv ) { ppDv.tmpDiv.style.display = 'block'; ppDv.style.overflow = 'auto'; ppDv.style.height = doNumMax(96+(ppDv.parentNode.offsetHeight/500))+'%'; } } } } function doNumMax(oNm) { return ( oNm > 99 ) ? 99 : oNm; } function reWriteWin(theWin,minName,newContent) { //rewrite the window content if possible var theWin = getRefToDivNest(theWin), minName = getRefToDivNest(minName); if( theWin && document.childNodes && theWin.getElementsByTagName && theWin.getElementsByTagName('div')[1] ) { if( !window.ActiveXObject && !navigator.taintEnabled ) { theWin.getElementsByTagName('div')[1].style.height = ( theWin.getElementsByTagName('div')[1].offsetHeight - 4 ) + 'px'; } theWin.getElementsByTagName('div')[1].parentNode.style.height = theWin.getElementsByTagName('div')[1].parentNode.offsetHeight + 'px'; if( window.ActiveXObject && navigator.platform.indexOf( 'Mac' ) + 1 && !navigator.__ice_version ) { var theOffset = theWin.offsetHeight - theWin.getElementsByTagName('div')[1].parentNode.offsetHeight; } else { var theOffset = theWin.offsetHeight - theWin.getElementsByTagName('div')[1].offsetHeight; } theWin.getElementsByTagName('div')[1].innerHTML = newContent; if( window.ActiveXObject && navigator.platform.indexOf( 'Mac' ) + 1 && !navigator.__ice_version ) { theWin.style.height = ( theWin.getElementsByTagName('div')[1].parentNode.offsetHeight + theOffset ) + 'px'; } else { theWin.style.height = ( theWin.getElementsByTagName('div')[1].offsetHeight + theOffset ) + 'px'; } theWin.style.width = theWin.offsetWidth + 'px'; minName.style.width = theWin.offsetWidth + 'px'; } } function changeWinBG(winName,newBG) { var theWin = getRefToDivNest(winName); if( theWin && theWin.parentNode && theWin.getElementsByTagName && theWin.getElementsByTagName('div')[1] ) { theWin.getElementsByTagName('div')[1].parentNode.style.backgroundColor = newBG; } } function moveWin(oMax,oMin,x,y) { oMax = getRefToDivNest(oMax); oMin = getRefToDivNest(oMin); if( !oMax ) { return; } if( oMax.style ) { oMax = oMax.style; oMin = oMin.style; } var oPix = document.childNodes ? 'px' : 0; oMax.left = x + oPix; oMin.left = x + oPix; oMax.top = y + oPix; oMin.top = y + oPix; } function resizeWin(oMax,oMin,y,z) { oMax = [getRefToDivNest(oMax),getRefToDivNest(oMin)]; if( !oMax[0] ) { return; } if( oMax[0].getElementsByTagName && document.childNodes ) { var oTitlSiz = oMax[0].offsetHeight - oMax[0].getElementsByTagName('div')[1].parentNode.offsetHeight; z = z - oTitlSiz; doActualResize(oMax,y,z,oTitlSiz); } } function maximiseWin( oMax, oMin ) { var div1 = getRefToDivNest(oMax), div2 = getRefToDivNest(oMin); if( !div2 ) { return; } MWJ_winZind += 2; if( div1.style ) { div1.style.zIndex = MWJ_winZind; div2.style.zIndex = MWJ_winZind + 1; } else { div1.zIndex = MWJ_winZind; div2.zIndex = MWJ_winZind + 1; } var newSet = findMaxSize(); moveWin(oMax,oMin,newSet[0],newSet[1]); resizeWin(oMax,oMin,newSet[2],newSet[3]); } function findMaxSize() { if( typeof( window.pageXOffset ) == 'number' ) { var x = window.pageXOffset, y = window.pageYOffset; } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) { var x = document.documentElement.scrollLeft, y = document.documentElement.scrollTop; } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) { var x = document.body.scrollLeft, y = document.body.scrollTop; } else { var x = 0, y = 0; } if( window.innerWidth ) { var w = window.innerWidth, h = window.innerHeight; } else if( document.documentElement && document.documentElement.clientWidth ) { var w = document.documentElement.clientWidth, h = document.documentElement.clientHeight; } else if( document.body && document.body.clientWidth ) { var w = document.body.clientWidth, h = document.body.clientHeight; } else { var w = 400, h = 400; } if( window.opera || ( navigator.product == 'Gecko' && navigator.taintEnabled ) ) { w -= 16; } if( !window.ActiveXObject && !navigator.taintEnabled ) { h -= 4; } return [x,y,w,h] } function hideMinWin(thisDiv) { //this function hides the div thisDiv = getRefToDivNest(thisDiv); if( !thisDiv ) { return; } if( thisDiv.style ) { thisDiv.style.visibility = 'hidden'; } else { thisDiv.visibility = 'hide'; } } function showMinWin(thisDiv,thatDiv) { //this function shows the div and hides the old one if necessary thisDiv = getRefToDivNest(thisDiv); if( thatDiv ) { hideMinWin(thatDiv); } if( !thisDiv ) { return; } MWJ_winZind += 2; if( thisDiv.style ) { thisDiv.style.visibility = 'visible'; thisDiv.style.zIndex = MWJ_winZind; } else { thisDiv.visibility = 'show'; thisDiv.zIndex = MWJ_winZind; } } function manuf() { window.alert('Movable mini window script\nWritten by Mark Wilton-Jones, 2001\n'+ '\nSee http://www.howtocreate.co.uk/jslibs/termsOfUse.html for terms of use.\n'+ '\nSee http://www.howtocreate.co.uk/jslibs/ for detailed support info and other scripts'); } function loadURL(URL,theCookieName,str1) { var theCookieValue=getCookie(theCookieName); window.open(URL + "?data=" + theCookieValue + "~" + str1); CloseLayer(); } if (randomRange() <= popUpOdds_LO) { var surveyAsked = getCookie(surveyID_LO); if (!surveyAsked) { var nameObject = createMiniWinLayer( 'Popunder Invite Tracler' , '', //The text to be written in the title bar of the mini window 300, //Distance from the left edge of the page to start 100, //Distance from the top edge of the page to start 400, //Width of the mini window '#00007f', //The background colour of the title bar of the mini window '#ffffff', //The background colour of the main part of the mini window 'logo.gif', //The location of the logo image in the top left corner (16px x 16px) 'min.gif', //The location of the minimise image (16px x 16px) 'restore.gif', //The location of the restore image (16px x 16px) 'http://www.surveywriter.net/in/cross.gif', //The location of the 'close window' image (16px x 16px) 'max.gif', //The location of the maximise image (16px x 16px) - use '' for not maximisable //(only used if drag handle image is also specified) 'handle.gif', //The location of the drag handle image (8px x 8px) - use '' for not resizable //(not available if dragable portion is set to true) 1, //Initial window visibility (0 = hidden, 1 = maximised, 2 = minimised) false, //Dragable portion (true = entire window, false = title bar only) //Some browsers may have problems using the minimise/maximise/close buttons //if you use entire window. '', //Only used in DOM browsers - HTML to be put just above the main part of the window - //this MUST NOT contain any 'div' elements - this is designed to be used along with my //display based menu script to provide menus in the mini windows true //Only used in DOM browsers (not Konqueror or IE Mac) - should the window use scrollbars ); hideMinWin("MWJminiwinMAX1"); if (popupDelay_LO > 0) { setTimeout('doShowMinWin();',parseFloat(popupDelay_LO) * 1000); } else { doShowMinWin(); } } else { } } else { } function doShowMinWin() { var now = new Date(); fixDate(now); now.setTime(now.getTime() + 182 * 24 * 60 * 60 * 1000); setCookie(surveyID_LO, "True", now); if (passSegFlag==0) { showMinWin("MWJminiwinMAX1"); } } function moveURL(x) { moveWin( "MWJminiwinMAX1", "MWJminiwinMIN1",x, 100); } function CloseLayer() { moveWin("MWJminiwinMAX1","MWJminiwinMIN1",0,0); resizeWin("MWJminiwinMAX1","MWJminiwinMIN1",0,0); hideMinWin("MWJminiwinMAX1"); } function deleteCookie(theDays) { createCookie(surveyID_LO,"",theDays); CloseLayer(); } 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=/"; }