       var dvname = "flashcontent";
       var dh=1;
       var ti;
       var nh;
       var d;
       var jsready = false;
       var gmsready = false;
	var TimeToFade = 1000;
	function fade(eid){
	    var e = document.getElementById(eid);
	    if(e == null) return;
            e.FadeState = -1;
	    e.FadeTimeLeft = TimeToFade;
	    setTimeout("doFade(" + new Date().getTime() + ",'" + eid + "')", 33);

        }

	function doFade(lastTick, eid){

	    var curTick = new Date().getTime();
	    var elapsedTicks = curTick - lastTick;
	    var e = document.getElementById(eid);
	    if(e.FadeTimeLeft <= elapsedTicks){

		e.style.opacity = e.FadeState == 1 ? '1' : '0';
		e.style.filter = 'alpha(opacity = ' + (e.FadeState == 1 ? '100' : '0') + ')';
		e.style.display = 'none';
		return;
	    }

	    e.FadeTimeLeft -= elapsedTicks;
	    var newOpVal = e.FadeTimeLeft/TimeToFade;
	    if(e.FadeState == 1) newOpVal = 1 - newOpVal;

	    e.style.opacity = newOpVal;
	    e.style.filter = 'alpha(opacity = ' + (newOpVal*100) + ')';
	    setTimeout("doFade(" + curTick + ",'" + eid + "')", 33);
 	}

       function resizeDiv( a ){
           alert( 'resizeDiv ' + a );
           var o = a.split(",");
	   for( i=0; i<o.length; i++ ){
	       p = o[i];
	       q = p.indexOf('=');
	       if( q > 0 ){
    	           r = p.substring(0,q);
	           q1= p.indexOf('"',q+1);
	           if( q1 > q ){
		       q2 = p.indexOf('"',q1+1);
	               v = p.substring( q1+1,q2 );
		       d = document.getElementById(dvname);
		   } else {
	               v = p.substring( q+1 );
		       d = document.getElementById(dvname);
		   }
		   if( r == 'x' ){ d.style.left = v;  }
		   if( r == 'y' ){ d.style.top = v; }
		   if( r == 'w' ){ d.style.width = v; }
		   if( r == 'h' ){ d.style.height = v; }
		   if( r == 'display' ){ d.style.display = v; }
		   if( r == 'div' ){ dvname = v;  d = document.getElementById(dvname); }
		   if( r == 'gh' ){
			s = 1;
			h = parseInt(d.style.height);
			nh = parseInt(v);
			if( nh > h ){
				dh = 20;
			} else { 
				dh = -20;
			}
			ti = setInterval( "setDivHeight( )", s ); 
		   }    		   
	       }
	   }
       }
	// this interval approach is clunky, but it triggers a flush of the display buffer.
	// setting height directly in a loop doesn't work--does just one refresh at the end.
       function setDivHeight( ){ 
		d.style.height = parseInt(d.style.height) + parseInt(dh);
		if(  ( dh > 0 && parseInt(d.style.height) >= parseInt(nh) ) ||
		     ( dh < 0 && parseInt(d.style.height) <= parseInt(nh) ) ){ 
			clearInterval( ti ); 
			d.style.height = nh;
		}  
	}

	function disableCtrlKeyCombination(e) {
            //list all CTRL + key combinations you want to disable
            var forbiddenKeys = new Array('a', 'd', 'n', 'c', 'x', 'v', 'j');
            var key;
            var isCtrl;
	        if(window.event) {
                	key = window.event.keyCode;     //IE
                	if(window.event.ctrlKey)
                        	isCtrl = true;
                	else
                        	isCtrl = false;
        	} else {
                	key = e.which;     //firefox
                	if(e.ctrlKey)
                        	isCtrl = true;
                	else
                        	isCtrl = false;
        	}

        	//if ctrl is pressed check if other key is in forbiddenKeys array
        	if(isCtrl) {
                	for(i=0; i<forbiddenKeys.length; i++) {
                        	//case-insensitive comparation
                        	if(forbiddenKeys[i].toLowerCase() == String.fromCharCode(key).toLowerCase()) {
                                	alert('Key combination CTRL + '
                                        	+String.fromCharCode(key)
                                        	+' has been disabled.');
                                	return false;
                        	}
                	}
        	}
        	return true;
	}

	// handle events from GeoMuse; watch for 'jsReady' and 'gmsReady' signals as first handshake
	function gmsEvent(ev,msg){
		if( ev == "gmsReady" ){ 
			gmsready = true; 
			fade('prctitle_div');
		}
		else if( ev == "jsReady" ){ return( jsready ); }  // jsready=false until page onLoad event (see following)
		else if( gmsready ){
//        		getSWF("geomuse").gmsEvent(ev,msg);
		        var d = document.getElementById('geomuse');
			d.gmsEvent(ev,msg);
        	}
    	}

	// following should be called after the gms instantiates in the swfobject script...
	function gmsOnLoad(){ 
		jsready = true; 
	}
	function getSWF(movieName){
    	    if (navigator.appName.indexOf("Microsoft") != -1){
	        return window[movieName];
   	    } else {
                return document[movieName];
    	    }
	}

	function toggleDiv( dvname ){
//alert('toggleDiv' + dvname);
	    var d,s;
	    if( document.getElementById ){ // this is the way the standards work
    		d = document.getElementById( dvname );
//alert('got an element');
//  	    else if( document.all ) // this is the way old msie versions work
//      		d = document.all[ dvname ];
//  	    else if( document.layers ) // this is the way nn4 works
//    		d = document.layers[ dvname ];
  	    s = d.style;
//	    alert('style='+s.display);

  	    // if the style.display value is blank we try to figure it out here
//  	    if( s.display=='' && d.offsetWidth != undefined && d.offsetHeight!=undefined)
//    		s.display = ( d.offsetWidth!=0 && d.offsetHeight!=0)? 'block' : 'none';
  	    s.display = (s.display=='' || s.display=='block')? 'none' : 'block';	
  	    s.visibility = (s.visibility=='hidden')? 'visible' : 'hidden';	

            }
	}

