function openInRightFrame(url) {

  parent.newsFrame.location.href=url;

}

function a(txt) { 
self.status = txt 
} 

function b() { 
self.status = "" 
}

function onSubject(page)
{

  parent.mainFrame.location.href="subject.php?page=" + page
  parent.newsFrame.location.href="subject.php?page=" + page + "&amp;place=right"

}


function onStartpage()
{
	parent.location.href="/geoscience";
}

function showInfo(id) {

  parent.mainFrame.location.href = "/getinfo.php?id=" + id;

}

function popUp(link, title, w, h)
{
    nLeft=(screen.width/2)-(w/2);
    nTop=(screen.height/2)-(h/2);
    
    wnd=window.open(link, title, "width="+w+", height="+h+",top="+nTop+",left="+nLeft+",resizable=no,scrollbars=no");
    wnd.focus();
}

function checkfile() {
	filepath = form1.file.value;

	ext = filepath.substring(filepath.length - 3, filepath.length);
	ext = ext.toLowerCase();
	if (filepath.length < 3) {
		alert("Please select a file!");
		return false;		
	} else {
		if (ext != "zip") {
			alert("The file must be a .zip file!");
			return false;
		} else {
			window.document.body.style.cursor = "wait";
			return true;
		}
	}
}


function checked(grp) {

	var isOK = false;
	for (var i=0; grp[i]; i++) {
		if (grp[i].checked) {
			isOK = true;
			break;
		}
	}

	if (!isOK) {
		alert('You need to check a radio button.');
		return isOK;
	}

}


function legalNotice() {
	newwindow=window.open('page.php?id=28','Legal_Notice','height=300,width=400,top=100,left=100,resizable=no,scrollbars=yes,menubar=no,toolbar=no,status=no,location=no');
	if (window.focus) {newwindow.focus()}
	return false;
}

function URLEncode(string)
{
	// The Javascript escape and unescape functions do not correspond
	// with what browsers actually do...
	var SAFECHARS = "0123456789" +					// Numeric
					"ABCDEFGHIJKLMNOPQRSTUVWXYZ" +	// Alphabetic
					"abcdefghijklmnopqrstuvwxyz" +
					"-_.!~*'()";					// RFC2396 Mark characters
	var HEX = "0123456789ABCDEF";

	var plaintext = string;
	var encoded = "";
	for (var i = 0; i < plaintext.length; i++ ) {
		var ch = plaintext.charAt(i);
	    if (ch == " ") {
		    encoded += "+";				// x-www-urlencoded, rather than %20
		} else if (SAFECHARS.indexOf(ch) != -1) {
		    encoded += ch;
		} else {
		    var charCode = ch.charCodeAt(0);
			if (charCode > 255) {
			    alert( "Unicode Character '" + ch + "' cannot be encoded using standard URL encoding.\n" +
				        "(URL encoding only supports 8-bit characters.)\n" +
						"A space (+) will be substituted." );
				encoded += "+";
			} else {
				encoded += "%";
				encoded += HEX.charAt((charCode >> 4) & 0xF);
				encoded += HEX.charAt(charCode & 0xF);
			}
		}
	}

	return encoded;
}
