
/*
	durgle.js
	version 1.4
	first created: 10/27/06
	last revised: 8/25/07
	http://durgle.com
	talk@durgle.com
*/


// -------- BEGIN DEBUG -----------


var GraySide = "2e302b";
var BG = "454841";
var header = "595f55";

// Set debug to show alerts
var debug = 0;
//var debug = 1;


// Show that debug is activated
if (debug) { window.onload = function() { alert("Debug Activated"); } }


// -------- END DEBUG -----------


// -------- BEGIN SETTINGS -----------


// Animation Frame rate per second
// unused now, integration within 2 months, err - maybe
var fRate = 24;


// -------- END SETTINGS -----------


// Get a reference to an object
function $d(TheID) { 
	return document.getElementById(TheID);
}


// Get a reference to an object with the style attribute
// why doesn't prototype offer this? :P
function $ds(x) {
	return $d(x).style;
}


// stop a form from being submitted, form onsubmit=ff(); ff = formFalse();
function ff() {
	return false;
}

// incase we forget :P
function formFalse() { ff(); }


// -------- BEGIN AJAX -----------


// Get a browser independent XMLHTTP Object
function GetXMLHTTP() {
	var XMLHTTP = false;
	if (window.XMLHttpRequest) {
		XMLHTTP = new XMLHttpRequest()
  	} else if (window.ActiveXObject) {
		try {
			XMLHTTP = new ActiveXObject("Msxml2.XMLHTTP")
		} catch (e) { 
			try {
        			XMLHTTP = new ActiveXObject("Microsoft.XMLHTTP")
      		} catch (E) {
        			XMLHTTP = false;
      		}
    		}
  	}
	return XMLHTTP;
};


// Pass a server side response as a javascript function
function Ajax2Function(url) {
	var XMLHTTP = new GetXMLHTTP();
	// Compatibility with IE 5.0
	if (params == null) {
		params = '0';
	}
	// Send the Request
	if (XMLHTTP) {
		XMLHTTP.onreadystatechange = function stateChange() {
			if (XMLHTTP && XMLHTTP.readyState == 4) {
				// Got something back..
				if (XMLHTTP.status == 200) {
					// Check to see if the response was good
					var response = XMLHTTP.responseText;
					if(debug) {
						alert(response);
					}
					eval(response);
				} else if(debug){
					document.write(XMLHTTP.responseText);
				}
			}
		}
		// open the page
		XMLHTTP.open("GET", url, true);
		// send the data
		XMLHTTP.send(null);
	}
}


// Pass a server side response as a javascript function
function InnerFromAJAX(url, params, obj_id, execAfterEval) {
	var XMLHTTP = new GetXMLHTTP();
	// Compatibility with IE 5.0
	if (params == null) {
		params = '0';
	}
	// Send the Request
	if (XMLHTTP) {
		XMLHTTP.onreadystatechange = function stateChange() {
			if (XMLHTTP && XMLHTTP.readyState == 4) {
				// Got something back..
				if (XMLHTTP.status == 200) {
					// Check to see if the response was good
					var response = XMLHTTP.responseText;
					if(debug) {
						alert(response);
					}
					document.getElementById(obj_id).innerHTML = response;
					if(debug) {
						alert(execAfterEval);
					}
					eval(execAfterEval);
				} else if(debug){
					document.write(XMLHTTP.responseText);
				}
			}
		}
	// open the page
	XMLHTTP.open("GET", url+params, true);
	// send the data
	XMLHTTP.send(null);
	}
}


// Pass a server side response as a javascript function
function InnerFromAJAXAppend(url, params, obj_id, execAfterEval) {
	var XMLHTTP = new GetXMLHTTP();
	// Compatibility with IE 5.0
	if (params == null) {
		params = '0';
	}
	// Send the Request
	if (XMLHTTP) {
		XMLHTTP.onreadystatechange = function stateChange() {
			if (XMLHTTP && XMLHTTP.readyState == 4) {
				// Got something back..
				if (XMLHTTP.status == 200) {
					// Check to see if the response was good
					var response = XMLHTTP.responseText;
					if(debug) {
						alert(response);
					}
					document.getElementById(obj_id).innerHTML += response;
					if(debug) {
						alert(execAfterEval);
					}
					eval(execAfterEval);
				} else if(debug){
					document.write(XMLHTTP.responseText);
				}
			}
		}
	// open the page
	XMLHTTP.open("GET", url+params, true);
	// send the data
	XMLHTTP.send(null);
	}
}


// -------- END AJAX -----------



// -------- BEGIN STRING, INT AND ARRAY FUNCTIONS -----------


// Trim a string on the left and right sides
function Trim(x) {
	//return x.replace(/^\s+|\s+$d/g,"");
}


// Split JavaScript by a semicolon
function splitSemi(x) {
	y = x.split(";");
	return y;	
}


// Print an array
function printr(arr) {
	for (var i = 0; i < arr.length; i++) {
		document.write(arr[i] + "<br />");
	}
}


// string to array split by commas
function str2arr(str) {
	var arr = str.split(",");
	return arr;
}


// Remove an array element by index
Array.prototype.removeByValue = function(value){
	for (var i = this.length; i >= 0; i--) {
		if (this[i] == value) {
			this.splice(i,1); 
			return value; 
		}
	}
}



// Store a string into an input field
function spt(x, y) {
	$d(x).value = y;
}


// hexadecimal to decimal
function hex2dec(hex) {
	return(parseInt(hex,16));
}


// decimal to hexadecimal
function dec2hex(dec) {
	return (dec < 16 ? "0" : "") + dec.toString(16);
}


// -------- END STRING, INT AND ARRAY FUNCTIONS -----------


// -------- BEGIN OPACITY, FADING AND VIEWING -----------


// Hide or show an object
function toggle(x) {
	if ($ds(x).display = 'none') {
		$ds(x).display = 'block';
	} else {
		alert('sdfvw');
		$ds(x).display = 'none';
	}
};


// Fade an element in or out via opacity
function opacity(id, opacStart, opacEnd, millisec) {
	//speed for each frame
	var speed = Math.round(millisec / 100);
	var timer = 0;

	// determine the direction for the blending, if start and end are the same nothing happens
	if(opacStart > opacEnd) {
		for(i = opacStart; i >= opacEnd; i--) {
			setTimeout("changeOpacity('" + id + "'," + i + ")",(timer * speed));
		timer++;
		}
	} else if(opacStart < opacEnd) {
		for(i = opacStart; i <= opacEnd; i++) {
			setTimeout("changeOpacity('" + id + "'," + i + ")",(timer * speed));
			timer++;
		}
	}
}


// Change the opacity for different browsers
function changeOpacity(id, opacity) {
	var object = $d(id).style;
	object.opacity = (opacity / 100);
	object.MozOpacity = (opacity / 100);
	object.KhtmlOpacity = (opacity / 100);
	object.filter = "alpha(opacity=" + opacity + ")";
} 


// -------- BEGIN OPACITY, FADING AND VIEWING -----------



// -------- BEGIN STYLESHEET FUNCTIONS -----------



// Set the active style sheet from an alternate style sheet
function disableStyleSheet(mysrc) {
	if (debug) {
		alert('removing styl sheet: ' + mysrc);
	}
	var i, a;
	for(i = 0; (a = document.getElementsByTagName("link")[i]); i++) {
		if (a.getAttribute("rel").indexOf("style") != -1) {
			if (a.getAttribute("src").indexOf(mysrc) != -1) {
				if (debug) {
					alert('stylesheet match');
				}
				a.disabled = true;
			}
		}
	}
}


// Set the active style sheet from an alternate style sheet
function disableFirstStyleSheet() {
	document.getElementsByTagName('link')[0].disabled = true;
}



// -------- END STYLESHEET FUNCTIONS -----------



// -------- BEGIN "DIMENSIONS" INFORMATION -----------


// Get an objects width
function getW(x) {
	if ($d(x).clientWidth) {
		var w = $d(x).clientWidth;
	} else {
		if ($d(divID).offsetWidth) {
			var w = $d(divID).offsetWidth;
		}
	}
	return w;
};


// Get an objects height
function getH(x) {
	if ($d(x).clientHeight) {
		var h = $d(x).clientHeight;
	} else {
		if ($d(divID).offsetHeight) {
			var h = $d(divID).offsetHeight;
		}
	}
	return h;
};


// Get an objects x coordinate
Object.prototype.getX = function () {
	var x = $ds(this).left;
	return x;
}


// Get an objects y coordinate
Object.prototype.getY = function (x) {
	var y = $ds(x).top;
	return y;
}


// -------- END "DIMENSIONS" INFORMATION -----------


// -------- BEGIN MISCELLANEOUS FUNCTIONS -----------


// Create a div
function createDiv(myL, x, y, w, h, bg) {
	myL = document.createElement("DIV"); 
	document.body.appendChild(myL); 
	myL.style.position = 'absolute';
	myL.style.background = bg;
	myL.style.top = y;
	myL.style.left = x;
	myL.style.width = w;
	myL.style.height = h;
	myL.style.innerHTML = "&nbsp;";
	myL.style.border = "1px solid red";
}


// Set new colors of divs with an __indexOf("color")
function setNewColors() {
	var i, a, j;
	j = 0;
	for(i = 0; (a = document.getElementsByTagName("div")[i]); i++) {
		if (a.getAttribute("id")) {
			if (a.getAttribute("id").indexOf("color") != -1) {
				//alert(pColors2[j]);
				//a.style.background = pColors2[i];
				//alert(a.getAttribute("id"));
			}
		}
	j++;
	}
};


function pause(numberMillis) {
	var now = new Date();
	var exitTime = now.getTime() + numberMillis;
	while (true) {
		now = new Date();
		if (now.getTime() > exitTime)
		return;
	}
} 


function toggle(obj) {
	var el = document.getElementById(obj);
	if ( el.style.display != 'none' ) {
		el.style.display = 'none';
	}
	else {
		el.style.display = '';
	}
}


function insertAfter(parent, node, referenceNode) {
	parent.insertBefore(node, referenceNode.nextSibling);
}


// -------- END MISCELLANEOUS FUNCTIONS -----------



// -------- BEGIN DRAG AND DROP FUNCTIONS ----------


var _startX = 0;			// mouse starting positions
var _startY = 0;
var _offsetX = 0;			// current element offset
var _offsetY = 0;
var _dragElement;			// needs to be passed from OnMouseDown to OnMouseMove
var _oldZIndex = 0;			// we temporarily increase the z-index during drag


InitDragDrop();

function InitDragDrop()
{
	document.onmousedown = OnMouseDown;
	document.onmouseup = OnMouseUp;
}

function OnMouseDown(e) {
	// IE is retarded and doesn't pass the event object
	if (e == null) 
		e = window.event; 
	// IE uses srcElement, others use target
	var target = e.target != null ? e.target : e.srcElement;
	// for IE, left click == 1
	// for Firefox, left click == 0
	if ((e.button == 1 && window.event != null || 
		e.button == 0) && 
		target.className == 'drag')
	{
		// grab the mouse position
		_startX = e.clientX;
		_startY = e.clientY;
		
		// grab the clicked element's position
		_offsetX = ExtractNumber(target.style.left);
		_offsetY = ExtractNumber(target.style.top);
		
		// bring the clicked element to the front while it is being dragged
		_oldZIndex = target.style.zIndex;
		target.style.zIndex = 10000;
		
		// we need to access the element in OnMouseMove
		_dragElement = target;

		// tell our code to start moving the element with the mouse
		document.onmousemove = OnMouseMove;
		
		// cancel out any text selections
		document.body.focus();
		
		// prevent text selection in IE
		document.onselectstart = function () { return false; };
		
		// prevent text selection (except IE)
		return false;
	}
}

function ExtractNumber(value) {
	var n = parseInt(value);
	return n == null || isNaN(n) ? 0 : n;
}

function OnMouseMove(e) {
	if (e == null) 
		var e = window.event; 
	// this is the actual "drag code"
	_dragElement.style.left = (_offsetX + e.clientX - _startX) + 'px';
	_dragElement.style.top = (_offsetY + e.clientY - _startY) + 'px';
}

function OnMouseUp(e)
{
	if (_dragElement != null)
	{
		_dragElement.style.zIndex = _oldZIndex;

		// we're done with these events until the next OnMouseDown
		document.onmousemove = null;
		document.onselectstart = null;

		// this is how we know we're not dragging		
		_dragElement = null;
		
	}
}


// -------- END DRAG AND DROP FUNCTIONS ----------



// -------- BEGIN TWEENING -----------


function Delegate() {}
Delegate.create = function (o, f) {
	var a = new Array() ;
	var l = arguments.length ;
	for(var i = 2 ; i < l ; i++) a[i - 2] = arguments[i] ;
	return function() {
		var aP = [].concat(arguments, a) ;
		f.apply(o, aP);
	}
}

Tween = function(obj, prop, func, begin, finish, duration, suffixe){
	this.init(obj, prop, func, begin, finish, duration, suffixe)
}
var t = Tween.prototype;

t.obj = new Object();
t.prop='';
t.func = function (t, b, c, d) { return c*t/d + b; };
t.begin = 0;
t.change = 0;
t.prevTime = 0;
t.prevPos = 0;
t.looping = false;
t._duration = 0;
t._time = 0;
t._pos = 0;
t._position = 0;
t._startTime = 0;
t._finish = 0;
t.name = '';
t.suffixe = '';
t._listeners = new Array();	
t.setTime = function(t){
	this.prevTime = this._time;
	if (t > this.getDuration()) {
		if (this.looping) {
			this.rewind (t - this._duration);
			this.update();
			this.broadcastMessage('onMotionLooped',{target:this,type:'onMotionLooped'});
		} else {
			this._time = this._duration;
			this.update();
			this.stop();
			this.broadcastMessage('onMotionFinished',{target:this,type:'onMotionFinished'});
		}
	} else if (t < 0) {
		this.rewind();
		this.update();
	} else {
		this._time = t;
		this.update();
	}
}
t.getTime = function(){
	return this._time;
}
t.setDuration = function(d){
	this._duration = (d == null || d <= 0) ? 100000 : d;
}
t.getDuration = function(){
	return this._duration;
}
t.setPosition = function(p){
	this.prevPos = this._pos;
	var a = this.suffixe != '' ? this.suffixe : '';
	this.obj[this.prop] = Math.round(p) + a;
	this._pos = p;
	this.broadcastMessage('onMotionChanged',{target:this,type:'onMotionChanged'});
}
t.getPosition = function(t){
	if (t == undefined) t = this._time;
	return this.func(t, this.begin, this.change, this._duration);
};
t.setFinish = function(f){
	this.change = f - this.begin;
};
t.geFinish = function(){
	return this.begin + this.change;
};
t.init = function(obj, prop, func, begin, finish, duration, suffixe){
	if (!arguments.length) return;
	this._listeners = new Array();
	this.addListener(this);
	if(suffixe) this.suffixe = suffixe;
	this.obj = obj;
	this.prop = prop;
	this.begin = begin;
	this._pos = begin;
	this.setDuration(duration);
	if (func!=null && func!='') {
		this.func = func;
	}
	this.setFinish(finish);
}
t.start = function(){
	this.rewind();
	this.startEnterFrame();
	this.broadcastMessage('onMotionStarted',{target:this,type:'onMotionStarted'});
	//alert('in');
}
t.rewind = function(t){
	this.stop();
	this._time = (t == undefined) ? 0 : t;
	this.fixTime();
	this.update();
}
t.fforward = function(){
	this._time = this._duration;
	this.fixTime();
	this.update();
}
t.update = function(){
	this.setPosition(this.getPosition(this._time));
	}
t.startEnterFrame = function(){
	this.stopEnterFrame();
	this.isPlaying = true;
	this.onEnterFrame();
}
t.onEnterFrame = function(){
	if(this.isPlaying) {
		this.nextFrame();
		setTimeout(Delegate.create(this, this.onEnterFrame), 0);
	}
}
t.nextFrame = function(){
	this.setTime((this.getTimer() - this._startTime) / 1000);
	}
t.stop = function(){
	this.stopEnterFrame();
	this.broadcastMessage('onMotionStopped',{target:this,type:'onMotionStopped'});
}
t.stopEnterFrame = function(){
	this.isPlaying = false;
}

t.continueTo = function(finish, duration){
	this.begin = this._pos;
	this.setFinish(finish);
	if (this._duration != undefined)
		this.setDuration(duration);
	this.start();
}
t.resume = function(){
	this.fixTime();
	this.startEnterFrame();
	this.broadcastMessage('onMotionResumed',{target:this,type:'onMotionResumed'});
}
t.yoyo = function (){
	this.continueTo(this.begin,this._time);
}

t.addListener = function(o){
	this.removeListener (o);
	return this._listeners.push(o);
}
t.removeListener = function(o){
	var a = this._listeners;	
	var i = a.length;
	while (i--) {
		if (a[i] == o) {
			a.splice (i, 1);
			return true;
		}
	}
	return false;
}
t.broadcastMessage = function(){
	var arr = new Array();
	for(var i = 0; i < arguments.length; i++){
		arr.push(arguments[i])
	}
	var e = arr.shift();
	var a = this._listeners;
	var l = a.length;
	for (var i=0; i<l; i++){
		if(a[i][e])
		a[i][e].apply(a[i], arr);
	}
}
t.fixTime = function(){
	this._startTime = this.getTimer() - this._time * 1000;
}
t.getTimer = function(){
	return new Date().getTime() - this._time;
}
Tween.backEaseIn = function(t,b,c,d,a,p){
	if (s == undefined) var s = 1.70158;
	return c*(t/=d)*t*((s+1)*t - s) + b;
}
Tween.backEaseOut = function(t,b,c,d,a,p){
	if (s == undefined) var s = 1.70158;
	return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
}
Tween.backEaseInOut = function(t,b,c,d,a,p){
	if (s == undefined) var s = 1.70158; 
	if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
	return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
}
Tween.elasticEaseIn = function(t,b,c,d,a,p){
		if (t==0) return b;  
		if ((t/=d)==1) return b+c;  
		if (!p) p=d*.3;
		if (!a || a < Math.abs(c)) {
			a=c; var s=p/4;
		}
		else 
			var s = p/(2*Math.PI) * Math.asin (c/a);
		
		return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
	
}
Tween.elasticEaseOut = function (t,b,c,d,a,p){
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (!a || a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return (a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b);
	}
Tween.elasticEaseInOut = function (t,b,c,d,a,p){
	if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) var p=d*(.3*1.5);
	if (!a || a < Math.abs(c)) {var a=c; var s=p/4; }
	else var s = p/(2*Math.PI) * Math.asin (c/a);
	if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
	return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
}

Tween.bounceEaseOut = function(t,b,c,d){
	if ((t/=d) < (1/2.75)) {
		return c*(7.5625*t*t) + b;
	} else if (t < (2/2.75)) {
		return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
	} else if (t < (2.5/2.75)) {
		return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
	} else {
		return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
	}
}
Tween.bounceEaseIn = function(t,b,c,d){
	return c - Tween.bounceEaseOut (d-t, 0, c, d) + b;
	}
Tween.bounceEaseInOut = function(t,b,c,d){
	if (t < d/2) return Tween.bounceEaseIn (t*2, 0, c, d) * .5 + b;
	else return Tween.bounceEaseOut (t*2-d, 0, c, d) * .5 + c*.5 + b;
	}

Tween.strongEaseInOut = function(t,b,c,d){
	return c*(t/=d)*t*t*t*t + b;
	}

Tween.regularEaseIn = function(t,b,c,d){
	return c*(t/=d)*t + b;
	}
Tween.regularEaseOut = function(t,b,c,d){
	return -c *(t/=d)*(t-2) + b;
	}

Tween.regularEaseInOut = function(t,b,c,d){
	if ((t/=d/2) < 1) return c/2*t*t + b;
	return -c/2 * ((--t)*(t-2) - 1) + b;
	}
Tween.strongEaseIn = function(t,b,c,d){
	return c*(t/=d)*t*t*t*t + b;
	}
Tween.strongEaseOut = function(t,b,c,d){
	return c*((t=t/d-1)*t*t*t*t + 1) + b;
	}

Tween.strongEaseInOut = function(t,b,c,d){
	if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
	return c/2*((t-=2)*t*t*t*t + 2) + b;
	}


// -------- END TWEENING -----------


MySounds = Array();
MySounds[0] = "audio/beep.mp3";
MySounds[1] = "audio/select.mp3";

function playSound(intSound) {
	myL = document.createElement("DIV"); 
	document.body.appendChild(myL); 
	var embedSound = '<embed src="' + MySounds[intSound] + '" autostart="true" loop="false" width="1" height="1" controller="false"></embed>';
	myL.innerHTML = embedSound;
	return true;
}


// -------- END SOUND MANAGER ----------


// -------- BEGIN REMOTE CONTROL FUNCTIONS ----------


// Turn a DIV into a widget
function durglize(strDivID, strDivIDCloser) {
	$d(strDivID).setAttribute("class", "drag"); 
	document.getElementById("remote").onclick = function() { closeDurgle("remote"); };
}


// Fade out a durgle
function closeDurgle(strDivOD) {
	//changeOpacity("remote", 1);
}


durglize("remote", "remoteCloser");


var MyReels = new Array(3);
MyReels[1] = "Come Sempre / Sony F900";
MyReels[2] = "Diamonds, Bullets, & Fate / Panasonic Varicam";
MyReels[3] = "LA FABBRICA DELLA NUVOLE / Panasonic DVX-100";
MyReels[4] = "ACTION AGAINST HUNGER - PSA / Panasonic Varicam";


var MyMovies = new Array(3);
MyMovies[1] = "../video/COMESEMP_ref.mov";
MyMovies[2] = "../video/DBF1_ref.mov";
MyMovies[3] = "../video/Enrico_ref.mov";
MyMovies[4] = "../video/PSA2_ref.mov";


function nextReel() {
	var currentReel = window.myCurrentMovie;
	var MyReelsLength = MyReels.length -1;
	if (currentReel < MyReelsLength) {
		$d("holder").innerHTML = '<embed src="' + MyMovies[currentReel + 1] + '" width="363" height="272" autoplay="true" controller="false">'
		window.myCurrentMovie = window.myCurrentMovie + 1; 
	}
	if (currentReel >= MyReelsLength) {
		$d("holder").innerHTML = '<embed src="' + MyMovies[1] + '" width="363" height="272" autoplay="true" controller="false">'
		window.myCurrentMovie = 1;
	}
	sub = '<span id="current">' + window.myCurrentMovie + '</span>/<span id="totals">' + MyReelsLength + '</span> &nbsp; | &nbsp; "' + MyReels[window.myCurrentMovie] + '"</p>';
	$d("subtitleP").innerHTML = sub;
	//alert(window.myCurrentMovie);
}


function previousReel() {
	var currentReel = window.myCurrentMovie;
	var MyReelsLength = MyReels.length -1;
	if (currentReel < MyReelsLength) {
		$d("holder").innerHTML = '<embed src="' + MyMovies[currentReel + 1] + '" width="363" height="272" autoplay="true" controller="false">'
		window.myCurrentMovie = window.myCurrentMovie + 1; 
	}
	if (currentReel >= MyReelsLength) {
		$d("holder").innerHTML = '<embed src="' + MyMovies[1] + '" width="363" height="272" autoplay="true" controller="false">'
		window.myCurrentMovie = 1;
	}
	sub = '<span id="current">' + window.myCurrentMovie + '</span>/<span id="totals">' + MyReelsLength + '</span> &nbsp; | &nbsp; "' + MyReels[window.myCurrentMovie] + '"</p>';
	$d("subtitleP").innerHTML = sub;
	//alert(window.myCurrentMovie);
}


function pauseReel() {
	alert("Pause Reel!");
}


var obj = {
	a : Object,
	b : Array,
	c : false,
	d : null,
	init : function() {
		// set local object vars here
		this.run();
	},
	run : function() {
		// run bulk of behavior here
		changeMovie(1);
	},
	preloader: function() {
		// Preload Website Images
	},
	websiteSetup: function() {
		// Setup website layout
	}
}


function initializer() {
	obj.init();
	// other init() methods go here
}


function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	}
	else {
		window.onload = function() {
			oldonload();
			func();
		}
	}
}


function closeMovie() {
	opacity('gropingInterns', 100, 0, 600);
	$d("gropingInterns").style.display = "none";
	opacity('taxEvasion', 100, 0, 600);
	$d("taxEvasion").style.display = "none";
	opacity('movieContainer', 100, 0, 600);
	$d("movieContainer").style.display = "none";
	opacity('theX', 100, 0, 600);
	$d("theX").style.display = "none";
	//changeOpacity('container', 100);
}


window.myCurrentMovie = 1;

function playMovie(intMovie) {
	window.scroll(0,0);
	window.myCurrentMovie = intMovie;
	var MyReelsLength = MyReels.length -1;
	//opacity('container', 100, 20, 600);
	changeOpacity('gropingInterns', 0);
	$d("gropingInterns").style.display = "block";
	opacity('gropingInterns', 0, 100, 600);
	changeOpacity('taxEvasion', 0);
	$d("taxEvasion").style.display = "block";
	opacity('taxEvasion', 0, 100, 600);
	$d("holder").innerHTML = '<embed src="' + MyMovies[intMovie] + '" width="363" height="272" autoplay="true" controller="false">'
	sub = '<span id="current">' + window.myCurrentMovie + '</span>/<span id="totals">' + MyReelsLength + '</span> &nbsp; | &nbsp; "' + MyReels[window.myCurrentMovie] + '"</p>';
	$d("subtitleP").innerHTML = sub;
}


function playMovie2(intMovieID) {
	//opacity("container", 100, 20, 600);
	changeOpacity('remote', 0);
	$d("remote").style.display = "block";
	opacity('remote', 0, 100, 600);
}

// Initialize Webpage
//addLoadEvent(initializer());


// -------- END REMOTE CONTROL FUNCTIONS ----------


// EOF

