function xhide(n) {
	document.getElementById(n).style.display = 'none';
}

function xshow(m) {
	document.getElementById(m).style.display = '';
}


//popup
var newWin = null;
function closeWin(){
	if (newWin != null){
		if(!newWin.closed)
			newWin.close();
	}
}

function popUp(strURL,strType,strHeight,strWidth) {
	closeWin();
	var strOptions="";
	if (strType=="console") strOptions="resizable,scrollbars,height="+strHeight+",width="+strWidth;
	if (strType=="fixed") strOptions="status,height="+strHeight+",width="+strWidth;
	if (strType=="elastic") strOptions="toolbar,menubar,scrollbars,resizable,location,height="+strHeight+",width="+strWidth;
	newWin = window.open(strURL, 'newWin', strOptions);
	newWin.focus();
}



function ajaxFileUpload_flyer()
{
	$("#loading")
	.ajaxStart(function(){
		$(this).show();
	})
	.ajaxComplete(function(){
		$(this).hide();
	});
	
	$.ajaxFileUpload
	(
		{
			url:'ajax.php?pg_name=annoncer_soiree&a=upload',
			secureuri:false,
			fileElementId:'flyerload',
			dataType: 'json',
			success: function (data, status)
			{
				if(typeof(data.error) != 'undefined')
				{
					if(data.error != '')
					{
						alert(data.error);
					}
					else
					{
						$("#rez").html(data.msg);
						$("#visu").hide();
						$("#visu").attr({ src: "upload/flyer/"+data.id});
						$("#visu").show();
						$("#visu3").attr({ src: "upload/flyer-big/"+data.id});
						$("#visu3").show();

						document.getElementById('filename').value = data.id;
					}
				}
			},
			error: function (data, status, e)
			{
				alert(e);
			}
		}
	)
	
	return false;	
}


function ajaxFileUpload_concert()
{
	$("#loading")
	.ajaxStart(function(){
		$(this).show();
	})
	.ajaxComplete(function(){
		$(this).hide();
	});
	
	$.ajaxFileUpload
	(
		{
			url:'ajax.php?pg_name=annoncer_concert&a=upload',
			secureuri:false,
			fileElementId:'afficheload',
			dataType: 'json',
			success: function (data, status)
			{
				if(typeof(data.error) != 'undefined')
				{
					if(data.error != '')
					{
						alert(data.error);
					}
					else
					{
						$("#rez").html(data.msg);
						$("#visu").hide();
						$("#visu").attr({ src: "upload/affiche/"+data.id});
						$("#visu").show();

						document.getElementById('filename').value = data.id;
					}
				}
			},
			error: function (data, status, e)
			{
				alert(e);
			}
		}
	)
	
	return false;	
}


function check_search(t){
	if (document.getElementById(t).value.length < 3){
		alert('Vous devez saisir au moins 3 caracteres');
		return false;
	};
	return true;
}

