// show portfolio big image description 
function showdes(){
		$("#bigdes").slideUp(200); // hide it first when loaded 
$("#bigimage").hover( // then show on hover 
	function(){
	$("#bigdes").slideDown(200);}, 
	function(){
	$("#bigdes").slideUp(200);}
);}



//***** AJAX requests

// get a new picture
function getanewone(myurl, container, wd, hg, comurl, comid){

$.ajax({
  url: myurl,
  timeout: 2000,
  beforeSend: function(){
	scrollit(container);
	},
  success: function(a){
	b=a;
	c = container;
	wd2 = wd; hg2 = hg;
	// hide the picture first 
		$('#'+c+' div').fadeTo(1000, 0).delay(200).fadeTo(1000, 1);
	// replace an old element with new one
		window.setTimeout("$('#'+c+' div').html(b);", 900);
	// and hide description when loaded (with delay)
		window.setTimeout("showdes();", 3000);
	// change the box sizes 
	window.setTimeout("$('#'+c).animate({width: wd2+'px', height: hg2+'px'}, 600);", 800);
	comrefresh(comurl, comid);
	},
  error: function(){
	alert("Изображение не найдено - ошибка соединения. Попробуйте, пожалуйста, еще раз. Приносим извинения за неудобства.");
	}
});
}


// refresh the requested page part
function comrefresh(myurl, container){
	$.get(myurl, function(data) {
		$('#'+container).html(data);
	
		if(container!='comments'){
			// reload
			fancyimg(); // Fancybox
			gettiny(); // tinyMCE
		}
	});
}

