var imgname = '';
function showUploader(imgid) {
	Element.show($('uploader-'+imgid));
	Element.hide($('selecter-'+imgid));
}
function showSelecter(imgid,url) {
	Element.hide($('uploader-'+imgid));
	Element.show($('selecter-'+imgid));
	php = url+'/admin/aj/upload-imgs.php';
	new Ajax.Updater('trgetimgs', php, {
			asynchronous:true, 
			evalScripts:true, 
			parameters:null
	});
	diagshow("block");
	imgname = imgid;
}
function diagshow(state) {
	$("imgdiag").style.display=state;
	$("overlay").style.display=state;
	if(state=="none") {
		$("unitContainerMain").style.display="block";
	} else {
		$("unitContainerMain").style.display="none";
	}
}

function insertImg(src,name) {
	$("selecter-"+imgname).innerHTML = '選択された画像：<br><img src="'+src+'" width="300">';
	$(imgname).value=name;
	diagshow("none");
}

function showSelecterForTTL(imgid,url) {
	Element.hide($('uploader-'+imgid));
	Element.show($('selecter-'+imgid));
	php = url+'/admin/aj/upload-imgs.php';
	new Ajax.Updater('trgetimgs', php, {
			asynchronous:true, 
			evalScripts:true, 
			parameters:'mode=ttlimg'
	});
	diagshow("block");
	imgname = imgid;
}
function showSelecterForHeader(imgid,url) {
	Element.hide($('uploader-'+imgid));
	Element.show($('selecter-'+imgid));
	php = url+'/admin/aj/upload-imgs.php';
	new Ajax.Updater('trgetimgs', php, {
			asynchronous:true, 
			evalScripts:true, 
			parameters:'mode=header'
	});
	diagshow("block");
	imgname = imgid;
}