﻿function openDownloadViewer (theFile, theTitle, theID)
{
	downloadWin=window.open('http://www.stertiluk.com/stertilstokvis/downloadviewer.asp?file='+theFile+'&downloadtitle='+theTitle+'&id='+theID,'downloadWindow','width=750,height=600,location=no,toolbars=no,scrollbars=yes,status=yes');
}

function openDownloadViewerDWG (theFile, theTitle, theID)
{
	downloadWin=window.open('http://www.stertiluk.com/stertilstokvis/downloadviewerdwg.asp?file='+theFile+'&downloadtitle='+theTitle+'&id='+theID,'downloadWindow','width=750,height=600,location=no,toolbars=no,scrollbars=yes,status=yes');
}

function openLargeReference (theID)
{
	largeImageWin=window.open('http://www.stertiluk.com/stertilstokvis/referencelarge.asp?id='+theID,'referenceImageWindow','width=790,height=620,location=no,toolbars=no,scrollbars=yes,status=yes');
	largeImageWin.focus();
}

function openVideoViewer (theFile, theTitle)
{
	videoWin=window.open('http://www.stertiluk.com/stertilstokvis/videoviewer.asp?file='+theFile+'&title='+theTitle,'videoWindow','width=500,height=500,location=no,toolbars=no,scrollbars=yes,status=yes');
	videoWin.focus();
}

function checkEnquiryEmail(myForm) {
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(myForm.enquiryemail.value))
{
	return (true);
}
	alert("Invalid E-mail Address! Please re-enter");
	myForm.enquiryemail.select();
	return (false);
}

function addMoreSparesRows()
{
	rowNumber = document.sparesform.nsf.value;
	rowNumber = rowNumber+1;
	document.sparesform.nsf.value = rowNumber;
	
	newSparesRowCode = "";
	newSparesRowCode = newSparesRowCode + "<table width=\"310\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
	newSparesRowCode = newSparesRowCode + "<tr height=\"23\">";
	newSparesRowCode = newSparesRowCode + "<td width=\"70\" height=\"23\"><input class=\"pagefields\" type=\"text\" name=\"spares_partno"+ rowNumber + "\" value=\"\" size=\"8\" tabindex=\"1\" /></td>";
	newSparesRowCode = newSparesRowCode + "<td width=\"160\" height=\"23\"><input class=\"pagefields\" type=\"text\" name=\"spares_description"+ rowNumber + "\" value=\"\" size=\"23\" tabindex=\"1\" /></td>";
	newSparesRowCode = newSparesRowCode + "<td height=\"23\"><input class=\"pagefields\" type=\"text\" name=\"spares_qty"+ rowNumber + "\" value=\"\" size=\"8\" tabindex=\"1\" /></td>";
	newSparesRowCode = newSparesRowCode + "</tr>";
	newSparesRowCode = newSparesRowCode + "</table>";
	document.getElementById('repeatsparestd').innerHTML = document.getElementById('repeatsparestd').innerHTML + newSparesRowCode;
	//document.getElementById('repeatsparestd').innerHTML = "testing";
}

function RefreshImage(valImageId) {
	var objImage = document.images[valImageId];
	if (objImage == undefined) {
		return;
	}
	var now = new Date();
	objImage.src = objImage.src.split('?')[0] + '?x=' + now.toUTCString();
}


function popup(url, width, height)
{
	newwindow=window.open(url,'name','height='+height+',width='+width+',scrollbars=yes,resizable=yes');
	if (window.focus) {newwindow.focus()}
}