/* Schilling Robotics JS Functions */
$(document).ready(function() {
  $('a').each(function() {
    // Ensure PDFs are opening in a new window
    if (this.href.indexOf('.pdf') > -1) {
      this.target="_blank";
    }
    // Modify internal re-directs
    var h; // href pointer
    if (this.href.indexOf('srstage') > -1) {
      h = this.href.split('http://')[1];
      this.href = h.substring(h.indexOf('/'));
    }
    if (this.href.indexOf('schilling.com') > -1 && this.href.indexOf('@') == -1) {
      $('.logo')[0].style.border = '2px solid white';
    }
  });

  // Setup Gallery
  if ($("a[rel^='prettyPhoto[rov_gal]']").length > 0) {
	  $("a[rel^='prettyPhoto[rov_gal]']").prettyPhoto({theme:'facebook', overlay_gallery: false});
	  $("a[rel^='prettyPhoto[man_gal]']").prettyPhoto({theme:'facebook', overlay_gallery: false});
	  $("a[rel^='prettyPhoto[as_gal]']").prettyPhoto({theme:'facebook', overlay_gallery: false});
  }
});
