		/******************************************************/
		/* CALL FUNCTIONS ON READY STATE AND SET VARIABLES
		/******************************************************/
			var myHeight = $('html').height();
			var myWidth = $('html').width();
			var bodyHeight = 600;
			var bodyWidth = 1000;
			var fade = 1000;
			var timeOut = 5000;
		
		/******************************************************/
		/* CALL FUNCTIONS ON READY STATE AND SET VARIABLES
		/******************************************************/
		$(function() {
			/*
			$(this).myWindowSizes();
			*/
			$(this).myDropDownMenu();

			$(this).myPngFix();
			$(this).myHover();

		});

		/******************************************************/
		/* CALL FUNCTIONS ON WINDOW RESIZE
		/******************************************************/
		/*
		$(window).resize( function() {
			myHeight = $('html').height();
			myWidth = $('html').width();
			$(this).myWindowSizes();
		});
		*/


(function($) {

/************************************************************************************************************/
/************************************************************************************************************/
/************************************************************************************************************/

	/******************************************************/
	/* MAKES IMG.JSHOVER HOVER ON ALL BROWSERS
	/******************************************************/	
	$.fn.myHover = function() {

		if ($.support.opacity == false) {
			/******************************************************/
			/* HOVER FOR IE BROWSER
			/******************************************************/
			$('img.jsHover').hover( 
			function() {
				$(this).attr('src','ressources/bkgd/blank.gif');
				$(this).get(0).runtimeStyle.filter = $(this).get(0).runtimeStyle.filter.replace('_0.png','_1.png');
			}, function() { 
				$(this).attr('src','ressources/blank.gif');
				$(this).get(0).runtimeStyle.filter = $(this).get(0).runtimeStyle.filter.replace('_1.png','_0.png');
			});

		} else {

			/******************************************************/
			/* HOVER FOR NON-IE BROWSER
			/******************************************************/
			$('img.jsHover').hover( function() {
				$(this).attr('src',$(this).attr('src').replace('_0.png','_1.png'));
			}, function() { 
				$(this).attr('src',$(this).attr('src').replace('_1.png','_0.png'));
			});	
		};
	};


/************************************************************************************************************/
/************************************************************************************************************/
/************************************************************************************************************/

	/******************************************************/
	/* FIXES PNG TRANSPARENCY FOR IE BROWSER (IMAGES, INPUTS, BACKGROUND IMAGES)
	/******************************************************/		
	$.fn.myPngFix = function() {

		/******************************************************/
		/* TRANSPARENCY FOR IE BROWSERS
		/******************************************************/	
		if ($.support.opacity == false) {

			/******************************************************/
			/* TRANSPARENCY FOR IMAGES
			/******************************************************/
			$(this).find('img').each(function(){
				$(this).get(0).runtimeStyle.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="'+$(this).attr('src')+'");';
				$(this).attr('src','ressources/blank.gif');
			});

			/******************************************************/
			/* TRANSPARENCY FOR DIVS
			/******************************************************/
			$(this).find('div').each(function(){
				var src = $(this).css('background-image');
				if(src.indexOf(".png")!=-1){
					$(this).get(0).runtimeStyle.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="'+src.split('url("')[1].split('")')[0]+'",sizingMethod="scale");';
					$(this).css('background-image', 'none');
				}
			});

			/******************************************************/
			/* TRANSPARENCY FOR INPUTS
			/******************************************************/
			$(this).find('input[@src$=.png]').each(function() {
				$(this).get(0).runtimeStyle.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="'+$(this).attr('src')+'", sizingMethod="scale");';
				$(this).attr('src','ressources/blank.gif');
			});
		};
	};

	
/************************************************************************************************************/
/************************************************************************************************************/
/************************************************************************************************************/

	/******************************************************/
	/* RESIZE CSS ACCORDING TO VIEWPORT SIZE
	/******************************************************/
	/*
	$.fn.myWindowSizes = function() {
		var top = (myHeight-bodyHeight)/2;
		if (myHeight < bodyHeight) top = 0;
		var left = (myWidth-bodyWidth)/2;
		if (myWidth < bodyWidth) left = 0;

		$('#tBody').css( { 'top':top+'px', 'left':left+'px' } );
	};
	*/


/************************************************************************************************************/
/************************************************************************************************************/
/************************************************************************************************************/

	/******************************************************/
	/* SLIDESHOW
	/******************************************************/
	var j = 1;

	$.fn.loadLogo = function() {
		
		var xmlfile = '../ressources/slides/slides.xml';
		var imgSrcs = [];
		var imgAlts = [];
		jQuery.get(xmlfile, function(xml) {
			var i = 0;

			// iterate xml
			jQuery(xml).find('image').each(function() {
				var node = jQuery(this);
				i++;
				// append image to array
				imgSrcs[i] = node.attr('src');
				imgAlts[i] = node.attr('alt');
			});
			
			var number = $(this).rand(1,i);
			while (j == number) {
				number = $(this).rand(1,i);
			}
			j = number;
			$('#slide2').css('background', $('#slide1').css('background'));
			$('#slide1').css({'background': 'transparent url("'+imgSrcs[number]+'") no-repeat', 'display': 'none'});
			$('#slide1').fadeIn(fade);
		});
	};

	
/************************************************************************************************************/
/************************************************************************************************************/
/************************************************************************************************************/

	/******************************************************/
	/* RESIZE CSS ACCORDING TO VIEWPORT SIZE
	/******************************************************/
	$.fn.rand = function( min, max ) {
		if( min > max ) {
			return( -1 );
		}
		if( min == max ) {
			return( min );
		}
		return( min + parseInt( Math.random() * ( max-min+1 ) ) );
	};


/************************************************************************************************************/
/************************************************************************************************************/
/************************************************************************************************************/

	/******************************************************/
	/* GET AN URL PART
	/******************************************************/
	$.fn.gup = function(name) {
		name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
		var regexS = "[\\?&]"+name+"=([^&#]*)";
		var regex = new RegExp( regexS );
		var results = regex.exec( window.location.href );
		if( results == null )
			return "";
		else
			return results[1];
	};


/************************************************************************************************************/
/************************************************************************************************************/
/************************************************************************************************************/

	/******************************************************/
	/* DROP DOWN MENU
	/******************************************************/
	$.fn.myDropDownMenu = function() {
		var color = '#3A6EA5';
		var colorHover = 'green';

		$('#blue').css( { 
			'float':'right',
			'margin':0,
			'padding':0,
			'list-style-type':'none'
		} );

		$('#blue li').css( { 
			'position':'relative',
			'float':'right',
			'cursor':'pointer',
			'z-index':2
		} );

		$('#blue li span').css( { 
			'display':'none',
			'background-color':'#000000',
			'position':'absolute',
			'top':'0px',
			'left':'150px',
			'width':'155px'
		} );

		$('#blue li').hover(
			function(){ $('span', this).slideDown('fast'); },
			function(){ $('span', this).slideUp('fast'); }
		);
	};

})($);
