﻿var LOADING = '/media/a_loading.gif';
var LOADING_SMALL = '/media/a_loading_small.gif';
var AJAX_LOADING = '<img src="'+LOADING+'" alt="Chargement..." height="32" width="32" />';
var AJAX_LOADING_SMALL = '<img src="'+LOADING_SMALL+'" alt="Chargement..." height="16" width="16" />';

function if_alert ($msg) {
	alert($msg);
}

function if_confirm(msg) {
	return confirm(msg)
}

function ajax_get (dom_id, url) {
	$(dom_id).innerHTML = AJAX_LOADING;
	new Ajax.Updater(dom_id, url, {asynchronous:true, method:'get',evalScripts:true});
}


function select_collapse (elt) {
	elt.size = 1;
}

function webkit_search (obj,text,namespace) {
	if (typeof(text)=='undefined') {
		placeholder='';
	}
	else {
		placeholder=text;
	}
	if (typeof(namespace)=='undefined') {
		autosave='';
	}
	else {
		autosave=namespace;
	}
	if (RegExp(" Safari/").test(navigator.userAgent) && ! RegExp(" Chrome/").test(navigator.userAgent)) {
		obj.type='search';
		obj.setAttribute('placeholder',placeholder);
		obj.setAttribute('autosave',autosave);
		obj.setAttribute('results',10);
		
//		obj.style.display='block';
		obj.style.position='relative';//('results',10);
		obj.style.top='3px';
	}
	else {
		obj.className='search';
		if (''==obj.value) {
			obj.value=placeholder;
		}
	}
}