﻿var LOADING = 'http://static.rtv-dreux.fr/media/a_loading.gif';
var LOADING_SMALL = 'http://static.rtv-dreux.fr/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_confirm(msg) {
	return confirm(msg)
}

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

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',100);
	}
	else {
		obj.className='search';
		if (''==obj.value) {
			obj.value=placeholder;
		}
	}
}

function window_set_width (width) {
	window.resizeTo(width,window.screen.height);
}
