/*
**
**	media bar - jQuery first try Plugin
**	Author: 		David H Garbutt Jr Qmedtrix Systems Inc
**	Version:		1.0 (Novenber 10, 2010)
**	
**
*/
$(document).ready(function() {

var $thumnails = $('#mediaButtons');
var buttonIncrement = 177;
var startStop= 0;
  $('#button1').click(function() {
		if (startStop == 1) {					   
     direction = '+=';
    $thumnails.animate({marginLeft: direction + buttonIncrement}, 150);
	startStop= 0;
		} else {
			direction = '-=';
		}
    
  });
  
    $('#button2').click(function() {
        if (startStop == 0) {
			direction = '-=';
    $thumnails.animate({marginLeft: direction + buttonIncrement}, 150);
	startStop= 1;
	} else {
			direction = '+=';
		}
 
  });
	
	
	
		//select all the a tag with name equal to modal
	$('#imgBut1').click(function(e) {
		//Cancel the link behavior
		e.preventDefault();
		
		//Get the A tag
		var id = $(this).attr('name');
	
		//Get the screen height and width
		var maskHeight = $(document).height();
		var maskWidth = $(window).width();
	
		//Set heigth and width to mask to fill up the whole screen
		$('#mask').css({'width':maskWidth,'height':maskHeight});
		
		//transition effect		
		$('#mask').fadeIn(1000);	
		$('#mask').fadeTo("slow",0.8);	
	
		//Get the window height and width
		var winH = $(window).height();
		var winW = $(window).width();
              
		//Set the popup window to center
		$(id).css('top',  winH/2-$(id).height()/2);
		$(id).css('left', winW/2-$(id).width()/2);
	
		//transition effect
		$(id).fadeIn(100); 
	
	});
	
	
	
	
	
	
	

	 	$('#imgBut2').click(function(e) {
		//Cancel the link behavior
		e.preventDefault();
		
		//Get the A tag
		var id = $(this).attr('name');
	
		//Get the screen height and width
		var maskHeight = $(document).height();
		var maskWidth = $(window).width();
	
		//Set heigth and width to mask to fill up the whole screen
		$('#mask').css({'width':maskWidth,'height':maskHeight});
		
		//transition effect		
		$('#mask').fadeIn(1000);	
		$('#mask').fadeTo("slow",0.8);	
	
		//Get the window height and width
		var winH = $(window).height();
		var winW = $(window).width();
              
		//Set the popup window to center
		$(id).css('top',  winH/2-$(id).height()/2);
		$(id).css('left', winW/2-$(id).width()/2);
	
		//transition effect
		$(id).fadeIn(100); 
	
	});

	$('#imgBut3').click(function(e) {


 
	});	
	 
	 
		$('#imgBut4').click(function(e) {
		//Cancel the link behavior
		e.preventDefault();
		
		//Get the A tag
		var id = $(this).attr('name');
	
		//Get the screen height and width
		var maskHeight = $(document).height();
		var maskWidth = $(window).width();
	
		//Set heigth and width to mask to fill up the whole screen
		$('#mask').css({'width':maskWidth,'height':maskHeight});
		
		//transition effect		
		$('#mask').fadeIn(1000);	
		$('#mask').fadeTo("slow",0.8);	
	
		//Get the window height and width
		var winH = $(window).height();
		var winW = $(window).width();
              
		//Set the popup window to center
		$(id).css('top',  winH/2-$(id).height()/2);
		$(id).css('left', winW/2-$(id).width()/2);
	
		//transition effect
		$(id).fadeIn(100); 
	
	});
	//if close button is clicked
	$('.window .close').click(function (e) {
		//Cancel the link behavior
		e.preventDefault();
		
		$('#mask').hide();
		$('.window').hide();

   
        window.location.replace(window.location);

 
	});		
	
	//if mask is clicked
	$('#mask').click(function () {
		$(this).hide();
		$('.window').hide();
		window.location.replace(window.location);
	});	
	
	 	
   return false;

});






