// www.oneworldclassrooms.org
// JavaScript Document

_fullscreen=false;

function toggle_fullscreen(){
	if(!_fullscreen){
		window_expand(screen.width,screen.height,985,700);
		_fullscreen=true;
	}else{
		window_expand(1000,700,screen.width,screen.height);
		_fullscreen=false;
	}
}

function popup_main(){
	window.open('main.htm','_ccproject_main','width=985,height=700');
	window.opener='self';
//	window.close();
}

function isIE(){
	return navigator.appName=="Microsoft Internet Explorer";
}
function isNetscape(){
	return navigator.appName=="Netscape";
}
function isOpera(){
	return navigator.appName=="Opera";
}
function isMac(){
	return navigator.platform=="MacPPC";
}
function isodd(n){
	return !(Math.floor(n/2)==n/2);
}

//window popup and resizing codes
function _popup(url,target,feature){
	w=open(url,target,feature);
	w.focus;
}
function window_popup(){
	_popup('popup.htm','_hopesun_main','width=350,height=200'+((isNetscape()&&isMac())?',resizable':''));
}
function window_center(w,h){
	window.resizeTo(w,h);
	window.moveTo((screen.width-w)/2,(screen.height-h)/2);
}
function window_expand(w,h,w0,h0,steps) { //v2.0
	document.body.style.display=="none";
	if(!steps)
		steps=10;
	if(!w0)
		w0=350;
	if(!h0)
		h0=200;
	window_center(w0,h0);
	if(isIE()){
		dw=w0-window.document.body.clientWidth;
		dh=h0-window.document.body.clientHeight;
	}else{
		dw=w0-window.innerWidth;
		dh=h0-window.innerHeight;
	}
	if(isOpera())
		dw-=16;
//	alert('dw='+dw+' app='+navigator.appName);
	window.focus();
	for(n=0;n<=steps;n++){
		if(window.closed)
			return;
		window_center(w0+(w-w0)/steps*n+dw,h0+(h-h0)/steps*n+dh);
	}
	window_center(w+dw,h+dh);
	if(isNetscape()&&isMac())
		window.setResizable(false);
}
