﻿// Welcome Page
function pageInit() {

	var layers = document.getElementsByTagName('div');
	for(c=0;c<layers.length;c++) {
		if (layers[c].id.substr(2,6) == '_long' || layers[c].id.substr(3,7) == '_long') {
		document.getElementById(layers[c].id).style.display = "none";
		}
	}

	document.getElementById('enter_left').style.visibility = "visible";
	document.getElementById('enter_right').style.visibility = "visible";

	document.body.style.backgroundImage='url(images/bg_welcome_new.png)';
	document.body.style.backgroundRepeat='no-repeat'; 
	document.body.style.backgroundAttachment='fixed';

}

// Building up Content Page
function contentInit() {
	/*
	var layers = document.getElementsByClassName('header_blue');
	for(c=0;c<layers.length;c++) {
		layers[c].style.color = "#FF9933";
		}
	*/

	document.body.style.backgroundImage='url(images/bg_new.png)';
	document.body.style.backgroundRepeat='no-repeat'; 
	document.body.style.backgroundAttachment='fixed';

	document.getElementById('welcome').style.display = "none";
	document.getElementById('additional').style.display = "none";
	document.getElementById('photo').style.display = "none";
	document.getElementById('fun').style.display = "none";
	document.getElementById('holder').style.display = "block";
	document.getElementById('recent').style.display = "block";

	myHeight = document.getElementById('recent').offsetHeight;
	document.getElementById('vline').style.height = myHeight -75 + 'px';

	myHeight = myHeight - document.getElementById('aboutme').offsetHeight - 48;

	document.getElementById('gototop_btn').style.top = myHeight + 'px';


}

// Changing Menu
function MenuChanger(swapTo) {
		
	document.getElementById('recent').style.display = "none";
	document.getElementById('additional').style.display = "none";
	document.getElementById('photo').style.display = "none";
	document.getElementById('fun').style.display = "none";
	document.getElementById(swapTo).style.display = "block";

	vLineResize(swapTo);

}

// Changing Projects (Short - Long)
function Changer(swapFrom, swapTo, swapIn) {
		
	document.getElementById(swapFrom).style.display = "none";
	document.getElementById(swapTo).style.display = "block";
	if (swapIn == 'recent') {
		swapTo = 'recent';
	} else if (swapIn == 'additional') {
		swapTo = 'additional';
	}
	vLineResize(swapTo);

}

// Changing Projects (Additional, Advanced)
/*
function ChangerAdvanced(swapTo) {
	if (document.getElementById('recent').style.display == "block") {
		document.getElementById('recent').style.display = "none";
		document.getElementById(swapTo).style.display = "block";
	}
	
	if (document.getElementById('additional').style.display == "block") {
		document.getElementById('additional').style.display = "none";
		document.getElementById(swapTo).style.display = "block";
	}
	vLineResize(swapTo);
}
*/
// Vertical Line Resize
function vLineResize(swapTo) {
	myHeight = document.getElementById(swapTo).offsetHeight;
	if (swapTo == 'recent') {
		document.getElementById('vline').style.height = myHeight - 75 + 'px';
		myHeight = myHeight - document.getElementById('aboutme').offsetHeight  - 48;
		document.getElementById('gototop_btn').style.top = myHeight + 'px';
	}
	if (swapTo == 'additional') {
		document.getElementById('vline').style.height = myHeight - 75 + 'px';
		myHeight = myHeight - document.getElementById('aboutme').offsetHeight - 48;
		document.getElementById('gototop_btn').style.top = myHeight + 'px';
	}
	if (swapTo == 'photo') {
		document.getElementById('vline').style.height = myHeight - 48 + 'px';
		myHeight = myHeight - document.getElementById('aboutme').offsetHeight - 20;
		document.getElementById('gototop_btn').style.top = myHeight + 'px'; 
	}
	if (swapTo == 'fun') {
		document.getElementById('vline').style.height = myHeight - 48 + 'px';
		myHeight = myHeight - document.getElementById('aboutme').offsetHeight - 20;
		document.getElementById('gototop_btn').style.top = myHeight + 'px';
	}	
}

// rollImage
function rollImageIn(toRoll) {
	document.getElementById(toRoll).style.backgroundPosition = -100 + '%';
}
function rollImageOut(toRoll) {
	document.getElementById(toRoll).style.backgroundPosition =  0 + '%';
}