window.onload =  function () {document.images['mTab'].onmouseup=cms;}

var mapSize = 1;


function getRefToDiv(divID,oDoc) {
  if( document.getElementById ) {
    return document.getElementById(divID); }
  if( document.all ) {
    return document.all[divID]; }
  if( !oDoc ) { oDoc = document; }
  if( document.layers ) {
    if( oDoc.layers[divID] ) { return oDoc.layers[divID]; } else {
      //repeatedly run through all child layers
      for( var x = 0, y; !y && x < oDoc.layers.length; x++ ) {
        //on success, return that layer, else return nothing
        y = getRefToDiv(divID,oDoc.layers[x].document); }
    return y; } }
  return false;
}



function cms() {
    
    if (mapSize == 1) {
	
	var newWidth = 550;
	var newHeight = 450;
	
	myRefMap = getRefToDiv('map');
	myRefInfo = getRefToDiv('infobox');
	myRefList = getRefToDiv('pslist');
	myRefButton = getRefToDiv('chSize');
	myRefHome = getRefToDiv('returnHome');
	
	if( myRefMap.style )	{ myRefMap = myRefMap.style; }
	if( myRefInfo.style )	{ myRefInfo = myRefInfo.style; }
	if( myRefList.style )	{ myRefList = myRefList.style; }
	if( myRefButton.style )	{ myRefButton = myRefButton.style; }
	if( myRefHome.style )   { myRefHome = myRefHome.style; }
	
	//Get Center

	var psMapCenter = gMap.getCenter();
	
	if( myRefMap.resizeTo )	{ myRefMap.resizeTo( newWidth, newHeight ); }
	
	var noPx = document.childNodes ? 'px' : 0;
	
	myRefMap.width = newWidth + noPx;
	myRefMap.pixelWidth = newWidth;
	myRefMap.height = newHeight + noPx;
	myRefMap.pixelHeight = newHeight;
	gMap.checkResize();
	gMap.panDirection(1, 1);
	
	myRefInfo.left = newWidth + 10 +  noPx;
	
	myRefList.top = 650 + noPx;
	myRefList.width = newWidth - 8 + noPx;
	myRefList.pixelWidth = newWidth - 8;
	
	myRefButton.top = 650 + noPx;
	myRefButton.left = 495 + noPx;
	
	myRefHome.top = 888 + noPx;
	myRefHome.width = newWidth - 2 + noPx;
	
	
	document.images['mTab'].src = "images/maptosmall.jpg";
	
	
	//gMap.removeControl(psSmallMapControl);
	//psLMC = new GLargeMapControl();
	//gMap.addControl(psLMC);
	
	//Re-set Center
	
	gMap.setCenter(psMapCenter);

	mapSize = 2;

    } else {
	
	var newWidth = 300;
	var newHeight = 268;
	
	myRefMap = getRefToDiv('map');
	myRefInfo = getRefToDiv('infobox');
	myRefList = getRefToDiv('pslist');
	myRefButton = getRefToDiv('chSize');
	myRefHome = getRefToDiv('returnHome');
	
	if( myRefMap.style )	{ myRefMap = myRefMap.style; }
	if( myRefInfo.style )	{ myRefInfo = myRefInfo.style; }
	if( myRefList.style )	{ myRefList = myRefList.style; }
	if( myRefButton.style )	{ myRefButton = myRefButton.style; }
	if( myRefHome.style )   { myRefHome = myRefHome.style; }
	
	//Get Center
	
	var psMapCenter = gMap.getCenter();
	
	if( myRefMap.resizeTo ) { myRefMap.resizeTo( newWidth, newHeight ); }
	
	var noPx = document.childNodes ? 'px' : 0;
	
	myRefMap.width = newWidth + noPx;
	myRefMap.pixelWidth = newWidth;
	myRefMap.height = newHeight + noPx;
	myRefMap.pixelHeight = newHeight;
	gMap.checkResize();
	gMap.panDirection(-1, -1);
	
	myRefInfo.left = newWidth + 10 + noPx;
	
	myRefList.top = 468 + noPx;
	myRefList.width = newWidth - 8 + noPx;
	myRefList.pixelWidth = newWidth - 8;
	
	myRefButton.top = 468 + noPx;
	myRefButton.left = 245 + noPx;
	
	myRefHome.top = 706 + noPx;
	myRefHome.width = newWidth - 2 + noPx;
	
	
	document.images['mTab'].src = "images/maptobig.jpg";
	
	//gMap.removeControl(psLMC);
	//gMap.addControl(psSmallMapControl);
	
	//Re-set Center
		
	gMap.setCenter(psMapCenter);

	
	mapSize = 1;
    }
gMap.checkResize();
}