function IsNumeric(char)
{	
var valid="0123456789";
IsNumber=true;
	if(valid.indexOf(char)==-1)
	{ IsNumber=false; }		
return IsNumber;	
}

function NewView(ifile,icount)
{
//Extract Title and Author
var mod1= "name"+icount;
var extract=document.getElementById(mod1);
var title= (extract.innerHTML);
//Extract Print size from Image Name
var count=0;
var str1=ifile.toLowerCase();
var len1=str1.length;				//--string length
var posx=str1.indexOf('x',0);	//--position of X
do 
	{
	count++;
	if (posx < 1) posx=1; 
	var char=str1.charAt(posx-1);		//--character before X
	IsNumeric(char);						//--is it a number
	finalx=posx;
	posx=str1.indexOf('x',(posx+1));	//--update string pointer
	if (posx==-1) posx=finalx;
	}
while (IsNumber==false && count<len1);
char=str1.charAt(posx+1);			//--start looking character after X
IsNumeric(char);						//--is it a number	
if(IsNumber==false) {width=100; height=600;}   //--set defaults
w=ifile.substr((posx-3),3);			//--extract width and height
h=ifile.substr((posx+1),3);
HorizOffset = Math.floor((screen.availHeight-h) / 2);		//--centralise screen
VertOffset = Math.floor((screen.availWidth-w) / 2);
w=w*1;				//--convert string to number
w=w+60;
if (w<400) {w=400};			//--carry out arithmetic to add margins
w=w.toString();	//--convert number to string
h=h*1;
h=h+120;
h=h.toString();

//Create Window for Large Image
//alert (h+"   "+w)
win = window.open('','name','height='+h+',width='+w+',toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no'); 
win.document.open();	//--open new image document wx by iy
win.document.write("<html><head><title>Leeds Co-operative Photographic Society</title></head>");	//--set up window heading 
win.document.write('<body style="text-align: center; font-family: arial; font-weight: 600; font-size: 16px; color:#111111; background: #778899">');   //--set background colour
win.document.write('<div>');
win.document.write("<p></p>" + title);

//win.document.write('<h3 style="position:relative; margin-top: 0px; text-align: center">' + title);

win.document.write("<p><img src="+ifile+"></img></p>");
win.document.write('<p align="right"><a href="#" onclick="self.close(); return false;"></p>');
win.document.write('</div><div style="position:relative; margin-top: -10px">');
win.document.write('<Form><Input Type="button" Value="Return"  onClick="history.back()">');
win.document.write("</div></body></html>");
win.moveTo(Math.floor(screen.availWidth/2-(w/2)),Math.floor(screen.availHeight/2-(h/2)));	//--move to centre
win.document.focus;
win.document.close();
}

