
/*
overlable
*/

jQuery.fn.overlabel = function() {
    this.each(function(index) {
        var label = $(this); var field;
        var id = this.htmlFor || label.attr('for');
        if (id && (field = document.getElementById(id))) {
            var control = $(field);
            label.addClass("overlabel-apply");
            if (field.value !== '') {
                label.css("text-indent", "-2000px");
            }
            control.focus(function () {label.css("text-indent", "-10000px");}).blur(function () {
                if (this.value === '') {
                    label.css("text-indent", "0px");
                }
            });
            label.click(function() {
                var label = $(this); var field;
                var id = this.htmlFor || label.attr('for');
                if (id && (field = document.getElementById(id))) {
                    field.focus();
                }
            });
        }
    });
};
	
	(function($){
    $.fn.extend({
        centerimg: function () {
            return this.each(function() {
               // var top = ($(window).height() - $(this).outerHeight()) / 2;
               // var left = ($(window).width() - $(this).outerWidth()) / 2;
               // $(this).css({position:'absolute', margin:0, top: (top > 0 ? top : 0)+'px', left: (left > 0 ? left : 0)+'px'}).fadeIn(150);
               $(this).css("position","relative");
		    $(this).css("top", ( $(this).parent().height() - $(this).height() ) / 2 + "px");
		    $(this).css("left", ( $(this).parent().width() - $(this).width() ) / 2 + "px").fadeIn(150);
		    return this;

            });
        }
    }); 
})(jQuery);
	
	
	
	jQuery.fn.centerimgold = function () {

			 /*
var img = new Image();
			 img.src = $(this).attr("src");
			 alert(img.width + 'x' + img.height);
*/

			
	        //alert (imgAttr[0]);
	        //var theHeight = imgAttr[0]['height'];
	        //var theWidth = imgAttr[0]['width'];
	       // $(this).css('height', img.height)
		    //$(this).css('width', img.width);
		    $(this).css("position","relative");
		    $(this).css("top", ( $(this).parent().height() - $(this).height() ) / 2 + "px");
		    $(this).css("left", ( $(this).parent().width() - $(this).width() ) / 2 + "px").fadeIn(150);
		    return this;

		    
		
		}

	
	jQuery.fn.centerelement = function ( verticalOffset , horizontalOffset) {
 			if ( !verticalOffset ) {voffset = 0;} else { voffset = verticalOffset }
 			if ( !horizontalOffset ) {hoffset = 0;} else { hoffset = horizontalOffset }
		    $(this).css("position","relative");
		    $(this).css("top", ( $(this).parent().height() - $(this).height() ) / 2 - voffset + "px");
		    $(this).css("left", ( $(this).parent().width() - $(this).width() ) / 2 - hoffset + "px").fadeIn(150);
		    return this;

		    
		
		}
/*
	jQuery.fn.fadeThenSlideToggle = function(speed, easing, callback) {	
	  if (this.is(":hidden")) {
	    return this.slideDown(speed, easing).fadeTo(speed, 1, easing, callback);
	  } else {
	    return this.fadeTo(speed, 0, easing).slideUp(speed, easing, callback);
	  }
	}
*/
	jQuery.fn.fadeThenSlideToggle = function(speed, easing, callback) {	
	  if (this.is(":hidden")) {
	    return this.slideDown(speed, easing).fadeTo(speed, 1, easing, callback);
	  } else {
	    return this.fadeTo(speed, 0, easing).slideUp(speed, easing, callback);
	  }
	}
	$("#heroinfo h2").centerelement();
/* 	$(".oembed-flickr-title").fadeTo(250, 0.01); */
	$(".oembed-flickr").hoverIntent(
	  function () {

		    $(this).children(".oembed-flickr-title").fadeIn();

	  },
	  function () {

		    $(this).children(".oembed-flickr-title").fadeOut();

	  }
	);

