
newWindow = null;
var agent = navigator.userAgent;
var appver = navigator.appVersion;
var nav = navigator.appName;
var plf = null;
var ver = null;
if(agent.indexOf('Mac') != -1){
	plf = "Mac";
}else if(agent.indexOf('Win') != -1){
	plf = "Win";
}else{
	plf = "other";
}
if(agent.indexOf('MSIE') == -1){
	ver = appver.substring(0,4);
	if(nav == "Netscape"){
		nav = "NN";
	}
}else{
	ver = agent.substring((agent.indexOf('MSIE') + 5), (agent.indexOf('MSIE') + 9));
	nav = "MSIE";
}
if(ver.indexOf(';') != -1 || ver.indexOf(' ') != -1){
	ver = ver.substring(0,3);
}

if (agent.indexOf('Win') != -1) {
//	document.write('<LINK REL="stylesheet" TYPE="text/css" HREF="win.css">');
	document.write('<LINK REL="stylesheet" TYPE="text/css" HREF="win.css">');
	document.close();
}

function openWin(url, name, width, height, toolbar, location, directories, status, menubar, resizable, scrollbars, dependent){
	width = parseInt(width);
	height = parseInt(height);

	if(scrollbars == '1'){
		if(nav == "NN" && ver >= 5){
			// NN6
			width -= 2;
			height -= 0;
		}else if(plf == "Mac" && nav == "NN" && ver >= 4){
			// NN4 for Mac
			width -= 16;
			height -= 0;
		}else if(nav == "NN" && ver >= 4){
			// NN4(for Win)
			width -= 0;
			height -= 0;
		}else if(plf == "Mac" && nav == "MSIE" && ver >= 5){
			// IE5 for Mac
			width -= 17;
			height -= 0;
		}else if(plf == "Mac" && nav == "MSIE" && ver >= 4){
			// IE4 for Mac
			width -= 17;
			height -= 0;
		}else if(nav == "MSIE" && ver >= 5){
			// IE5(for Win)
			width += 0;
			height += 0;
		}else if(nav == "MSIE" && ver >= 4){
			// IE4(for Win)
			width += 0;
			height += 0;
		}else{
			// other
			width += 0;
			height += 0;
		}
	}

	if(status == '1'){
		if(plf == "Mac" && nav == "MSIE" && ver >= 5){
			// IE5 for Mac
			width -= 0;
			height -= 0;
		}else if(plf == "Mac" && nav == "MSIE" && ver >= 4){
			// IE4 for Mac
			width -= 0;
			height += 16;
		}else{
			// other
			width += 0;
			height += 0;
		}
	}

	if(toolbar == '1'){ toolbar = 'yes'; }else{ toolbar = 'no'; }
	if(location == '1'){ location = 'yes'; }else{ location = 'no'; }
	if(directories == '1'){ directories = 'yes'; }else{ directories = 'no'; }
	if(status == '1'){ status = 'yes'; }else{ status = 'no'; }
	if(menubar == '1'){ menubar = 'yes'; }else{ menubar = 'no'; }
	if(resizable == '1'){ resizable = 'yes'; }else{ resizable = 'no'; }
	if(scrollbars == '1'){ scrollbars = 'yes'; }else{ scrollbars = 'no'; }
	if(dependent == '1'){ dependent = 'yes'; }else{ dependent = 'no'; }

	if(plf == "Mac" && nav == "MSIE" && ver == 4){
		newWindow = null;
	}
	if(newWindow){
		if(!newWindow.closed){
			if(newWindow.name == name){
				newWindow.location.href = url;
				return;
			}else{
				closeWin();
			}
		}
	}
	var win_size = 'width=' + width + ',height=' + height;
	var win_attr = 'toolbar=' + toolbar + ',location=' + location + ',directories=' + directories + ',status=' + status + ',menubar=' + menubar + ',resizable=' + resizable + ',scrollbars=' + scrollbars + ',dependent=' + dependent;

	newWindow = open(url, name, win_attr + ',' + win_size);
	newWindow.name = name
	newWindow.opener = self;
}
function closeWin(){
	if(newWindow){
		if(!newWindow.closed){
			newWindow.close();
			newWindow = null;
		}
	}
}

