//############ Nav Show/hide
var stopflag = 0;
var oldmenu = '';

function showme(ID){
	stopnoshow('');
	if (oldmenu != ''){
		$(oldmenu).style.display='none';
		$(oldmenu+'_nav').removeClassName('hov');
	}
	$(ID).style.display='block';
	$(ID+'_nav').addClassName('hov');
}


function startnoshow(ID){
	stopflag = 1;
	oldmenu = ID;
	setTimeout("noshow()",'500');
}

function noshow(){
	if (stopflag == 1){
		if (oldmenu != ''){
			$(oldmenu).style.display='none';
			$(oldmenu+'_nav').removeClassName('hov');
		}
		stopflag = 0;
		oldmenu = '';
	}
}

function stopnoshow(){
	stopflag = 0;
}


//############ Side Sliding
var inmotion = false;
var mcount = 3;
var mpage = 1;
var cpage = 0;
var pcount = 0;

function movit(d){
	if ((d+mpage) <= mcount && (d+mpage) > 0){
		if(!inmotion){
			mpage = d + mpage;
			mov = d * moving;
			inmotion = true;
			new Effect.Move('scrollall', { x: mov, y: 0, duration:0.8, mode: 'relative', transition:Effect.Transitions.EaseFromTo, afterFinish:function(){
				inmotion = false;
			}});
		}
	} else if (d+mpage > mcount){
		if(!inmotion){
			mpage = 1;
			mov = -(mcount-1) * moving;
			inmotion = true;
			new Effect.Move('scrollall', { x: mov, y: 0, duration:0.8, mode: 'relative', transition:Effect.Transitions.EaseFromTo, afterFinish:function(){
				inmotion = false;
			}});
		}
	}
}

function povit(d,t){
	if ((d+mpage) <= mcount && (d+mpage) > 0){
		if(!inmotion){
			mpage = d + mpage;
			mov = d * moving;
			inmotion = true;
			new Effect.Move('scrollall', { x: mov, y: 0, duration:0.8, mode: 'relative', transition:Effect.Transitions.EaseFromTo, afterFinish:function(){
				inmotion = false;
			}});
		}
	} else if ((d+mpage) > mcount && cpage < pcount) { // to the right
		location.href='portfolio.php?t='+t+'&i='+(cpage+1);
	} else if (cpage > 0 && d < 0) { // to the left
		location.href='portfolio.php?t='+t+'&i='+(cpage-1);
	} else { // loop back
		location.href='portfolio.php?t='+t;
	}
}



// ############ Tabs

var showing = 'recent';

function showtab(ID){

	$(showing).style.display = 'none'; // hides current body
	
	$(showing+'_tab').style.backgroundColor='#979797'; // resets current tab
	$(showing+'_tab').style.borderBottom='1px solid #979797';
	$(showing+'_tab').style.height='24px';
	$(showing+'_tab').style.color='#393939';
	$(showing+'_tab').style.backgroundImage='';
	
	$(ID+'_tab').style.backgroundColor='#fff'; // highlights new tab
	$(ID+'_tab').style.borderBottom='none';
	$(ID+'_tab').style.height='25px';
	$(ID+'_tab').style.color='#fff';
	$(ID+'_tab').style.backgroundImage='URL(/images/blog_tab.gif)';
	
	$(ID).style.display = 'block'; // displays new body
	
	showing = ID; // sets new body to current variable
}


var showinga = 'categories';

function showtaba(ID){

	$(showinga).style.display = 'none'; // hides current body
	
	$(showinga+'_tab').style.backgroundColor='#979797'; // resets current tab
	$(showinga+'_tab').style.borderBottom='1px solid #979797';
	$(showinga+'_tab').style.height='24px';
	$(showinga+'_tab').style.color='#393939';
	$(showinga+'_tab').style.backgroundImage='';
	
	$(ID+'_tab').style.backgroundColor='#fff'; // highlights new tab
	$(ID+'_tab').style.borderBottom='none';
	$(ID+'_tab').style.height='25px';
	$(ID+'_tab').style.color='#fff';
	$(ID+'_tab').style.backgroundImage='URL(/images/blog_tab.gif)';
	
	$(ID).style.display = 'block'; // displays new body
	
	showinga = ID; // sets new body to current variable
}



var showing2 = 'twitter';

function showtab2(ID){

	$(showing2).style.display = 'none'; // hides current body
	
	$(showing2+'_tab').style.backgroundColor='#979797'; // resets current tab
	$(showing2+'_tab').style.borderBottom='1px solid #979797';
	$(showing2+'_tab').style.height='24px';
	$(showing2+'_tab').style.color='#393939';
	$(showing2+'_tab').style.backgroundImage='';
	
	$(ID+'_tab').style.backgroundColor='#fff'; // highlights new tab
	$(ID+'_tab').style.borderBottom='none';
	$(ID+'_tab').style.height='25px';
	$(ID+'_tab').style.color='#fff';
	$(ID+'_tab').style.backgroundImage='URL(/images/blog_tab.gif)';
	
	$(ID).style.display = 'block'; // displays new body
	
	showing2 = ID; // sets new body to current variable
}