<!-- 

// Popup Window Javascript Utilities

//FUNC: openWindow()
//DESC: This is a function to simplify the creation of making windows. 
//		You just "feed" it the values you'd like and the script takes care of the hard part. 

//You would call this function by using a pseudo url like: 
//<a href="javascript:openWindow( 'http://scriptasylum.com', 200, 200 ,0 ,0 ,0 ,0 ,0 ,1 ,10 ,10 )">Link text here</a> 
//Usage: openWindow( url , w , h , tb , stb , L , mb , sb , rs , x , y ) 

//url - The URL of the page to open. Example: "http://scriptasylum.com". 
//w - The width of the window in pixels. 
//h - The height of the window in pixels (doesn't include menubars). 
//tb - Toolbar visible? 1 = yes, 0 = no. 
//stb - Status bar visible? 1 = yes, 0 = no. 
//L - Linkbar visible? 1 = yes, 0 = no. 
//mb - Menubar visible? 1 = yes, 0 = no. 
//sb - Scrollbars visible? 1 = yes, 0 = no. 
//rs - Resizable window? 1 = yes, 0 = no. 
//x - The horizontal position of the window from the left of the screen. 
//y - The vertical position of the window from the top of the screen. 

function openWindow(url,w,h,tb,stb,l,mb,sb,rs,x,y){
	//A LITTLE CROSS-BROWSER CODE FOR WINDOW POSITIONING
	var t=(document.layers)? ',screenX='+x+',screenY='+y: ',left='+x+',top='+y;
	tb=(tb)?'yes':'no'; stb=(stb)?'yes':'no'; l=(l)?'yes':'no'; mb=(mb)?'yes':'no'; sb=(sb)?'yes':'no'; rs=(rs)?'yes':'no';
	var x=window.open(url, 'newWin'+new Date().getTime(), 'scrollbars='+sb+',width='+w+',height='+h+',toolbar='+tb+',status='+stb+',menubar='+mb+',links='+l+',resizable='+rs+t);
	x.focus();
	
	return x;
}

// Initialise pop-up WINDOW variables
var FabricViewer;
var PhotoViewer;
var MediaPlayer;

//FUNC: openPhotoViewer()
//DESC: Opens a popup window and loads in a HTML page containing image of fabric/textile. 
//Usage: openPhotoViewer( URL, htmlpage, width, height, scrollbars, xpos, ypos ) 

//URL - The base (absolute) URL of website directory. Example: 'http://www.ucl.ac.uk/mediares' or '' (empty) etc. 
//htmlpage - Relative path name for HTML page. Example: 'media/smildemo.htm'. 
//width - Width of window in pixels. 
//height - Height of window in pixels.
//scrollbars - Yes/No
//xpos - X screen position. 
//ypos - Y screen position. 
function openPhotoViewer(URL, htmlpage, width, height, scrollbars, xpos, ypos)
{
	if (PhotoViewer != null && !PhotoViewer.closed)
	{
		// Close window before displaying any new content
		PhotoViewer.close();
	}
	
	if (URL != "")
	{
		// Absolute or relative addressing possible
		htmlpage = URL + "/" + htmlpage;
	}
	
	PhotoViewer = openWindow(htmlpage, width, height, 0 ,0 ,0 ,0 ,scrollbars ,0 ,xpos ,ypos );
}


function openMediaPlayer(URL, htmlpage, width, height, scrollbars, xpos, ypos)
{
	if (MediaPlayer != null && !MediaPlayer.closed)
	{
		// Close window before displaying any new content
		MediaPlayer.close();
	}
	
	if (URL != "")
	{
		// Absolute or relative addressing possible
		htmlpage = URL + "/" + htmlpage;
	}
	
	MediaPlayer = openWindow(htmlpage, width, height, 0 ,0 ,0 ,0 ,scrollbars ,0 ,xpos ,ypos );
}


//FUNC: openFabricViewer()
//DESC: Opens a popup window and loads in a HTML page containing image of fabric/textile. 
//Usage: openFabricViewer( URL, htmlpage, width, height, scrollbars, xpos, ypos ) 

//URL - The base (absolute) URL of website directory. Example: 'http://www.ucl.ac.uk/mediares' or '' (empty) etc. 
//htmlpage - Relative path name for HTML page. Example: 'media/smildemo.htm'. 
//width - Width of window in pixels. 
//height - Height of window in pixels.
//scrollbars - Yes/No
//xpos - X screen position. 
//ypos - Y screen position. 
function openFabricViewer(URL, htmlpage, width, height, scrollbars, xpos, ypos)
{
	if (FabricViewer != null && !FabricViewer.closed)
	{
		// Close window before displaying any new content
		FabricViewer.close();
	}
	
	if (URL != "")
	{
		// Absolute or relative addressing possible
		htmlpage = URL + "/" + htmlpage;
	}
	
	FabricViewer = openWindow(htmlpage, width, height, 0 ,0 ,0 ,0 ,scrollbars ,0 ,xpos ,ypos );
}

//FUNC: openFabricViewer()
//DESC: Opens a popup window and loads in a HTML page containing image of fabric/textile. 
//Usage: openFabricViewer( URL, htmlpage, width, height, scrollbars, xpos, ypos ) 

//URL - The base (absolute) URL of website directory. Example: 'http://www.ucl.ac.uk/mediares' or '' (empty) etc. 
//htmlpage - Relative path name for HTML page. Example: 'media/smildemo.htm'. 
//width - Width of window in pixels. 
//height - Height of window in pixels.
//scrollbars - Yes/No
//xpos - X screen position. 
//ypos - Y screen position. 
function embedImage(src, width, height, title)
{
	document.writeln('<img src="' + src + '" width="' + width + '" height="' + height + '" + title="' + title + '" alt="' + title + '" />');
}

// -->
