<!--
/* global vars*/
var helpURL = "http://robohelp.tvi.help";
/**** general functions ****/
function _init(){
	/* call any preload image functions throughout the template */
	if(typeof window.preloadGlobalImages == "function" ) window.preloadGlobalImages();
	if(typeof window.preloadHeaderImages == "function" ) window.preloadHeaderImages();
	if(typeof window.preloadContextImages == "function" ) window.preloadContextImages();
	if(typeof window.preloadFooterImages == "function" ) window.preloadFooterImages();
	if(typeof window.preloadPopUpImages == "function" ) window.preloadPopUpImages();

	/* call any specified onLoadExtras methods within the core page */
	if(typeof window.onLoadExtras == "function" ) window.onLoadExtras();

	// focus the first textfield/textarea if it exists
	if(document.forms[0] != "undefined" && document.forms[0] != null){
		var elements = document.forms[0].elements
		for(var a=0; a<elements.length;a++){
			if((elements[a].type == "text" || elements[a].type == "textarea" || elements[a].type == "password") && !elements[a].readOnly && !elements[a].disabled){
				elements[a].focus()
				break;
			}
		}
	}
}
function goBack(steps){
	// check optional steps arg
	if( !isNaN(parseFloat(steps)) ){
		// if a valid value was passed 
		// then go back that many steps
		history.go(-steps);
	}else{
		// default - go back 1
		history.go(-1);
	}
}
function goTo(url){
	window.location = url;
}
function goTo_frompopup(url){
	var ow = window.opener;
	if(ow == null || typeof ow == "undefined" || ow.closed){
		// (nonIE, IE, IE)
		// HAD or NO opener
		var nw = window.open(url);
		nw.focus();
	}else{
		// HAS opener
		ow.location.href=url;
		ow.focus();
	}
}
function getQueryString(){
	var q = window.location.search
	q = q.substring(1, q.length);
	return q;
}
function getQSArgs() {
	var args = new Object();
	var query = location.search.substring(1);
	var pairs = query.split("&");
	for (var i = 0; i < pairs.length; i++){
		var pos = pairs[i].indexOf('=');
		if (pos == -1) continue;
		var argname = pairs[i].substring(0,pos);
		var value = pairs[i].substring(pos+1);
		args[argname] = unescape(value);
	};
	return args;
};
/**** help functions ****/
// add the RoboHelp logic file
document.write("<script language='JavaScript1.2' src='/_JS/RoboHelp_CSH.js' type='text/javascript'><\/script>");

function getHelp(topicID, windowType){
	if(typeof topicID == 'undefined'){topicID = 0;}
	if(typeof helpType == 'undefined'){helpType = HH_HELP_CONTEXT;}
	if(typeof windowType == 'undefined'){windowType = "Main";}
	// Check the browser...we're looking for ie/win, but not aol
	var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;    // true if we're on ie
	var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false; // true if we're on windows
	var strPathAndWindow;
	//if(isWin && isIE){
		// WIN can handle RoboEngine
		strPathAndWindow = helpURL + "/roboapi.asp?project=VI_AgentHelp>" + windowType;
		//strPathAndWindow = "https://dev.callwords.com>" + windowType;
	//}else{
		// all other browsers get Flash version for compatibility reasons
		//strPathAndWindow = "http://MIKEY/Callwords/help/FlashHelp/Callwords.htm>" + windowType;
	//}
	RH_ShowHelp(0, strPathAndWindow, helpType, topicID)
	//alert('no errors');
}
//-->