win_num = 0;ua = navigator.userAgent;win_msie = ((ua.indexOf("Win") >= 0) && (ua.indexOf("MSIE") >= 0))function new_win(win_url,win_name) {// optional 3rd param = max_width// optional 4th param = max_height	// if no window name is given, craete one to ensure a new window opens	if (win_name == '' || win_name == '_new') {		win_nm = 'new_win_' + win_num;		win_num = win_num + 1;	} else {		win_nm = win_name;	}	//if (win_msie) {	//	win_nm = win_name + win_num;	//	win_num = win_num + 1;	//} else { win_nm = win_name; }	if (arguments.length >= 3) { max_width=arguments[2]; } else { max_width=600; }	if (arguments.length >= 4) { max_height=arguments[3]; } else { max_height=450; }	// alert(max_width);	// alert(max_height);		left1 = Math.round(screen.availWidth * 0.085);	top1 = 30;	w1 = Math.round(screen.availWidth*0.85);	h1 = Math.round(screen.availHeight*0.85);	// Math.round((screen.availHeight-200));	if ((max_width > 0) && (w1 > max_width)) {		dif1 = w1-max_width;		left1 = Math.round(left1+(dif1/2));		w1 = max_width; }	if ((max_height > 0) && (h1 > max_height)) {		dif1 = h1-max_height;		top1 = Math.round(top1+(dif1/2));		h1 = max_height; }	win_attr = 'resizable=yes,scrollbars'; // toolbar,menubar	//win_features = win_attr;	if (win_attr != '') { win_features = win_attr + ','; } else { win_features = '' }	if (win_attr.indexOf("left=") < 0) {win_features = win_features+'left='+left1}	if (win_attr.indexOf("top=") < 0) {win_features = win_features+',top='+top1}	if (win_attr.indexOf("screenX=") < 0) {win_features = win_features+',screenX='+left1}	if (win_attr.indexOf("screenY=") < 0) {win_features = win_features+',screenY='+top1}	if (win_attr.indexOf("width=") < 0) {win_features = win_features+',width='+w1}	if (win_attr.indexOf("height=") < 0) {win_features = win_features+',height='+h1}	win = window.open(win_url, win_nm, win_features);	win.focus();}/* win_num = 0;ua = navigator.userAgent;win_msie = ((ua.indexOf("Win") >= 0) && (ua.indexOf("MSIE") >= 0))mac_msie = ((ua.indexOf("Mac") >= 0) && (ua.indexOf("MSIE") >= 0))function new_win(win_url,win_name, win_attr) {	win = window.open(win_url, win_name, win_attr);	win.focus();	return win;}*/// mac ie 4.5 ignores top/leftfunction new_win2(win_url,win_name, win_attr, win_size, max_width, max_height) {	if (win_size==1) {		left1 = Math.round(screen.availWidth * 0.075);		top1 = 40;		// Math.round(screen.availHeight * 0.05);		w1 = Math.round(screen.availWidth*0.85);		h1 = Math.round((screen.availHeight-200));		//availŠ150 = good for 1280x1024		// 5-22-02 this was "availHeight*0.87" - this was too tall on win ie 1024x768 and reduced		// 87% for no toolbar etc		if ((max_width > 0) && (w1 > max_width)) {			dif1 = w1-max_width;			left1 = Math.round(left1+(dif1/2));			w1 = max_width; }		if ((max_height > 0) && (h1 > max_height)) {			dif1 = h1-max_height;			top1 = Math.round(top1+(dif1/2));			h1 = max_height; }		if (win_attr != '') { win_features = win_attr + ','; } else { win_features = '' }		if (win_attr.indexOf("left=") < 0) {win_features = win_features+'left='+left1}		if (win_attr.indexOf("top=") < 0) {win_features = win_features+',top='+top1}		if (win_attr.indexOf("screenX=") < 0) {win_features = win_features+',screenX='+left1}		if (win_attr.indexOf("screenY=") < 0) {win_features = win_features+',screenY='+top1}		if (win_attr.indexOf("width=") < 0) {win_features = win_features+',width='+w1}		if (win_attr.indexOf("height=") < 0) {win_features = win_features+',height='+h1}	} else {		win_features = win_attr;	}	// alert('win_features = '+win_features);	win = window.open(win_url, win_name, win_features);	win.focus();	return win;}// define constants for window sizing (win_sizing parameter)// don't define window size (ie, use win_attr)var WIN_NONE = 0; // open full screenvar WIN_FULL = 1;// open slightly smaller than full screenvar WIN_BIG = 2;// open slightly smaller than full screen, but crop down to specified width and/or height (-1 values will be ignored)var WIN_BIG_CROP = 3;// open to target size, unless this would go offscreenvar WIN_TARGET = 4;// win_type:var WIN_DEFAULT = 1;	// usual complementvar WIN_BARE = 2;	// auto scrollbars, no other features// win_namevar WIN_NEW = 'open_win_new_window';// NOTES:// for some reason, referring to these constants in the function below causes errors and crashes in win netscape 4.xfunction open_win(win_url, win_name, win_type, win_sizing, target_width, target_height, win_attr) {	var h1,w1,top1,left1, win_attr;	if (win_name == 'open_win_new_window') { // WIN_NEW		win_name = '_new';	}	debug_flag = false;	//alert(screen.availWidth);	//alert(screen.availHeight);	if (debug_flag) { alert("win_sizing = "+win_sizing); }	// we won't necessarily use this... but figure out size for WIN_BIG	left1 = Math.round(screen.availWidth * 0.075);	top1 = 10;	w1 = Math.round(screen.availWidth*0.85);	if (win_type == 2) { // WIN_BARE		vert_extra = 50; }	else {		vert_extra = 210;	}	h1 = Math.round((screen.availHeight-vert_extra));	//availŠ150 = good for 1280x1024	// 5-22-02 this was "availHeight*0.87" - this was too tall on win ie 1024x768 and reduced	// 87% for no toolbar etc	// figure out win_features based on size parameters	switch (win_sizing) {	case 0: // WIN_NONE		win_features = win_attr;		break;	case 1: // WIN_BIG		if (win_attr != '') { win_features = win_attr + ','; } else { win_features = '' }		if (win_attr.indexOf("left=") < 0) {win_features = win_features+'left='+left1}		if (win_attr.indexOf("top=") < 0) {win_features = win_features+',top='+top1}		if (win_attr.indexOf("screenX=") < 0) {win_features = win_features+',screenX='+left1}		if (win_attr.indexOf("screenY=") < 0) {win_features = win_features+',screenY='+top1}		if (win_attr.indexOf("width=") < 0) {win_features = win_features+',width='+w1}		if (win_attr.indexOf("height=") < 0) {win_features = win_features+',height='+h1}		break;	case 3: // WIN_BIG_CROP	default:		if ((target_width > 0) && (w1 > target_width)) {			if (debug_flag) { alert("cropping to target_width: "+target_width); }			dif1 = w1-target_width;			left1 = Math.round(left1+(dif1/2));			w1 = target_width; }		if ((target_height > 0) && (h1 > target_height)) {			if (debug_flag) { alert("cropping to target_height: "+target_height); }			dif1 = h1-target_height;			top1 = Math.round(top1+(dif1/2));			h1 = target_height; }		if (win_attr != '') { win_features = win_attr + ','; } else { win_features = '' }		if (win_attr.indexOf("left=") < 0) {win_features = win_features+'left='+left1}		if (win_attr.indexOf("top=") < 0) {win_features = win_features+',top='+top1}		if (win_attr.indexOf("screenX=") < 0) {win_features = win_features+',screenX='+left1}		if (win_attr.indexOf("screenY=") < 0) {win_features = win_features+',screenY='+top1}		if (win_attr.indexOf("width=") < 0) {win_features = win_features+',width='+w1}		if (win_attr.indexOf("height=") < 0) {win_features = win_features+',height='+h1}		break;	case 4: // WIN_TARGET		whitespace_x = 15;		whitespace_y = 35;		availWidth = screen.availWidth - whitespace_x;		availHeight = screen.availHeight - whitespace_y;		// assume two target values exist		if ((target_width > availWidth)) {			// need to reduce this dimension to keep on screen			left1 = 0; //Math.round(whitespace_x/2);			w1 = availWidth;		} else {			// center with extra space			left1 = Math.round((availWidth - target_width)/2);			w1 = target_width;		}		if ((target_height > availHeight)) {			// need to reduce this dimension to keep on screen			top1 = 0; //Math.round(whitespace_y/2);			h1 = availHeight;		} else {			// center with extra space			top1 = Math.round((availHeight - target_height)/2);			h1 = target_height;		}		if (win_attr != '') { win_features = win_attr + ','; } else { win_features = '' }		if (win_attr.indexOf("left=") < 0) {win_features = win_features+'left='+left1}		if (win_attr.indexOf("top=") < 0) {win_features = win_features+',top='+top1}		if (win_attr.indexOf("screenX=") < 0) {win_features = win_features+',screenX='+left1}		if (win_attr.indexOf("screenY=") < 0) {win_features = win_features+',screenY='+top1}		if (win_attr.indexOf("width=") < 0) {win_features = win_features+',width='+w1}		if (win_attr.indexOf("height=") < 0) {win_features = win_features+',height='+h1}		break;	}	if (debug_flag) { alert("win_type = "+win_type); }	switch (win_type) {	case 1: // WIN_DEFAULT		type_features = 'menubar=yes,toolbar=yes,location=yes,status=yes,resizable=yes,scrollbars=yes';		break;	case 2: // WIN_BARE	default:		type_features = 'menubar=no,toolbar=no,location=no,status=no,resizable=yes,scrollbars=yes';		break;	}	if (debug_flag) { alert("win_features = "+win_features); }	if (win_features != '') { win_features = win_features + ',' + type_features; } else { win_features = type_features; }	// alert('win_features = '+win_features);	win = window.open(win_url, win_name, win_features);	win.focus();	return win;}function agelink_popup(win_url, target_width, target_height) {	open_win(win_url,WIN_NEW,WIN_BARE,WIN_TARGET,target_width,target_height,'');	return false;}