(function ($) {
$.fn.vAlign = function() {
	return this.each(function(i){
	var h = $(this).height();
	var oh = $(this).outerHeight();
	var mt = (h + (oh - h)) / 2;	
	$(this).css("margin-top", "-" + mt + "px");	
	$(this).css("top", "50%");
	$(this).css("position", "absolute");	
	});	
};
})(jQuery);

(function ($) {
$.fn.hAlign = function() {
	return this.each(function(i){
	var w = $(this).width();
	var ow = $(this).outerWidth();	
	var ml = (w + (ow - w)) / 2;	
	$(this).css("margin-left", "-" + ml + "px");
	$(this).css("left", "50%");
	$(this).css("position", "absolute");
	$(this).css("width", (w + 8) + "px");
	});
};
})(jQuery);


$(document).ready(function(){
	//To switch directions up/down and left/right just place a "-" in front of the top/left attribute
	//Caption Sliding (Partially Hidden to Visible)
	$('.boxgrid.caption').hover(function(){
		$(".cover", this).stop().animate({top:'0px'},{queue:false,duration:300});
	}, function() {
		$(".cover", this).stop().animate({top:'100px'},{queue:false,duration:500});
	});

	$(".inner").vAlign();
	$(".inner").hAlign();

	// IE 5.5/6 Transparenzfix
	var ie55 = (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) == 4 && navigator.appVersion.indexOf("MSIE 5.5") != -1);
	var ie6 = (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) == 4 && navigator.appVersion.indexOf("MSIE 6.0") != -1);

	if (jQuery.browser.msie && (ie55 || ie6)) {
			var PNGobj = jQuery(this).find("#logo a");
			var bgIMG = jQuery(PNGobj).css('background-image');
			var iebg = bgIMG.split('url("')[1].split('")')[0];
			jQuery(PNGobj).css('background-image', 'none');
			jQuery(PNGobj).get(0).runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + iebg + "',sizingMethod='scale')";

			var PNGobj = jQuery(this).find("#searchbtndiv");
			var bgIMG = jQuery(PNGobj).css('background-image');
			var iebg = bgIMG.split('url("')[1].split('")')[0];
			jQuery(PNGobj).css('background-image', 'none');
			jQuery(PNGobj).get(0).runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + iebg + "',sizingMethod='scale')";
	}

});

$(window).bind("load", function() {
	$("div#mygallery").slideView({
		easeFunc: "easeInOutSine",
		easeTime: 700,
		uiBefore: true,
		ttOpacity: 0.5,
		toolTip: false
	});
});
