/*
 * order array randomly  
 */
function orderRandom() {

	return ( Math.round( Math.random() ) - 0.5 );

}

/*
 * checks for a given browser name
 */ 
function checkBrowserName(name){  

	var agent = navigator.userAgent.toLowerCase();  

	if (agent.indexOf(name.toLowerCase()) > -1) {  

		return true;

	}

	return false;  

}

/*
 * proves real visibility of an object
 */
jQuery.extend(

		jQuery.expr[ ':' ], {
			
			reallyvisible : function (a) {
				
				return !(jQuery(a).is(':hidden') || jQuery(a).parents(':hidden').length);
			
			}
		
		}

);

/*
 * opens newsletter windows
 */
function newsletter() {
	
	var win = window.open('http://www.mz-x.com/newsletter/form.php', '', 'width=400, height=400, toolbar=no, location=no, status=no'); 
	return true;

}

/*
 * opens external links
 */
function setExternalLinks() {  

	$(function() {
		
		$("a[rel*='external']").click(function(){
			
			this.target = "_blank";
		});

	});
	
	return true;

}
		
		
/*
 * CryptMail by dirk alban adler - see http://cryptmail.klitsche.org
 */
function mailto(s) {
	
	document.location.href =  "mailto:" + unCryptMail(s);

}

function unCryptMail(r) {

	r		= unescape(r);
	
	var l	= r.length;
	var o	= "";
	
	for (i = 0; i < l; ++i) {
		
		o += String.fromCharCode (r.charCodeAt (i) - 1);
		
	}
	
	return o;
	
}

function cryptMail(r) {
	
	var l	= r.length;
	var o	= "";
	
	for (i = 0; i < l; ++i) {
		
		o += String.fromCharCode (r.charCodeAt (i) + 1);

	}
	
	return escape(o);

}
