/**
 *
 * Contains global javascript related to admin pages
 *
 * @version 1.0 
 * @author Ivor
 * @package WEB4 1.2
 * @copyright All intellectual property rights are reserved. 
 * @category  JavaScript
 * @since Unknown
 * @license http://www.netjam.nl/over-netjam/algemene-voorwaarden/index.html
 *
 *             _    _                 
 *  _ __   ___| |_ (_) __ _ _ __ ___  
 * | '_ \ / _ \ __|| |/ _` | '_ ` _ \ 
 * | | | |  __/ |_ | | (_| | | | | | |
 * |_| |_|\___|\__|/ |\__,_|_| |_| |_|
 *               |__/                 
*/

$(document).ready( function() {
	$('#homeicons').masonry({ singleMode: true, animate: true });	
	
	$('#legend').masonry({ singleMode: true, animate: true });	
	
//	$('img.menuicon').bind('load', function (e) {
//		$(this).pixastic("desaturate");
//	});
	
	$('a.popupwindow').popupWindow({ 
		height:500, 
		width:800, 
		top:50, 
		left:50 
		}); 	
	

});


function forceCron() {
	$.get(sLinkRoot+'/do/admin_admin/forcedailycron', function() {
		document.location.href = sLinkRoot+'/view/admin_admin/home';
	});
	
}

/**
 * Global functions
 */

function reloadFromDbAlert() {

	$('#dbalter').html('&nbsp;');
	setTimeout( function() {
		window.location.href='#';
		parent.window.location.reload(true);
	},1000);
	 	
	
	
	
	

	
}

function ajaxLoading() {
	$('#loader').show();
}
 
function ajaxStopLoading() {
	$('#loader').hide();
}

function isdefined( variable)
{
    return (typeof(window[variable]) == "undefined")?  false: true;
}
function setSession(sKey,sValue) {
	 
	 
	 	 $.ajax({
	  		type: "POST",
	  		url: sLinkRoot+"/do/system/setsession",
	  		data: "key="+sKey+"&value="+sValue,
	  		dataType: "text",
	  		async: false
	 	 });
	
 
 }


function switchTab(sUrl) {
	setSession('aftertipedit',sUrl);
	$('#admin_form').submit();
}
