var iBrowse = null; function SetCookie (name, value) { var argv = SetCookie.arguments; var argc = SetCookie.arguments.length; var expires = (argc > 2) ? argv[2] : null; var path = (argc > 3) ? argv[3] : null; var domain = (argc > 4) ? argv[4] : null; var secure = (argc > 5) ? argv[5] : false; document.cookie = name + "=" + escape (value) + ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + ((path == null) ? "" : ("; path=" + path)) + ((domain == null) ? "" : ("; domain=" + domain)) + ((secure == true) ? "; secure" : ""); } function getCookieVal (offset) { var endstr = document.cookie.indexOf (";", offset); if (endstr == -1) endstr = document.cookie.length; return unescape(document.cookie.substring(offset, endstr)); } function GetCookie (name) { var arg = name + "="; var alen = arg.length; var clen = document.cookie.length; var i = 0; while (i < clen) { var j = i + alen; if (document.cookie.substring(i, j) == arg) return getCookieVal (j); i = document.cookie.indexOf(" ", i) + 1; if (i == 0) break; } return null; } function hasCookies() { if( navigator !== undefined ) { if( navigator.cookieEnabled !== undefined ) return navigator.cookieEnabled; } SetCookie( "cootest", "test" ); if( GetCookie( "cootest" ) == "test" ) { SetCookie( "cootest", "", -1 ); return true; } return false; } function setEventHandler(element, evt, code) { if( element.addEventListener ) { element.addEventListener( evt, code, true ); } else if( element.attachEvent ) { element.attachEvent( "on" + evt, code ); } else { /** this part is hard-coded for obvious reasons **/ switch( evt ) { case "mouseover" : element.onmouseover = code; break; case "mouseout" : element.onmouseout = code; break; } } } function getDocMetrics() { var metrics = { offX : 0, offY : 0, width : 0, height: 0 }; if( window.pageXOffset !== undefined ) { metrics.offX = window.pageXOffset; } else if( document.documentElement.scrollLeft !== undefined ) { metrics.offX = document.documentElement.scrollLeft; } else if( document.body.scrollLeft !== undefined ) { metrics.offX = document.body.scrollLeft; } if( window.pageYOffset !== undefined ) { metrics.offY = window.pageYOffset; } else if( document.documentElement.scrollTop !== undefined ) { metrics.offY = document.documentElement.scrollTop; } else if( document.body.scrollTop !== undefined ) { metrics.offY = document.body.scrollTop; } if( window.innerWidth ) { metrics.width = window.innerWidth ; metrics.height = window.innerHeight; } else if( document.documentElement.clientWidth ) { metrics.width = document.documentElement.clientWidth; metrics.height = document.documentElement.clientHeight; } else if( document.body.clientWidth ) { metrics.width = document.body.clientWidth; metrics.height = document.body.clientHeight; } return metrics; } function warnUnload() { return "Leaving or closing this page will interrupt the conversation"; } function c2rwidget_DoFSCommand(command, args) { if( command == "quit" ) { var divC2R = document.getElementById( "c2r_divMain" ); var divWD = document.getElementById( "c2r_divWD" ); var objWD = document.getElementById( "c2rwidget" ); if( objWD ) { divWD.removeChild( objWD ); } else { var objs = document.getElementsByTagName( "object" ); for( var j = 0; j < objs.length; j ++ ) { if( objs[ j ].name !== undefined ) { if( objs[ j ].name == "c2rwidget" ) { objWD = objs[ j ]; break; } } else if( objs[ j ].getAttribute ) { if( objs[ j ].getAttribute( "name" ) == "c2rwidget" ) { objWD = objs[ j ]; break; } } } if( !objWD ) { var embeds = document.getElementsByTagName( "embed" ); for( var j = 0; j < embeds.length; j ++ ) { if( embeds[ j ].name !== undefined ) { if( embeds[ j ].name == "c2rwidget" ) { objWD = embeds[ j ]; break; } } else if( embeds[ j ].getAttribute ) { if( embeds[ j ].getAttribute( "name" ) == "c2rwidget" ) { objWD = embeds[ j ]; break; } } } if( objWD ) { divWD.removeChild( objWD ); } } } if( divC2R ) { document.body.removeChild( divC2R ); } if( divWD ) { document.body.removeChild( divWD ); } if( document.documentElement !== undefined ) { document.documentElement.style.overflow = ""; document.body.style.overflow = ""; } else { document.body.style.overflow = ""; } if( iBrowse != null ) { iBrowse.close(); iBrowse = null; } window.onbeforeunload = null; setEventHandler( window, "resize", null ); } else if( command == "url" ) { c2r_openUrl( args ); } } function isMacFF2() { var userAgent = navigator.userAgent.toLowerCase(); if (/firefox[\/\s](\d+\.\d+)/.test(userAgent)) { var ffversion = new Number(RegExp.$1); if (ffversion < 3 && userAgent.indexOf('mac') != -1) { return true; } } return false; } function onWindowResize() { var divC2R = document.getElementById( "c2r_divMain" ); var divWD = document.getElementById( "c2r_divWD" ); var spanUrl = document.getElementById( "c2rUrl" ); var mtx = getDocMetrics(); if( divC2R && divWD ) { divWD.style.left = (mtx.offX + ((mtx.width - 332)/2)) + "px"; divWD.style.top = (mtx.offY + ((mtx.height - 278)/2)) + "px"; divC2R.style.left = mtx.offX + "px"; divC2R.style.top = mtx.offY + "px"; divC2R.style.width = mtx.width + "px"; divC2R.style.height = mtx.height + "px"; } if( spanUrl ) { spanUrl.style.width = (mtx.width - ((26*5) + 96 + 80)) + "px"; } if( iBrowse != null ) { iBrowse.mainDiv.style.left = mtx.offX + "px"; iBrowse.mainDiv.style.top = mtx.offY + "px"; iBrowse.mainDiv.style.width = mtx.width + "px"; iBrowse.mainDiv.style.height = (iBrowse.minimized) ? "31px" : mtx.height + "px"; iBrowse.mainDiv.style.display = "block"; iBrowse.frameBrowse.style.left = mtx.offX + "px"; iBrowse.frameBrowse.style.top = (mtx.offY + 35) + "px"; iBrowse.frameBrowse.style.width = mtx.width + "px"; iBrowse.frameBrowse.style.height = (iBrowse.minimized) ? "1px" : (mtx.height - 31) + "px"; } } function makeRing(bellcs, locale) { var divC2R = document.getElementById( "c2r_divMain" ); var divWD; if( document.documentElement !== undefined ) { document.documentElement.style.overflow = "hidden"; document.body.style.overflow = "hidden"; } else { document.body.style.overflow = "hidden"; } if( !divC2R ) { divC2R = document.createElement( "div" ); divC2R.id = "c2r_divMain"; divC2R.style.position = "absolute"; divC2R.style.display = "none"; divC2R.style.width = "1px"; divC2R.style.height = "1px"; divC2R.style.zIndex = 101; if( isMacFF2() ) { divC2R.style.backgroundImage = "url(http://bell.click2ring.net/tap/shade.png)"; divC2R.style.backgroundRepeat = "repeat"; } else { divC2R.style.background = "#ffffff"; divC2R.style.opacity = 0.7; divC2R.style.filter = "alpha(opacity=70)"; if( divC2R.style.setAttribute ) divC2R.style.setAttribute( "-moz-opacity", "0.7" ); } document.body.appendChild( divC2R ); divWD = document.createElement( "div" ); divWD.id = "c2r_divWD"; divWD.style.display = "none"; divWD.style.width = "332px"; divWD.style.height = "278px"; divWD.style.display = "block"; divWD.style.position = "absolute"; divWD.style.zIndex = 1001; if( divWD.style.setAttribute ) divWD.style.setAttribute( "-moz-opacity", "1" ); divWD.innerHTML = ""; document.body.appendChild( divWD ); } divWD.style.display = "block"; divC2R.style.display = "block"; onWindowResize(); window.onbeforeunload = warnUnload; setEventHandler( window, "resize", onWindowResize ); } function openPage() { window.open( document.location.href, "_blank" ); } function getPageCoords (element) { var coords = {x: 0, y: 0}; while (element) { coords.x += element.offsetLeft; coords.y += element.offsetTop; element = element.offsetParent; } return coords; } var hider = null; function c2rTipOn(el) { if( hider ) { window.clearTimeout( hider ); hider = null; return; } var divTip = document.getElementById( "c2r_divTip" ); if( !divTip ) { divTip = document.createElement( "DIV" ); divTip.id = "c2r_divTip"; divTip.style.display = "none"; divTip.style.clear = "none"; divTip.style.position = "absolute"; divTip.style.border = "solid 1px #1c1c1c"; divTip.style.padding = "6px 6px 6px 6px"; divTip.style.backgroundColor = "#ffffff"; divTip.style.fontFamily = "Verdana"; divTip.style.fontSize = "10px"; divTip.style.width = "200px"; divTip.style.zIndex = 101; divTip.innerHTML = 'This site uses Click2Ring service that enables visitors to have live voice conversation with a web site owner.'; setEventHandler( divTip, "mouseover", function() { c2rTipOn( divTip ); } ); setEventHandler( divTip, "mouseout", function() { c2rTipOff(); } ); document.body.appendChild( divTip ); } var pos = getPageCoords( el ); var mtx = getDocMetrics( ); var xleft = (pos.x + 148); var xtop = (pos.y); if( (xleft + 200) > (mtx.width + mtx.offX) ) { xleft = (pos.x - 200); } divTip.style.left = (xleft) + "px"; divTip.style.top = (xtop) + "px"; divTip.style.display = "block"; } function c2rTipHide() { var divTip = document.getElementById( "c2r_divTip" ); if( divTip ) { divTip.style.display = "none"; } hider = null; } function c2rTipOff() { hider = window.setTimeout( c2rTipHide, 600 ); } function c2r_setCookie(name, value) { var date = new Date(); date.setTime( date.getTime() + (7*24*60*60*1000) ); SetCookie( name, value, date, "/" ); } function c2r_updCookie(name, value) { var date = new Date(); date.setTime( date.getTime() + (7*24*60*60*1000) ); SetCookie( name, value, date, "/" ); } function c2r_btnMouseOver(btn, ho) { if( ho ) { btn.style.background = "url(http://bell.click2ring.net/images/bar/" + btn.getAttribute( "bgon" ) + ")"; } else { btn.style.background = "url(http://bell.click2ring.net/images/bar/" + btn.getAttribute( "bgoff" ) + ")"; } } function c2r_initBrowse() { var elDivMax = document.createElement( "div" ); elDivMax = document.createElement( "div" ); elDivMax.style.position = "absolute"; elDivMax.style.display = "none"; elDivMax.style.width = "1px"; elDivMax.style.height = "1px"; elDivMax.style.zIndex = 2001; elDivMax.style.background = "#ffffff"; elDivMax.style.overflow = "hidden"; document.body.appendChild( elDivMax ); var elDivBar = document.createElement( "div" ); elDivBar.innerHTML = "     "; elDivBar.style.height = "29px"; elDivBar.style.display = "block"; elDivBar.style.overflow = "hidden"; elDivBar.style.background = "#ff9900"; elDivBar.style.border = "solid 1px #ffffff"; elDivMax.appendChild( elDivBar ); var elBrowseFrame = document.createElement( "IFRAME" ); elBrowseFrame.style.zIndex = 2002; elBrowseFrame.style.border = "none"; elBrowseFrame.frameborder = "0px"; elDivMax.appendChild( elBrowseFrame ); iBrowse = { mainDiv : elDivMax, frameBrowse : elBrowseFrame, toolbar : elDivBar, minimized : false, close : function() { iBrowse.mainDiv.removeChild( iBrowse.frameBrowse ); iBrowse.mainDiv.removeChild( iBrowse.toolbar ); document.body.removeChild( iBrowse.mainDiv ); iBrowse = null; } } elDivMax.style.display = "block"; onWindowResize(); } function c2r_updateUrlDispaly() { var spanUrl = document.getElementById( "c2rUrl" ); if( !spanUrl || !iBrowse ) return; var url = iBrowse.frameBrowse.src; spanUrl.innerHTML = "" + url + ""; var li = document.getElementById( "linkPop" ); if( li ) { li.href = url; } li = document.getElementById( "linkSave" ); if( li ) { li.setAttribute( "addr", url ); } } function c2r_saveLink(link) { var url = link.getAttribute( "addr" ); if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) { window.external.AddFavorite( url, url ); } else if (navigator.appName == "Netscape") { window.sidebar.addPanel( url, url, "" ); } } function c2r_openUrl(url) { if( iBrowse == null ) { c2r_initBrowse(); } iBrowse.minimized = false; iBrowse.frameBrowse.src = url; onWindowResize(); c2r_updateUrlDispaly(); } function c2r_browseClose() { iBrowse.close(); iBrowse = null; } function c2r_switchToC2r() { if( iBrowse != null ) { iBrowse.minimized = true; onWindowResize(); } } function c2r_switchToBrowse() { if( iBrowse != null ) { iBrowse.minimized = false; onWindowResize(); } } if( hasCookies() ) { var bellcs = GetCookie( "c2r_bell_32" ); var mainDoc = document; if( window.top != mainDoc ) { try { if( window.top.location.host === undefined ) { mainDoc = null; } else { mainDoc = window.top; } } catch( e ) { mainDoc = null; } } if( mainDoc != null ) { if( bellcs == null ) { var orf = ""; if( mainDoc.referrer ) orf = escape( mainDoc.referrer ); document.write( "" ); } else { document.write( "" ); } } }