/*
******************************************************
 change image on mouseover

******************************************************
													*/

function onhoverchange(id) {
		
	document.getElementById(id).src = 'images/' + id + '_on.jpg';
	
}


function offhoverchange(id) {
	
	document.getElementById(id).src = 'images/' + id + '_off.jpg';
	
}

function onplayfilm(id) {
		
	document.getElementById(id).src = 'images/play_on.jpg';
	
}


function offplayfilm(id) {
	
	document.getElementById(id).src = 'images/play_off.jpg';
	
}

/*
******************************************************
 change element opacity

******************************************************
													*/
function opacity(id, opacStart, opacEnd) {
	
	var speed = 10;
	var timer = 0;
	
	//determine the direction of the dissolve - if start and end are the same nothing happens
	if (opacStart > opacEnd) {
		for (i = opacStart; i >= opacEnd; i--) {
			setTimeout("changeOpac (" + i + ",'" + id + "')", (timer * speed));
			timer++; 
		
		}
		
		}		
		else if (opacStart < opacEnd) {
			for (i = opacStart; i<= opacEnd; i++) {
				setTimeout("changeOpac (" + i + ",'" + id + "')", (timer * speed));
				timer++;
			
			
		}		
	}				
	
}		
		
		//change opacity for diff browsers
		function changeOpac(opacity, id) {
		
			var object = document.getElementById(id).style;
			object.MozOpacity = ( opacity / 100 );
			object.KhtmlOpacity = ( opacity / 100 );
			object.opacity = ( opacity / 100 );
			object.filter = 'alpha(opacity="' + opacity + '")';

		}
		
		
/*
******************************************************
 Will make an invisible content element visible while 
 making all other content elements invisible
 
******************************************************
													*/
function display(id) {
		
		for (x in 	filmographyMenu) 
			{
				document.getElementById(filmographyMenu[x] + 'Content').style.display = 'none';
				
				var ident = filmographyMenu[x] + 'Content';
				changeOpac(0, ident)
			}
			
		return displayDiv(id);

}

/*
******************************************************
 Makes an element visible
 
******************************************************
													*/
function displayDiv(id) {

		document.getElementById(id).style.display = 'block';
		opacity(id, 0, 100);
		return false;
		
}

/*
*****************************************************
Create flash container div

*****************************************************
												   */
function createDiv(flvName) {
	
	document.getElementById('shadeBottom').style.visibility = 'hidden';
	
	container1 = document.getElementById('contentRight');
	
	contentDiv = document.createElement('div');
		contentDiv.setAttribute('id','flashTest');
		contentDiv.setAttribute('align','center');
		
	container1.appendChild(contentDiv);
	
	
	return flashLoad(flvName);

}

function createDiv2() {
	
	document.getElementById('shadeBottom').style.visibility = 'hidden';
	
	container1 = document.getElementById('contentRight');
	
	contentDiv = document.createElement('div');
		contentDiv.setAttribute('id','flashTest');
		contentDiv.setAttribute('align','center');
		contentDiv.innerHTML = '<object width="400" height="225"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=2752001&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=2752001&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="225"></embed></object><p><a href="http://vimeo.com/2752001">The Firm - Dismal Results</a> from <a href="http://vimeo.com/user1046186">Harry Clegg</a> on <a href="http://vimeo.com">Vimeo</a>.</p>'
		
	container1.appendChild(contentDiv);
	
	
	document.getElementById('close').style.display = 'block';

}

/*
*****************************************************
Create flash object

*****************************************************
												   */
function flashLoad(flvName) {		
	var ext = '.flv';
					
	var s1 = new SWFObject("player.swf","ply","715","500","9","#FFFFFF");
	s1.addParam("allowfullscreen","true");
	s1.addParam("allowscriptaccess","always");
	s1.addVariable("skin", "stijl.swf");
	s1.addVariable("file",'films/' + flvName + ext);
	s1.addVariable("fullscreen","true");
	s1.write('flashTest');
	
	document.getElementById('close').style.display = 'block';
	
}
function flashLoad2(flvName) {
	var ext = ".flv";
	
	var s1 = new SWFObject("player.swf","ply","500","400","9","#111111");  
	s1.addParam("allowfullscreen","true");		
	s1.addParam("allowscriptaccess","always");
	s1.addVariable("skin", "stijl.swf");
	s1.addVariable("file",'films/' + flvName + ext);
	s1.addVariable("fullscreen","true");
	s1.write('flashTest2');
	
}

/*
*****************************************************
Remove flash container div and unload link

*****************************************************
												   */
function removeDiv() {

	container1 = document.getElementById('contentRight');
	
	contentDiv = document.getElementById('flashTest');
		
	container1.removeChild(contentDiv);

	document.getElementById('close').style.display = 'none';
	
	document.getElementById('shadeBottom').style.visibility = 'visible';
	

}


/*
******************************************************
 preLoad images on filmography page

******************************************************
													*/
		
function preLoad() {

	for (x in filmographyMenu) {
			
		//preLoad main image in filmography
		var contentObj = filmographyMenu[x] + 'Image';
		contentObj = new Image();
		contentObj.src = 'images/' + filmographyMenu[x] + 'Img.jpg';
		
		//preLoad h3 background images
		var contentObj2 = filmographyMenu[x];
		contentOb2j = new Image();
		contentObj2.src = 'images/' + filmographyMenu[x] + '.jpg';
		
	}
	
}
