function submitForm () {
	document.icpsignup.submit() ;
}


function changeBG(s) {
	document.getElementById('bodyMain').className = 'body_'+s;
}

function changeNav(i,c) {
	document.getElementById('navBaseL').className = 'navBaseL'+i+' bgPink shadow';
	document.getElementById('navSel').className = 'navSel'+i+' '+c;
	document.getElementById('navBaseR').className = 'navBaseR'+i+' bgPink shadow';
}

var CS2vis = true;

function togCS2(tog) {
	if (tog=='show' && CS2vis!==true) {
		document.getElementById('contentShell2').style.visibility = 'visible';
		CS2vis = true;
	} else if (tog=='hide' && CS2vis!==false) {
		document.getElementById('contentShell2').style.visibility = 'hidden';
		CS2vis = false;
	}
}

var twitvis = true;

function togTwitter(tog) {
	if (tog=='show' && twitvis!==true) {
		document.getElementById('twidget').style.visibility = 'visible';
		twitvis = true;
	} else if (tog=='hide' && twitvis!==false) {
		document.getElementById('twidget').style.visibility = 'hidden';
		twitvis = false;
	}
}

function gotoNews() {
	initNewsVars();
	changeNav('1','bgBlueDark'); 
	ajaxpage('news.html', 'contentShell1', function () {
		new Effect.Opacity('newer', { to: 0, duration: 0 });
	});
	togTwitter('show');
	togCS2('show');
	changeBG('news');
}
function gotoShows() {
	initShowVars();
	togTwitter('show');
	togCS2('hide');
	changeNav('2','bgGreyDark2');
	ajaxpage('shows.html', 'contentShell1');
	changeBG('shows');
}
function gotoBio() {
	changeNav('3','bgLavendar');
	togTwitter('show');
	togCS2('hide');
	ajaxpage('bio.html', 'contentShell1');
	changeBG('bio');
}
function gotoPhotos() {
	initPhotoVars();
	changeNav('4','bgGreyDarkF');
	togTwitter('show');
	togCS2('hide');
	ajaxpage('photos.html', 'contentShell1');
	changeBG('photos');
}
function gotoVideo() {
	changeNav('5','bgGreyDarkF');
	togTwitter('show');
	togCS2('hide');
	ajaxpage('video.html', 'contentShell1');
	changeBG('video');
}
function gotoStore() {
	changeNav('6','bgGreyDarkF');
	togTwitter('show');
	togCS2('hide');
	ajaxpage('store.html', 'contentShell1');
	changeBG('store');
}
function gotoContact() {
	changeNav('7','bgGold');
	ajaxpage('contact.html', 'contentShell1');
	togTwitter('hide');
	togCS2('show');
	changeBG('contact');
}


function gotoTwitter() {
	window.open('http://twitter.com/#!/hollybackgirl','hollyTwitter');
}
function gotoFacebook() {
	window.open('http://www.facebook.com/pages/Holly-Conlan/145831452125213','hollyFacebook');
}
function gotoYouTube() {
	window.open('http://www.youtube.com/results?search_query=holly+conlan','hollyYouTube');
}
function gotoMySpace() {
	window.open('http://www.myspace.com/hollyconlan','hollyMySpace');
}




function initNewsVars() {
	newsItems = 4;
	newsPos = 0;
	newsWidth = 375;

	newsPrevVis = true;
	newsNextVis = false;
}

initNewsVars();



function newerNews() {
	if (newsPos > 0) {
		newsPos--;
		var dPos = newsPos*newsWidth;
		new Effect.Move('allNews', { x: -dPos, y: 0, duration: .8, mode: 'absolute' });
		
		if (newsPrevVis == false) {
			newsPrevVis = true;
			new Effect.Opacity('older', { to: 1, duration: .5 });
		}
		if (newsPos == 0 && newsNextVis == true) {
			newsNextVis = false;
			new Effect.Opacity('newer', { to: 0, duration: .5 });
		}
	}
	return false;
}

function olderNews() {
	if (newsPos < newsItems-1) {
		newsPos++;
		var dPos = newsPos*newsWidth;
		new Effect.Move('allNews', { x: -dPos, y: 0, duration: .8, mode: 'absolute' });
		if (newsNextVis == false) {
			newsNextVis = true;
			new Effect.Opacity('newer', { to: 1, duration: .5 });
		}
		if (newsPos == newsItems-1 && newsPrevVis == true) {
			newsPrevVis = false;
			new Effect.Opacity('older', { to: 0, duration: .5 });
		}
		return false;
	}
}


function createNewsDots() {
	for (d=0;d<=newsItems-1;d++) {
		console.log(d);
		
		var gDot = document.getElementById('newsDots');
		var dotTag = document.createElement('dot');
		dotTag.id = 'dot'+d;
		dotTag.className ='newsDot';
		dotTag.innerHTML = "<img src='images/nav_dot_fade.png'>";
		//gDot.appendChild(dotTag);
	}
}








function initShowVars() {
	showItems = 5;
	showPos = 4;
	showWidth = 375;

	showPrevVis = true;
	showNextVis = false;
}

initShowVars();

function nextMonth() {
	if (showPos < showItems-1) {
		showPos++;
		var dPos = showPos*showWidth;
		new Effect.Move('allShows', { x: -dPos, y: 0, duration: .8, mode: 'absolute' });
		
		if (showPrevVis == false) {
			showPrevVis = true;
			new Effect.Opacity('prev', { to: 1, duration: .5 });
		}
		if (showPos == showItems-1 && showNextVis == true) {
			showNextVis = false;
			new Effect.Opacity('next', { to: 0, duration: .5 });
		}
	}
	console.log(showPos, showNextVis);
		
	return false;
}

function prevMonth() {
	if (showPos > 0) {
		showPos--;
		var dPos = showPos*showWidth;
		new Effect.Move('allShows', { x: -dPos, y: 0, duration: .8, mode: 'absolute' });
		
		if (showNextVis == false) {
			showNextVis = true;
			new Effect.Opacity('next', { from: 0, to: 1, duration: .5 });
		}
		if (showPos == 0 && showPrevVis == true) {
			showPrevVis = false;
			new Effect.Opacity('prev', { from: 1, to: 0, duration: .5 });
		}
	}
	console.log(showPos, showPrevVis);
	
	return false;
}







function initPhotoVars() {
	photoItems = 2;
	photoPos = 0;
	photoWidth = 375;

	//photoPrevVis = false;
	//photoNextVis = true;
}

initPhotoVars();

function nextPhotoCat() {
	if (photoPos < photoItems-1) {
		photoPos++;
		var dPos = photoPos*photoWidth;
		new Effect.Move('allPhotos', { x: -dPos, y: 0, duration: .8, mode: 'absolute' });
		
		document.getElementById("live").className = "photoSec";
		document.getElementById("promo").className = " photoSecSel";
		
//		if (photoPrevVis == false) {
//			photoPrevVis = true;
//			new Effect.Opacity('prev', { from: 0, to: 1, duration: .5 });
//		}
//		if (photoPos == photoItems-1 && photoNextVis == true) {
//			photoNextVis = false;
//			new Effect.Opacity('next', { from: 1, to: 0, duration: .5 });
//		}
	}
//	console.log(photoPos, photoNextVis);
		
	return false;
}

function prevPhotoCat() {
	if (photoPos > 0) {
		photoPos--;
		var dPos = photoPos*photoWidth;
		new Effect.Move('allPhotos', { x: -dPos, y: 0, duration: .8, mode: 'absolute' });
		
		document.getElementById("live").className = "photoSecSel";
		document.getElementById("promo").className = " photoSec";
		
//		if (photoNextVis == false) {
//			photoNextVis = true;
//			new Effect.Opacity('next', { from: 0, to: 1, duration: .5 });
//		}
//		if (photoPos == 0 && photoPrevVis == true) {
//			photoPrevVis = false;
//			new Effect.Opacity('prev', { from: 1, to: 0, duration: .5 });
//		}
	}
//	console.log(photoPos, photoPrevVis);
	
	return false;
}



var plVis = false;

function togPlaylist(com) {
	if (com == 'close') {
		document.getElementById('jp_playlist_2').style.visibility = 'hidden';
		plVis = false;
	} else {
		if (plVis == true) {
			document.getElementById('jp_playlist_2').style.visibility = 'hidden';
			plVis = false;
		} else {
			document.getElementById('jp_playlist_2').style.visibility = 'visible';
			plVis = true;
		}
	}
}

function changeReadout(newTitle) {
	document.getElementById('rd').innerHTML=newTitle;
}



window.onload = function() {
	gotoNews();
	ajaxpage('infoSub.html', 'contentShell2');
	//createNewsDots();
}
