
window.onload = function(){setScreenClass();}; 
	window.onresize = setScreenClass;
	
var cls;
var currentphoto = 0;
var timer = null;
var photos = new Array();
var captions = new Array();

photos[0] = "building";
photos[1] = "teaching";
photos[2] = "045";
photos[3] = "008";
photos[4] = "017";
photos[5] = "035";
photos[6] = "014";

captions[0] = "Colorado Law is located at the base of the inspirational Rocky Mountains.";
captions[1] = "Our faculty are passionate about teaching and easily accessible for informal consultations.";
captions[2] = "Students participate in moot court competitions to develop skills in appellate brief writing and oral arguments.";
captions[3] = "Students work one&ndash;on&ndash;one with professors on actual cases in the Clinical Education Program.";
captions[4] = "Colorado Law's size and setting allow for a collaborative yet personalized approach to legal education.";
captions[5] = "Students are actively engaged outside the classroom &mdash; in organizations, journals, centers, volunteering, and outdoor activities.";
captions[6] = "Our faculty are nationally recognized scholars who influence legal and public policy debates through research, publication, and public service.";
				


	function setScreenClass(){
		
		var fmt = document.documentElement.clientWidth;
		
		if (fmt > 960) {
			cls = "large";
		} else {
			cls = "small";
		}
		
		document.body.className=cls;
		
		if(document.getElementById('mainPhoto')) {
			preloadimg();
			//swapper1();
			$("div#picture").css("backgroundImage", "url(images/homepage/" + photos[currentphoto] + "-" + cls +".jpg)");
			$("div#photoCaption").html(captions[currentphoto]);
			if (timer) {
					clearInterval(timer);
					timer = setInterval("swapper()", 7000);
			} 
			
		}
		
		
		if(document.getElementById('mainPhoto')) {
		
		
		 newHeight =  ($("div.headline:eq("+current_headline+")").height() + 10);
  if (newHeight < 300) {
  	 $("div#scrollup").css("height", 300);
	 
	 } else {
   		$("div#scrollup").css("height", $("div.headline:eq("+current_headline+")").height() + 10);
		
 	}
	$("div.container").show();
	
		}
		
		
	};



	
function swapper() {
	currentphoto++;
	if (currentphoto > photos.length - 1) {
			currentphoto = 0;
	}
		$("div#picture").css("backgroundImage", "url(images/homepage/" + photos[currentphoto] + "-" + cls +".jpg)");
	//alert("url(images/homepage/" + photos[currentphoto] + "-" + cls +".jpg)");
	$("div#photoCaption").html(captions[currentphoto]);
	
	
}
function swapper1() {
	
	//alert("url(images/homepage/" + photos[currentphoto] + "-" + cls +".jpg)");
		$("div#picture").css("backgroundImage", "url(images/homepage/" + photos[currentphoto] + "-" + cls +".jpg)");
	
	$("div#photoCaption").html(captions[0]);
	currentphoto++;
	
}

if(document.getElementById('mainPhoto')) {
	timer = setInterval("swapper()", 7000);
}

function preloadimg() {
for (var a=0; a < photos.length; a++) {
	$("div.preload").append("<img src='images/homepage/" + photos[a] + "-" + cls +".jpg'>");
	
}
}
