/* --------------------------------------------------------- *\
|
|  main functions library - main_lib.js
|
|
\* --------------------------------------------------------- */


// -- suppress error messages --
//window.onerror = function(){ return true; }

// -- open popup window --
var myPopUp;
launchWin = function(winUrl, winName, winX, winY, winFeatures, noFocus) {
	myPopUp = window.open(winUrl, winName, 'width='+winX+', height='+winY+', '+winFeatures);
	if(!noFocus && moveTo && screen.width) {
		myPopUp.moveTo((screen.width - winX) * .2, (screen.height - winY) * .5);
	}
	if(!noFocus && focus) {
		setTimeout('myPopUp.focus()', 250);
	}
}

// -- mask email address --
getEmail = function(name, domain) {
	var str = String(name + String.fromCharCode(64) + domain);
	str = "<a href=\"mailto:"+ str +"\" title=\""+ str +"\">"+ str +"</a>";
	document.open();
	document.write(str);
	document.close();
}

// -- the gallery routines --
pictures = [
	"gallery_01.jpg",
	"gallery_02.jpg",
	"gallery_03.jpg",
	"gallery_04.jpg",
	"gallery_05.jpg",
	"gallery_06.jpg",
	"gallery_07.jpg",
	"gallery_08.jpg",
	"gallery_09.jpg",
	"gallery_10.jpg",
	"gallery_11.jpg"
];
gallery = [];
for(var i in pictures) {
	gallery[i] = new Image();
	gallery[i].src = "./img/"+ pictures[i];
}
pic = 0;
gallerySwap = function(arg) {
	pic += (arg < 0) ? -1 : 1;
	if(pic < 0) {
		pic = gallery.length - 1;
	} else if(pic > gallery.length - 1) {
		pic = 0;
	}
	if(document.getElementById) {
		document.getElementById("image").src = gallery[pic].src;
	} else {
		document["image"].src = gallery[pic].src;
	}
}

