var ie = (function(){
	var undef,
		v = 3,
		div = document.createElement('div'),
		all = div.getElementsByTagName('i');
	while (
		div.innerHTML = '<!--[if gt IE ' + (++v) + ']><i></i><![endif]-->',
		all[0]
	);
	return v > 4 ? v : undef;
}());

function attowpopup(size, width, height) {
	var browser = navigator.appName;
	width = 990;
	height = 670;
	swidth = ((screen.width/2)-(width/2));
	sheight = ((screen.height/2)-(height/2));
	macwidth = width-16;
	macheight = height-16;
	safariwidth = width;
	safariheight = height;
	ie9width = width-4;
	ie9height = height-4;
	
	if ((browser == "Microsoft Internet Explorer") && (navigator.appVersion.lastIndexOf('Mac') != -1)){ 
		if (width < screen.width && height < screen.height) {
			window.open('http://tt.kfsnet.co.jp/','attow','width='+ macwidth +',height='+ macheight +',top='+ sheight +',left='+ swidth +',scrollbars=no,resizable=no');
		}else {
			window.open('http://tt.kfsnet.co.jp/','attow','width='+ macwidth +',height='+ macheight +',top='+ sheight +',left='+ swidth +',scrollbars=yes,resizable=no');
		}
	}else if (navigator.userAgent.indexOf('Safari') != -1){
		if (width < screen.width && height < screen.height) {
			window.open('http://tt.kfsnet.co.jp/','attow','width='+ safariwidth +',height='+ safariheight +',top='+ sheight +',left='+ swidth +',scrollbars=no,resizable=no');
		}else {
			window.open('http://tt.kfsnet.co.jp/','attow','width='+ macwidth +',height='+ macheight +',top='+ sheight +',left='+ swidth +',scrollbars=yes,resizable=no');
		}
	} else if (ie == 9) {
		if (width < screen.width && height < screen.height) {
			window.open('http://tt.kfsnet.co.jp/','attow','width='+ ie9width +',height='+ ie9height +',screenY='+ sheight +',screenX='+ swidth +',top=' + sheight + ',left=' + swidth + ',menubar=no,toolbar=no,location=no,status=no,scrollbars=no,resizable=no');
		}else {
			window.open('http://tt.kfsnet.co.jp/','attow','width='+ ie9width +',height='+ ie9height +',screenY='+ sheight +',screenX='+ swidth +',top=' + sheight + ',left=' + swidth + ',menubar=no,toolbar=no,location=no,status=no,scrollbars=yes,resizable=no');
		}
	} else {
		if (width < screen.width && height < screen.height) {
			window.open('http://tt.kfsnet.co.jp/','attow','width='+ width +',height='+ height +',screenY='+ sheight +',screenX='+ swidth +',top=' + sheight + ',left=' + swidth + ',menubar=no,toolbar=no,location=no,status=no,scrollbars=no,resizable=no');
		}else {
			window.open('http://tt.kfsnet.co.jp/','attow','width='+ width +',height='+ height +',screenY='+ sheight +',screenX='+ swidth +',top=' + sheight + ',left=' + swidth + ',menubar=no,toolbar=no,location=no,status=no,scrollbars=yes,resizable=no');
		}
	}
}

