﻿$(document).ready(function() {

  // Initialize menu: requires jquery-1.2.6.min.js, superfish.js and hoverIntent.js
  $("#nav ul").superfish({ 
    hoverClass: 'sfHover',
    animation: {height:'show'}, 
    delay: 500,
    speed: "fast",
    autoArrows: false,
    dropShadows: false                            
  }); 
  
// Javascript for home page image rotation.
// Script requires jquery-1.2.6.min.js and jquery.cycle.all.min.js

var arrImages = new Array();

// Set images to include in the rotator. Image on home page in the div#images is for people who do not have javascript enabled, and for graceful loading.  This image should be set to the same image as arrImages[0]
arrImages[0] = "/images/home-image-1.jpg";
arrImages[1] = "/images/home-image-2.jpg";
arrImages[2] = "/images/home-image-3.jpg";
arrImages[3] = "/images/home-image-4.jpg";

// Set rotation speed - this is the amount of time spent on each image before it rotates (in seconds)
var rotationSpeed = 8;

// Set transition speed - this is the amount of time it takes to transition from one image to the next (in seconds)
var transitionSpeed = 1.5;

$(document).ready(function() {
	var images = "";
	
	// Load Images into div#images
	for (var i = 0; i < arrImages.length; i++) { images += '<img src="' + arrImages[i] + '" />'; }
	$('#images').html(images);
	
	// Add previous and next buttons
	//$('#rotator').append('<img id="prev" alt="Previous" src="images/prev.gif" /><img id="next" alt="Next" src="images/next.gif" />');
	
	// Initialize image rotation and apply additional settings 
	$('#images').before('<div id="img-nav">').cycle({ 
		fx:     'fade', 
		speed:  transitionSpeed * 1000, 
		timeout: rotationSpeed * 1000, 
		pager:  '#img-nav' 
	});
});


  // "How can we help you" dropdown menus on home page
  $(".select").click(function () {
    if ($.browser.safari) {
      this.focus();
    }
    $("#" + this.id + "-choices").fadeIn("fast");
    return false;
  });
  $("#select-business").blur(function () {
      $("#select-business-choices").fadeOut("fast");
  });
  $("#select-capability").blur(function () {
      $("#select-capability-choices").fadeOut("fast");
  });
  
  
  // Remove and add text in search field
  $("#search").focus(function() {
    if (this.value == "Search Keywords...") {
        this.value = "";
        this.style.color = "#555555";
    }
  });
  $("#search").blur(function() {
    if (this.value == "") {
        this.value = "Search Keywords...";
        this.style.color = "#CFCCB2";
    }
  });
  
  $("#ctl00_cphMain_ddlReferral").change(function() {
    if ($(this).val() == "University") {
      $("#ctl00_cphMain_universities").slideDown("fast")
    } else {
      $("#ctl00_cphMain_universities").slideUp("fast");
    }
  });

});
