// ------------------------------ bottom slider ------------------------------

var evtabs = {};
evtabs.jq= jQuery.noConflict(false);
 
(function($) {
	evtabs.jq(document).ready(function() {

		/*First box*/
		$("#eventslider").supermenu({selected:true,selectedClass:'selected',oClass:'_paging'});
		$(".supermenu_paging").mousewheel(function(eventA, deltaA) {
				if (deltaA > 0) $("#eventslider").trigger("left",[30]);
				else if (deltaA < 0) $("#eventslider").trigger("right",[30]);
				eventA.stopPropagation();
				eventA.preventDefault();
		})
		/*MOUSEOVER & MOUSEOUT*/
		$("#big_slider_prev").bind("mouseover",function() {
			var offset_ = 20;			
			this.interval_ = window.setInterval(function() {
				offset_ = (offset_) + 2;
				if (offset_ >= 40)
				{
					offset_ = 40;
				}
				$("#eventslider").trigger("left",[offset_]);
			},100);
		}).bind("mouseout",function() {
			window.clearInterval(this.interval_);
			this.offset_ = 0;
		});
		$("#big_slider_next").bind("mouseover",function() {
			var offset_ = 20;
			this.interval_ = window.setInterval(function() {
				offset_ = (offset_) + 2;
				if (offset_ >= 40)
				{
					offset_ = 40;
				}
				$("#eventslider").trigger("right",[offset_]);
			},100);
		}).bind("mouseout",function() {
			window.clearInterval(this.interval_);
			this.offset_ = 0;
		});
		/*End First box*/
		
		
		/*Second box*/
		$(".eventslider_small_ul").each(function(i){
		   $(this).supermenu({selected:true,selectedClass:'selected',oClass:'_paging_small'});
		});

		$(".supermenu_paging_small").mousewheel(function(eventA, deltaA) {
				if (deltaA > 0) $(".eventslider_small_ul", $(this)).trigger("left",[10]);
				else if (deltaA < 0) $(".eventslider_small_ul", $(this)).trigger("right",[10]);
				eventA.stopPropagation();
				eventA.preventDefault();
		})
		/*MOUSEOVER & MOUSEOUT*/
		$(".small_slider_prev").bind("mouseover",function() {
			var spag_id = $(this).parent().attr("id");
			var offset_ = 5;			
			this.interval_ = window.setInterval(function() {
				offset_ = (offset_) + 1;
				if (offset_ >= 10)
				{
					offset_ = 10;
				}
				$("#ul_" + spag_id ).trigger("left",[offset_]);
			},30);
		}).bind("mouseout",function() {
			window.clearInterval(this.interval_);
			this.offset_ = 0;
		});
		$(".small_slider_next").bind("mouseover",function() {
			var spag_id = $(this).parent().attr("id");
			var offset_ = 5;
			this.interval_ = window.setInterval(function() {
				offset_ = (offset_) + 1;
				if (offset_ >= 10)
				{
					offset_ = 10;
				}
				$("#ul_" + spag_id ).trigger("right",[offset_]);
			},30);
		}).bind("mouseout",function() {
			window.clearInterval(this.interval_);
			this.offset_ = 0;
		});
		/*End Second box*/
		
		$('.index_post').css("display", "none");
		$('.index_post').css("visibility", "visible");
		$('.index_post:first').css("display", "block");
			
		$('.post_link, .image_m').click(function () {
			$('.index_post').css("display", "none");
			$($(this).attr("href")).fadeIn("slow");
			return false;
		});

		$('.image_s').click(function () {
			$('.image_l', $(this).parents(".index_post")).css("display", "none");
			$('.image_xl').css("display", "none");
			$($(this).attr("href")).fadeIn("slow");
			return false;
		});

	});
})(jQuery);

// ------------------------------ END bottom slider ------------------------------


// ------------------------------ simple actions ------------------------------

var simpleActions = {};
simpleActions.jq= jQuery.noConflict(false);
 
(function($) {

	simpleActions.jq(document).ready(function() {
		// variables

         var siteurl = $('#siteurl').attr('value');
         var is_home = $('#is_home').attr('value');

		// init scrollbar
		if ( $('#eventlist_with_scroll').is('div') ) {
    		$('#eventlist_with_scroll').jScrollPane({showArrows:true, scrollbarWidth: 13});
		}

		if ( $('#submenu').is('div') ) {
    		$('#submenu').jScrollPane({showArrows:true, scrollbarWidth: 13, animateTo:true});
			if ( jQuery.isFunction($('#submenu')[0].scrollTo) ) {
				$('#submenu')[0].scrollTo('.current_page_item');
			}			
		}

		if ( $('.search_div').is('div') ) {
    		$('.search_div').jScrollPane({showArrows:true, scrollbarWidth: 13});
		}

		if ( $('.termsbox').is('div') ) {
    		$('.termsbox').jScrollPane({showArrows:true, scrollbarWidth: 13, dragMinHeight: 20});
		}

		if ( $('#eventlist_with_scroll').is('div') || $('#submenu').is('div') ) {
			$('.submenu_tab').css("display", "none");
		}

		// right submenu
		
		$('.submenu_tab').css("display", "none");
		$('.submenu_tab').css("visibility", "visible");
		$('.submenu_tab:eq('+$('.tab_link').index( $("td.submenu_tab_active a") )+')').css("display", "block");

		$('.tab_link').click(function () {
			if ($('.tab_link').size() > 1)
			{
				$("td.submenu_tab_active").removeAttr("className");
				$(this).parent().attr("className","submenu_tab_active");
				$('.submenu_tab').css("display", "none");
				$('.submenu_tab:eq('+$('.tab_link').index(this)+')').fadeIn("fast");
			}
			return false;
		});
		// end right submenu


		// event submenu
		//gmaps onLoad();
		if ( typeof onLoad==='function' ) {
			onLoad();
		}
		$('.content_event').css("display", "none");
		$('.content_event').css("visibility", "visible");
		$('.content_event:eq('+$('.tab_link_event').index( $("td.event_menu_active a") )+')').fadeIn();
		
		$('.tab_link_event').click(function () {
			$("td.event_menu_active").removeAttr("className");
			$(this).parent().attr("className","event_menu_active");
			$('.content_event').css("display", "none");
			$('.content_event:eq('+$('.tab_link_event').index(this)+')').fadeIn();
			return false;
		});

		// special for comments button in event:
		$('.event_comments_link').click(function () {
			$('#single_comments_tab').click();
		});

		// special for blogs button in event:
		$('.event_blogs_link').click(function () {
			$('#single_blogs_tab').click();
		});

		// end event submenu

        // bottom site map trigger
		$('.trigger #plus').show();
		$('.trigger #minus').hide();
		$('.showhide > .column ul').hide();

		$('.trigger #plus, .showhide > .column > h3').mouseover(function() {
			$(this).css('cursor', 'pointer');
		});

		$('.trigger #plus, .trigger #minus, .showhide > .column > h3').click(function () {
			$('.trigger #plus').toggle();
			$('.trigger #minus').toggle();
			$('.showhide > .column ul').slideToggle(400);
		});
        
        //top slider
        $('#sliders')
        .cycle({ 
            fx:     'fade', 
            speed:  300, 
            next:   '#imageSliderNextButton',
            prev:   '#imageSliderPrevButton', 
            timeout: 20000,
            pager:  '#nav'
        }); 
        
        // page image's TITLE catcher
        $('div.content.page img').each(function(i){
		    var width = 'style="width: ' + $(this).attr('width') + 'px;"';
		    var title = '';
		    if ( $(this).attr('title') != '' ) {
                title = '<span>' + $(this).attr('title') + '</span>';
            }

            if ( $(this).attr('className').lastIndexOf('alignright') >= 0 ) {
                var cssClass = 'class="inline_image fr"';                
            } else {
                var cssClass = 'class="inline_image fl"';
            }

		    $(this).wrap('<div ' + cssClass + ' ' + width + '></div>');
		    $(this).parent().append(title);
		});	

		// =========================================================================================== //
		
		// inputs onhover effect
		function inputs_onhover_effect_refresh (  ) {
			$('input, select, textarea').hover(
				function(){
					$(this).addClass('hover');
				},
				function(){
					$(this).removeClass('hover');
				}
			);

			$('input, select, textarea').focus(
				function(){
					$(this).addClass('focus');
				}
			);
			$('input, select, textarea').blur(
				function(){
					$(this).removeClass('focus');
					$(this).removeClass('hover');
				}
			);
		}

		inputs_onhover_effect_refresh();
		
		// registration form
		$('form.register, form.profile').keypress(function (e) {
			if (e.which == 13){ // on enter press
				$('.registration_form_submit_link', $(this)).click();
			}
		});

		// this func prevents wrong symbols in input
		$('input.register_login').keypress(function (e) {
			if ( (e.which != 13) && (e.which != 8) && (e.which != 0) && (e.which != 127) ) {
				var c = String.fromCharCode(e.which);
				var loginRegEx = /[a-zA-Z0-9]/;
				if ( loginRegEx.test(c) == false ) 
					return false;
			}
			return true;
		});

		$('.captcha_refresh').click(function(){
			$('.captcha_img').attr('src', siteurl+'/wp-includes/securimage/securimage_show.php?' + Math.random());
		});

		$('.registration_form_submit_link').click(function() {
			// validation
			var is_form_valid = true;

			var form = $(this).parents('form:eq(0)');
			
			//login validation
			$('.register_login', form).each(function(i){
				if ( $(this).attr("value") == null || $(this).attr("value") == "" || $(this).attr("value").match(/[^a-zA-Z0-9]/) ) {
					is_form_valid = false;
					$(this).addClass("error");
				} else {
					$(this).removeClass("error");
				}
			});

			//strings validation
			$('.register_string', form).each(function(i){
				if ($(this).attr("value") == null || $(this).attr("value") == "") {
					is_form_valid = false;
					$(this).addClass("error");
				} else {
					$(this).removeClass("error");
				}
			});
			
			//email validation
			var emailRegEx = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
			$('.register_email', form).each(function(i){
				if ( emailRegEx.test($(this).attr("value")) == false ) {
					is_form_valid = false;
					$(this).addClass("error");
				} else {
					$(this).removeClass("error");
				}
			 });

			// terms checkbox
			$('.register_checkbox', form).each(function(i){
				if (!this.checked) {
					is_form_valid = false;
					$(this).parent().addClass("error");
				} else {
					$(this).parent().removeClass("error");
				}
			});

			if (is_form_valid)
			{
				// that is an update from user profile
				if ( $('.register_action', form).val() == 'update') {
					$('.error_message', form).hide();
					$('.ajax_loader', form).show('fast');
					$.post(siteurl+"/wp-includes/lt1000_updateuser.php", $(form).serialize(), function(data) {
						if ( (data.success !== null) && (typeof( data.success ) == 'object') ) {
							$('.error_message', form).empty();
							$.each(data.success, function(i, item){							
								$('.error_message', form).append('<p>'+item+'</p>');
							});
							$('.ajax_loader', form).hide('slow');
							$('.error_message', form).show('fast');
						} else if ( (data.errors !== null) && (typeof( data.errors ) == 'object') ) {
							$('.error_message', form).empty();
							$.each(data.errors, function(i, item){							
								$('.error_message', form).append('<p>'+item+'</p>');
							});
							$('.ajax_loader', form).hide('slow');
							$('.error_message', form).show('fast');
						}
					}, "json");
					$('.ajax_loader', form).hide();
				} else {
					$('.error_message', form).hide();
					$('.ajax_loader', form).show('fast');
					$.post(siteurl+"/wp-includes/lt1000_registeruser.php", $(form).serialize(), function(data) {
						//alert(data);
						if ( (data.errors !== null) && (typeof( data.errors ) == 'object') )
						{
							$('.error_message', form).empty();
							$.each(data.errors, function(i, item){							
								$('.error_message', form).append('<p>'+item+'</p>');
								return false;
							});
							$('.ajax_loader', form).hide('slow');
							$('.error_message', form).show('fast');
							$('.captcha_img').attr('src', siteurl+'/wp-includes/securimage/securimage_show.php?' + Math.random());
						} else {
							$('#registration').hide();
							$('#registration_success').show();
							//$(form).submit();
							//window.location.reload(true);
						}
					}, "json");
					$('.ajax_loader', form).hide();
				}
			} else {
				$('.required_message', form).show('fast');
			}
		});
		// =========================================================================================== //
		
		// post image's fulltext viewer
        $('div.ngg-galleryoverview').each(function(i){
            $(this).addClass("lt1000_gallery");
        });
        
        // set 'image_l' center
        $('div.image_l img').each(function(i){
        //alert( $(this) );
            $(this).wrap('<table><tr><td></td></tr></table>');
        });
        
        // HOME a must have target "_blank"
        /*if ( is_home ) {
            $('a[className!="no_blank"]').attr('target', '_blank');
        }*/
        
		// sign in form ============================================================================== //
		$('input', '#signin_form').keypress(function (e) {
			if (e.which == 13){ // on enter press
				$('.signin_form_submit_link').click();
			}
		});

        $('input', '#MailPress').keypress(function (e) {
            if (e.which == 13){ // on enter press
                $('#newsletter_form_submit_link').click();
                return false;
			}
            return true;
		});

		$('#signin_link, .signin_form_close_link').click(function(){
			$('#login_popup').toggle();
		});

		$('#newsletter_link, .newsletter_form_close_link').click(function(){
			$('#newsletter_popup').toggle();
		});
		
		$('#resize_header').click(function(){
		    if ( $.cookie('resize_header') ) {
                $.cookie('resize_header', null, { path: "/"});
            } else {
                $.cookie('resize_header', 'resize header on click buttom at the top of the head', { expires: 7, path: "/"} );
            }
            window.location.reload();
		});		

		$('.retrieve_form_show_link').click(function(){
			$('#retrieve_password_div').toggle();
		});

		$('.signin_form_submit_link').click(function() {
			// validation
			var is_form_valid = true;

			var form = $(this).parents('form');
			
			//strings validation
			$('.register_string', form).each(function(i){
				if ($(this).attr("value") == null || $(this).attr("value") == "") {
					is_form_valid = false;
					$(this).addClass("error");
				} else {
					$(this).removeClass("error");
				}
			});

			if (is_form_valid)
			{
				$('.error_message', form).hide();
				$('.ajax_loader', form).show('fast');
				$.post(siteurl+"/wp-includes/lt1000_signinuser.php", $(form).serialize(), function(data) {
					if ( (data.errors !== null) && (typeof( data.errors ) == 'object') )
					{						
						$('.error_message', form).empty();
						$.each(data.errors, function(i, item){							
							$('.error_message', form).append('<p>'+item+'</p>');
						});
						$('.ajax_loader', form).hide('slow');
						$('.error_message', form).show('fast');
					} else {
						window.location.replace(location.href);
					}
				}, "json");
				$('.ajax_loader', form).hide();
			} else {
				$('.required_message', form).show('fast');
			}
			
		});

		$('input', '#retrieve_form').keypress(function (e) {
			if (e.which == 13){
				$('.retrieve_form_submit_link').click();
			}
		});

		$('.retrieve_form_submit_link').click(function() {
			// validation
			var is_form_valid = true;

			var form = $(this).parents('form');
			
			//strings validation
			$('.register_string', form).each(function(i){
				if ($(this).attr("value") == null || $(this).attr("value") == "") {
					is_form_valid = false;
					$(this).addClass("error");
				} else {
					$(this).removeClass("error");
				}
			});

			if (is_form_valid)
			{
				$('.error_message', form).hide();
				$('.ajax_loader', form).show('fast');
				$.post(siteurl+"/wp-includes/lt1000_retrievepass.php", $(form).serialize(), function(data) {
					$('.error_message', form).empty();
					if ( (data.errors !== null) && (typeof( data.errors ) == 'object') )
					{						
						$.each(data.errors, function(i, item){							
							$('.error_message', form).append('<p>'+item+'</p>');
						});
						$('.ajax_loader', form).hide('slow');
						$('.error_message', form).show('fast');
					} else {
						$('.ajax_loader', form).hide();
						$('#user_login', form).val('');
						$('#retrieve_password_div').hide();
						//$('#retrieve_password_div').remove();
					}
				}, "json");
				$('.ajax_loader', form).hide();
			} else {
				$('.required_message', form).show('fast');
			}
			
		});

		// comments form:
		$('.commentform_submit_link').click(function() {
			var form = $(this).parents('form');
			$('.error_message', form).hide();
			$('.ajax_loader', form).show('fast');
			$.post(siteurl+"/wp-includes/lt1000_postcomment.php", $(form).serialize(), function(data) {
				if ( (data.errors !== null) && (typeof( data.errors ) == 'object') )
				{						
					$('.error_message', form).empty();
					$.each(data.errors, function(i, item){							
						$('.error_message', form).append('<p>'+item+'</p>');
					});
					$('.ajax_loader', form).hide('slow');
					$('.error_message', form).show('fast');
				} else if ( (data.success !== null) && (typeof( data.success ) == 'object') ) { // comment
					$('.ajax_loader', form).hide();
					$('#addcomment').hide('fast',function() {
						$('#commentadded').show('fast', function() {
							$('#comments_scrollable_div').jScrollPane({smallHeight:true}).jScrollPane({showArrows:true, scrollbarWidth: 13});
						});
					});
				} else if ( (data.update_text !== null) && (typeof( data.update_text ) == 'object') ) { // blog
					$('.ajax_loader', form).hide();
					$.each(data.update_text, function(i, item){
						if (i == 'text') {
							$('#blog_edit_area').val(item);
							$('#blog_view_area').text(item);
						} else if (i == 'is_approved') {
							if (item == '0') {
								$('#blog_awaiting_moderation').show();
							} else {
								$('#blog_awaiting_moderation').hide();
							}
						} else if (i == 'is_draft') {
							if (item == '1') {
								$('#blog_dont_show').show();
							} else {
								$('#blog_dont_show').hide();
							}
						} else if (i == 'gallery') {
							$('#blog_user_pictures').html(item);
						} else if (i == 'video_gallery') {
                            $('#blog_user_videos').html(item);
						}
                        tb_init('a.thickbox, area.thickbox, input.thickbox');//pass where to apply thickbox
					});
					$('.current_user_block').hide();
                    $('#blog_user_blogs').show();
                    $('#blog_text_view').show();
                    $('.ico_minus').hide();
                    $('.ico_plus').show();
                    $('#commentform_view_link > .ico_plus').hide();
                    $('#commentform_view_link > .ico_minus').show();
					//$('#blog_edit_view').hide();
					//$('#blog_awaiting_moderation').show();
					$('#blogs_scrollable_div').jScrollPane({smallHeight:true}).jScrollPane({showArrows:true, scrollbarWidth: 13});
					if ( jQuery.isFunction($('#blogs_scrollable_div')[0].scrollTo) ) {
						$('#blogs_scrollable_div')[0].scrollTo(0);
					}
				}
			}, 'json');
		});

		$('.commentform_edit_link').click(function() {
			$('#blog_edit_view').show();
			$('#blog_edit_area').focus();	
			$('#blog_text_view').hide();
			$('#blogs_scrollable_div').jScrollPane({smallHeight:true}).jScrollPane({showArrows:true, scrollbarWidth: 13});
			if ( jQuery.isFunction($('#blogs_scrollable_div')[0].scrollTo) ) {
				$('#blogs_scrollable_div')[0].scrollTo(0);
			}	
		});

        $('#commentform_view_link').click(function() {
            $('.current_user_block').hide();
            $('.ico_minus').hide();
            $('.ico_plus').show();
            $('.ico_plus', this).hide();
            $('.ico_minus', this).show();
            $('#blog_text_view').show();
            $('#blogs_scrollable_div').jScrollPane({smallHeight:true}).jScrollPane({showArrows:true, scrollbarWidth: 13});
			if ( jQuery.isFunction($('#blogs_scrollable_div')[0].scrollTo) ) {
				$('#blogs_scrollable_div')[0].scrollTo(0);
			}
        });
        $('#commentform_edit_blogs_link').click(function() {
            $('#blog_form_edit_field').val('blogs');
            $('.current_user_block').hide();
            $('.ico_minus').hide();
            $('.ico_plus').show();
            $('.ico_plus', this).hide();
            $('.ico_minus', this).show();
            $('#edit_current_user_blogs').show();
            $('#blogs_scrollable_div').jScrollPane({smallHeight:true}).jScrollPane({showArrows:true, scrollbarWidth: 13});
			if ( jQuery.isFunction($('#blogs_scrollable_div')[0].scrollTo) ) {
				$('#blogs_scrollable_div')[0].scrollTo(0);
			}
        });
        $('#commentform_edit_photos_link').click(function() {
            $('#blog_form_edit_field').val('photos');
            $('.current_user_block').hide();
            $('.ico_minus').hide();
            $('.ico_plus').show();
            $('.ico_plus', this).hide();
            $('.ico_minus', this).show();
            $('#edit_current_user_photos').show();
            $('#blogs_scrollable_div').jScrollPane({smallHeight:true}).jScrollPane({showArrows:true, scrollbarWidth: 13});
			if ( jQuery.isFunction($('#blogs_scrollable_div')[0].scrollTo) ) {
				$('#blogs_scrollable_div')[0].scrollTo(0);
			}
        });
        $('#commentform_edit_videos_link').click(function() {
            $('#blog_form_edit_field').val('videos');
            $('.current_user_block').hide();
            $('.ico_minus').hide();
            $('.ico_plus').show();
            $('.ico_plus', this).hide();
            $('.ico_minus', this).show();
            $('#edit_current_user_videos').show();
            $('#blogs_scrollable_div').jScrollPane({smallHeight:true}).jScrollPane({showArrows:true, scrollbarWidth: 13});
			if ( jQuery.isFunction($('#blogs_scrollable_div')[0].scrollTo) ) {
				$('#blogs_scrollable_div')[0].scrollTo(0);
			}
        });

        // video submit handling
        $('.commentform_video_submit_link').click(function() {
			var form = $(this).parents('form');
			$('.error_message_video', form).hide();
            $('#videoadded', form).hide();
			$('.ajax_loader_video', form).show('fast');
			$.post(siteurl+"/wp-includes/lt1000_submitvideo.php", $(form).serialize(), function(data) {
                if ( (data.errors !== null) && (typeof( data.errors ) == 'object') )
				{
					$('.error_message_video', form).empty();
					$.each(data.errors, function(i, item){
						$('.error_message_video', form).append('<p>'+item+'</p>');
					});
					$('.ajax_loader_video', form).hide('slow');
					$('.error_message_video', form).show('fast');
				} else if ( (data.success !== null) && (typeof( data.success ) == 'object') ) { // comment
                    $('#submit_video_input').val('');
                    $('.ajax_loader_video').hide('fast',function() {
						$('#videoadded').show('fast');
                        $('#submit_impression_link').click();
					});
				}
			}, 'json');
		});


		// =========================================================================================== //
		
		// AJAX uploader
		if ( $('#blog_image_load_button').length > 0 ) {
			var blog_image_load_text = $('#blog_image_load_text').val();
			var blog_image_loading_text = $('#blog_image_loading_text').val();

			var button = $('#blog_image_load_button'), interval;

			new Ajax_upload(button,{			
				action: siteurl+'/wp-includes/lt1000_uploadpicture.php', 
				name: 'userfile',
				onSubmit : function(file, ext){
					if (! (ext && /^(jpg|png|jpeg|gif)$/.test(ext))){
						// extension is not allowed
						$('.image_error_message').hide();
						$('.error_wrong_extension').show('fast');
						// cancel upload
						return false;
					}

					this.setData({
						gallery_post_id : $('#blog_gallery_post_id').val()
					});

					// change button text, when user selects file			
					button.text(blog_image_loading_text);

					// If you want to allow uploading only 1 file at time,
					// you can disable upload button
					this.disable();
					
					// Uploading -> Uploading. -> Uploading...
					interval = window.setInterval(function(){
						var text = button.text();
						if (text.length - blog_image_loading_text.length < 5){
							button.text(text + '.');					
						} else {
							button.text(blog_image_loading_text);				
						}
					}, 200);
				},
				onComplete: function(file, response){
					button.text(blog_image_load_text);

					window.clearInterval(interval);
					
					// enable upload button
					this.enable();

					//alert(response);
					if ( response.length == 0 ) {
						$('.image_error_message').hide();
						$('.error_upload_failed').show('fast');
						return false;
					}

					data = JSON.parse(response);
					if ( typeof data.success.pic_url != 'string'  || typeof data.success.pic_id != 'string' ) {
						$('.image_error_message').hide();
						$('.error_upload_failed').show('fast');
						return false;
					}
					
					// hiding errors
					$('.image_error_message').hide();

					// add file to the list
					$('<div id="p' + data.success.pic_id + '" class="uploaded_picture_wrap" style="display:none;"></div>').appendTo(
						'.uploaded_files').html('<input type="hidden" name="pic_id" value="' + data.success.pic_id + '" /><div class="blog_user_image_gray_box padding_bottom_20"><div class="image_m fl"><img id="img_' + data.success.pic_id + '" src="' + data.success.pic_url + '" class="mw100" /></div><a class="uploaded_picture_delete_link" href="#">delete</a></div><div class="photo_desc_container fl"><textarea name="' + data.success.pic_id + '" autocomplete="off" rows="8" cols="40">' + data.success.pic_desc + '</textarea></div><span class="clr">&nbsp;</span>');

					$('#img_' + data.success.pic_id)[0].onload = function () {
						$('#p' + data.success.pic_id).show('fast', function() {
							$('#blogs_scrollable_div').jScrollPane({smallHeight:true}).jScrollPane({showArrows:true, scrollbarWidth: 13});	
						});
					};

					$('.uploaded_picture_delete_link').click(function() {
						uploaded_picture_delete( $("input[@name='pic_id']:eq(0)", $(this).parents() ).val() );
						return false;
					});

					inputs_onhover_effect_refresh();
				}
			});
		};

		// remove image link
		function uploaded_picture_delete ( pic_id ) {
			var div = $('div#p' + pic_id);
			$.post(siteurl+"/wp-includes/lt1000_deleteuploadedpicture.php", { "pic_id": pic_id }, function(data) {
				$(div).hide('fast', function(){
					$(div).remove();
					$('#blogs_scrollable_div').jScrollPane({smallHeight:true}).jScrollPane({showArrows:true, scrollbarWidth: 13});
				});
			});
		}

		$('.uploaded_picture_delete_link').click(function() {
			uploaded_picture_delete( $("input[@name='pic_id']:eq(0)", $(this).parents() ).val() );
			return false;
		});

		// =========================================================================================== //

	});
})(jQuery);

// ------------------------------ END simple actions ------------------------------
