
jQuery.fn.center = function(params) {

		var options = {

			vertical: true,
			horizontal: true

		}
		op = jQuery.extend(options, params);

   return this.each(function(){

		//initializing variables
		var $self = jQuery(this);
		//get the dimensions using dimensions plugin
		var width = $self.width();
		var height = $self.height();
		//get the paddings
		var paddingTop = parseInt($self.css("padding-top"));
		var paddingBottom = parseInt($self.css("padding-bottom"));
		//get the borders
		var borderTop = parseInt($self.css("border-top-width"));
		var borderBottom = parseInt($self.css("border-bottom-width"));
		//get the media of padding and borders
		var mediaBorder = (borderTop+borderBottom)/2;
		var mediaPadding = (paddingTop+paddingBottom)/2;
		//get the type of positioning
		var positionType = $self.parent().css("position");
		// get the half minus of width and height
		var halfWidth = (width/2)*(-1);
		var halfHeight = ((height/2)*(-1))-mediaPadding-mediaBorder;
		// initializing the css properties
		var cssProp = {
			position: 'absolute'
		};

		if(op.vertical) {
			cssProp.height = height;
			cssProp.top = '50%';
			cssProp.marginTop = (halfHeight+25);
		}
		if(op.horizontal) {
			cssProp.width = width;
			cssProp.left = '50%';
			cssProp.marginLeft = halfWidth;
		}
		//check the current position
		if(positionType == 'static') {
			$self.parent().css("position","relative");
		}
		//aplying the css
		$self.css(cssProp);


   });

};


/*** 
    Simple jQuery Slideshow Script
    Released by Jon Raasch (jonraasch.com) under FreeBSD license: free to use or modify, not responsible for anything, etc.  Please link out to me if you like it :)
***/

function slideSwitch() {
    var jQueryactive = jQuery('#slideshow IMG.active');

    if ( jQueryactive.length == 0 ) jQueryactive = jQuery('#slideshow IMG:last');

    // use this to pull the images in the order they appear in the markup
    var jQuerynext =  jQueryactive.next().length ? jQueryactive.next()
        : jQuery('#slideshow IMG:first');

    // uncomment the 3 lines below to pull the images in random order
    
    // var jQuerysibs  = jQueryactive.siblings();
    // var rndNum = Math.floor(Math.random() * jQuerysibs.length );
    // var jQuerynext  = jQuery( jQuerysibs[ rndNum ] );


    jQueryactive.addClass('last-active');

    jQuerynext.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            jQueryactive.removeClass('active last-active');
        });
}

jQuery(function() {
    setInterval( "slideSwitch()", 5000 );
});



function doFading() { 
      jQuery("#small-map").css({opacity : 0}).animate({opacity : 0}, 1500).fadeIn(5000).animate({opacity : 1}, 7500).fadeOut(3000,doFading); 
    } 

jQuery(document).ready(function(jQuery){ 

doFading();
jQuery("#map").css({opacity : 0});
jQuery("#news-section ul").center({
horizontal: false // only vertical
});
jQuery('.nav-but-title').css({opacity : 0.75});
//initial settings 

jQuery("#map").hover(function(){ 
jQuery(this).stop().animate({opacity : 1}, 350);
},function(){ 
jQuery(this).stop().animate({opacity : 0}, 750);
 }); //  .hover
 

}); // doc.ready close
