// {{MadCap}} //////////////////////////////////////////////////////////////////
// Copyright: MadCap Software, Inc - www.madcapsoftware.com ////////////////////
////////////////////////////////////////////////////////////////////////////////
// <version>3.0.0.0</version>
////////////////////////////////////////////////////////////////////////////////

var gDocumentOnclickFunction    = document.onclick;
var gDocumentOnclickFuncs		= new Array();

gDocumentOnclickFuncs.push( FMCClickHandler );

document.onclick = function( e )
{
    gDocumentOnclickFunction ? gDocumentOnclickFunction() : false;
    
    for ( var i = 0; i < gDocumentOnclickFuncs.length; i++ )
    {
		gDocumentOnclickFuncs[i]( e );
    }
};

function FMCCheckForBookmarkInternal( a )
{
    var hrefPrefix  = FMCGetHref( document.location );
    var href        = FMCEscapeHref( a.href );
    
    if ( href.substring( 0, hrefPrefix.length ) != hrefPrefix )
    {
        return;
    }
    
    var hash        = a.href.substring( a.href.lastIndexOf( "#" ) + 1 );
    var bookmark    = null;
    
    for ( var i = 0; i < document.anchors.length; i++ )
    {
        var currAnchor  = document.anchors[i];
        
        if ( currAnchor.name == hash )
        {
            bookmark = currAnchor;
            
            break;
        }
    }
    
    if ( bookmark && typeof( FMCUnhide ) == "function" )
    {
        FMCUnhide( window, bookmark );
    }
}

function FMCClickHandler( e )
{
    var target  = null;
    
    if ( !e )
    {
        e = window.event;
    }
    
    if ( e.srcElement )
    {
        target = e.srcElement;
    }
    else if ( e.target )
    {
        target = e.target;
    }
    
    (target.nodeName == "A") ? FMCCheckForBookmarkInternal( target ) : false;
    
    //
    
    if ( typeof( gJustPopped ) == "undefined" )
    {
        return;
    }
    
    if ( !gJustPopped && gPopupObj && gPopupObj.style.display != "none" )
    {
        if ( typeof( FMCContainsClassRoot ) == "function" && FMCContainsClassRoot( gPopupObj.className, "MCKLinkBody" ) )
        {
            gPopupObj.parentNode.removeChild( gPopupObj );
            gPopupBGObj.parentNode.removeChild( gPopupBGObj );
        }
        else
        {
            if ( gImgNode && typeof( FMCImageSwap ) == "function"  )
            {
                FMCImageSwap( gImgNode, "swap" );
                gImgNode = null;
            }
            
            // Reset fading
            
			if ( gPopupObj.filters )
			{
				gPopupObj.style.filter = "alpha( opacity = 0 )";
				gPopupBGObj.style.filter = "alpha( opacity = 0 )";
			}
			else if ( gPopupObj.style.MozOpacity != null )
			{
				gPopupObj.style.MozOpacity = "0.0";
				gPopupBGObj.style.MozOpacity = "0.0";
			}
			
			//

            gPopupObj.style.display = "none";
            gPopupBGObj.parentNode.removeChild( gPopupBGObj );
        }
        
        if ( gFadeID != 0 )
        {
            clearInterval( gFadeID );
        }
        
        gPopupObj = null;
        gPopupBGObj = null;
        gFadeID = 0;
        
        if ( gTextPopupBody )
        {
            gTextPopupBody = null;
            gTextPopupBodyBG = null;
            window.onresize = null;
        }
    }
    
    gJustPopped = false;
}


var sWOGateway       = "gwdedicated9.whoson.com";    // specify the external address:port of the WhosOn Gateway server
var sWOGatewaySSL    = "gwdedicated9.whoson.com"; // specify the external address:port of the WhosOn Gateway server SSL interface
var sWODomain        = "www.iistools.com";  // the domain you are monitoring
var sWODepartment    = ""; // optional department
var sWOChatstart     = "https://dedicated9.whoson.com/chat/chatstart.htm"; // url to the chatstart.htm page 
var sWOLanguage      = ""; // language for the chat window
var sWOBackgroundURL = ""; // optional custom background url
var sWOResponse      = ""; // set to a blank string if you do NOT want a visible chat link
var sWOInvite        = "";  // set to a blank string if you do NOT want invite requests to be polled
var sWOPreselect     = ""; // set to D to pre-select Department before starting chat, O to pre-select Operator

var sWOSession;
var sWOUrl;
var sWOUser="";
var sWOPage="";
var sWOProtocol=window.location.protocol;

// specify a user name here if you want a specific user name instead of a session cookie
// sWOUser="my user";

// specify a page name here if you want a specific page name shown in WhosOn instead of the window.location
// sWOPage="my page";

var sWOCost=0;    // specify a visit cost 
var sWORevenue=0; // specify the revenue generated by the visitor

// optional contact information. Specify values for these variables if you want contact info for the visitor passed to WhosOn
var sWOName="";
var sWOCompany="";
var sWOEmail="";
var sWOTelephone="";

var sWOImage = new Image();

if(sWOUser==""){
	// create a unique session cookie for the visitor
	var dt=new Date();
	var sWOCookie=document.cookie.toString();
	if(sWOCookie.indexOf("whoson")==-1){
		sWOSession=parseInt(Math.random()*1000)+"-"+dt.getTime();
		document.cookie="whoson="+sWOSession+";expires=Fri, 31-Dec-2010 00:00:00 GMT;";
	}
	sWOCookie=document.cookie.toString();
	if(sWOCookie.indexOf('whoson')==-1){
		sWOSession="";
	} else {
		var s=sWOCookie.indexOf("whoson=")+7;
		var e=sWOCookie.indexOf(";",s);
		if(e==-1)e=sWOCookie.length;
		sWOSession=sWOCookie.substring(s,e);
	}
}

if(sWOProtocol=="https:")sWOGateway=sWOGatewaySSL;
if(sWOUser!="")sWOSession=sWOUser;
if(sWOPage=="")sWOPage=escape(window.location);
if(sWOProtocol=="file:")sWOProtocol="http:";

sWOUrl=sWOProtocol+"//"+sWOGateway+"/stat.gif?u="+sWOSession+"&d="+sWODomain;
if(sWODepartment.length>0)sWOUrl+="&t="+escape(sWODepartment);
sWOUrl+="&p='"+sWOPage+"'&r='"+escape(document.referrer)+"'";
if(sWOCost!=0)sWOUrl+="&c="+sWOCost;
if(sWORevenue!=0)sWOUrl+="&v="+sWORevenue;
if(sWOName!="" || sWOCompany!="" || sWOEmail!="" || sWOTelephone!="")sWOUrl+="&n="+sWOName+"|"+sWOCompany+"|"+sWOEmail+"|"+sWOTelephone;
if(sWOResponse==""){
	if(document.layers)document.write("<layer name=\"WhosOn\" visibility=hide><img src=\""+sWOUrl+"\" height=1 width=1><\/layer>");
	else document.write("<div id=\"WhosOn\" STYLE=\"position:absolute;visibility:hidden;\"><img src=\""+sWOUrl+"\" height=1 width=1><\/div>");
} else {
	sWOUrl+="&response=g";
	sWOImage.src = sWOUrl;
}