/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
  break out of frames
- - - - - - - - - - - - - - - - - - - - - - - - - - - - */

function escape() {
if (window.top != window.self) {
	window.top.location="http://ncbg.unc.edu/";
	}
if (parent.frames.length > 0) {
	parent.location.href = location.href;
	}	
if (top.location != location) {
	top.location.href = document.location.href ;
	}
}

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
  antispam
- - - - - - - - - - - - - - - - - - - - - - - - - - - - */

function antispam(user,domain) {
	var locationstring = "mailto:" + user + "@" + domain;
	window.location = locationstring;
}
// usage: <a href="javascript:antispam('someuser','unc.edu');">send email</a>

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
  unfortunately necessary browser/OS detection
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

if ($.client.os == 'Mac') {
  // alert($.client.os);
  document.write("\r\n" + '<link href="http://ncbg.unc.edu/includes/mac.css" media="screen,print" rel="stylesheet" type="text/css">');
}

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
  jQuery stuff
- - - - - - - - - - - - - - - - - - - - - - - - - - - - */

$(document).ready(function(){

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
  reset form fields
- - - - - - - - - - - - - - - - - - - - - - - - - - - - */

$('.focusreset').clearOnFocus();
$('input.focusreset').change(function () {
  // $(this).removeClass('focusreset');  
});

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
  dropdowns
- - - - - - - - - - - - - - - - - - - - - - - - - - - - */

$('.myMenu > li').bind('mouseover', openSubMenu);
$('.myMenu > li').bind('mouseout', closeSubMenu);

function openSubMenu() {
	$(this).find('ul').css('visibility', 'visible');	
};

function closeSubMenu() {
	$(this).find('ul').css('visibility', 'hidden');	
};

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
  slideshow
- - - - - - - - - - - - - - - - - - - - - - - - - - - - */

$('.slideshow').slides({
	preload: true,
	preloadImage: 'http://ncbg.unc.edu/img/slideshow/loading.gif',
	play: 0,
	pause: 0,
  slideSpeed: 500,
  // autoHeight: true,
	hoverPause: true,
	animationStart: function(current){
		$('.caption').animate({
			bottom:-35
		},0);
		if (window.console && console.log) {
			// example return of current slide number
			console.log('animationStart on slide: ', current);
		};
	},
	animationComplete: function(current){
		$('.caption').animate({
			bottom:0
		},250);
		if (window.console && console.log) {
			// example return of current slide number
			console.log('animationComplete on slide: ', current);
		};
	},
	slidesLoaded: function() {
		$('.caption').animate({
			bottom:0
		},250);
	}
});

//end
});

