function help(obj) {
	var id = obj.id ? obj.id.replace(/act-/,'') * 1 : obj.previousSibling.id.replace(/act-/,'') * 1
	var msg = ''
	switch(id) {
		// Нижняя панель
		case 24: // Сравнить с оригиналом
			msg = '<h2 align="center"><img src="./images/tb/06-old-a.gif" width="50" height="41"><br>Compare with original.</h2>You can view the original image and how it was changed after editing operations in order to compare them. When pressing the button you will see the image downloaded originally without deleting the current image and when you release the button you will see your current image in the “Image viewing area”. The current image is your original image after application of various filters and effects.<br><br><br>'
			break
		case 25: // Автоматическое улучшение
			msg = '<h2 align="center"><img src="./images/tb/25-cool-a.gif" width="50" height="41"><br>Automatic improvement.</h2>It allows you to perform automatic improvement of image using unique algorithms developed by our company. Our software will correct geometric distortions, will adjust balance of light and shadows, will add clarity and contrast and much more. Your pictures will “come to life and sparkle” as if you have been taking pictures with a high-quality camera and if it is indeed so, you will be able to remove defects that cannot be avoided even with a high-class camera. All changes are performed by our program automatically with a high consistency level. Just press the button… <br><br><br>'
			break
		case 14: // Отменить
			msg = '<h2 align="center"><img src="./images/tb/14-undo-a.gif" width="50" height="41"><br>Undo last operation.</h2>The purpose is to undo the last activity performed by you.<br><br><br>'
			break
		case 15: // Повторить
			msg = '<h2 align="center"><img src="./images/tb/15-redo-a.gif" width="50" height="41"><br>Redo previous operation.</h2>The purpose is to repeat the last undone activity.<br><br><br>'
			break
		case 17: // Сохранить
			msg = '<h2 align="center"><img src="./images/tb/17-save-a.gif" width="50" height="41"><br>Save the image.</h2>The purpose is to save the edited image to your computer. It brings forth the standard screen to select the saving location with possibility to select a folder or create a new one. You can save the images in “My pictures” or photograph for example.<br><br><br>'
			break
		case 19: // Печать
			msg = '<h2 align="center"><img src="./images/tb/19-print-a.gif" width="50" height="41"><br>Print the image.</h2>The purpose is to print out the edited image from your computer. It brings forth the standard printing screen with possibility to select an appropriate printer and settings. You can print out pictures in color as well as in black and white.<br><br><br>'
			break
		case 16: // Загрузить
			msg = '<h2 align="center">Section «Download the photo».</h2> <p>The “Download the photo” section contains the following:</p><ul type="disc"><li>Entry field. The purpose is to show the path to the image file on your computer or in the network. When the file is selected with the help of the “Browse” button the file path is shown automatically in the entry field;</li><li>“Browse” button. It is needed to find the image file on your computer or in the network with the help of a regular explorer;</li></ul> <h2 align="center"><img src="./images/tb/16-load-a.gif" width="50" height="41"><br>Download for editing” button.</h2><br>It downloads your image file on server for further editing – improvement or change.<br><br><br>'
			break

		// раздел Действия
		case -1: // Действия
			msg = '<h2 align="center"><br>Activities.</h2>This section contains the history of all your activities in the order you have performed them. Each state in the “Activities” section represents a separate “image”. As in working with an “image” you can return the image to the fixed state or restore certain areas by ticking the checkboxes to the left of the operation’s name. This allows selecting and switching off an operation the result of which you didn’t like. To undo the last action please press the “Undo” button.</a><br><br><br>'
			break

		// вкладка Камера
		case 11: // Красные глаза
			msg = '<h2 align="center"><img src="./images/tb/11-eyes-a.gif" width="50" height="41"><br>Correct “red-eyes” effect.</h2>Thanks to unique red-eye detection algorithm developed by the Smilart company and implemented into this software you have possibility to remove this unpleasant effect from your digital images. Moreover it is done automatically, and you can be positive of maximum accuracy and efficiency of final image. You don’t need to struggle anymore with selecting the eyes and appropriate color – the program will do it all by itself. <br>The “red-eye” removal is performed by the program with a very high level of accuracy.<br><br><br>'
			break
		case 4: // Устранение шумов на изображении
			msg = '<h2 align="center"><img src="./images/tb/04-noise-a.gif" width="50" height="41"><br>Remove the noise.</h2>This function suppresses noises from the digital camera matrix as well as noises occurring during image scanning, it decreases image graininess and eliminates inhomogeneous color specks on images while preserving details and sharpness of borders.<br>The program removes brightness as well as color (chromatic) noise. The first one occurs as distortion elements different in brightness (example – skin irregularities), the second one – as minor spots different in color (example – ill-placed red or blue spots). This function deals with its task admirably in both cases.<br>Your pictures will look a lot better after being treated by this program. Noise correction is done by our program automatically and with a high level of accuracy.<br><br><br>'
			break
		case 7: // Устранение выпуклости
			msg = '<h2 align="center"><img src="./images/tb/07-vypuk-a.gif" width="50" height="41"><br>Remove distortions.</h2>Effect due to which the image scale (geometry of lines or objects) in the centers and around the borders is not even is called distortion. For example, people seem heavier, doors look like barrels, and houses and columns seem to be falling down. Such distortions that are more or less obvious are caused by all camera lenses. <br> Correction of such distortion is done by our program automatically and with a high level of accuracy.<br><br><br>'
			break
		case 18: // Затемнение от центра
			msg = '<h2 align="center"><img src="./images/tb/18-dark-a.gif" width="50" height="41"><br>Correct vignette.</h2>Dimming of the image from center to the borders is called vignette. Lighting in the center and along the borders is not even. As an example, straight walls along the borders seems to be somewhat stained. Such distortions that are more or less obvious are caused by all camera lenses. <br> Correction of image dimming (vignette) is done by our program automatically and with a high level of accuracy.<br><br><br>'
			break

		// Вкладка Ориентация
		case 26: // Повернуть влево
			msg = '<h2 align="center"><img src="./images/tb/26-rotleft-a.gif" width="50" height="41"><br>Rotate to the left.</h2>Turns the current image 90 degrees counterclockwise. It does not change quality of the image.<br><br><br>'
			break
		case 27: // Повернуть вправо
			msg = '<h2 align="center"><img src="./images/tb/27-rotright-a.gif" width="50" height="41"><br>Rotate to the right.</h2>Turns the current image 90 degrees clockwise. It does not change quality of the image.<br><br><br>'
			break
		case 28: // Перевернуть
			msg = '<h2 align="center"><img src="./images/tb/28-rot180-a.gif" width="50" height="41"><br>Flip over.</h2>Flips the current image over (180 degrees rotation). It does not change quality of the image.<br><br><br>'
			break
		case 30: // Зеркально по горизонтали
			msg = '<h2 align="center"><img src="./images/tb/30-fliph-a.gif" width="50" height="41"><br>Flip horizontally.</h2>Flips the current image horizontally (mirroring). It does not change quality of the image.<br><br><br>'
			break
		case 31: // Зеркально по вертикали
			msg = '<h2 align="center"><img src="./images/tb/31-flipv-a.gif" width="50" height="41"><br>Flip vertically.</h2>Flips the current image vertically (mirroring). It does not change quality of the image.<br><br><br>'
			break

		// Вкладка Цвет
		case 32: // Выравнивание теней
			msg = '<h2 align="center"><img src="./images/tb/29-shadow-a.gif" width="50" height="41"><br>Shadows adjustment.</h2>Digital cameras have some challenges with the range of light, namely with the shadows distortion. For example, some areas on your pictures with insufficient light seem to be darker than they really are. By using the “Shadows adjustment” button you basically “pull in” disappearing objects.<br>Such distortions that are more or less obvious are caused by all camera lenses. Adjustment of shadows is done by our program automatically and with a high level of accuracy.<br><br><br>'
			break
		case 33: // Баланс света и тени
			msg = '<h2 align="center"><img src="./images/tb/13-razmyt-a.gif" width="50" height="41"><br>Balance of light and shadows.</h2>Digital cameras have some challenges with the range of light, namely with the balance of light and shadows. For example, some areas on your pictures turn out light-exposed, and some areas with insufficient light seem to be darker than they really are. By using the “Balance of light and shadows” button you basically “pull in” disappearing objects and even out the balance of light.<br>Such distortions that are more or less obvious are caused by all camera lenses. Balance of light and shadows is done by our program automatically and with a high level of accuracy.<br><br><br>'
			break
		case 9: // Выравнивание освещенности
			msg = '<h2 align="center"><img src="./images/tb/09-color-a.gif" width="50" height="41"><br>Lighting adjustment.</h2>Digital cameras have some challenges with the range of light, namely with the level of lighting of various objects. For example, some areas on your pictures turn out light-exposed, and some areas with insufficient light seem to be darker than they really are. By using the “Lighting adjustment” button you basically “pull in” disappearing objects and even out the balance of light.<br>Such distortions that are more or less obvious are caused by all camera lenses. Adjustment of lighting is done by our program automatically and with a high level of accuracy.<br><br><br>'
			break
		case 8: // Оттенок холоднее
			msg = '<h2 align="center"><img src="./images/tb/08-otten-a.gif" width="50" height="41"><br>Shade colder.</h2>Digital cameras have some challenges with the range of light and color mapping, namely with lighting/illumination color of various objects. For example, the image seems to be yellowish (warmer) than it really is. By using the “Shade colder” button you basically make the image more natural (colder).<br>Such distortions that are more or less obvious are caused by all camera lenses. Correction of shades is done by our program automatically and with a high level of accuracy.<br><br><br>'
			break
		case 29: // Оттенок теплее
			msg = '<h2 align="center"><img src="./images/tb/08-otten-a.gif" width="50" height="41"><br>Shade warmer.</h2>Digital cameras have some challenges with the range of light and color mapping, namely with lighting/illumination color of various objects. For example, the image seems to be bluish (colder) than it really is. By using the “Shade warmer” button you basically make the image more natural (warmer).<br>Such distortions that are more or less obvious are caused by all camera lenses. Correction of shades is done by our program automatically and with a high level of accuracy.<br><br><br>'
			break
		case 10: // Исправление цвета
			msg = '<h2 align="center"><img src="./images/tb/10-light-a.gif" width="50" height="41"><br>Color correction.</h2>Digital cameras have some challenges with the range of light, namely with the level of lighting of various objects. For example, some areas on your pictures turn out light-exposed, and some areas with insufficient light seem to be darker than they really are. This happens due to so-called splashes on the image histogram. By using the “Color correction button” you basically make the image more natural – with even lighting.<br>Such distortions that are more or less obvious are caused by all camera lenses. Correction of color is done by our program automatically and with a high level of accuracy.<br><br><br>'
			break

		//вкладка Четкость
		case 1: // Увеличение резкости фотографии
			msg = '<h2 align="center"><img src="./images/tb/01-sharp-a.gif" width="50" height="41"><br>Sharpness increase of photo.</h2>Digital cameras have some challenges with sharpness, namely with displaying various objects. It is one of the parameters of camera lenses. Expert combination of lenses resolution characteristics and contrast will increase sharpness. Sharpness of film or camera matrix is also determined by the balance of resolution characteristics and contrast.<br>Such distortions that are more or less obvious are caused by all camera lenses. Correction of sharpness is done by our program automatically and with a high level of accuracy.<br><br><br>'
			break
		case 2: // Повышение контрастности
			msg = '<h2 align="center"><img src="./images/tb/02-kontr-a.gif" width="50" height="41"><br>Contrast increase of photo.</h2>What do you think is the basis for indelible impressions from professional works of art? It is a level of contrast. Contrast is not only “black” or “white”, it has numerous variations, shades and meanings. Level of contrast is rather subjective. The expert will see it straight away and will be able to explain the reason behind such level, while the amateur will not even think to look for it.<br>Such distortions that are more or less obvious are caused by all camera lenses. Correction of contrast is done by our program automatically and with a high level of accuracy.<br><br><br>'
			break
		case 13: // Устранение размытости снимка
			msg = '<h2 align="center"><img src="./images/tb/13-razmyt-a.gif" width="50" height="41"><br>Устранение размытости снимка.</h2>Цифровые фотоаппараты имеют проблемы со световым диапазоном и отображением цвета, в частности с цветом освещенности различных объектов. К примеру, некоторые места на вашем снимке оказываются "засвеченными", а не достаточно освещённые места кажутся темнее, чем в реальности. Это происходит из-за так называемых всплесков на гистограмме снимка. Используя кнопку "Исправление цвета" вы фактически делаете снимок более естественным - равномерно освещённым.<br>Данные искажения более или менее заметные привносят практически все фотоаппараты. Исправление цвета выполняется нашей программой в автоматическом режиме и с высокой степенью корректности<br><br><br>'
			break
		case 34: // Умный контрастности
			msg = '<h2 align="center"><img src="./images/tb/02-kontr-a.gif" width="50" height="41"><br>Smart Contrast increase of photo.</h2>What do you think is the basis for indelible impressions from professional works of art? It is a level of contrast. Contrast is not only “black” or “white”, it has numerous variations, shades and meanings. Level of contrast is rather subjective. The expert will see it straight away and will be able to explain the reason behind such level, while the amateur will not even think to look for it.<br>Such distortions that are more or less obvious are caused by all camera lenses. Correction of contrast is done by our program automatically and with a high level of accuracy.<br><br><br>'
			break

		//вкладка Размер снимка
		case 3: // Обрезка снимка
			msg = '<h2 align="center"><img src="./images/tb/03-crop-a.gif" width="50" height="41"><br>Image crop.</h2>The way we usually take a picture or scan an image is to encompass a bit more than we need. Just in case. So we get to use the “Image crop” tool quite often. Its value is that prior to cropping we have a very good possibility to correct the cropping borders. It is sufficient to drag a corner or side marker, or by pressing and holding the left mouse button we can move the area to be cropped. By pressing the “Image crop” again you will keep the changes.<br>Change of the image dimensions is done by our program automatically and with a high level of accuracy.<br><br><br>'
			break
		case 12: // Размеры снимка
			msg = '<h2 align="center"><img src="./images/tb/12-razmer-a.gif" width="50" height="41"><br>Picture size.</h2>Why change the image size and dimensions? There are many good and valid reasons for that. Many contemporary average digital cameras and phones with cameras take small-sized pictures that when printed are of the postmark size. Printers or picture printing studios require images of a certain fixed size that may not coincide with original dimensions. In order to deal with that you need to use the “Picture size” tool to increase or decrease the image size.<br>Change of the image dimensions is done by our program automatically and with a high level of accuracy.<br><br><br>'
			break

		//вкладка Эффекты
		case 6: // Эффект старины
			msg = '<h2 align="center"><img src="./images/tb/06-old-a.gif" width="50" height="41"><br>“Vintage” photo.</h2>What is sepia (vintage effect)? It is an artist’s tool, such as pastel as a dark-brown chalk. A drawing, picture or any other image that is done not in black/white but brown/white is also sepia. “To do sepia” means to turn the image tone range into brownish. When the pictures were only black-and-white they were actually of the brownish tone range.<br>This change of the image is done by our program automatically and with a high level of accuracy.<br><br><br>'
			break
		case 5: // Чёрно-белый снимок
			msg = '<h2 align="center"><img src="./images/tb/05-bw-a.gif" width="50" height="41"><br>Black and white photo.</h2>What is the purpose for changing color photos into black/white ones? By all means artistic. Obviously if you change the color photo into black/white one you simply want to make it more interesting from the artistic point of view. The perception effect of black/white photos is considerably different from perception of a color one, mainly due to the fact that the viewer is not distracted by color concentrating his attention on play of forms and tones instead. A black/white image is more expressive, it conveys emotions with certainty, so if you strive for that in your image you should definitely try this option out.<br><br>Printing with laser printer.<br><br>A valid reason to make an image black/white is printing on laser or some other non-color printer. Very often the color picture printed as black/white may turn out nothing like you’ve imagined it – it may have no contrast whatsoever.<br><br>This change of the image is done by our program automatically and with a high level of accuracy.<br><br><br>'
			break
		case 22: // Рамки
			msg = '<h2 align="center"><img src="./images/tb/22-frame-a.gif" width="50" height="41"><br>Рамки.</h2>Обычно картина лучше выглядит в рамке, особенно если рамка сделана с учетом особенностей изображения. Это касается не только рисованных изображений, но и созданных при помощи цифрового фотоаппарата или компьютерной графики.<br>Изменение выполняется нашей программой в автоматическом режиме и с высокой степенью корректности.<br><br><br>'
			break
		case 21: // Комната смеха
			msg = '<h2 align="center"><img src="./images/tb/21-fun-a.gif" width="50" height="41"><br>Комната смеха.</h2>При помощи "Комнаты смеха" вы создаете смешные эффекты, превращая фотографии в неповторимые фото-открытки. Все эффекты этого раздела - фотоприколы можно использовать бесконечно, прилеплять на фото и отлеплять снова - с тем, чтобы украсить другое фото. Ни фотоприколы, ни сами фотографии от этого не портятся. Повеселите себя и ваших друзей!<br>Изменение выполняется нашей программой в автоматическом режиме и с высокой степенью корректности.<br><br><br>'
			break
		case 23: // Декоративные эффекты
			msg = '<h2 align="center"><img src="./images/tb/23-decor-a.gif" width="50" height="41"><br>Декоративные эффекты.</h2>Постоянное стремление к прекрасному и этот раздел позволят вам создать в снимках множество оригинальных декоративных эффектов.<br>Изменение выполняется нашей программой в автоматическом режиме и с высокой степенью корректности.<br><br><br>'
			break

		default:
			msg = '<h2 align="center">Under construction.</h2><br><br><br>'
			break
	}
	help_msg(msg)
}

function help_deblocking() {
	var msg = '<h2 align="center"><img src="./images/tb/47-jpgkvadrat-a.gif" width="50" height="41"><br>Деблокинг.</h2>Вы хотите улучшить жпег?.<br><br><h2 align="center"><input type="button" value="Улучшить" onClick="action({id:\'act-47\'});gebi(\'confirm\').style.display=\'none\';">&nbsp;&nbsp;&nbsp;<input type="button" value="Отмена" onClick="confirm_msg()"></h2>';
	confirm_msg(msg);
}

function help_save() {
	if (processing != false){
		alert("Wait a moment, please");
		return false;
	}
	if (!session_prefix){
		alert("Изображение не загружено");
		return false;
	}
	var msg = '<form action="save.php" target="fprocessing"><h2 align="center"><img src="./images/tb/17-save-a.gif" width="50" height="41"><br>Save your photo or Get free link.</h2>';
	msg += "<input type='radio' name='dtype' value='fanstudio' onclick='gebi(\"help_save_local\").style.display=\"none\";gebi(\"help_save_fanstudio\").style.display=\"\";' checked> - Get a free permanent link at Fan Studio<br>";
	msg += "<input type='radio' name='dtype' value='local' onclick='gebi(\"help_save_fanstudio\").style.display=\"none\";gebi(\"help_save_local\").style.display=\"\";'> - Save photo on your computer<br>";
	msg += "<img src='images/d.gif' alt='' width='1' height='1' border='0' class='i-h-sep'>";
	msg += "<div id='help_save_local' style='display: none;'>Save as:<br><input type='text' name='photo' value='" + name_original + "'><br>Select file type:<br>";
	var ftype = new Array('jpg', 'png', 'gif', 'tiff', 'pdf', 'psd', 'pcx', 'bmp');
	msg += "<table width='100%' align='center'><tr>";
	i=0;
	for(n in ftype){
		msg += "<td><input type='radio' name='ftype' value='" + ftype[n] + "' " + (ftype[n] == ftype_original?"checked":"") + " >" + ftype[n] + "</td>";
		i++;
		if (i == 4){
			i=0;
			msg += "</tr><tr>";
		}
	}
	msg += "</tr></table></div>";
	msg += '<div id="help_save_fanstudio">';
	msg += '<input type="checkbox" name="gen_preview" value="1" checked> - Create preview';
	msg += '&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="sizepreview" value="160" size="4"> - Size of preview';
	//msg += '<br><input type="checkbox" name="size_original" value="1" > - Save original size';
	msg += '<div id="load_more_link">&nbsp;</div>';
	msg += '</div>';
	msg += '<h2 align="center"><input type="submit" value="Save" id="confirm_button" noonClick="gebi(\'confirm\').style.display=\'none\';">&nbsp;&nbsp;&nbsp;<input type="button" value="Close" onClick="confirm_msg()"></h2></form>';
	confirm_msg(msg);
}

function view_location_img(url, murl, flink, flink1){
	var msg = '<br>';//<h2 align="center"><img src="./images/tb/17-save-a.gif" width="50" height="41"><br>Сохранение фотографии.</h2>';
	msg += '1. <b>Link (URL) for your friends</b> <br> <input type="text" value="'+(flink1?flink1:url)+'" readonly style="width: 390px;" Onclick="fs(this)"><br>';
	msg += '2. <b>For a forum or message board</b> <br><input type="text" value="' + (murl?"[URL="+flink1+"][IMG]"+murl+"[/IMG][/URL]":"") + '" readonly style="width: 390px;" Onclick="fs(this)"><br>';
	msg += '3. <b>For a forum or message board 2 (BBCode)</b> <br><input type="text" value="' + (murl?"[url="+flink1+"][img]"+murl+"[/img][/url]":"") + '" readonly style="width: 390px;" Onclick="fs(this)"><br>';
	msg += '4. <b>For a Blog or Website (LiveJournal, MySpace, eBay, Xanga, Blogger etc.)</b> <br><input type="text" value=\'' + (murl?'<a target="_blank" href="'+flink1+'"><img src="'+murl+'"></a>':"") + '\' readonly style="width: 390px;" Onclick="fs(this)"><br>';
	msg += '5. <b>For an Email or Instant Messenger (ICQ, MS Messenger etc.)</b> <br> <input type="text" value="'+(flink1?flink1:url)+'" readonly style="width: 390px;" Onclick="fs(this)"><br>';
	msg += '6. <b>For a site (HTML code)</b> <br><input type="text" value=\'' + (murl?'<a target="_blank" href="'+flink1+'"><img src="'+murl+'"></a>':"") + '\' readonly style="width: 390px;" Onclick="fs(this)"><br>';
	msg += '7. <b>Direct link to image</b> <br><input type="text" value="'+url+'" readonly style="width: 390px;" Onclick="fs(this)"><br>';
//	msg += '<h2 align="center"><input type="button" value="Закрыть" onClick="confirm_msg()"></h2>';
//	confirm_msg(msg);
	gebi('confirm_button').style.display='none';
	gebi('load_more_link').innerHTML = msg;
}

function view_decor_effect(){
	if (processing != false){
		alert("Дождитесь обработки изображения");
		return false;
	}
	if (!session_prefix){
		alert("Изображение не загружено");
		return false;
	}
	var msg = '<h2 align="center"><img src="./images/tb/23-decor-a.gif" width="50" height="41"><br>Decor effects.</h2>';
	var ftype = new Array('http://www.fanstudio.ru/images/tb/effects/decor1.gif',
	'http://www.fanstudio.ru/images/tb/effects/decor2.gif',
	'http://www.fanstudio.ru/images/tb/effects/decor3.gif',
	'http://www.fanstudio.ru/images/tb/effects/decor4.gif');
	msg += "<table width='100%' align='center'><tr>";
	i=0;
	qq=360;
	for(n in ftype){
		msg += "<td align=center><img src='" + ftype[n] + "' border='0' style='cursor: hand;' OnClick='gebi(\"confirm\").style.display=\"none\";processingStart("+qq+")'></td>";
		i++;
		qq+=2;
		if (i == 3){
			i=0;
			msg += "</tr><tr><td colspan=3>&nbsp;</td></tr><tr>";
		}
	}
	msg += "</tr></table></div>";
	msg += '<h2 align="center"><!--- <input type="submit" value="Применить" id="confirm_button" noonClick="gebi(\'confirm\').style.display=\'none\';">&nbsp;&nbsp;&nbsp; ---><input type="button" value="Close" onClick="confirm_msg()"></h2></form>';
	confirm_msg(msg);
}

function view_ramki_effect(){
	if (processing != false){
		alert("Дождитесь обработки изображения");
		return false;
	}
	if (!session_prefix){
		alert("Изображение не загружено");
		return false;
	}
	var msg = '<h2 align="center"><img src="http://www.fanstudio.ru/images/tb/22-frame-a.gif" width="50" height="41"><br>Borders.</h2>';
	var ftype = new Array('http://www.fanstudio.ru/images/tb/effects/ramkapr1.gif',
	'http://www.fanstudio.ru/images/tb/effects/ramkapr2.gif',
	'http://www.fanstudio.ru/images/tb/effects/ramkapr3.gif',
	'http://www.fanstudio.ru/images/tb/effects/ramkapr4.gif',
	'http://www.fanstudio.ru/images/tb/effects/ramkapr5.gif',
	'http://www.fanstudio.ru/images/tb/effects/ramkapr6.gif',
	'http://www.fanstudio.ru/images/tb/effects/ramkapr7.gif',
	'http://www.fanstudio.ru/images/tb/effects/ramkapr8.gif',
	'http://www.fanstudio.ru/images/tb/effects/ramkapr9.gif');
	msg += "<table width='100%' align='center'><tr>";
	i=0;
	qq=390;
	for(n in ftype){
		msg += "<td align=center><img src='" + ftype[n] + "' border='0' style='cursor: hand;' OnClick='gebi(\"confirm\").style.display=\"none\";processingStart("+qq+")'></td>";
		i++;
		qq+=2;
		if (i == 3){
			i=0;
			msg += "</tr><tr><td colspan=3>&nbsp;</td></tr><tr>";
		}
	}
	msg += "</tr></table></div>";
	msg += '<h2 align="center"><!--- <input type="submit" value="Применить" id="confirm_button" noonClick="gebi(\'confirm\').style.display=\'none\';">&nbsp;&nbsp;&nbsp; ---><input type="button" value="Close" onClick="confirm_msg()"></h2></form>';
	confirm_msg(msg);
}

function view_room_effect(){
	if (processing != false){
		alert("Дождитесь обработки изображения");
		return false;
	}
	if (!session_prefix){
		alert("Изображение не загружено");
		return false;
	}
	var msg = '<h2 align="center"><img src="./images/tb/21-fun-a.gif" width="50" height="41"><br>Hall of distorting mirrors.</h2>';
	var ftype = new Array('http://www.fanstudio.ru/images/tb/effects/smex1.gif',
	'http://www.fanstudio.ru/images/tb/effects/smex2.gif',
	'http://www.fanstudio.ru/images/tb/effects/smex3.gif',
	'http://www.fanstudio.ru/images/tb/effects/smex4.gif',
	'http://www.fanstudio.ru/images/tb/effects/smex5.gif',
	'http://www.fanstudio.ru/images/tb/effects/smex6.gif');
	msg += "<table width='100%' align='center'><tr>";
	i=0;
	qq=420;
	for(n in ftype){
		msg += "<td align=center><img src='" + ftype[n] + "' border='0' style='cursor: hand;' OnClick='gebi(\"confirm\").style.display=\"none\";processingStart("+qq+")'></td>";
		i++;
		qq+=2;
		if (i == 3){
			i=0;
			msg += "</tr><tr><td colspan=3>&nbsp;</td></tr><tr>";
		}
	}
	msg += "</tr></table></div>";
	msg += '<h2 align="center"><!--- <input type="submit" value="Применить" id="confirm_button" noonClick="gebi(\'confirm\').style.display=\'none\';">&nbsp;&nbsp;&nbsp; ---><input type="button" value="Close" onClick="confirm_msg()"></h2></form>';
	confirm_msg(msg);
}

function action(obj, param) {
	if (processing != false){
		alert("Wait a moment, please");
		return false;
	}
	var id = obj.id.replace(/act-/,'') * 1
	switch(id) {
		case -2:
//		alert(getHistoryString())
			processingStart('history', '&history=' + getHistoryString())
			break;
		case 3:
			if (gebi('size').style.display!='none'){
				gebi('size').style.display = 'none';
				gebi('act-12').sl = gebi('act-12').bu;
				gebi('act-12').src = gebi('act-12').sl.src;
			}
			if (gebi('crop').style.display=='none') {
				gebi('crop').style.display = '';
			} else {
				gebi('crop').style.display = 'none';
			}
			if (turnCrop()) {
				obj.bu = obj.sl
				obj.sl = obj.sh
				obj.src = obj.sh.src
			} else {
				obj.sl = obj.bu
				obj.src = obj.sl.src
//				var c = getCrop()
//				processingStart(210, '&x1=' + c.x1 + '&y1=' + c.y1 + '&x2=' + c.x2 + '&y2=' + c.y2)
			}
			break
			
		case -4:
			if (!turnCrop()) {
				obj = gebi('act-3');
				obj.sl = obj.bu
				obj.src = obj.sl.src
				gebi('crop').style.display = 'none';
				var c = getCrop()
				processingStart(210, '&x1=' + c.x1 + '&y1=' + c.y1 + '&x2=' + c.x2 + '&y2=' + c.y2)
			}
			break
		
		case 12:
			if (gebi('crop').style.display!='none'){
				gebi('crop').style.display = 'none'
				crop.active=false;
				reposition();
				gebi('act-3').sl = gebi('act-3').bu;
				gebi('act-3').src = gebi('act-3').sl.src;
			}
			if (gebi('size').style.display=='none') {
				obj.bu = obj.sl
				obj.sl = obj.sh
				obj.src = obj.sh.src
				gebi('size').style.display = ''
			} else {
				obj.sl = obj.bu
				obj.src = obj.sl.src
				var c = getCrop()
				gebi('size').style.display = 'none'
			}
			break

		case -3:
		/*
			gebi('size_r1').checked
			gebi('size_w').value
			gebi('size_w').value
			gebi('size_r2').checked
		*/
			if (gebi('size_r1').checked)
			{
//				alert("Временно не доступно");
//				alert("BI BI 1 " + gebi('size_w').value + gebi('size_w').value);
//				processingStart(220, '&w1=' + gebi('size_w').value + '&h1=' + gebi('size_h').value)
                                new_w = parseInt(gebi('size_w').value);
                                new_h = parseInt(gebi('size_h').value);
                                if (new_h+new_w>20000){
                                   new_h = Math.round(20000/(1+w/h));
                                   new_w = Math.round(20000/(1+w/h)*w/h);
                                }

                                processingStart(220, '&w1=' + gebi('size_w').value + '&h1=' + gebi('size_h').value);
				
			}
			else	
			if (gebi('size_r2').checked)
			{
//				alert("Временно не доступно");
				w = gebi('mainpic').width;
				h = gebi('mainpic').height;
				pr = w/h;
				new_pr = max_size_image_w / max_size_image_h;
				if (pr > new_pr){
					new_h = max_size_image_h;
					new_w = max_size_image_h * w / h;
				} else {
					new_h = max_size_image_w * h / w;
					new_w = max_size_image_w;
				}
				if (new_h+new_w>20000){
                                   new_h = Math.round(20000/(1+w/h));
                                   new_w = Math.round(20000/(1+w/h)*w/h);
                                }
				processingStart(220, '&w1=' + new_w + '&h1=' + new_h)
			}			
			break

		//вкладка Камера
		case 11: //красные глаза
			processingStart(90)
			break;
		case 4: //Устранение шумов на изображении
			processingStart(120)
			break;
		case 40: //Устранение дефектов кожи
			processingStart(240)
			break;
		case 7: //устранение выпуклости
			processingStart(110)
			break;
		case 18: //Затемнение от центра
			processingStart(100)
			break;
		case 47: //Деблокинг
			processingStart(310)
			break;

		//вкладка Ориентация
		case 26: //Повернуть влево
			processingStart(160)
			break;
		case 27: //Повернуть вправо
			processingStart(150)
			break;
		case 28: //Перевернуть
			processingStart(140)
			break;
		case 30: //Зеркально по горизонтали
			processingStart(190)
			break;
		case 31: //Зеркально по вертикали
			processingStart(200)
			break;
		case 48: //Повернуть влево
			processingStart(320)
			break;
		case 49: //Повернуть вправо
			processingStart(330)
			break;
			
		//вкладка Cвет
		case 32: //Выравнивание теней
			processingStart(60)
			break;
		case 33: //Баланс света и тени
			processingStart(80)
			break;
		case 10: //Исправление цвета
			processingStart(50)
			break;
		case 46: //Повышение яркости
			processingStart(250)
			break;
		case 45: //Понижение яркости
			processingStart(260)
			break;
			
			
		//вкладка Цвет
		case 10: //Исправление цвета
			processingStart(50)
			break;
		case 8: //Оттенок холоднее
			processingStart(52)
			break;
		case 29: //Насыщенность выше
			processingStart(53)
			break;
		case 44: //Насыщенность ниже
			processingStart(270)
			break;
		case 43: //Оттенок теплее
			processingStart(280)
			break;
			
		//вкладка Четкость
		case 1: //Увеличение резкости фотографии
			processingStart(55)
			break;
		case 52: //Размытость фотографии
			processingStart(56)
			break;
		case 2: //Автоматический контраст
			processingStart(71)
			break;
		case 34: //Повышение контрастности
			processingStart(230)
			break;
		case 13: //Устранение размытости снимка
			processingStart(130)
			break;
		case 42: //Повышение контрастности
			processingStart(290)
			break;
		case 41: //Понижение контрастности
			processingStart(300)
			break;
		
		//вкладка Эффекты
		case 6: //Эффект старины
			processingStart(170)
			break;
		case 5: //Черно-белый снимок
			processingStart(180)
			break;
		case 51: //Эффект цвета
			gradient_msg();
			cp.select(gebi('gradient_color'),'act-51');
//			processingStart(350)
			break;
		case 23: //Эффекты
			view_decor_effect();
			break;
		case 22: //рамки
			view_ramki_effect();
			break;
		case 21: //Комната смеха
			view_room_effect();
			break;

			
		case 24: //оригинал
			if (param && original_image.src) {
				last_image.src = gebi('mainpic').src
				gebi('mainpic').src = original_image.src
//				last_img_width = gebi('mainpic').width;
//				last_img_height = gebi('mainpic').height;
				gebi('mainpic').width = size_preview_original_w;
				gebi('mainpic').height = size_preview_original_h;
			}
			if (!param && last_image.src) {
				gebi('mainpic').src = last_image.src;
				gebi('mainpic').width = last_img_width;
				gebi('mainpic').height = last_img_height;
			}
			break
		case 25: //автоулучшение
			processingStart(30)
			break
		case 14: // undo
			hystoryUndo()
			break
		case 15: // redo
			hystoryRedo()
			break
		case 17: // save //'bitmap.bmp'
			if (!session_prefix) {
				alert('Изображение не загружено')
			} 
			else 
			{
//				location.href=session_prefix + 'bitmap.bmp' 
				location.href='down/download.jpg'
			}	
			break;
		default:
			alert('Временно недоступно')
			break
	}
}


