var nextZindex = 200;
nextZindex = 200;
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
if(!document.getElementById) {
	if(document.all) {
		document.getElementById = function() {
			if(typeof document.all[arguments[0]] != "undefined") {
				return document.all[arguments[0]];
			} else { return null; }
		}
	} else if(document.layers) {
		document.getElementById = function() {
			if(typeof document[arguments[0]] != "undefined") {
				return document[arguments[0]];
			} else { return null; }
		}
	}
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
function showBOX(n)
{
    document.getElementById(n).style.display = 'block';
}
function hideBOX(n)
{
    document.getElementById(n).style.display = 'none';
}   
function hideALL()
{
   // document.getElementById('PORTFOLIO').style.display = 'none';
	//document.getElementById('BIO').style.display = 'none';
	document.getElementById('CONTACT').style.display = 'none';
	document.getElementById('GALLERY').style.display = 'none';
	document.getElementById('REARRANGE').style.display = 'none';
	document.getElementById('LINKS').style.display = 'none';
} 

function hideLISTS()
{

	document.getElementById('listPERFORMANCES').style.display = 'none';
	document.getElementById('listRESIDENT_ARTISTS').style.display = 'none';
	document.getElementById('listLECTURES').style.display = 'none';
}
function hideLISTS2()
{

	document.getElementById('listGENERAL').style.display = 'none';
	document.getElementById('listEVENT').style.display = 'none';
} 
function adminNAV(n)
{
	holderSTYLE = document.getElementById(n).style.display;
	hideALL();
	document.getElementById(n).style.display = holderSTYLE=='none'?'block':'none';
} 
function swapBOX(n)
{
	document.getElementById(n).style.display = document.getElementById(n).style.display=='none'?'block':'none';
} 
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
var step = 10;
var step2 = 0;
var imBusy = 0;
var yPos = 0;
var xPos = 0;
var fadeTimer;
var fadeINTimer;
var scale = 100;
var yDistance = 0;
var y1 = 0;
var y2 = 0;
var onFrame = 0;
var div1 = 0;
var div2 = 0;
var winPad = -60;
var winOFFSET = getScrollY();

DIV_COORDS = new Array(0, 870 + winPad, 1480 + winPad, 1882 + winPad, 4120 + winPad);

MOVE_COORDS_PLUS = new Array(0, 1, 4, 7, 11, 17, 23, 30, 38, 47, 56, 66, 75, 84, 92, 99, 100);
MOVE_COORDS_MINUS = new Array(100, 99, 92, 84, 75, 66, 56, 47, 38, 30, 23, 17, 11, 7, 4, 1, 0);

var frameTotal = MOVE_COORDS_PLUS.length;
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
function setOpacity(value, divID) {
	document.getElementById(divID).style.opacity = value/10;
	document.getElementById(divID).style.filter = 'alpha(opacity=' + value*10 + ')';
}

function fadePIC(divID) {
	if(step > 0){
		fadeTimer = setTimeout("fadePIC('"+divID+"')", 50);
		step = step - .5;
		setOpacity(step, divID);
	} else {
		document.getElementById(divID).style.display = 'none';
		if (fadeTimer) clearTimeout(fadeTimer);
	}
}

function colorON(divID) {
	document.getElementById(divID).style.color = '#ffffff';
	document.getElementById(divID).style.backgroundColor = '#eb208d';
}

function colorOFF(divID) {
	document.getElementById(divID).style.color = '#000000';
	document.getElementById(divID).style.backgroundColor = '#ffffff';
}

function updateCOOR(){
	var theLAT = document.getElementById("uLAT").value;
	var theLON = document.getElementById("uLON").value;
	//alert(theLAT + " / " + theLON);
	if(theLON < 0 || theLON > 490 || theLAT < 0 || theLAT > 270){
		alert("Please stay on the map.");
	} else {
		document.getElementById('theMARK').style.left = theLON+'px';
		document.getElementById('theMARK').style.top = theLAT+'px';
	}
}

function updateLON(dist){
	var xLON = document.getElementById('theMARK').style.left;
	
	xLON = xLON.replace(/px/gi,"");
	xLON = xLON.replace(/pt/gi,"");
	
	xLON = parseInt(xLON) + parseInt(dist);
	
	if(xLON < 0 || xLON > 490){
		alert("Please stay on the map.");
	} else {
		document.getElementById('theMARK').style.left = xLON+"px";
		document.getElementById("uLON").value = xLON;
	}
}

function updateLAT(dist){
	var xLAT = document.getElementById('theMARK').style.top;
	
	xLAT = xLAT.replace(/px/gi,"");
	xLAT = xLAT.replace(/pt/gi,"");
	
	xLAT = parseInt(xLAT) + parseInt(dist);
	
	if(xLAT < 0 || xLAT > 270){
		alert("Please stay on the map.");
	} else {
		document.getElementById('theMARK').style.top = xLAT+"px";
		document.getElementById("uLAT").value = xLAT;
	}
}

function switchPORTFOLIO(numID, totNUM){

	/*for(x=1; x<=totNUM; x++){
		//document.getElementById('PORT_' + numID).style.display = 'block';
		if(x != numID){
			document.getElementById('PORT_' + x).style.zIndex = '100';
		}
	}*/
	
	//document.getElementById('PORT_' + numID).style.display = 'none';
	document.getElementById('PORT_' + numID).style.display = 'block';
	setOpacity(0, "PORT_" + numID);
	nextZindex++;
	document.getElementById('PORT_' + numID).style.zIndex = nextZindex;
	
	step2 = 0;
	fadeIN("PORT_" + numID);
	
	if(numID == totNUM){
		numID = 1;
	} else {
		numID++;
	}
	
	setTimeout("switchPORTFOLIO(" + numID + ", " + totNUM + ")",5000);
}

function fadeIN(divID) {
	if(step2 < 10){
		fadeINTimer = setTimeout("fadeIN('"+divID+"')", 50);
		step2 = step2 + .5;
		setOpacity(step2, divID);
	} else {
		//document.getElementById(divID).style.display = 'block';
		if (fadeINTimer) clearTimeout(fadeINTimer);
	}
}

function emailAdd(){
	var emailAddress = document.getElementById('emailAdd').value;
	//alert(emailAddress);
	new Ajax.Updater('emailResult', 'add_email.php?email='+emailAddress, {asynchronous:true});
}

/***********************************************
* Drag and Drop Script: © Dynamic Drive (http://www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/

var dragobject={
	z: 0, x: 0, y: 0, offsetx : null, offsety : null, targetobj : null, dragapproved : 0,
	initialize:function(){
		document.onmousedown=this.drag
		document.onmouseup=function(){this.dragapproved=0
	}
},
	drag:function(e){
		var evtobj=window.event? window.event : e
		this.targetobj=window.event? event.srcElement : e.target
		if (this.targetobj.className=="drag"){
		this.dragapproved=1
		
		if (isNaN(parseInt(this.targetobj.style.left))){this.targetobj.style.left=0}
		if (isNaN(parseInt(this.targetobj.style.top))){this.targetobj.style.top=0}
		
		var tester = this.targetobj.style.left
		var tester1 = tester.substr(0,(tester.length - 2))
		//alert(tester1)
		var ax = tester1 * 1
		
		if(ax <= 600){
			
			this.offsetx=parseInt(this.targetobj.style.left)
			this.x=evtobj.clientX
		} else {
			alert(ax)
		}
		
		var tester = this.targetobj.style.top
		var tester2 = tester.substr(0,(tester.length - 2))
		//alert(tester.substr(0,(tester.length - 2)))
		//alert(this.targetobj.style.left)
		var ay = tester2 * 1
		
		if(ay <= 600){
			this.offsety=parseInt(this.targetobj.style.top)
			this.y=evtobj.clientY
			
		} else {
			alert(ay)
		}
		
		if (evtobj.preventDefault)
		evtobj.preventDefault()
		document.onmousemove=dragobject.moveit
		
	}
},
	moveit:function(e){
		var evtobj=window.event? window.event : e
		if (this.dragapproved==1){
			
			twin = this.targetobj.id;
			twin = twin.replace(/T/gi,"");

				this.targetobj.style.left=this.offsetx+evtobj.clientX-this.x+"px"
				document.getElementById(twin).style.left=(this.offsetx+evtobj.clientX-this.x)*10+"px"

				this.targetobj.style.top=this.offsety+evtobj.clientY-this.y+"px"
				document.getElementById(twin).style.top=(this.offsety+evtobj.clientY-this.y)*10+"px"
			 
			return false
		}
	}
}

dragobject.initialize()



