www=0;
function openImage(url, w, h){
	www++
	h = ((screen.height)?((screen.height-20<h)?screen.height-40:h):h);
	w += 20;
	ls=window.open("", "Image"+www, "toolbar=0, menubar=0, status=1, scrollbars=1,resizable=1, width="+w)
	ls.document.write("<html><head><style> body {margin:0}</style></head><body><a href='javascript:window.close();'><IMG SRC='" + url + "' alt='Закрыть' border='0'></a></body></html>");
	ls.document.close();
	ls.focus();
}

function openBlock(id) {
	div = document.getElementById(id);
	if (div.style.display=='none') {
		div.style.display='block';
	} else {
		div.style.display='none';
	}
}
function showhint(e,evt) {
	var evt = (evt) ? evt : ((window.event) ? event : null);
	var obj = e.childNodes[1];
	obj.style.display= "block";
}
function hidehint(e) {
	e.childNodes[1].style.display= "none";
}

function new_file(id){
	for(i=1; i<=20; i++){
		if(document.getElementById('div' + i).innerHTML == '') {
			document.getElementById('div' + i).innerHTML = '<input id="in' + i + '" type="file" name="file' + i + '" onChange="new_file(' + i + ');"> <a href="javascript:del_file(' + i + ')">del</a>';
			exit;
		}
	}
}

function del_file(id){
	document.getElementById('div' + id).innerHTML = '';
	var zero = 0;
	for(i=1; i<=20; i++){
		if(document.getElementById('div' + i).innerHTML != '') {
			zero = 1;
		}
	}
	if (zero ==0){
		document.getElementById('div1').innerHTML = '<input id="in1" type="file" name="file1" onChange="new_file(1);"> <a href="javascript:del_file(1)">del</a>';
	}
}
