var cbtDir="cbts/";
var cbtIndex="cbt.html";
var cdrom=false;
var unix=false;

var d = document;

function SetCookie(name, value){
	expire=new Date("July 1, 2010");
	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;
	path = "/";
	document.cookie = name + "=" + escape (value) +
	((expire == null) ? "" : ("; expires=" + expire.toGMTString())) +
	((path == null) ? "" : ("; path=" + path)) +
	((domain == null) ? "" : ("; domain=" + domain)) +
	((secure == true) ? "; secure" : "");
}

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;
}



// runs specific activity probably not needed
function runAct(cbtName, actNumber) {
//	SetCookie("run_act",  'none');
//	if (false) {// (cbtName!="demo"){
//		var onNm = GetCookie("OnNm");
//		if ((onNm==""||onNm==null)&&cdrom==false&&unix==false){
//			location.href="login.html"
//			return
//		}
//	}

//	if (document.layers&&cdrom==true){
cbtDir="cbts/"
//}
  		CBT = window.open(cbtDir + cbtName + "/"+actNumber+".html" + "?" + actNumber, "NorwichUnion", "scrollbars=no,width=640,height=480");
  	if(CBT) {
    		CBT.opener=top;
    		CBT.moveTo(80,60);
  	}
}

// runs specific activity probably not needed
function runActBig(cbtName, actNumber) {
//	SetCookie("run_act",  'none');
//	if (false) {// (cbtName!="demo"){
//		var onNm = GetCookie("OnNm");
//		if ((onNm==""||onNm==null)&&cdrom==false&&unix==false){
//			location.href="login.html"
//			return
//		}
//	}

//	if (document.layers&&cdrom==true){
cbtDir="cbts/"
//}
  		CBT = window.open(cbtDir + cbtName + "/"+actNumber+".html" + "?" + actNumber, "NorwichUnion", "scrollbars=no,width=800,height=600");
  	if(CBT) {
    		CBT.opener=top;
    		CBT.moveTo(80,60);
  	}
}

// required for popular task tutorial
function jump(ttaddstring,thettfile){
	thettfile = thettfile.toLowerCase()
	thettfile = '101/' + ttaddstring + "/" + replaceString(thettfile," ","") + '.htm'
//	var onNm = GetCookie("OnNm");
	if (false) {//((onNm==""||onNm==null)&&cdrom==false&&unix==false){
		location.href="login.html"
		return
	}
	pdf101window = window.open(thettfile,"Reference",'location=no,toolbar=yes,menubar=yes,status=yes,resizable=yes,scrollbars=no,height='+(screen.height-250)+',width='+(screen.width-50), false)
	pdf101window.moveTo(22,25);

}

// required for popular task tutorial
function replaceString(stringit, replaceit, withit) {
	newdescribe=stringit.replace(replaceit, withit)
	newdescribe=newdescribe.replace(replaceit, withit)
	newdescribe=newdescribe.replace(replaceit, withit)
	newdescribe=newdescribe.replace(replaceit, withit)
	newdescribe=newdescribe.replace(replaceit, withit)
	newdescribe=newdescribe.replace(replaceit, withit)
	newdescribe=newdescribe.replace(replaceit, withit)
	return newdescribe;
}


function openDoc(docName) {

	CBT = window.open(docName+".html", "NorwichUnion", "scrollbars=no,width=640,height=480");
  	if(CBT) {
    		CBT.opener=top;
    		CBT.moveTo(80,60);
  	}
}
