window.addEvents({
	'load':function(){
		$('content').setStyle('min-height',window.getHeight()-240);
		//alert($('footer').offsetHeight);
	},
	'resize':function(){
		$('content').setStyle('min-height',window.getHeight()-240);
	}
});
var ajaxGet = function(what, params, where){
		new Request.HTML({
			headers: {'If-Modified-Since': 'Thu, 1 Jan 1970 00:00:00 GMT','Content-type':'text/html; charset=utf-8'},
			url: what,
			onRequest:function(){$(document.body).setStyle('cursor','progress');},
			method: 'get',
			evalScripts: true,
			evalResponse: true,
			update: where,
			onSuccess:function(){$(document.body).setStyle('cursor','auto');}
		}).send(params);
	}
var ajaxGetCache = function(what, params, where){
	new Request.HTML({		
		url: what,
		onRequest:function(){$(document.body).setStyle('cursor','progress');},
		method: 'get',
		evalScripts: true,
		evalResponse: true,
		update: where,
		onSuccess:function(){$(document.body).setStyle('cursor','auto');}
	}).send(params);
}
var ajax = function(what, params, where){
	new Request({
		method: 'get',
		onRequest:function(){$(document.body).setStyle('cursor','progress');},
		url: what+"?"+params,
		evalScripts:true,
		onSuccess:function(responseText){
			where.innerHTML=responseText;
			$(document.body).setStyle('cursor','auto');
		}
	}).send();
}
var ajaxPost = function(form, what, where){
	new Request.HTML({		
		url: what,
		onRequest:function(){$(document.body).setStyle('cursor','progress');},
		evalScripts: true,
		evalResponse: true,
		update: where,
		onSuccess:function(){$(document.body).setStyle('cursor','auto');}
	}).post(form);
}
var preview = function(){
	ajaxGet('projects.php','preview',$('projects_preview'));
}
var cancelpreview = function(){
    $('projects_preview').setStyles({'position':'absolute','height':'0px','width':'0px','top':'0px','left':'0px','border-bottom':'0px'});
    $('projects_preview').innerHTML='';
}
var sendInfo = function(where, what, spanstyle){
    var style = '';
    switch(spanstyle){
        case 'warning':
            style = 'background-color: #ff0000; color: #fff;';
        break;
        case 'info_blue':
            style = 'background-color: #0000ff; color: #fff;';
        break;
        case 'info_black':
            style = 'background-color: #000; color: #fff;';
        break;
        default:
            style = 'background-color: #fff; color: #000;';
        break;
    }
    where.innerHTML = "<span style='"+style+" padding: 3px;'>"+what+"</span>";
    (function(){where.getElement('span').fade('out');}).delay(3000);
}