﻿function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function hasOptions(obj) {
	// log('hasOptions');
	if (obj!=null && obj.options!=null) { return true; }
	// inspect(obj);
	return false;
}

function copyOptions(from,to) {
	//log('copyOptions start');
	var options = new Object();
	
	//log('copyOptions 1');
	if (!hasOptions(from)) { return; }
	//log('copyOptions 2');
	
	if (hasOptions(to)) {
		// Remove any existing options
		for (var i=to.options.length - 1; i>=0; i--) {
		//for (var i=0; i<to.options.length; i++) {
			to.remove(i);
		}
	}
	
	for (var i=0; i<from.options.length; i++) {
		var o = from.options[i];
		if (options[o.value] == null || options[o.value] == "undefined" || options[o.value]!=o.text) {
			// Don't append if destination has options already
			if (!hasOptions(to)) { 
				var index = 0;
			} 
			else { 
				var index=to.options.length; 
			}
			
			to.options[index] = new Option( o.text, o.value, false, false);
		}
	}
	//log('copyOptions 9');
	from.selectedIndex = -1;
	to.selectedIndex = -1;
	//log('copyOptions end');
}