function LinkFocus( link, target ) {

	var w = window.open( link, target, "menubar=1,status=1,toolbar=1,directories=1,location=1,resizable=1,scrollable=1,scrollbars=1" );
	w.focus();
}

function LaunchActivitySubmit( topic, activity ) {

//	var url = "http://www.dlese.org/cgi-bin/vgee_submit_activity.pl";
	var url = "/cgi-bin/vgee_submit_activity.pl";
	var winHeight = "480";

	if ( topic && activity )
		url += "?topic=" + topic + "&activity=" + activity;

	if ( window.screen ) {

		if ( screen.availHeight )
			winHeight = Math.round( screen.availHeight * 0.8 );
		else
			winHeight = Math.round( screen.height * 0.8 );
	}

	var w = window.open( url, "vgee_activity_submit", "menubar=0,status=1,toolbar=0,directories=0,location=0,resizable=1,scrollable=1,scrollbars=1,width=600,height=" + winHeight );
	w.focus();
}

function LaunchActivityManager() {

	var url = "/vgee/teacherGuide/cgi-bin/vgee_review_activity.pl";
	var winHeight = "480";

	if ( window.screen ) {

		if ( screen.availHeight )
			winHeight = Math.round( screen.availHeight * 0.8 );
		else
			winHeight = Math.round( screen.height * 0.8 );
	}

	var w = window.open( url, "vgee_activity_review", "menubar=0,status=1,toolbar=0,directories=0,location=0,resizable=1,scrollable=1,scrollbars=1,width=600,height=" + winHeight );
	w.focus();
}

function LaunchActivityViewer( dest ) {

	var url = "/cgi-bin/vgee_view_activity.pl";
	var winHeight = "480";
	
	if ( dest )
		url = dest;

	if ( window.screen ) {

		if ( screen.availHeight )
			winHeight = Math.round( screen.availHeight * 0.8 );
		else
			winHeight = Math.round( screen.height * 0.8 );
	}

	var w = window.open( url, "vgee_activity_view", "menubar=0,status=1,toolbar=0,directories=0,location=0,resizable=1,scrollable=1,scrollbars=1,width=600,height=" + winHeight );
	w.focus();
}


var rclickmsg = "Please do not use the 'Back' function of your browser while submitting activities!";
var agt = navigator.userAgent.toLowerCase();
var is_sun   = ( agt.indexOf( "sunos" ) != -1 );
var is_win   = ( ( agt.indexOf( "win" ) != -1 ) || ( agt.indexOf( "16bit" ) != -1 ) );

function click( e ) {

    if ( document.all ) {

        if ( event.button == 2 || event.button == 3 ) {

		if ( rclickmsg )
	            alert( rclickmsg );
            return false;
        }
    }
    if ( document.layers ) {

        if ( e.which == 2 || e.which == 3 ) {

		if ( rclickmsg )
	            alert( rclickmsg );
            return false;
        }
    }
    return false;
}

function DisableRightClick() {

    if ( is_win || is_sun ) {

        if ( document.layers ) {

            document.captureEvents( Event.MOUSEDOWN );
        }
        document.onmousedown = click;
        window.onmousedown = click;
    }
    return true;
}
