<!--
// Modified 4/14/2003
// icontact Request NetRep
// WIT v2.2
// Kevin Klawon
//

var webServer = "http://support.rockymountaineer.com/wia";
var binPath ="http://support.rockymountaineer.com/bin/icx.dll";
var bin_sslPath ="https://support.rockymountaineer.com/bin/icx.dll";

var c_dllPath;
if (location.protocol == "http:") c_dllPath = binPath;
else if (location.protocol == "https:") c_dllPath = bin_sslPath;

//
//  iMatter stuff
//

var iRandomNumber = 1000000 + Math.round(Math.random()*9999999); 


var thisZone = "rockymountaineer";
var istZone = escape(thisZone);


//
// CPAC STUFF
//

var thisPage = escape(document.location);
var thisTitle = escape(document.location);
// This will show up as the "Zone" column 
// You can either hard code for each site; uncomment this
// var thisZone = escape("SuN");
// or use the host name in the URL
//var thisZone = escape(document.location.host);

var randomNumber = 1000000 + Math.round(Math.random()*9999999);
var beatVal = 0;
var c_beatRate = 7;


if (navigator.appVersion.indexOf("Safari") < 0)
{
	// Not Safari - So continue
	var ic_initCookie = new Image(1,1);
	var surferID = 0;  // If 0, chat system create userID (ICID)
	ic_initCookie.onerror = makeRemainingCalls;
	ic_initCookie.onload = makeRemainingCalls;
	ic_initCookie.src = c_dllPath + "?initcookie?" + surferID;
}



// Uppage creates the user object, so now we can tell the server more info
function makeRemainingCalls()
{
    setTimeout("makeTimerCalls()", 1500);
}

function makeTimerCalls()
{
    var ic_uppage    = new Image(1,1);
    var ic_pnotify   = new Image(1,1);
    var ic_zoneinfo  = new Image(1,1);
    var ic_sinfo     = new Image(1,1);


    
    ic_uppage.src = c_dllPath + "?uppage?" + thisPage + "&" + randomNumber;
    ic_pnotify.src = c_dllPath + "?pnotify?" + thisTitle + "&" + randomNumber;
    ic_zoneinfo.src = c_dllPath + "?zoneinfo?" + thisZone + "&" + randomNumber;
    // This will show up in the name column
    //ic_sinfo.src = c_dllPath + "?sinfo?" + theName;
    
    if (self.name != "content")
    { 
        ic_beatGraphic = new Image(1,1);
        ic_beatGraphic.onload = beatSuccess;
        ic_beatGraphic.onerror = beatError;
        ic_beatGraphic.src = c_dllPath + "?beat?" + beatVal + "&" + getRandom();
    } else {
    	//if (window.onload) oldOnLoadFcn = window.onload;
    	//else oldOnLoadFcn = new Function();
    	//window.onload = doOnLoad;
    	var k = 1;
    }
}

function doOnLoad()
{
	oldOnLoadFcn();
	changeTargets();
}

function changeTargets()
{
	for (i = 0; i < document.links.length; i++)
	{
		if (document.links[i].protocol == "http:") c2_dllPath = binPath;
		else if (document.links[i].protocol == "https:") c2_dllPath = bin_sslPath;
		if (document.links[i].protocol == "http:" || document.links[i].protocol == "https:")
		{
			if (location.protocol != document.links[i].protocol)
			{
				if ((document.links[i].target != "_new") && (document.links[i].target != "_blank"))
				{
					document.links[i].target = "_top";
					document.links[i].href = c2_dllPath + "?pushpage?" + escape(document.links[i].href);
				}
			}
		}
	}
}


function getRandom()
{
	var max_random = 32000;
 	return Math.floor(max_random * Math.random());
}

function doBeat()
{
    ic_beatGraphic = new Image(1,1);
    ic_beatGraphic.onload = beatSuccess;
    ic_beatGraphic.onerror = beatError;
    ic_beatGraphic.src = c_dllPath + "?beat?" + beatVal + "&" + getRandom();
}

function beatError()
{
    setTimeout("doBeat()", c_beatRate * 1000);
}

function beatSuccess()
{
	self.moveTo(0,0);
    window.resizeTo(screen.width,screen.height);
    top.location = c_dllPath+"?cap?"+escape(document.location);
}

//-->