// JavaScript Document

var eventHeight = null;
function init(){
	var showbtn = document.getElementById("showbutton").value;
	if(showbtn){
		document.getElementById('buttongroup').className = "vis";
	}
	var wPX = $('events_mod').getStyle('height')
	eventHeight = parseInt(wPX.substring(0, wPX.length-2));
	
}

function swapNav(e) {
	var server = "http://www.grandwoodslounge.com"
	var path = server  + "/images/"; 
	var overstate = path + e.id + "_over.png";
	//alert(e.src);
	if(e.src == overstate){
		e.src = path + e.id + ".png";
	} else {
		e.src = overstate;
	}
	
}



function showEvents(){
	overflow = $("eventOverflow");
	overflow.className = "vis";
	overflow.set("tween", { duration:500 });
	overflow.fade("in");
	
	$('button_hide').className = "vis";
	$('button_seemore').className = "hidden";
	
	var extraheight = parseInt($("extraheight").className);
	var targheight = extraheight + eventHeight;

	var heightChange = new Fx.Tween('events_mod',  {duration:500});
	heightChange.start('height',eventHeight, targheight);

	var heightFix = new Fx.Tween('eventOverflowFix',  {duration:500});
	heightFix.start('height', 680, targheight+180);
}

function hideEvents(){
	overflow = $("eventOverflow");
	overflow.className = "vis";
	overflow.set("tween", { duration:500 });
	overflow.fade("out");
	
	$('button_seemore').className = "vis";
	$('button_hide').className = "hidden";
	
	var extraheight = parseInt(document.getElementById("modheight").value);
	var targheight = extraheight + eventHeight;
	
	var heightChange = new Fx.Tween('events_mod', {duration:500, onComplete: hideOverflow});
	heightChange.start('height',700, eventHeight);
	
	var heightFix = new Fx.Tween('eventOverflowFix', {duration:500});
	heightFix.start('height', targheight+180, 680);
}

function showEventsHome(){
	overflow = $("eventOverflow");
	overflow.className = "vis";
	overflow.set("tween", { duration:500 });
	overflow.fade("in");
	
	$('button_hide').className = "vis";
	$('button_seemore').className = "hidden";
	
	var extraheight = parseInt($("extraheight").className);	
	var targheight = extraheight + 475;

	var heightChange = new Fx.Tween('events_mod_home',  {duration:500});
	heightChange.start('height', 475, targheight);
	var heightFix = new Fx.Tween('eventOverflowFix',  {duration:500});
	heightFix.start('height', 600, targheight+180);
}

function hideEventsHome(){
	var overflow = document.getElementById('eventOverflow');
	var alpha = new Fx.Style(overflow, 'opacity').set(1);
	alpha = new Fx.Style(overflow, 'opacity', {duration:500});
	alpha.start(1, 0);
	document.getElementById('button_seemore').className = "vis";
	document.getElementById('button_hide').className = "hidden";
	var extraheight = parseInt(document.getElementById("modheight").value);
	var targheight = extraheight + 475;
	var heightChange = new Fx.Style('events_mod_home', 'height', {duration:500, onComplete: hideOverflow});
	heightChange.start(targheight, 475);
	var heightFix = new Fx.Style('eventOverflowFix', 'height', {duration:500});
	heightFix.start(targheight+180, 600);
}

function hideOverflow(e){
	document.getElementById('eventOverflow').className = "hidden";
	
}
function showlink(e){
	var linkname = e.id + "_link";
	if(document.getElementById(linkname)){
		document.getElementById(linkname).style.cssText = "display:block";
	}
	//var alpha = new Fx.Style(linkname, 'opacity').set(0);
	//alpha = new Fx.Style(linkname, 'opacity', {duration:500});
	//alpha.start(0, 1);
}

function hidelink(e){
	var linkname = e.id + "_link";
	if(document.getElementById(linkname)){
		document.getElementById(linkname).style.cssText = "display:none";
	}
}

function getLink(){
	alert("click");
}

function goHome(){
	document.location = "/";
}

function popImage(gallery,image) {
	win = window.open("imageViewer.php?g=" + gallery + "&i=" + image,"ImageViewer","width=750,height=500,scrollbars=yes");
}
