//--- frame destroya ---------------------------------------

function noFrames() {
	if (top.location != self.location) {
		top.location.href = self.location.href;
	}
}

//--- Image Mouseovers -------------------------------------

var outArr = new Array();
var overArr = new Array();
var path = '/img/global/';
var ids = new Array('home', 'browse', 'buying', 'busservices','about', 'search', 'contact', 'logo', 'find', 'login', 'submit', 'next', 'previous', 'artistinfo', 'info', 'send', 'add', 'view', 'artworkinfo', 'glossary', 'resources', 'press', 'brows_art', 'contact_mail', 'buying_guide', 'private_view', 'buy_sell_guide','moreby' );

// preload
if (document.images) {
	for (i=0; i < ids.length; i++) {
		overArr[i] = new Image;
		overArr[i].src = path + ids[i] + "_on.gif";
		outArr[i] = new Image;
		outArr[i].src = path + ids[i] + "_off.gif"
	}
}

change = false;

function over(obj, n) {
	if (obj.src.indexOf("_on.gif") == -1) {
		change = true;
		obj.src = overArr[n].src;
	}
}

function out(obj, n) {
	if (change == true) {
		obj.src = outArr[n].src;
		change = false;
	}
}

function setActive() {
	for (x = 0; x < 20; x++) {
		if (location.pathname.indexOf(ids[x]) == 1)
			document.images[ids[x]].src = overArr[x].src;
		//if (location.pathname == "/")
		//	document.images['home'].src = overArr[0].src;
	}
}

//--- Popup Windows -------------------------------------------

function bioPopup(url, name, w, h) {  // status bar, scroll bars, not resizable
	var winW = (screen.width - w) / 2;
	var winH = (screen.height - h) / 2;
	var win1 = window.open(url,name,'width='+w+',height='+h+',top='+winH+',left='+winW+',toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=no');
	win1.focus();
}

//--- DIV show/hide -------------------------------------------

function switcher(div) {
	var obj = document.getElementById(div);
	obj.style.display = (obj.style.display == "none") ? "block" : "none";
}

function switcher2(div) {
	var obj = document.getElementById('container');
	obj.style.display = (obj.style.display == "none") ? "block" : "none";

	var obj = document.getElementById('footer');
	obj.style.display = (obj.style.display == "none") ? "block" : "none";

	var obj = document.getElementById(div);
	obj.style.display = (obj.style.display == "none") ? "block" : "none";

}

//--- Start Up ------------------------------------------------

function startUp() {
	noFrames();
}

//-------------------------------------------------------------

window.onload = startUp;