Image1 = new Image();
Image1.src = "/images/loading.gif";

function insert_comment_form(id, type) {
	s = "";
	s += '<form method="post">';
	s += '<textarea name="description" style="width:300px; height: 50px;"></textarea><br/>';
	s += '<input type="hidden" name="comment_parent_id" value="'+id+'"/>';
	if (type == 0)
		s += '<br><em>Вы можете прокомментировать страницу после <a href="javascript:show_registration_window()" id="show_registration_window">регистрации</a> или входа под своим паролем:</em><br><br>Логин:&nbsp;&nbsp; <input name="login" value=""><div style="margin:6px 0 25px 0;">Пароль: <input type="password" name="password" value=""></div><input type="hidden" name="authorized_flag_comment" value="none">';
	s += '<input type="submit" name="comment_save_button" value="Сохранить"/>';
	s += '</form>';	

	document.all["comment_insert_"+id].innerHTML = s;
	
	s = '<a style="cursor: pointer;" class="bluelink" onclick="clear_comment_form('+id+')">Скрыть</a>';
	document.all["comment_clear_"+id].innerHTML = s;
}


// тут я пробував умови якщо id=0 або 1
function form_image(id, type) {
	s = "";
	s += '<form method="post">';
	s += '<textarea name="description" style="width:300px; height: 50px;"></textarea><br/>';
	s += '<input type="hidden" name="comment_parent_id" value="'+id+'"/>';
	if (id == 0)
		s += '<br><em>Вы можете прокомментировать страницу после <a href="javascript:show_registration_window()" id="show_registration_window">регистрации</a> или входа под своим паролем:</em><br><br>Логин:&nbsp;&nbsp; <input name="login" value=""><div style="margin:6px 0 25px 0;">Пароль: <input type="password" name="password" value=""></div><input type="hidden" name="authorized_flag_comment" value="none">';
		if (id == 1)
		s += '<br><em>Вы fgможете прокомментировать страницу после <a href="javascript:show_registration_window()" id="show_registration_window">регистрации</a> или входа под своим паролем:</em><br><br>Логин:&nbsp;&nbsp; <input name="login" value=""><div style="margin:6px 0 25px 0;">Пароль: <input type="password" name="password" value=""></div><input type="hidden" name="authorized_flag_comment" value="none">';
	s += '</form>';	

	document.all["comment_insert_"+id].innerHTML = s;
	
	s = '<a style="cursor: pointer;" class="bluelink" onclick="clear_comment_form('+id+')">Скрыть</a>';
	document.all["comment_clear_"+id].innerHTML = s;
}






function clear_comment_form(id) {
	document.all["comment_insert_"+id].innerHTML = "";
	document.all["comment_clear_"+id].innerHTML = "";
}

function display_big_file(id, title, added, dir)	{
	$("#min_added").html('');
	$("#min_title").html('');
	$("#big_file").attr("src", '/');
	$("#big_file").css("margin", "200px 0 0 200px");
	$("#big_file").attr("src", "/images/loading.gif");
		
	bigImage = new Image()
	bigImage.src = "/_up_photo_report/"+dir+"/"+id;
	//bigImage.onload = display_image(dir, id, added, title);
	setTimeout('display_image("'+dir+'", "'+id+'", "'+added+'", "'+title+'")', 0);
}

function display_image(dir, id, added, title) {
	if (bigImage.complete == true) {
		$("#min_added").html(added);
		$("#min_title").html(title);
		$("#big_file").css("margin", "0 0 0 0");
		$("#big_file").attr("src", "/_up_photo_report/"+dir+"/"+id);
	} else {
		setTimeout('display_image("'+dir+'", "'+id+'", "'+added+'", "'+title+'")', 0);
	}
}