/**
 *
 * File:
 * basic.js
 *
 * Description:
 * Basic javascript functions.
 *
 * Author: Armin Fischer
 *
 */
 
var popup;

/**
 *
 * Checks if a given string is an email address.
 *
 */
function is_mail(email) {
	return email.match(/^[0-9a-zA-Z-\._]+@([0-9a-zA-Z-_]+.)+[0-9a-zA-Z-_]+$/);
}

/**
 *
 * Executed when page is loaded.
 *
 */
function load() {
}

/**
 * 
 * Decodes an email adress.
 *
 */
function mailto(email) {
	var ret = "";
	for (var i=email.length-1; i >= 0; i--)
		ret += String.fromCharCode(email.charCodeAt(i)-5);
	location.href = "mailto:" + ret;
}

/**
 *
 * Trims a string.
 *
 */
function trim(str) {
  return str.replace(/^\s*|\s*$/g,"");
}

/**
 *
 * Opens a popup for a picture.
 *
 */
function show(pic,title) {
	if (popup) {
		
		popup.close();
	}
	popup = window.open("show.php?pic="+pic+"&title="+title,"picture","width=30,height=30,left=100,top=200");	
}

/**
 *
 * Resizes the current window.
 *
 */
function resize(x,y) {
	if (!navigator.userAgent.match(/MSIE/))
		window.resizeTo(x,y+52);
	else
		window.resizeTo(x,y+32);
}

