// $_meef is main object containing javascript logic
var _meef = {};
// very common stuff declared here only
//
_meef.debug = function(s)	{
	if (typeof console != "undefined" && typeof console.debug != "undefined") {
			console.log(s);
	} else {
		alert(s);
	}
};
_meef.scrollTo = function(el)	{
	// use jQuery.scrollTo for scrolling above element
	if (!$.scrollTo)	return;
	$.scrollTo('#' + el, {duration: 300, offset: {top: -30} });
}
_meef.fixPng = function(el)	{
	// fix png without autoPNG (e.g. on logo before loading the complete page)
	var msie6 = false;
	if ($.browser.msie && parseInt($.browser.version) == 6) msie6 = true;
	if (!msie6)	return;

	$(el).each(function(){
		$(this).removeClass('autoPng').ifixpng();
	});
}
_meef.popup = function(self, width, height)	{
	  var url = $(self).attr('href');
	  var newwindow = window.open(url,'popup','width=' + width + ',height=' + height + ',scrollbars=yes,top=40');
	  if (newwindow.focus)	newwindow.focus();
	  return false;
}
$.bind = function(object, method){
	var args = Array.prototype.slice.call(arguments, 2);  
	return function() {
		var args2 = [this].concat(args, $.makeArray( arguments ));
		return method.apply(object, args2);  
	};  
};  
/*
 * jQuery shuffle
 *
 * Copyright (c) 2008 Ca-Phun Ung <caphun at yelotofu dot com>
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://yelotofu.com/labs/jquery/snippets/shuffle/
 *
 * Shuffles an array or the children of a element container.
 * This uses the Fisher-Yates shuffle algorithm <http://jsfromhell.com/array/shuffle [v1.0]>
 */
 
(function($){

	$.fn.shuffle = function() {
		return this.each(function(){
			var items = $(this).children().clone(true);
			return (items.length) ? $(this).html($.shuffle(items)) : this;
		});
	}
	
	$.shuffle = function(arr) {
		for(var j, x, i = arr.length; i; j = parseInt(Math.random() * i), x = arr[--i], arr[i] = arr[j], arr[j] = x);
		return arr;
	}
	
})(jQuery);
/*
 * JQuery Random Plugin
 * 
 * Adds two random number functions to jQuery -
 * one to find a random number and one to find a random number between a max and min limit.
 * 
 * Version 1.0
 * 
 * by Christian Bruun - 23. jan 2009
 * 
 * Like it/use it? Send me an e-mail: rockechris@rockechris.com
 * 
 * License: None. Use and abuse. Comes with no warranty, of course!
 * 
 * 
 * Usage:
 * $.random(int);
 * $.randomBetween(min, max);
 * 
 * Code found at:
 * http://www.merlyn.demon.co.uk/js-randm.htm
 * 
 */
jQuery.extend({
	random: function(X) {
	    return Math.floor(X * (Math.random() % 1));
	},
	randomBetween: function(MinV, MaxV) {
	  return MinV + jQuery.random(MaxV - MinV + 1);
	}
});
