// JavaScript Document
var mobilePlatforms = ['iPhone','iPod','iPad'];
var campusName = "";
var currentName = "";
$(document).ready(function() {

if( in_array( navigator.platform, mobilePlatforms ) ) {
	$('.idevice').click(function() {
		
		campusName = $(this).attr('id');
		
		if( campusName == currentName ) {
			
		} else {
			
			//alert(campusName);
			
			resetElement();
			
			console.log($(this));
			
			$(this).delay(100).queue(function(){ 
			  	$(this).css('z-index','10');
				$(this).children('div:first').fadeIn('fast');
				$(this).children('img:first').css('opacity','0.6');
				console.log(campusName);
				$(this).dequeue();
				$(this).stop();

			});
			
			currentName = campusName;
			
			
		}
		
		
	});
} else {
	$('#campus-canyon').hover(function() {
		campusName = $(this).attr('id');
		
		$('#campus-canyon').css('z-index','10');
		$('#campus-canyon .info').fadeIn('fast');
		$('#campus-canyon .img').css('opacity','0.6');
		},
		function() {
			$('#campus-canyon').css('z-index','5');
			$('#campus-canyon .info').fadeOut('fast');
			$('#campus-canyon .img').css('opacity','1');
		});						   
							  
	$('#campus-amarillo').hover(function() {	
		$('#campus-amarillo').css('z-index','10');
		$('#campus-amarillo .info').fadeIn('fast');
		$('#campus-amarillo .img').css('opacity','0.6');
		},
		function() {
			$('#campus-amarillo').css('z-index','4');
			$('#campus-amarillo .info').fadeOut('fast');
			$('#campus-amarillo .img').css('opacity','1');
		});
	
	$('#campus-amarillosouth').hover(function() {	
		$('#campus-amarillosouth').css('z-index','10');
		$('#campus-amarillosouth .info').fadeIn('fast');
		$('#campus-amarillosouth .img').css('opacity','0.6');
		},
		function() {
			$('#campus-amarillosouth').css('z-index','3');
			$('#campus-amarillosouth .info').fadeOut('fast');
			$('#campus-amarillosouth .img').css('opacity','1');
		});
	
	$('#campus-dalhart').hover(function() {
		$('#campus-dalhart').css('z-index','10');
		$('#campus-dalhart .info').fadeIn('fast');
		$('#campus-dalhart .img').css('opacity','0.6');
		},
		function() {
			$('#campus-dalhart').css('z-index','2');
			$('#campus-dalhart .info').fadeOut('fast');
			$('#campus-dalhart .img').css('opacity','1');
		});
	
	$('#campus-kingston').hover(function() {
		$('#campus-kingston').css('z-index','10');
		$('#campus-kingston .info').fadeIn('fast');
		$('#campus-kingston .img').css('opacity','0.6');
		},
		function() {
			$('#campus-kingston').css('z-index','1');
			$('#campus-kingston .info').fadeOut('fast');
			$('#campus-kingston .img').css('opacity','1');
		});
 } // if ends

 });
 
 
 
function resetElement() {
	$('#campus-canyon').css('z-index','5');
	$('#campus-amarillo').css('z-index','4');
	$('#campus-amarillosouth').css('z-index','3');
	$('#campus-dalhart').css('z-index','2');
	$('#campus-kingston').css('z-index','1');
	
	$('.idevice .info').hide();
	$('.idevice .img').css('opacity','1'); 
}

