 /*
 * openWind(url,h,w,v,s)
 *	where:
 *		url => url to load in the window
 *		h => window height
 *		w => window width
 *		y => vertical position top/bottom/center
 *		x => horizontal postion left/right/center
 */


var hwyx = new Array(320,450,'top','left');


    function openWind(){
    	//h = 350;
    	//w = 450;
    	if(arguments.length == 0)  document.writeln("error");
    	//alert("arguments: "+String(arguments));
    	aPage = arguments[0];
    	switch (arguments.length) {
			case 1:
				break;
			case 2:
				// could be of the form h=nnn, w=nnn or nnn
				retVal(0,arguments[1])
				break;
			case 3:
				retVal(0,arguments[1]);
				retVal(1,arguments[2]);
				break;
			case 4:
				retVal(0,arguments[1]);
				retVal(1,arguments[2]);
				retVal(2,arguments[3]);
				break;
			case 5:
				retVal(0,arguments[1]);
				retVal(1,arguments[2]);
				retVal(2,arguments[3]);
				retVal(3,arguments[4]);
				break;			
		}
		//alert('hwvz:'+hwyx.toString());
		// setup the position of the window
		switch (hwyx[2]) {
			case 'top':
				hwyx[2] = 0;
				break;
			case 'bottom':
				hwyx[2] = screen.availHeight - hwyx[0];
				break;
			case 'center':
				hwyx[2] = ((screen.availHeight)/2) - ((hwyx[0])/2);
				break;
		}
		switch (hwyx[3]) {
			case 'left':
				hwyx[3] =0;
				break;
			case 'right':
				hwyx[3] = screen.availWidth - hwyx[1];
				break;
			case 'center':
				//alert(hwyx[3]);
				hwyx[3] = ((screen.availWidth)/2) - ((hwyx[1])/2);
				break;
		}
		winf = "height="+hwyx[0]+",width="+hwyx[1]+",scrollbars=yes,titlebar=yes";
		//winf = winf +",resizable=yes, screenY="+hwyx[2]+", screenX="+hwyx[3];
		winf = winf +",resizable=yes, top="+hwyx[2]+", left="+hwyx[3];
		//alert(winf);
		atitle = "";
		wGloss = window.open(aPage,atitle,winf);
	}


function retVal(no,inp) {
//	alert('no:'+no+"  inp: "+inp);
	if(isNaN(inp)) {
	//parse 
		inp = inp.replace(/\ /g,'');
		args = inp.split('=');
		if(inp.length ==1) {
			args[0]  = '';
			args[1] = inp;
		}
		switch (args[0]) {
			case 'h':
				hwyx[0] = args[1];
				break;
			case 'w':
				hwyx[1] = args[1];
				break;
			case 'y':
				hwyx[2] = args[1];
				break;
			case 'x':
				hwyx[3] = args[1];
				break;
			default:
				hwyx[no] = inp;
				break;
		}
	} else {
		if(inp != '') hwyx[no] = inp;
	}
	//alert("from retVal: "+hwyx.toString());
}		
