	var swfu;
	var id;
	var relation;
	
	
	function swfInitialize(id, relation, session) {
		settings = {
			flash_url : "/swf/swfupload.swf",
			upload_url: "/images/uploader/"+id+"/"+relation+"/",
			post_params: {"PHPSESSID" : session},
			file_size_limit : "100 MB",
			file_types : "*.jpg",
			file_types_description : "All Files",
			file_upload_limit : 100,
			file_queue_limit : 0,
			custom_settings : {
				progressTarget : "fsUploadProgress",
				cancelButtonId : "btnCancel"
			},
			debug: false,

			// Button settings
			button_image_url : "/img/upload/XPButtonUploadText_61x22.png",
			button_placeholder_id : "spanButtonPlaceholder1",
			button_width: 61,
			button_height: 22,

			// The event handler functions are defined in handlers.js
			file_queued_handler : fileQueued,
			file_queue_error_handler : fileQueueError,
			file_dialog_complete_handler : fileDialogComplete,
			upload_start_handler : uploadStart,
			upload_progress_handler : uploadProgress,
			upload_error_handler : uploadError,
			upload_success_handler : uploadSuccess,
			upload_complete_handler : myComplete,
			queue_complete_handler : queueComplete	// Queue plugin event
		};

		swfu = new SWFUpload(settings);
	};
	
	function swfInitialize_big(id, relation, session) {
		settings = {
			flash_url : "/swf/swfupload.swf",
			upload_url: "/images/uploader/"+id+"/"+relation+"/",
			post_params: {"PHPSESSID" : session},
			file_size_limit : "100 MB",
			file_types : "*.jpg",
			file_types_description : "All Files",
			file_upload_limit : 100,
			file_queue_limit : 0,
			custom_settings : {
				progressTarget : "fsUploadProgress",
				cancelButtonId : "btnCancel"
			},
			debug: false,

			// Button settings
			button_image_url : "/css/common/swfuploadbutton.gif",
			button_placeholder_id : "spanButtonPlaceholder1",
			button_text: '<span class="btnText">Upload<br />photo</span><br /><span class="btnText_small">(you can select<br /> and upload more than one photo)</span>',
			button_text_style: '.btnText {font-size: 20; font-weight: bold; font-family: Arial; text-align: center;} .btnText_small {font-size: 11; font-family: Arial; text-align: center;}',
			button_text_top_padding: '80',
			button_width: 223,
			button_height: 223,

			// The event handler functions are defined in handlers.js
			file_queued_handler : fileQueued,
			file_queue_error_handler : fileQueueError,
			file_dialog_complete_handler : fileDialogComplete,
			upload_start_handler : uploadStart,
			upload_progress_handler : uploadProgress,
			upload_error_handler : uploadError,
			upload_success_handler : uploadSuccess,
			upload_complete_handler : myComplete,
			queue_complete_handler : queueComplete	// Queue plugin event
		};

		swfu = new SWFUpload(settings);
	};
	
	function tinyInitialize(){
		
		tinyMCE_GZ.init({
			themes: "advanced",
			plugins: "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",
			languages: "en",
			disk_cache: true
		});
		
		
		tinyMCE.init({
			mode: "textareas",
			theme: "advanced",
			editor_selector: "Work",
			plugins: "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",
			theme_advanced_buttons1: "save,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,fontselect,fontsizeselect",
			theme_advanced_buttons2: "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,blockquote,|,link,unlink,anchor,cleanup,code,preview,|,forecolor,backcolor,|,spellchecker,table",
			theme_advanced_buttons3: "hr,removeformat,visualaid,|,sub,sup,|,print,|,fullscreen,|,undo,redo",
			theme_advanced_toolbar_location: "top",
			theme_advanced_toolbar_align: "left",
			theme_advanced_statusbar_location: "bottom",
			theme_advanced_resizing: true,
			
			blockquote_clear_tag: "br",
			
			content_css: "/css/jurgitalt/article.css",
			width:500,
			height:500,
			force_br_newlines: true,
			forced_root_block: ''
		});

		tinyMCE.init({
			mode: "textareas",
			theme: "advanced",
			editor_selector: "SimpleWork",
			plugins: "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",
			theme_advanced_buttons1: "save,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,undo,redo,|,bullist,numlist,blockquote,|,sub,sup,|,table",
			theme_advanced_buttons2: "",
			theme_advanced_buttons3: "",
			theme_advanced_toolbar_location: "top",
			theme_advanced_toolbar_align: "left",
			theme_advanced_statusbar_location: "bottom",
			theme_advanced_resizing: false,
			
			blockquote_clear_tag: "br",
			
			content_css: "/css/jurgitalt/article.css",
			width:500,
			height:500,
			force_br_newlines: true,
			forced_root_block: ''
		});
		
		tinyMCE.init({
			mode: "textareas",
			theme: "simple",
			editor_selector: "Simple",
			
			force_br_newlines: true,
			forced_root_block: ''
		});
	}
	
	
	
	function miestas_autocompletes_init(mode){
		$("#"+mode+"City").autocomplete("/autocomplete/towns/", {
			delay:100,
			width:300,
			minChars:2,
			scrollHeight:100,
			matchSubset:true,
			matchContains:true,
			cacheLength:0,
			onItemSelect:selectItem,
			formatItem:formatItem,
			autoFill:false
		});	
	}
	

