var sURL = "http://www.trainpipe.co.uk/";
var imageWindow = null;
function loadImage(folderName, imgName, width, height){
	var left;
	var top;
	left = (screen.width - width) / 2;
	top = (screen.height - height) / 2;
	var args = "width=" + width + ",height=" + height + ",left=" + left + ",top=" + top;
	imageWindow = window.open("", "LaunchImage", args);
	url = sURL + "/assets/image/" + folderName + "/" + imgName + ".jpg";
	imageWindow.document.open();
	imageWindow.document.write('<style>body{margin:0px;padding:0px}</style>');
	imageWindow.document.write('<img src="' + url + '" />');
	imageWindow.document.close();

}

var selectedImage = null;
var selectedRow = null;

function fadeImageIn(item){
	fadeImageOut(item);
	selectedImage = document.getElementById("image" + item);
	selectedRow = document.getElementById("row" + item);
	selectedImage.style.filter = "alpha(opacity=100)";
	selectedImage.style.borderColor = "#333333";
	selectedRow.className = "rowhover";
}

function fadeImageOut(item){
	if(selectedImage != null){
		selectedImage.style.filter = "alpha(opacity=90)";
		selectedImage.style.borderColor = "#999999";
	}
	if(selectedRow != null){
		selectedRow.className = "rownormal";
	}
}

function launchEmail(){
	window.open("mailto:contact@thejackdaws.co.uk?subject=Website Query");
}

function goBack(){
	history.go(-1);
}

var movieWin = null;
function launchPage(page, width, height){

	if(movieWin!=null){
		movieWin.close();
	}
	var left;
	var top;
	left = (screen.width - width) / 2;
	top = (screen.height - height) / 2;
	var args = "width=" + width + ",height=" + height + ",left=" + left + ",top=" + top;
	
	movieWin = window.open(sURL + "assets/videos/" + page, "Movie", args);
	return false;
}
var movieWin = null;
function launchMovie(sFilename){
	if(movieWin!=null){
		movieWin.close();
	}
	var args = "width=665,height=526";
	invoiceWin = window.open("http://www.trainpipe.com/viewvideo.php?vid=" + sFilename, "Movie", args);
}