//CSS selector

function css_browser_selector(u){var ua = u.toLowerCase(),is=function(t){return ua.indexOf(t)>-1;},g='gecko',w='webkit',s='safari',h=document.getElementsByTagName('html')[0],b=[(!(/opera|webtv/i.test(ua))&&/msie\s(\d)/.test(ua))?('ie ie'+RegExp.$1):is('firefox/2')?g+' ff2':is('firefox/3')?g+' ff3':is('gecko/')?g:/opera(\s|\/)(\d+)/.test(ua)?'opera opera'+RegExp.$2:is('konqueror')?'konqueror':is('chrome')?w+' chrome':is('applewebkit/')?w+' '+s+(/version\/(\d+)/.test(ua)?' '+s+RegExp.$1:''):is('mozilla/')?g:'',is('j2me')?'mobile':is('iphone')?'iphone':is('ipod')?'ipod':is('mac')?'mac':is('darwin')?'mac':is('webtv')?'webtv':is('win')?'win':is('freebsd')?'freebsd':(is('x11')||is('linux'))?'linux':'','js']; c = b.join(' '); h.className += ' '+c; return c;}; css_browser_selector(navigator.userAgent);


//allows slidedown animation on the homepage
$(document).ready(function(){
				//To switch directions up/down and left/right just place a "-" in front of the top/left attribute
				//Vertical Sliding
				$('.boxgrid.slidedown').hover(function(){
					$(".cover", this).stop().animate({top:'0px'},{queue:false,duration:300});
				}, function() {
					$(".cover", this).stop().animate({top:'-436px'},{queue:false,duration:300});
				});
}); 


//finds the current page and sets the link's class to current
$(function(){
       $("a").each(function(){
               if ($(this).attr("href") == window.location.pathname){
                       $(this).addClass("current");
               }
       });
});

//returns the total number of pictures in the list on the projects pages
function totalPhoto(){	
	document.getElementById('numberPhotos').innerHTML = totalPics();	
}

//gets the total number of images in the pictures div
function totalPics(){
	var parent = document.getElementById("projectImagesList");
    var childCount = parent.getElementsByTagName("li").length;
	return childCount;
}


//gets the number of the photo when the next or back button is pushed: projects page
var picNumber = 1; 
function photoNumber(buttonClick){
	var maxPic = totalPics() -2;
	picNumber += buttonClick;
	
	if(picNumber <= 0)
		picNumber = maxPic
	
	if (picNumber > maxPic)
		picNumber = 1;	
	document.getElementById("photoNumber").innerHTML = picNumber;
}
	 









