

// global variables 

var is_msie = (navigator.appName == "Microsoft Internet Explorer") ? true : false;



var common_page_title = "Joel Smoller, Lamberto Cesari Chair";

function make_page_title(page_title,subpage_title) {
page_title = (subpage_title) ? subpage_title : ((page_title == 'Home') ? null : page_title);
document.title = (page_title) ? common_page_title+' :: '+page_title : common_page_title;
}



function go_page(page_name) {
top.window.location.href=page_name;
}

function go_page_replace(page_name) {
top.window.location.replace(page_name);
}


function hide_div(d) {
	document.getElementById(d).style.display = "none";
}

function show_div(d) {
	document.getElementById(d).style.display = "block";
}


function show_hide_div(id,zindex) {
var el = document.getElementById(id);
	if (el.style.display != "none") {
	el.style.display = "none";
		if (zindex) {
		el.style.zIndex = "0";
		}
	}
	else {
	el.style.display = "";
		if (zindex) {
		el.style.zIndex = zindex;
		}
	}
}


function preload_img(img_path) {
var img_file = new Image();
img_file.src = img_path;
}


preload_img('img/tooltip/top-shade.png');
	
preload_img('img/tooltip/body-shade.png');
	
preload_img('img/tooltip/bottom-shade.png');


var fade_timer;
var div_fadeamt = 0;
var fade_div_name;

function fade_div(div_name,direction,max_opacity) {
	max_opacity = (!max_opacity) ? 10 : max_opacity;
	if (!is_msie) {
	fade_div_name = div_name;
var divobj = document.all ? document.all[div_name] : document.getElementById ? document.getElementById(div_name) : "";
	//clearTimeout(fade_timer);
	if (direction == 'in') {
		divobj.style.display = "";
		//show_hide_div(fade_div_name,'1000');
		if(div_fadeamt < max_opacity) {
		div_fadeamt++;
		divobj.style.filter = "alpha(opacity="+div_fadeamt*10+")";
		divobj.style.opacity = div_fadeamt/10;
		fade_timer = setTimeout("fade_div('"+fade_div_name+"','in',"+max_opacity+")",15);
		} else {
		clearTimeout(fade_timer);
		}
	} else if (direction == 'out') {
		if(div_fadeamt > 0) {
		div_fadeamt--;
		divobj.style.filter = "alpha(opacity="+div_fadeamt*10+")";
		divobj.style.opacity = div_fadeamt/10;
		fade_timer = setTimeout("fade_div('"+fade_div_name+"','out')",20);
		} else {
		clearTimeout(fade_timer);
		//show_hide_div(fade_div_name,'0');
		divobj.style.display = "none";
		div_fadeamt = 0;
		}
	}
	} else {
		show_hide_div(div_name,'100');
	}
}



function make_tooltip(pub_page,pub_num) {
	if (pub_page == 1) {
		for(i=0;i<pubs_principal.length;i++) {
			if (pub_num == pubs_principal[i][0]) {
			ddrivetip(pubs_principal[i][2]);
			}
		}
	} else if (pub_page == 2) {
		for(i=0;i<pubs_select.length;i++) {
			if (pub_num == pubs_select[i][0]) {
			ddrivetip(pubs_select[i][2]);
			}
		}
	} else if (pub_page == 3) {
		for(i=0;i<pubs_other.length;i++) {
			if (pub_num == pubs_other[i][0]) {
			ddrivetip(pubs_other[i][2]);
			}
		}
	}
}
