function popupOpen() {		// parameter.reihenfolge: URL, WIDTH, HEIGHT
	var w,h,url,aw,ah;
	var a=popupOpen.arguments;
	if (a.length==0) return;
	url=a[0];
	if (a.length>1) {
		w=a[1]; h=a[2];
	}
	else {
		w=500; h=400
	}
	win=window.open(url,'win_front','toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width='+w+',height='+h);
	if (screen) {
		aw=screen.availWidth;
		ah=screen.availHeight;
		win.moveTo(((aw/2)-(w/2)),((ah/2)-(h/2)));
	}
	win.focus();
}

function openPicture() {		// parameter.reihenfolge: URL, WIDTH, HEIGHT
	var w,h,url,aw,ah;
	var a=openPicture.arguments;
	if (a.length==0) return;
	url=a[0];
	if (a.length>1) {
		w=a[1]; h=a[2];
	}
	else {
		w=500; h=400
	}
	win_pic=window.open(url,'win_pic','toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width='+w+',height='+h);
	if (screen) {
		aw=screen.availWidth;
		ah=screen.availHeight;
		win_pic.moveTo(((aw/2)-(w/2)),((ah/2)-(h/2)));
	}
	win_pic.focus();
}

agt = navigator.userAgent.toLowerCase();
is_ie= ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
is_mac	   = (agt.indexOf("mac") != -1);
is_mac_ie = (is_ie && is_mac);

old_ob=false;
max_num=1;
function trace(o) {
	var out="";
	for (z in o) {
		if (o[z]!="" && o[z]!=null)	out+=z+" = "+o[z]+"; <br>";
	}
	debug(out)
}
function debug(msg) {
	if (typeof w == "undefined" || w.closed ) {
		w=window.open('','w','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=640,height=600');
	}
	w.document.write(msg+"<br>");
}

function cNaviInit(pmax_num) {
	max_num=Number(pmax_num);
	show("1");
}

function show(ob) {
	if (old_ob!==false) {
		hide(old_ob);
		if (ob.indexOf('txt') != -1) 
			var b=max_num + Number(ob.substr(ob.indexOf('_')+1));
		else
			var b=Number(ob);
		if (b>1) {
			for (var z=1; z<b; z++) {
				if (z > max_num) 
					hide('txt_'+(z-max_num));
				else
					hide(z);
			}
		}
	}
	var div=document.getElementById(ob);
	if (div)
		div.style.display="block";
	old_ob=ob;
}

function hide(ob) {
	var div=document.getElementById(ob);
	if (div)
		div.style.display="none";
}

////// Scrolling ///////
var scroll_speed=10;
var scroll_tid=null;

function startScrolling(dir,obj) {
	if (dir=='down') 
		var speed= scroll_speed;
	else 
		var speed= -scroll_speed;
	scroll_tid=setInterval('_scrollDiv("'+obj+'",'+speed+')', 50);
}
function _scrollDiv(obj,speed) {
	obj=document.getElementById(obj);
	var y=obj.style.top;
	if (y=='') y=0;
	else {
		y=parseInt(y.substring(0,y.indexOf('p')));
		if (y+speed > 0 && speed>0) {
			y = -speed;
			stopScrolling();
		}
		if (obj.scrollHeight+(y+speed) < obj.parentNode.clientHeight && speed<0) {
			y -= speed;
			stopScrolling();
		}
	}

	obj.style.top=(y+speed)+'px';
}
function stopScrolling() {
	clearInterval(scroll_tid);
}

