jQuery(document).ready(function(){	
  jQuery(".confirm").click(function(){
		return confirm("Opravdu provést?");
	});
  jQuery('.shadowBorder').borderImage('url("/images/video/shadow.png") 13');
    
  $('.dragndrop img').draggable({
      cursor: "move"
    });
  
  changeSize("size_eu");
})

function zoomPreview(val) {
  var img = jQuery('.dragndrop.active img');
  
  if(!img.parent().find(".dimension").hasClass("dimension")) {
	  img.parent().append('<span class="dimension hide"><span class="width">'+img.width()+'</span><span class="height">'+img.height()+'</span></span>');
  }
  
  img.animate({
		width: Math.round(img.width()*val)+'px',
		height: Math.round(img.height()*val)+'px'
	})
}
function zoomCenter(width,height) {
  var img = jQuery('.dragndrop.active img');
  
  if(!img.parent().find(".dimension").hasClass("dimension")) {
	  img.parent().append('<span class="dimension hide"><span class="width">'+img.width()+'</span><span class="height">'+img.height()+'</span></span>');
  }
  
  img.animate({
		width: img.parent().find(".dimension .width").text()+'px',
		height: img.parent().find(".dimension .height").text()+'px',
		left: Math.round(600-parseInt(img.parent().find(".dimension .width").text()))/2,
		top: 0
	})
}

function activateImage(ident)
{
	jQuery('.dragndrop.active').fadeOut();
	jQuery('.dragndrop.active img').fadeOut();
	jQuery('.dragndrop.active').removeClass("active");
	
	jQuery(".dragndrop."+ident).addClass("active").fadeIn();
	jQuery(".dragndrop."+ident+' img').fadeIn();
	setTimeout(function(){
		zoomCenter('580','330');
	},500);
}

function changeSize(sizeClass)
{
  jQuery('.sizeDiv:not(.'+sizeClass+')').hide();
  jQuery('.'+sizeClass).show();
}
