/**
 * '''' Add by michael for OOIS CR-09
 * '''' On 28-Jul-2009 
 * '''' ID	Item
 * '''' 10	Enlarge map window to maximum 40% of screen size(*)
 *
 * 20090728 create by: Michael Fung
 * For calc the map viewer window size.
 *
 */
 		var msg =""
		
		//calc Max Map Size
		//var maxscreenfactor = 0.63245553203367586639977870888654 ;  //  40/100  square root
		var maxscreenfactor = Math.sqrt(40/100);
		
		//msg += 'maxscreenfactor = 0.63245553203367586639977870888654 ' + '\n';
		//msg += 'maxscreenfactor = ' + maxscreenfactor + '\n';
		
		var screenwidth = screen.width ; 
		var screenheight = screen.height ; 
		
		var minresolution = true;
		var minresolutionmsg = '';
		
		//var lang = '<%=ctype(Session("Language"),string).tolower%>';
		var lang = 'chs'
		switch (lang) {
		case 'cht': minresolutionmsg = '屏幕分辨率太低，請更改為800 * 600或以上。'; break;
		case 'chs': minresolutionmsg = '屏幕分辨率太低，请更改为800 * 600或以上。'; break;
		default   : minresolutionmsg = 'Screen resolution too low, please change to 800 * 600 or above.';
		}
	
		//screenwidth = 1280;
		//screenheight = 800;
	
		if (screenwidth < 800 || screenheight < 600 ) {minresolution = false};
		
		if (minresolution == false){
			alert(minresolutionmsg);
		}else{
			msg += 'minresolution = ' + minresolution + '\n';
			
			//screenwidth = 1280;
			//screenheight = 600;
			
			var maximgwidth = Math.floor(screenwidth * maxscreenfactor);
			var maximgheight = Math.floor(screenheight * maxscreenfactor);
					 
			//calc Map Window Size
			var maxwinwidth ;
			var maxwinheight ;
			
			var mintoolbarwidth = 550;
			var minzoomtoolheight= 250;
			// for GOS set layer control width to 320
			// for SPP set layer control width to 250
			var minlayercontrolwidth = 250;
			var minpantoolwidth= 15;
			// for GOS set zoom tool width to 0
			// for SPP set zoom tool width to 40
			var minzoomtoolwidth= 40;
			
			var minbannerheight= 72;
			var mintoolbarheight= 48;
			var minpantoolheight= 15;
			
			var rightframe4width = minpantoolwidth + maximgwidth + minpantoolwidth + minzoomtoolwidth ;
			var rightframe4height = minpantoolheight + maximgheight + minpantoolheight ;
	
			if (mintoolbarwidth > rightframe4width ) { rightframe4width = mintoolbarwidth};
			if (minzoomtoolheight > rightframe4height ) { rightframe4height = minzoomtoolheight};
			
			// layer control +  frame4
			maxwinwidth = minlayercontrolwidth + rightframe4width ;
	
			// banner + tool bar + frame4
			maxwinheight = minbannerheight + mintoolbarheight + rightframe4height ;
	
			var widthPass = true;
			var heightPass = true;
			
			if (maxwinwidth > screenwidth) { widthPass = false  };
			if (maxwinheight > screenheight) { heightPass = false  };
	
			msg += 'screen.width = ' + screenwidth + '\n';
			msg += 'screen.height = ' +  screenheight + '\n';
			msg += '\n';
			msg += 'maximgwidth = ' +  maximgwidth + '\n';
			msg += 'maximgheight = ' +  maximgheight + '\n';
			msg += '\n';
			msg += 'rightframewidth = ' +  rightframe4width + '\n';
			msg += 'rightframeheight = ' +  rightframe4height + '\n';
			msg += '\n';
			msg += 'maxwinwidth = ' +  maxwinwidth + '\n';
			msg += 'maxwinheight = ' +  maxwinheight + '\n';
			msg += '\n';
			msg += 'widthPass = ' +  widthPass + '\n';
			msg += 'heightPass = ' +  heightPass + '\n';
			msg += '\n';
			
			if (widthPass == false ) { maxwinwidth = screenwidth }  ;
			if (heightPass == false ) { maxwinheight = screenheight }  ;
			
			msg += 'lastest maxwinwidth = ' +  maxwinwidth + '\n';
			msg += 'lastest maxwinheight = ' +  maxwinheight + '\n';
		}

		
