﻿interval=30;
scrollSpeed=5;
pagecheck=window.location.href.toString();
	pagecheckarray=pagecheck.split("/");
if(pagecheckarray[3]!="cupola_triads.php" && pagecheckarray[3]!="remains.php" && pagecheckarray[3]!="cupola_triads_scroll.php" && pagecheckarray[3]!="feed.php" && pagecheckarray[3].substr(0,24)!="cupola_semantics_new.php" && pagecheckarray[3].substr(0,13)!="contributions" ){

	
 addLoadEvent(checkScroll);
 }

function scroll(direction, mouseDown)	{


if(direction=='north')	{
document.getElementById('north').style.background='#ffffff';
scrolling=setInterval('north(' + mouseDown + ')', interval);
}
if(direction=='south')	{
document.getElementById('south').style.background='#ffffff';
scrolling=setInterval('south(' + mouseDown + ')', interval);
}
if(direction=='east')	{
document.getElementById('east').style.background='#ffffff';
scrolling=setInterval('east(' + mouseDown + ')', interval);
}
if(direction=='west')	{
document.getElementById('west').style.background='#ffffff';
scrolling=setInterval('west(' + mouseDown + ')', interval);
}
if(direction=='stop')	{
document.getElementById('north').style.background='#333333';
document.getElementById('south').style.background='#333333';
document.getElementById('east').style.background='#333333';
document.getElementById('west').style.background='#333333';
clearInterval(scrolling);
}
}

function north(mouseDown)	{

var dome =document.getElementById('dome');
pos=dome.style.top;

pos=parseInt(pos.substring(0, pos.indexOf('px')));
if(mouseDown)	{
pos+=scrollSpeed*2;
} else	{
pos+=scrollSpeed;
}
dome.style.top = pos + 'px';

}

//previously marginTop, marginLeft, etc.

function south(mouseDown)	{
var dome =document.getElementById('dome');
pos=dome.style.top;
pos=parseInt(pos.substring(0, pos.indexOf('px')));
if(mouseDown)	{
pos-=scrollSpeed*2;
} else	{
pos-=scrollSpeed;
}
dome.style.top = pos + 'px';

}

function west(mouseDown)	{
var dome =document.getElementById('dome');
pos=dome.style.left;
pos=parseInt(pos.substring(0, pos.indexOf('px')));
if(mouseDown)	{
pos+=scrollSpeed*2;
} else	{
pos+=scrollSpeed;
}
dome.style.left = pos + 'px';

}

function east(mouseDown)	{
var dome =document.getElementById('dome');
pos=dome.style.left;
pos=parseInt(pos.substring(0, pos.indexOf('px')));
if(mouseDown)	{
pos-=scrollSpeed*2;
} else	{
pos-=scrollSpeed;
}
dome.style.left = pos + 'px';

}

function getDimensions(type)	{
if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    x = window.innerWidth;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    x = document.documentElement.clientWidth;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    x = document.body.clientWidth;
   
  }
   y=document.getElementById('dome').style.width;
   y=y.substring(0,y.indexOf("px"));
//alert(document.getElementById('dome').style.width );
leftPos= ((x-y)/2);
if(type=='node')	{
leftPos=390;
//alert("ok");
}
//alert(x + " - " + y + " = " +leftPos);
document.getElementById('dome').style.position = "absolute";
if(type=='node')	{
document.getElementById('dome').style.top = 30 + "px";
document.getElementById('dome').style.left = leftPos+ "px";
} else	{
document.getElementById('dome').style.top = 0 + "px";
document.getElementById('dome').style.left = leftPos+ "px";
//document.getElementById('dome').style.border = "solid 1px #ffffff";
}

if(type=='node')	{
window.onresize = function()	{ getDimensions('node') };
} else	{
window.onresize = getDimensions;
}
if(pagecheckarray[3]!="cupola_triads.php" && pagecheckarray[3]!="remains.php" && pagecheckarray[3]!="cupola_triads_scroll.php"  && pagecheckarray[3]!="cupola_semantics_new.php5"  )	{
checkScroll();
}
}
/*
function hideLabels(c)	{
alert(c);

for(x=0;x<6;x++)	{
which=x+'_directive';
who=(x+1)+'_directive';

if(document.getElementById(which))	{
if(x+1!=(c) )	{
document.getElementById(which).style.display='none';
} else	{
if(document.getElementById(who))	{
document.getElementById(who).style.display='block';
}
}
}
}
}
*/

function hideLabels(c)	{

which=c+'_directive';
var  who=(c+1)+'_directive';
//alert("who: " + who);
if(document.getElementById(who))	{
document.getElementById(who).style.display='block';
}


}

//begin ajax management of dome


function ajaxManager()

	{
	
	var args = ajaxManager.arguments;
	var x = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP"): new XMLHttpRequest();
	switch (args[0])
		{

		case "look_up":
			if (document.getElementById)
				{
				//document.getElementById("contentLYR").style.left = 2000+px;	
				//alert("lookup");
				}
			if (x)
				{
				x.onreadystatechange = function()
					{
						if (x.readyState <4)
						{
						//
					//alert("waiting...");
						}
				
					if (x.readyState == 4 )
					//&& x.status == 200 removed for Ie problem temp.
						{

						t=x.responseText;
					//alert(t);
						var artist=t.substring(t.indexOf("=")+1, t.indexOf("&&"));
						
}

						
			
						}
					
				x.open("GET", args[1], true);
				x.send(null);
				}
				
			break;
			}
			}
	
function checkScroll()	{
	var dome=document.getElementById('dome');
	var nav=document.getElementById('nav');
	if(window.innerHeight)	{
	windowHeight=window.innerHeight;
	} else	{
	windowHeight=document.documentElement.clientHeight;
	}
	divHeight=dome.offsetHeight;
	pagecheck=window.location.href.toString();
	pagecheckarray=pagecheck.split("/");
	if(pagecheckarray[3]=="?q=node")	{
	divHeight+=175;
	} else	{
		divHeight+=200;
	}
//alert(divHeight + "," + windowHeight + "," + document.documentElement.clientHeight);
	//alert("x:"+windowHeight + "," + divHeight);
if(divHeight>windowHeight)	{
nav.style.display='block';

} else	{
nav.style.display='none';
}
//window.onresize=checkScroll;	
	
	
	}
	
	
	
	 function navigate(params)	{
		
		args=navigate.arguments[0].split(',');
	
	 if(!document.getElementById('navmode'))	{
var nav = document.createElement('div');
nav.setAttribute('style', 'position: relative;cursor:pointer;top: -38px;left:-158px;z-index:999;width:133px;font-size: 10px;color:#614e2c;height:30px; padding:5px;padding-left:20px;border: solid 1px #151109;background: #000000');
nav.setAttribute('id','navmode');

if(navigator.userAgent.indexOf('MSIE')!=-1)	{
styles='position: relative;cursor:pointer;top: -38px;left:-158px;z-index:999;width:133px;font-size: 10px;color:#614e2c;height:30px; padding:5px;padding-left:20px;border: solid 1px #151109;background: #000000';
nav.style.setAttribute('cssText',styles);
}




document.getElementById('triadics').appendChild(nav);
traversal=new Array("triadic","radial","orbital");
var navmode=document.getElementById('navmode');
navmode.innerHTML='<div style="margin-bottom:4px;color:#614e2c">TRAVERSE DOME</div>';
for(t=0;t<3;t++)	{
if(traversal[t]==args[4])	{
	navmode.innerHTML+="<span   onclick=\"ajaxManager2('triadic_navigation', " + args[0] + "," + args[1] + "," + args[2] + "," + args[3] + ",'" + traversal[t] + "')\" style=\"text-decoration: underline\">"+traversal[t]+"</span>";

} else	{
		navmode.innerHTML+="<span   onclick=\"ajaxManager2('triadic_navigation', " + args[0] + "," + args[1] + "," + args[2] + "," + args[3] + ",'" + traversal[t] + "')\">"+traversal[t]+"</span>";
}
if(t!=2)	{
navmode.innerHTML+=" | ";	
}

}
} else	{
var navmode=document.getElementById('navmode');
var triadica=document.getElementById('triadics');
triadica.removeChild(navmode);
}
 
 }

function author(previous_url,next_url,pattern_url)	{
args=author.arguments;
if(!document.getElementById('authmode'))	{
/*
var navauth = document.createElement('div');
navauth.setAttribute('style', 'position: relative;cursor:pointer;top: 15px;z-index:999;width:175px;font-size: 10px;padding:5px;padding-left:17px;color:#614e2c;left:0px;height:30px; border: solid 1px #151109;background: #000000');
navauth.setAttribute('id','authmode');
document.getElementById('lens').appendChild(navauth);
*/

var navauth = jQuery('<div>hi<\/div>').attr("id","authmode").css({ 'position': 'relative','cursor':'pointer','top': '15px','z-index':'999','width':'185px','font-size': '10px','padding':'5px','padding-left':'17px','color':'#614e2c','left':'0px','height':'30px', 'border': 'solid 1px #151109','background': '#000000'});
navauth.appendTo("#lens");


traversal=new Array("previous","next","dance","pattern");
var authmode=document.getElementById('authmode');
authmode.innerHTML='<div style="margin-bottom:4px">TRAVERSE AUTHOR</div>';
for(t=0;t<traversal.length;t++)	{
	color="#614e2c";
	if(args[t]=='?q=node/')	{
	color='#333333';
	args[t]='#;return false';	
	}
	
	if(t>2)	{
	authmode.innerHTML+= "<div style='display: inline; cursor: pointer' onclick=\"window.open('"+args[t]+"','', 'scrollbars=no,status=no,location=no,width='+screen.width+',height='+screen.height +',resizable=yes')\" onmouseover=\"this.style.textDecoration='underline'\" onmouseout=\"this.style.textDecoration='none'\">"+traversal[t]+"</div>"
	} else	{
	
authmode.innerHTML+="<span style=\"cursor:pointer\"><a style=\"font-weight:normal;color:" + color + "\" href=" + args[t] + ">" + traversal[t]+"</a></span>";
}
if(t!=(traversal.length-1)) {
	authmode.innerHTML+=" | ";
}

}
} else	{
document.getElementById('lens').removeChild(authmode);
}
 }
 
 
 
 
 
 
 
  function optical_ore(params)	{
		
		args=optical_ore.arguments;
	
	 if(!document.getElementById('optics'))	{
optical = document.createElement('div');
optical.setAttribute('style', 'position: absolute;top: 45px;z-index:999;font-size: 10px;width:368px;color:#614e2c;left:14px;height:200px; padding:20px;border: solid 1px #151109;background: #000000');
optical.setAttribute('id','optics');

document.getElementById('or').appendChild(optical);
traversal=new Array("source","responses","excavate");
optical=document.getElementById('optics');
optical.innerHTML='<div style="margin-bottom:4px">OPTICAL RELATIONS</div>';
for(t=0;t<3;t++)	{
if(traversal[t]=="source")	{
	optical.innerHTML+="<span id=\"source\" onclick=\"ajaxManager2('optics_source',args[0]);this.style.textDecoration='underline';document.getElementById('responses').style.textDecoration='none';document.getElementById('excavate').style.textDecoration='none'\" onmouseover=\"this.style.cursor='pointer'\">" +traversal[t]+  "</span>";
	}
	
	if(traversal[t]=="responses")	{
	optical.innerHTML+="<span id=\"responses\" onclick=\"ajaxManager2('optics_responses',args[0]);this.style.textDecoration='underline';document.getElementById('source').style.textDecoration='none';document.getElementById('excavate').style.textDecoration='none';\" onmouseover=\"this.style.cursor='pointer'\">" +traversal[t]+  "</span>";
	}
	
	if(traversal[t]=="excavate"){
	optical.innerHTML+="<span id=\"excavate\" onclick=\"ajaxManager2('optics_source',1);this.style.textDecoration='underline';document.getElementById('responses').style.textDecoration='none';document.getElementById('source').style.textDecoration='none'\" onmouseover=\"this.style.cursor='pointer'\">" +traversal[t]+  "</span>";
	}


if(t!=2)	{
optical.innerHTML+=" | ";	
}

}


result = document.createElement('div');
result.setAttribute('id','status');
result.setAttribute('style','margin-top: 15px');
document.getElementById('optics').appendChild(result);


} else	{
document.getElementById('or').removeChild(optical);
}
 
 }
 
 
 
  
 function lens_data_off()	{
 var center=document.getElementById('dome');
 var data=document.getElementById('excerpt');
 center.removeChild(data);
 
 }
 
 
 
 
 
 


