/**
 * Dependent on Jquery
 */

function floatElements(floatBox) {
	var msie6 = $.browser == 'msie' && $.browser.version < 7;

	if (!msie6) {
		var top = $(floatBox).offset().top - parseFloat($(floatBox).css('margin-top').replace(/auto/, 0));
		$(window).scroll(function (event) {
			// what the y position of the scroll is
			var y = $(this).scrollTop();

			// whether that's below the form
			if (y >= top) {
				// if so, ad the fixed class
				$(floatBox).addClass('fixed');
			} else {
				// otherwise remove it
				$(floatBox).removeClass('fixed');
			}
		});
	}
}

function isEmpty(obj) {
	for(var prop in obj) {
		if(obj.hasOwnProperty(prop))
			return false;
	}

	return true;
}

function getObj(image) {
	var dimensions = [675, 500];

	var so = new SWFObject(WEBROOT + "flash/zoom.swf", "zoomFlash", dimensions[0], dimensions[1], "9", "#FFFFFF");
	so.addVariable("image", image);
	so.addVariable("xmlPath", WEBROOT + "flash/config.xml");
	so.addParam("menu", "false");
	so.addParam("wmode", "transparent");
	so.write("zoomFlash");
}


function loadFlash(image) {
	var so = new SWFObject(WEBROOT + "flash/zoom.swf", "flashcontent", "675", "500", "9");
	so.addVariable("image", image);
	so.addVariable("xmlPath", WEBROOT + "flash/config.xml");
	so.addParam("menu", "true");
	so.addParam("wmode", "transparent");
	so.write("zoomFlash");
}

function slideSwitch() {
	var $active = $('.smallSlideshow a.active');

	if ( $active.length == 0 ) $active = $('.smallSlideshow a:last');

	var $next =  $active.next().length ? $active.next() : $('.smallSlideshow a:first');

	$active.removeClass('active');
	$next.css({
		opacity: 0.0
	}).addClass('active').animate({
		opacity: 1.0
	}, 1000);
}

function preloadImg(image) {
	var img = new Image();
	img.src = image;
}
