function fAjaxSetLang(alias){
	//alert(alias);
	new Ajax.Request(
		'/inc/ajax.php?action=setLang&arg_1=' + alias, 
		{
		method: 'get',
		onComplete: function(request){
			//alert(request.responseText);
			location.reload(true);
		}
	}); 
	return false;
}

function fAjaxSetSearch(search_str){
	//alert(search_str);
	new Ajax.Request(
		'/inc/ajax.php?action=setSearch&str=' + search_str, 
		{
		method: 'get',
		onComplete: function(request){
			//alert(request.responseText);
			//location.reload(true);
		}
	}); 
	return false;
}

function emoticon(text) {
	var txtarea = $$('textarea.emoticon')[0];
	//text = ' ' + text + ' ';
	if (txtarea.createTextRange && txtarea.caretPos) {
		var caretPos = txtarea.caretPos;
		caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' : caretPos.text + text;
		txtarea.focus();
	} else {
		txtarea.value  += text;
		txtarea.focus();
	}
};

Event.observe(window, 'load', function(event){
	var count=0;
	/*
	if($('sw')!='null' && $('sw')!=undefined) $('sw').value=screen.width;
	if($('sh')!='null' && $('sh')!=undefined) $('sh').value=screen.height;
	if($('scd')!='null' && $('scd')!=undefined) $('scd').value=screen.colorDepth;
	if($('np')!='null' && $('np')!=undefined) $('np').value=navigator.platform;
	*/

	$A($$('button.cal')).each(function(button){
		var input=$('cal_input');
		input.id=input.id+'_'+count;
		button.id = button.id+'_'+count;
		
		Calendar.setup({
			inputField		:	input.id,
			ifFormat		:	"%Y-%m-%d %H:%M:%S",
			showsTime		:	true,
			button			:	button.id,
			singleClick		:	true,
			step			:	1
		});
		count++;
	})
}); 