
function noSpam(user,domain) {
	locationstring = "mailto:" + user + "@" + domain;
	window.location = locationstring;
}


function newWindow(mypage,myname,w,h,features) {
  var winl = (screen.width-w)/2;
  var wint = (screen.height-h)/2;
  if (winl < 0) winl = 0;
  if (wint < 0) wint = 0;
  var settings = 'height=' + h + ',';
  settings += 'width=' + w + ',';
  settings += 'top=' + wint + ',';
  settings += 'left=' + winl + ',';
  settings += features;
  win = window.open(mypage,myname,settings);
  win.window.focus();
}


// photo switcher

//n = 0;
found = false;

function photoInit(){
	newList = new Array();
	for(var i=0;i<photoList.length;i++){
		if(photoList[i].title == "default"){
			n = i;
			found = true;
		}
		if(!found){
			
		}
		//
		newList[i] = photoList[i];
	}
	//
	if(!defaultFixed){
		n = Math.round(Math.random()*(newList.length-1));
		found = true;
	}
}

function switchPhoto(fixed){
	defaultFixed = fixed;
	if(!found || newList.length == 0){
		photoInit();
	} else {
		n = Math.round(Math.random()*(newList.length-1));
	}
	gallery = document.getElementById('photoGallery');
	//
	w = 420;
	h = Math.round(newList[n].h*420/newList[n].w);
	//
	divH = Math.ceil((h + 18)/25)*25;
	//
	c = "<center><a href='javascript:switchPhoto()'><img src='/site/images/" + newList[n].albumID + "/" + newList[n].filename + "r" + newList[n].ext + "' style='width:" + w + "px;height:" + h + "px;border:0' /><\/a>";
	c += "<div class='photoCaption' style='height:" + (divH - h) + "px'><span class='black' style='padding-top:4px;padding-right:10px;float:right'><a href='javascript:newWindow(\"/site/images/" + newList[n].albumID + "/"+ newList[n].filename + newList[n].ext +"\",\"popup\",\"" + newList[n].w + "\",\"" + newList[n].h + "\",\"true\")'>[ + ]<\/a><\/span>";
	c += "<span class='blue' style='padding-top:4px;padding-left:10px;float:left'>" + newList[n].body + "<\/span><\/div><\/center>";
	//
	//
	gallery.innerHTML = c;
	//
	gallery.style.height = "" + divH + "px";
	//
	newList.splice(n,1);
}

//

function photoDirect(id){

	id = unescape( id );
	
	for(var i=0;i<photoList.length;i++){
		if(photoList[i].title == id){
			n = i;
			i = photoList.length;
		}
	}
	gallery = document.getElementById('photoGallery');
	//
	w = 420;
	h = Math.round(photoList[n].h*420/photoList[n].w);
	//
	divH = Math.ceil((h + 18)/25)*25;
	//
	c = "<center><a href='javascript:switchPhoto()'><img src='/site/images/" + photoList[n].albumID + "/" + photoList[n].filename + "r" + photoList[n].ext + "' style='width:" + w + "px;height:" + h + "px;border:0' /><\/a>";
	c += "<div class='photoCaption' style='height:" + (divH - h) + "px'><span class='black' style='padding-top:4px;padding-right:10px;float:right'><a href='javascript:newWindow(\"/site/images/" + photoList[n].albumID + "/"+ photoList[n].filename + photoList[n].ext +"\",\"popup\",\"" + photoList[n].w + "\",\"" + photoList[n].h + "\",\"true\")'>[ + ]<\/a><\/span>";
	c += "<span class='blue' style='padding-top:4px;padding-left:10px;float:left'>" + photoList[n].body + "<\/span><\/div><\/center>";
	//
	//
	gallery.innerHTML = c;
	//
	gallery.style.height = "" + divH + "px";
	//
	newList.splice(n,1);
}


function showPhoto(loc){
	gallery = document.getElementById('photoGallery');
	//
	c = "<center><a href='javascript:switchPhoto()'><img src='" + loc + "' name='mainImage' style='border:0px'><\/a>";
	c += "<div class='photoCaption' style='height:" + (divH - h) + "px'>";
	c += "<span class='blue' style='padding-top:4px;padding-left:10px;float:left'>" + photoList[n].body + "<\/span><\/div><\/center>";
	//
	//
	gallery.innerHTML = c;
	//
	h = document.images['mainImage'].height;
	divH = Math.ceil((h + 18)/25)*25;
	//
	gallery.style.height = "" + divH + "px";
	gallery.style.height = "";
}




// Active Images

if (document.images) {            
	newson = new Image();      
	newson.src = "/site/graphics/news_on.gif";
	newsoff = new Image(); 
	newsoff.src = "/site/graphics/news_off.gif";
	//
	showson = new Image();      
	showson.src = "/site/graphics/shows_on.gif";
	showsoff = new Image(); 
	showsoff.src = "/site/graphics/shows_off.gif";
	//
	bandon = new Image();      
	bandon.src = "/site/graphics/band_on.gif";
	bandoff = new Image(); 
	bandoff.src = "/site/graphics/band_off.gif";
	//
	musicon = new Image();      
	musicon.src = "/site/graphics/music_on.gif";
	musicoff = new Image(); 
	musicoff.src = "/site/graphics/music_off.gif";
	//
	merchon = new Image();      
	merchon.src = "/site/graphics/merch_on.gif";
	merchoff = new Image(); 
	merchoff.src = "/site/graphics/merch_off.gif";
	//
	presson = new Image();      
	presson.src = "/site/graphics/press_on.gif";
	pressoff = new Image(); 
	pressoff.src = "/site/graphics/press_off.gif";
	//
	contacton = new Image();      
	contacton.src = "/site/graphics/contact_on.gif";
	contactoff = new Image(); 
	contactoff.src = "/site/graphics/contact_off.gif";
}


// Function to 'activate' images.

function imgOn(imgName) {
	if (document.images) {
		document[imgName].src = eval(imgName + "on.src");
	}
}

// Function to 'deactivate' images.

function imgOff(imgName) {
	if (document.images) {
		document[imgName].src = eval(imgName + "off.src");
	}
}



// random images

function randomImage(collection) {

	// collection[i][0] = image src
	// collection[i][1] = href

	this.collection = collection;
	this.unitCount = this.collection.length - 1;
	this.randomNumber = randomize(0,this.unitCount);
	this.src = this.collection[this.randomNumber][0];
	this.link = this.collection[this.randomNumber][1];

	function randomize(x, y) {
		var range = y - x + 1;
		return Math.floor(Math.random() * range) + x;
	}

	// var listBanners = new randomImage(listBanners);
	// random image src = listBanners.src
	// random link href = listBanners.linl

}


