//all javascripts that are SITE SPECIFIC, and probably cannot be reused in other site, go in this file

openCat=0;

function switchOpenCat(catID,closeOld,type,animDur){
	if(animDur==null){animDur=400;}
	//open the current category if it is not already open
	if(catID!=openCat){
		//if there is another open category, close it
		if(openCat!=0 && closeOld==1){toggleContDiv(openCat,'image','','','',0,animDur);}
		toggleContDiv(catID,'image','','','',0,animDur);
		openCat=catID;
	}else{
		//if the openCat was clicked again, simply close it and reset the openCat variable
		toggleContDiv(openCat,'image','','','',0,animDur);
		openCat=0;
	}
	//do perform other functions depending on type
	if(type!=null){
		switch(type){
			case 'media': /*nothing*/ break;
		}
	}
}

function updateMedia(step,data){
	switch(step){
		case 1:
			//fade up the loading animation and retrieve the data
			$("#mContent").html('&nbsp;').css({display:'none'});
			$("#loadingAnim").css({display:'block',opacity:0}).fadeTo(200,1,function(){$.get('/media/data.php?mID='+data,function(data){updateMedia(2,data);})});
	 	break;
		case 2:
			$("#loadingAnim").css({display:'none'});$("#mContent").css({display:'block'}).html(data);
		break;
	}
}