$(function() { //Document .ready
	//Sign In pop over
	$(".signin").click(function(e) {          
		e.preventDefault();
    	$("fieldset#signin_menu").toggle();
		$(".signin").toggleClass("menu-open");
    });
	$("fieldset#signin_menu").mouseup(function() {
		return false
	});
	$(document).mouseup(function(e) {
		if($(e.target).parent("a.signin").length==0) {
			$(".signin").removeClass("menu-open");
			$("fieldset#signin_menu").hide();
		}
	});
	//Navigation Rollovers
	function addMega(){
		$(this).addClass("hovering");
    }
    
	function removeMega(){
    	$(this).removeClass("hovering");
    }
    var megaConfig = {
         interval: 1,
         sensitivity: 4,
         over: addMega,
         timeout: 250,
         out: removeMega
    };
	 var megaConfig2 = {
         interval: 1,
         sensitivity: 4,
         over: addMega,
         timeout: 250,
         out: removeMega
    };
	$("li.mega").hoverIntent(megaConfig);
	$("li.mega2").hoverIntent(megaConfig2);
	//Free Trial Rollovers
	function addMega(){
		$(this).addClass("hovering");
    }
    
	function removeMega(){
    	$(this).removeClass("hovering");
    }
    var megaConfig = {
         interval: 1,
         sensitivity: 4,
         over: addMega,
         timeout: 250,
         out: removeMega	 
    }
	$("li.popup").hoverIntent(megaConfig);
	
	//Participate Button Tooltip
	function addMega(){
		$(this).addClass("hovering");
    }
    
	function removeMega(){
    	$(this).removeClass("hovering");
    }
    var megaConfig = {
         interval: 1,
         sensitivity: 4,
         over: addMega,
         timeout: 250,
         out: removeMega	 
    }
	$(".participateSet").hoverIntent(megaConfig);
	

    
	//Modal Windows
	$('.modalWindow').nyroModal();
	$('.modalWindowContactUs').nyroModal({height: 510, width: 660});
	$('.modalWindowSS').nyroModal({
      width: 850,
      height: 675,
      swf: {
        allowFullScreen: true,
        allowScriptAccess: 'always'
      }
    });

	$('.modalWindowJobs').nyroModal({
      width: 512,
      height: 327,
      swf: {
        allowFullScreen: true,
        allowScriptAccess: 'always'
      }
    });
    $('.modalWindowTT').nyroModal({width: 900, height: 700});
	$('.modalWindowWin').nyroModal({
      width: 550,
      height: 380,
      swf: {
        allowFullScreen: true,
        allowScriptAccess: 'always'
      }
    });
	$('.modalWindowFTVid').nyroModal({
      width: 550,
      height: 380,
      swf: {
        allowFullScreen: true,
        allowScriptAccess: 'always'
      }
    });
    $('.modalLightWindow').nyroModal({
      width: 550,
      height: 380,
      swf: {
        allowFullScreen: true,
        allowScriptAccess: 'always'
      }
    });
    $('.modalLightVid').nyroModal({
      width: 522,
      height: 323,
	  wMargin: 0,
	  hMargin: 0,
      swf: {
        allowFullScreen: true,
        allowScriptAccess: 'always'
      }
    });
	$('.modalLightWindowSG').nyroModal({
	  galleryLoop: true,
      width: 1000,
      height: 1000,
      swf: {
        allowFullScreen: true,
        allowScriptAccess: 'always'
      }
    });
	$('.modalWindowContactManager').nyroModal({
      width: 610,
      height: 280,
      swf: {
        allowFullScreen: true,
        allowScriptAccess: 'always'
      }
    });
	$('.modalWindowContactManagerPub').nyroModal({
      width: 610,
      height: 310,
      swf: {
        allowFullScreen: true,
        allowScriptAccess: 'always'
      }
    });
	//Add your code here
});

  jQuery.fn.attach_message_box_close = function(message_box_name) {
    $(this).click( function() { 
        message_div = $("#" + message_box_name);
        path = $(this).attr("href");
        if(path == undefined || path === ""){
          message_div.fadeOut();
          return false;
        }
        $.get( path, function(){ 
          message_div.fadeOut();
          });
        return false; 
        });
  };

jQuery.fn.make_link_ajaxy = function(call_back_function){
  $(this).click( function(event){
    $.get( $(this).attr("href"), call_back_function ) 
    event.preventDefault();
  });
};

