function popUpWindow(URL, width, height) {
	//alert("width=" + width + "  height=" + height);
	popwin = window.open(URL, "PopUpWindow", "'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=" + width +",height=" + height)
	popwin.opener = self
	popwin.focus()
}

if (document.images) {
	goodVersion = true;
} else {
	goodVersion = false;
}
// Begin Browser and DHTML detect	
isNS4 = (document.layers) ? true : false;
isIE4 = (document.all && !document.getElementById) ? true : false;
isIE5 = (document.all && document.getElementById) ? true : false;
isNS6 = (!document.all && document.getElementById) ? true : false;

if (isNS4) {
	var DHTMLversion = "NS4"
} else if (isIE4) {
	var DHTMLversion = "MSIE4"
} else if (isIE5) {
	var DHTMLversion = "MSIE5"
} else if (isNS6) {
	var DHTMLversion = "NS6"
} else {
	var DHTMLversion = "unknown"
}
//var myObject = document.all[ID].style
//alert("NS4: " + isNS4 + "\nIE4: " + isIE4 + "\nIE5:  " + isIE5 +"\nNS6: " + isNS6 + "\nDHTML Version: " + DHTMLversion)

var OSType = "Unknown";
var isWin = false;
var isMac = false;
if (navigator.userAgent.indexOf("Win", 0) > -1) {
	OSType = "Win";
	isWin = true;
} else if (navigator.userAgent.indexOf("Macintosh", 0) > -1) {
	OSType = "Mac";
	isMac = true;
}

function getImage(inputName) {
	//document.write("About to get Image: " + image_name +"<BR>");
	var myImage = document [inputName];
	browserName = navigator.appName;
      	browserVer = parseInt(navigator.appVersion);
       if (browserName == "Netscape" && browserVer == 3) {
		if (myImage.length) {
			return myImage[myImage.length-1];
		} else return myImage;
	} else {
		return myImage;
	}
}

function imageSwap(which, state, imageType) {
// this script needs getImage function and Browser sniffer function
      if (goodVersion) {
		//var thisImage = document.images[which];
		var thisImage = getImage(which);
		var thisImageSrc = thisImage.src;
		var imageName = thisImageSrc.substring(0,thisImageSrc.indexOf("_o"));
          if (state == 0) {
              thisImage.src = imageName + "_off." + imageType
          } else {
              thisImage.src = imageName + "_on." + imageType
        	}
      }
  }

function pokeOpener(url) {
	//alert("hello:  " + url);
	if (window.opener!=null && (!window.opener.closed)) {
		//alert("there is an opener: ");
		//Poke opener with url passed
		//opener.location.href = url;
		window.opener = window.open(url, "mainSite");
		//blur current window
		window.blur();
	} else {
		//alert("no opener!" );
		window.opener = window.open(url, "mainSite");
	}
	window.opener.focus()
}

function atLeastOneChecked(objForm) {
	imchecked = false
	for (i=0;i<objForm.length;i++) {
		if (objForm[i].checked = true) {
			imchecked = true
		}
	}
	return imchecked
}

if (document.images) {
	//button_whatsnew = newImage("/images/button_whatsnew_on.gif");
	preloadFlag = true;
}

function changeImages() {
	//alert(preloadFlag);
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}


/* TH --- Functions to encode e-mail links */

function DA_mail() {
document.write('<a href=mail'+'to:'+'david'+'@'+'BCimmigration'+'.com>'+'david'+'@'+'BCimmigration'+'.com</a>'); 
}

function TH_mail() {
document.write('<a href=mail'+'to:'+'tim'+'@'+'trh.bc'+'.ca>'+'tim'+'@'+'trh.bc'+'.ca</a>'); 
}

function WM_mail() {
document.write('<a href=mail'+'to:'+'webmaster'+'@'+'victorialaw'+'.com>'+'site'+' manager</a>'); 
}

function any_mail(aa,bb) {
document.write("<a href=mailto:" + aa + "@" + bb + "><img src=/images/mailto.gif border=0><a/>");   
}
