var VisMis; //Array of Mission and Vision
var firstVisMisNum=0;
var lastVM=0;
var loginOpen = false;
var timerVisMis;

$(document).ready(function(){
	getVisMis();
	var baseurl = window.location.protocol+"://"+window.location.host;
	$('#Login dt').bind('click', function(){
		animateLoginPanel()
		return false;
	});
	$('.petOwners').bind('click', function(){
		document.location = 'owners/';
	});
	$('.imagingCenter').bind('click', function(){
		document.location = 'imaging/';
	});
	$('.telemedicine').bind('click', function(){
		document.location = 'http://www.idexx.com/telemedicine';
	});
	$('#loginBtn').bind('click', function() {
		$('#VDICDotCom').submit();
	});
	$('#btnForgottenPwd').bind('click', function() {
		if ($('#USER').val()!="") {
			document.location = "http://www.vetmedstat.com/ForgottenPwd.aspx?an=" + $('#USER').val();
			return false;
		} else {
			alert("Please enter your Acct Name first.");
		}
	});
	$('#USER, #Password').bind('keydown', function(e){
	    if (e.keyCode == 13) { // Return/Enter
			$('#loginBtn').focus();
			$('#VDICDotCom').submit();
		}
	})
});

function animateLoginPanel() {
	if (loginOpen) {
		$('#Login').animate({"top": "+=75px"},"slow");
		loginOpen=false;
	} else {
		$('#Login').animate({"top": "-=75px"},"slow").dequeue();
	    $('#USER').focus();
		loginOpen=true;
	}
}

function getVisMis() {
		VisMis = Array("<strong>Vision:</strong> With great compassion and professionalism, our team seeks to provide the most advanced diagnostic imaging, cytopathology and consultation services available anywhere.","<strong>Mission:</strong> Helping People, Helping Animals.  Since 1991, we've carried out this mission with great passion and commitment by seeking to do the right things for the right reasons.");
		lastVM = VisMis.length-1;
		firstVisMisNum = 0
		$('.vismis').html(VisMis[firstVisMisNum])
		timerVisMis = self.setTimeout("displayVisMis()",12000);
}

function displayVisMis() {
	(firstVisMisNum == lastVM)?firstVisMisNum=0:firstVisMisNum+=1;
	$('.vismis').fadeOut();
	//$('.testimonial').hide('slide', { direction: "up"},1000);
	$(".vismis").queue(function () {
		$('.vismis').html(VisMis[firstVisMisNum])
		$(this).dequeue();
	});
	$('.vismis').fadeIn();
	//$('.testimonial').show('slide', { direction: "down"},1000);
	timerVisMis = self.setTimeout("displayVisMis()",12000);
};
