$(document).ready(function() {
  if ($('#joukkuekuva').length != 0) {
    add_css("http://www.karhuht.com/sources/js/fancybox/jquery.fancybox-1.3.4.css");
    //if ($.browser.msie && $.browser.version.substr(0,1)<7) { //IE version bellow 7
        //add_css("http://www.karhuht.com/sources/js/fancybox/asd-ie.css");
    //}
    $.getScript("http://www.karhuht.com/sources/js/fancybox/jquery.fancybox-1.3.4.js", function(){
      setTimeout("init_fancybox()",250);  //wait before initialising to prevent intermittent load error
    });
  }
});

function init_fancybox() {
  $("#joukkuekuva").fancybox({
    'overlayShow'	   : true,
    'hideOnContentClick': true,
    'showCloseButton'   : true,
    'transitionIn'	   : 'elastic',
    'transitionOut'	   : 'elastic'
  });
}


function add_css(url) {
    $("head").append("<link>");
    css = $("head").children(":last");
    css.attr({
      rel:  "stylesheet",
      type: "text/css",
      href: url
    });
}
/*
function updateForm(){
	$("#width").val($("#drag").attr("offsetWidth"));
	$("#height").val($("#drag").attr("offsetHeight"));
	$("#top").val($("#drag").attr("offsetTop"));
	$("#left").val($("#drag").attr("offsetLeft"));
}
$(document).ready(function(){
	updateForm();
	$("#drag").resizable({
		 stop: function() {
			updateForm();
		  }
	});
	$("#drag").draggable({
		  containment: 'parent',
		  stop: function() {
			updateForm();
		  }
	});
	$(".tag").hover(
	function () {
	$(this).children("span").removeClass("tagOff");
	$(this).children("span").addClass("tagOn");
	},
	function () {
	$(this).children("span").removeClass("tagOn");
	$(this).children("span").addClass("tagOff");
	}
	);

});*/

