// JavaScript Document

/* 	Creator: Ng Ek Ngee
*	For use on Wild Empire website only
*/


/* ---------- Latest News Writeup ---------- */
/* -- Description --
*	Place the write up on any latest news
*	within the 'writeup' variable
*	Please use html code.
*	For proper formatting and readability,
*	please break up all lines according to HTML tags.
*/

function leftColumn(move)
{
	var latest_news, links, 
		contact_page, home_page, 
		kranji_choir, crescent_girls_choir, cdas;
	
	// contact pop-up page link
	home_page = move+"index.html";
	contact_page = move+"javascript:openForm('','performance');";
	
	// latest news goes here
	latest_news = "<p class=\"header\"><strong>Latest Events</strong></p>" +
				"<p>No events have been planned yet.</p>" +
				"<p>If you wish to have us at any of your events, please feel free to <a href=\""+contact_page+"\">contact us</a>.</p>";
	
	
	
	
	
	
	// link links goes here
	cdas = "http://cdas.org.sg/";
	kranji_choir = "http://kranjichoir.blogspot.com";
	crescent_girls_choir = "http://thevoicethespiritthesoul.blogspot.com";
	
	// links goes here
	links = "<p class=\"header\"><strong>Friends of WE</strong></p>" +
				"<p><a href=\""+cdas+"\" target=\"_blank\">Choral Directors' Association (Singapore)</a></p>" +
				"<p><a href=\""+kranji_choir+"\" target=\"_blank\">Kranji Secondary School Choir</a></p>" +
				"<p><a href=\""+crescent_girls_choir+"\" target=\"_blank\">Crescent Girls' Choir</a></p>" +
				"<p>&nbsp;</p><p>&nbsp;</p>";
				
				
	
	document.getElementById("leftColumn").innerHTML=latest_news+"<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p>"+links;
}




















/* ----- preload -----
*  -- Description --
*	To preload anything that can be handled in javascript)
*
*  -- Variables --
*	move = how many steps to that particular folder
*
*  -------------------- */

function preload(move)
{
	// images
	contact_us_mouseover = new Image();
	gallery_mouseover = new Image();
	history_mouseover = new Image();
	home_mouseover = new Image();
	showcase_mouseover = new Image();
	
	
	contact_us_mouseover.src = move+"images/contact_us_mouseover.jpg";
	gallery_mouseover.src = move+"images/gallery_mouseover.jpg";
	history_mouseover.src = move+"images/history_mouseover.jpg";
	home_mouseover.src = move+"images/home_mouseover.jpg";
	showcase_mouseover.src = move+"images/showcase_mouseover.jpg";
	
	// other javascript functions
	leftColumn(move);
	websiteHeader(move);
	footer(move);
	copyright();
}



/* ---------- Event functions ---------- */

/* ----- swapImage -----
*  -- Description --
*	To swap images
*
*  -- Variables--
*	what 	= which image id
*	event	= which mouse event
*
*  -------------------- */

function swapImages(what, event, move)
{
	switch(event.type)
	{
		case "mouseover":
			document.getElementById(what).src=move+"images/"+what+"_mouseover.jpg";
			break;
			
		case "mouseout":
			document.getElementById(what).src=move+"images/"+what+".jpg";
			break;
		
		default:
			break;
	}
}





/* ----- showHide -----
*  -- Description --
*	To show or hide the showcase divs
*
*  -- Variables--
*	what 	= which image id
*	event	= which mouse event
*
*  -------------------- */

function showHide(what)
{
	var dis = document.getElementById(what).style.display;
	
	if (dis == "none")
	{
		document.getElementById(what).style.display = "";
	}
	else
	{
		document.getElementById(what).style.display = "none";
	}
}




/* ---------- showArchive ---------- */
/* -- Description --
*	To show and hide the archive divs
*
*
*/


function showArchive(what)
{
	var archiveDiv = document.getElementById(what).style.display;

	// hide all divs
	for (i=1;i<=12;i++)
	{
		document.getElementById(i).style.display = "none";
	}
	
	document.getElementById(what).style.display = "";

}



/* ----- goTo -----
*  -- Description --
*	Subsitute for the 'a href' link.
*	Use on the 'onclick' event.
*
*  -- Variables --
*	where = which URL
*
*  -------------------- */

function goTo(where)
{
	window.location.replace(where);
}


function openForm(move, what)
{
	var loc = move+what;
	
	switch (what)
	{
		case "tickets":
			var loc = move+"form/tickets.html";
			window.open(loc, 'TicketForm', 'width=480,height=280,location=0,menubar=0,resizable=0,scrollbars=0,status=0,toolbar=0');
			break;
			
		case "performance":
			var loc = move+"form/performance.html";
			window.open(loc, 'PerformanceForm', 'width=520,height=580,location=0,menubar=0,resizable=0,scrollbars=0,status=0,toolbar=0');
			break;
			
		case "pictures":
			var loc = move+"gallery/pictures/index.html";
			window.open(loc, 'PictureGallery','width=820,height=630,location=0,menubar=0,resizable=0,scrollbars=0,status=0,toolbar=0');
			break;
			
		case "music":
			var loc = move+"gallery/music/index.html";
			window.open(loc, 'MusicGallery','width=740,height=410,location=0,menubar=0,resizable=0,scrollbars=0,status=0,toolbar=0');
			break;
			
		case "video":
			var loc = move+"gallery/video/index.html";
			window.open(loc, 'VideoGallery','width=740,height=410,location=0,menubar=0,resizable=0,scrollbars=0,status=0,toolbar=0');
			break;
			
		default:
			break;
	}
	
}


function viewPhoto (what, what2 , w, h)
{
	var caption = document.getElementById(what2).alt;
	
	parent.document.getElementById("mainPhoto").innerHTML="<img src=\""+what+"\" width=\""+w+"\" height=\""+h+"\" /><br /><em>"+caption+"</em>";
}






/* ----- websiteHeader -----
*  -- Description --
*	To load flash header on to website
*
*
*  -------------------- */

function websiteHeader(move)
{
	movieSrc = move+"images/wild_empire_header.swf";
	headerMovie = new SWFObject(movieSrc, "wildEmpireHeader", "480", "130", "8", "#000000");
	
	headerMovie.write("websiteHeader");
}



/* ----- footer -----
*  -- Description --
*	Footer of the website
*
*
*  -------------------- */

function footer(move)
{
	var home_link, history_link, showcase_link, gallery_link, contactus_link;
	
	home_link= "<a href=\""+move+"index.html\">Home</a>";
	history_link = "<a href=\""+move+"history.html\">About Us</a>";
	showcase_link = "<a href=\""+move+"showcase.html\">Showcase</a>";
	gallery_link = "<a href=\""+move+"gallery.html\">Gallery</a>";
	contactus_link = "<a href=\""+move+"contact_us.html\">Contact Us</a>";
	
	document.getElementById("footer").innerHTML = home_link+" | "+history_link+" | "+showcase_link+" | "+gallery_link+" | "+contactus_link;
}


/* ----- copyright -----
*  -- Description --
*	Copyright of the website
*
*
*  -------------------- */

function copyright()
{
	document.getElementById("copyright").innerHTML = "&copy; 2007 - 2008 Wild Empire Singers";
}