function setLinks(){
	var links = document.getElementsByTagName('a');
	for (var i=0;i<links.length;i++){
	 	if(links[i].className == 'external'){
		links[i].onclick = function(){window.open(this.href,'','');return false}
		}else if(links[i].className == 'contact'){
	    links[i].onmouseover = function(){setContact(this.id);return false} 
		links[i].onfocus = function(){setContact(this.id);return false}
		}else if(links[i].id == 'print'){
		links[i].onclick = function(){printer_friendly(this.href);return false}
		}else if(links[i].className == 'archived_years'){
		links[i].onclick = function(){block(this.title);return false}
		}
	}
} 
function setContact(adr) {
var obj = document.getElementById(adr);
	if (obj) {
		adr = (adr == 'w') ? 'webmaster' : 'info';
		var dmn = 'sevencolors.org';
		obj.href = 'mailto:' + adr + '@' + dmn;
	}
	return true;
}
 function randomQuotes()
{
var q = new Array('\<strong\>&#x201C;\<\/strong\>Balance with your thinking,\<br \/>harmonize with your doing.\<strong\>&#x201D;\<\/strong\>\<br \/>\<b\>Suhu Rahardja\<\/b\>','\<strong\>&#x201C;\<\/strong\>Genius has a limit,\<br \/>stupidity is limitless.\<strong\>&#x201D;\<\/strong\>\<br \/>\<b\>On a wall\<\/b\>','\<strong\>&#x201C;\<\/strong\>Fear breeds hate,\<br \/>respect brings peace.\<strong\>&#x201D;\<\/strong\>\<br \/>\<b\>Toughts\<\/b\>','\<strong\>&#x201C;\<\/strong\>Shadows feed on light.\<strong\>&#x201D;\<\/strong\>\<br \/>\<b\>Toughts\<\/b\>','\<strong\>&#x201C;\<\/strong\>Take advantage of what is by\<br \/>making use of what is not.\<strong\>&#x201D;\<\/strong\>\<br \/>\<b\>Tao te Ching\<\/b\>','\<strong\>&#x201C;\<\/strong\>You must be the change\<br \/>you wish to see in the world.\<strong\>&#x201D;\<\/strong\>\<br \/>\<b\>Gandhi\<\/b\>');
var n = parseInt(Math.floor(Math.random()*6));
var rq = document.getElementById('rand_quotes');
if(!rq) return;
var h = screen.height;
var w = screen.width;
if(h==600 && w==800){
rq.className = "s_res";
}
rq.innerHTML = q[n];
}
function tag_search(s){
if(s == 'deli'){
 var d = document.getElementById('d_tag').value;
 document.location = 'http://del.icio.us/tag/' + d.replace(/ +/g,"+");
}else if(s == 'tech'){
 var t = document.getElementById('t_tag').value;
 document.location = 'http://technorati.com/tags/' + t.replace(/ +/g,"+");
  }
}

function search_tags(){
var obj = document.getElementsByTagName('form');
if(!obj) return;
for(f=0;f<obj.length;f++){
if(obj[f].id == 'deli' || obj[f].id == 'tech'){
obj[f].onsubmit = function(){tag_search(this.id);return false};
	}
  }
}
function make_search(){
	var div = document.createElement('div');
	div.setAttribute('id','tags_search');
	var pos = document.getElementById('categories');
	if(!pos) return;
	var par = pos.parentNode;
	par.insertBefore(div,pos);
var div_d = "<div id='delicious_search'><p class='headers'>Delicious</p><a href='http://del.icio.us'>del.icio.us</a> /&nbsp;<a href='http://del.icio.us/tag'>tag</a> / <form id='deli'><input id='d_tag' type='text' size='12' /><input type='submit' value='search' /></form></div>";
var div_t = "<div id='technorati_search'><p class='headers'>Technorati</p><a href='http://technorati.com'>technorati</a> /&nbsp;<a href='http://technorati.com/tags'>tags</a> / <form id='tech'><input id='t_tag' type='text' size='12' /> <input type='submit' value='search' /></form></div>";
div.innerHTML = div_d + div_t;
search_tags();
}
function printer_friendly(uri){
var css = document.getElementsByTagName('link');
	for(i=0;i<css.length;i++){
	if (css[i].type == "text/css"){
	css[i].href = uri;
		}
	}
}
function close_arch(){
var d = document.getElementsByTagName("dl");
for(var i=0;i<d.length;i++){
if(d[i].className == 'years_list')
d[i].style.display = 'none'; 
 }
}
var supported = (document.all || (document.getElementById && !window.opera));

function block(i){
	if(!supported)return;	//added by A.Bianchini
	var x = document.getElementById(i);
	with(x.style)
	{
	display == 'none' ? display = 'block' : display = 'none';
	}
	}
function go_home(){
var h = document.getElementById('header');
if(!h) return;
h.onmouseover = function(){this.style.cursor = "pointer";return false};
h.onclick = function(){window.location = "http://sevencolors.org";return false};
}
function go_studies(){
var s = document.getElementById('studies_page_header');
if(!s) return;
s.onmouseover = function(){this.style.cursor = "pointer";return false};
s.onclick = function(){window.location = "http://sevencolors.org/index.htm#studies_div";return false};
}
window.onload = function(){setLinks();randomQuotes();close_arch();go_home();go_studies()};
