/**********************************************************
 * Hide from email robots                                 *
 **********************************************************/
 
function nospam(user,domain) {
	locationstring = "mailto:" + user + "@" + domain;
	window.location = locationstring;
}


/**********************************************************
 * External window                                        *
 **********************************************************/

function externalLinks() { 
 if (!document.getElementsByTagName) return; 
 var anchors = document.getElementsByTagName("a"); 
 for (var i=0; i<anchors.length; i++) { 
   var anchor = anchors[i]; 
   if (anchor.getAttribute("href") && 
       anchor.getAttribute("rel") == "external") 
     anchor.target = "_blank"; 
 } 
} 
window.onload = externalLinks;

function add_load_event(func) {

	var oldonload = window.onload;

	if (typeof window.onload != 'function') {

		window.onload = func;

	}

	else{

		window.onload = function() {

			oldonload();

			func();

		}

	}

}


/* start menu code */
/* Safety measurement */
			if (!document.getElementById) {
				document.getElementById = function() {
					return null;
				}
			}



			/*
			 * menuDropdown.js - implements an dropdown menu based on a HTML list
			 * Author: Dave Lindquist (dave@gazingus.org)
			 *
			 * Originally from http://gazingus.org/dhtml/?id=109
			 *
			 * mfischer, 2003.05.07: reworked for own purposes
			 * - Open menus with onmouseover event
			 * - use timeout to closemenu when mouse not over
			 * - renamed all identifier names so we've no namespace clashes
			 *   (lwm - light weight menu)
			 *
			 * mfischer, 2003.05.08:
			 * - use getPosition function to get left/top offset if menu is contained in other elements
			 *
			 * Last time tested: 2003.05.08:
			 * Works in: MSIE55+, MacMSIE51 (OSX) , Win/Gecko, Win/Opera 7.1, Safari 1.0
			 * 
			 */

			var lwmCurrentMenu = null;
			var lwmMenuTimer = null;
			var lwm_MENU_TIMER_TIMEOUT = 500;

			function lwmInitMenu(menuId, triggerId) {
				var menu = document.getElementById(menuId);
				var trigger = document.getElementById(triggerId);

				if (menu == null || trigger == null) {
					return;
				}
					
				menu.onfocus = menu.onmouseover = function() {
					if (lwmMenuTimer == null) {
						return;
					}
					clearTimeout(lwmMenuTimer);
				}
				
				menu.onblur = menu.onmouseout = function() {
					lwmMenuTimer = setTimeout('lwmTimerHideMenu()', lwm_MENU_TIMER_TIMEOUT);
				}

				trigger.onfocus = trigger.onmouseover = function() {
					if (lwmCurrentMenu) {
						lwmCurrentMenu.style.visibility = 'hidden';
					}
					this.showMenu();

					if (lwmMenuTimer == null) {
						return;
					}
					clearTimeout(lwmMenuTimer);
				}

				trigger.onblur = trigger.onmouseout = function() {
					lwmMenuTimer = setTimeout('lwmTimerHideMenu()', lwm_MENU_TIMER_TIMEOUT);
				}

				/* uncomment this function if you want the menus to just show/hide onClick we want clicks on the menus to go to pages */

				/*
				trigger.onclick = trigger.onfocus = function() {	
					if (lwmCurrentMenu == null) {
						this.showMenu(); 
					} else {
						lwmCurrentMenu.style.visibility = 'hidden';
						lwmCurrentMenu = null;
					}
					return false;
					
				}
				*/
				
				trigger.showMenu = function() {
					var pos = lwmGetPosition(this);
					// Wierd MacMSIE5
					if (pos.top == 0) {
						pos.top = 10;
					}
					menu.style.left = pos.left + 'px';
					menu.style.top = pos.top + this.offsetHeight + 'px';
					menu.style.visibility = 'visible';
					lwmCurrentMenu = menu;
				}
			}

			function lwmTimerHideMenu() {
				if (lwmCurrentMenu) {
					lwmCurrentMenu.style.visibility = 'hidden';
				}
			}

			/* Originally from
			 * http://www.faqts.com/knowledge_base/view.phtml/aid/9095/fid/128 , rewritten
			 * for better readability */
			 
			function lwmGetPosition(element) {
				var left = 0;
				var top = 0;
				while (element != null) {
					left += element.offsetLeft;
					top  += element.offsetTop;
					element = element.offsetParent;
				}
				return {left:left, top:top}
			}
			
//*********************************************************************************//
function OpenWindow (c, w, h) {
		  if (!arguments[1]) {w=490}
		  if (!arguments[2]) {h=480}
        detail = window.open(c,'detail','width=' + w + ',height=' + h + ',scrollbars=yes,status=yes,menubar=yes,resizable=yes');
		  detail.focus();
        }	
		  
function OpenScreenshotWindow (c, w, h) {
		  if (!arguments[1]) {w=680}
		  if (!arguments[2]) {h=620}
        screenshot = window.open(c,'detail','width=' + w + ',height=' + h + ',scrollbars=yes,status=yes,menubar=yes,resizable=yes');
		  screenshot.focus();
        }	
		  
//*********************************************************************************//		  
		  function validateEmail(email, msg, optional) {
			if (!email.value && optional) {
			return true;
			}
			var re_mail = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z])+$/;
			if (!re_mail.test(email.value)) {
			alert(msg);
			email.focus();
			email.select();
			return false;
			}
			return true;
			}
			
			function validateString(field, msg, min, max) {
					if (!min) { min = 1 }
					if (!max) { max = 65535 }
					if (!field.value || field.value.length < min || 
					field.value.max > max) {
					alert(msg);
					field.focus();
					field.select();
					return false;
					}
					
					return true;
					}
		  








