function arr2str(arr) {
	var str = '';
	var d1 = '#';
	var d2 = '!';
	for (var i in arr) {
		str += i+d1+arr[i]+d2;
	}
	return str.substring(0, str.length-d2.length);
}

function str2arr(str) {
	var arr = new Array();
	var d1 = '#';
	var d2 = '!';
	var tmp = str.split(d2);
	for (var i in tmp) {
		var tmp2 = tmp[i].split(d1);
		arr[tmp2[0]] = tmp2[1];
	}
	return arr;
}

$(document).ready(function() {
				 //tables
					$("tr").mouseover(function() {$(this).addClass("over");}).mouseout(function() {$(this).removeClass("over");});
					$("tr:odd").addClass("odd");
					
					
					// png fix
					$(document).pngFix();
					
					
					//show_hide control
					/*
					$('.expandable h2.control, .expandable h2.control_closed').toggle(
							   function() {
								   			$(this).parent().children('.expandable_content').slideToggle(200);
								},
								function() {
											$(this).parent().children('.expandable_content').slideToggle(200);
								}
					);
					*/
						
					//drag and drop on the left column. You need to .. somehow store this in a cookie
					// http://jqueryui.com/demos/sortable/
					//$(".drop_sort").sortable({update:function(event, ui) {var sortorder=$(this).sortable('toArray');blockMoved(sortorder);}});
				 /**/
					// close tip
					
					
					$('.yellow_bg .close_ico').click(function() {
													 
													 $(this).parent().parent().fadeOut();
													  });

						
					// edit element hover state	
						
						$('.editable').hover(function() {
								$(this).addClass('edit_element_hover')
					
						},function() {$(this).removeClass('edit_element_hover');})

						
						
					 $('.editable').click(function() {
													$(this).parent().children('.edit_descr').css("display", "block"); 
													$(this).css("display", "none"); 
													  });
						
						$('.close_edit_descr').click(function() {
													 $(this).parent().parent().parent().parent().children('.editable').show();
													 
													 $('.editable').removeClass('edit_element_hover')
													 $(this).parent().parent().parent().hide(); 
													 return(false);
													
													  });
						
						
						
						// delete
						
						$('.comments_list .delete_ico').click(function() {
								
										var answer = confirm ("Are you sure you want to delete this comment?")
										if (answer)
										$(this).parent().parent().fadeOut();
										else
										return(false);
													  });


						// message close
						
						$('.message').click(function() {
								
										$(this).fadeOut();
										return(false);
													  });
						
						
						// show func in posts
						
						
						$('table.posts td').hover(function() {
							$(this).children('.edit_inline_post').fadeIn();
							
							
						},function() { $(this).children('.edit_inline_post').hide();})
		
		
						//status list fix
						
						$('.status_list li:last').css("border-bottom", "none");
							
			});
