/* jQuery for "Arbeiten" Page of rubenwyttenbach.ch */
/* loads images from thumbs into DIV */

$(function() {
	// Portfolio Page Scrollpane Adjustemnts
	if($('body').is('.single-portfolio')){
		// Get the width of images and apply to scrollpane
		var width = 0;
		$('#content > *').each(function() { 
			width += $(this).width(); 
		});
		width += 550;
		$("#main").css({width: width + "px"});
		$("#container").css({width: width + "px"});
		$("#content").css({width: width + "px"});	
	}
	
	// Shift Centering with or without Window Scrollbar
	// Check if body height is higher than window height
    if ((jQuery.browser.mozilla) && (jQuery("body").width() < jQuery(window).width()) && (jQuery("body").height() <= jQuery(window).height())) {
       //alert("No Vertical Scrollbar!");
        jQuery('#wrapper').css({'marginLeft': '-8px'});
    } else if ((jQuery.browser.safari) && (jQuery("body").width() < jQuery(window).width()) && (jQuery("body").height() <= jQuery(window).height())) {
	    //alert("No Vertical Scrollbar!");
        jQuery('#wrapper').css({'marginLeft': '-7px'});
    }  

});


$.fn.hideTips = function(){
      // when building a plugin, "this" references the jquery object that the plugin was called on.
      // iterate through each element and return the elements.
      return this.each(function(){
            // save element for referencing later
            var $elem = $(this)
            // save alt and title
            var savealt = $elem.attr('alt');
            var savetitle = $elem.attr('title');
            // on mouseover, remove attributes
            // on mouseout, set attributes
            $elem.hover(function(){
                  $elem.removeAttr('title').removeAttr('alt');
            },function(){
                  $elem.attr({title:savetitle,alt:savealt});
            });
      });
};

$(function(){
  $('img').hideTips();
});
