// ======================================
// =========== Menu Functions ===========
// ======================================

function show(id,parentId){
	document.getElementById(id).style.display = 'block';
	document.getElementById(id).style.visibility = 'visible';
	document.getElementById(parentId).style.fontWeight = 'bold';
	document.getElementById(id).style.fontWeight = 'normal';
}

function hide(id,parentId){
	document.getElementById(id).style.display = 'none';
	document.getElementById(id).style.visibility = 'hidden';
	document.getElementById(parentId).style.fontWeight = 'normal';
}

// ======================================
// =========== Content Paging ===========
// ======================================

function showContent(num, total){
	for (i = 1; i <= total; i++) {
		if (i != num) {
			var contentText = document.getElementById('contentText' + i);
			contentText.style.visibility = 'hidden';
			contentText.style.display = 'none';
		} else if (i == num) {
			var contentText = document.getElementById('contentText' + i);
			contentText.style.visibility = 'visible';
			contentText.style.display = 'block';
		}
	}	
}

function generatePaging(num, total){
	document.write('<div class="paging">');
	for (i = 1; i <= total; i++) {
		if (i != num) {
			document.write('<a onMouseOver="showContent(' + i + ',' + total + ');" href="#" style="cursor:default;">' + i + '</a>');
		} else if (i == num) {
			document.write('<strong>' + i + '</strong>');
		}
	}	
	document.write('</div>');
}

// ======================================
// ========== Sketches Gallery ==========
// ======================================

function generateGallery(xml){
	document.write('<div id="flashcontent"><strong>Please note: </strong> You need to upgrade your Flash Player.<br/>Please <a href="http://www.adobe.com/go/getflashplayer" target="_blank"><strong>click here</strong></a> to download the latest version.</div>');
	
	// <![CDATA[
	var so = new SWFObject("/gallery/ewegallery2.swf", "ewegallery", "510", "220", "8", "#F7F3E0");
	so.addVariable("galleryXML", xml);
	so.addParam("wmode", "transparent");
	so.write("flashcontent");
	// ]]>
}

// =====================================
// ========= Big Image Gallery =========
// =====================================

function loadBigImage(myArray){
	
	var strToSplit = myArray[0];
	var urlAndHeight = strToSplit.split(",");
	
	var bigImage = document.getElementById('passepartout');
	bigImage.style.background = 'url(\'/images/' + urlAndHeight[0] + '\')';
	bigImage.style.backgroundPosition = 'bottom';
	bigImage.style.backgroundRepeat = 'no-repeat';
	myAnimUp.attributes.height = { to: urlAndHeight[1] };  
			
}

function changeBigImage(myArray){
	
	currentBigImage = currentBigImage + 1;
	if (currentBigImage >= myArray.length) {
		currentBigImage = 0;
	}
	
	var strToSplit = myArray[currentBigImage];
	var urlAndHeight = strToSplit.split(",");
	
	var bigImage = document.getElementById('passepartout');
	bigImage.style.background = 'url(\'/images/' + urlAndHeight[0] + '\')';
	bigImage.style.backgroundPosition = 'bottom';
	bigImage.style.backgroundRepeat = 'no-repeat';
	myAnimUp.attributes.height = { to: urlAndHeight[1] };  
	myAnimUp.animate();
			
}

function homeShow() {
	
	var myLanguageIn = new YAHOO.util.Anim('home'); 
		myLanguageIn.attributes.opacity = { to: 1 }; 
		myLanguageIn.duration = .4; 
		
}