/*
File Name:
   magazine.js
File Description:
   Northwestern Magazine Javascript Functions
File Author:
   <j-morrow@northwestern.edu>
Last Updated:
   3:00pm, November 29, 2006
*/

 
//  Usage: <a onclick="return openwin('URL');" href="URL">Link</a>
function openwin(url) {
	window.open(url,'','width=600,height=400,scrollbars=yes,resizable=yes').focus();
	return false;
}
function openSnapshotWin(url) {
	window.open(url,'','width=600,height=700,scrollbars=yes,resizable=yes').focus();
	return false;
}
function openPhotoWin(url,width,height) {
	if (width>800) {width=800;}
	if (height>800) {height=800;}
	window.open(url,'','width='+width+',height='+height+',scrollbars=no,resizable=yes').focus();
	return false;
}

/*
writeConsole('Hello from JavaScript!');
function writeConsole(content) {
 top.consoleRef=window.open('','myconsole',
  'width=350,height=250'
   +',menubar=0'
   +',toolbar=1'
   +',status=0'
   +',scrollbars=1'
   +',resizable=1')
 top.consoleRef.document.writeln(
  '<html><head><title>Console</title></head>'
   +'<body bgcolor=white onLoad="self.focus()">'
   +content
   +'</body></html>'
 )
 top.consoleRef.document.close()
}
*/



function popitup2() {
	var newwindow2=window.open('','name','height=200,width=150');
	newwindow2.document.write('<html lang="en"><hEAD><TITLE>Popup</TITLE>');
	newwindow2.document.write('<LINK REL="stylesheet" HREF="js.css">');
	newwindow2.document.write('</hEAD><BODY><p>This is once again a popup.</p>');
	newwindow2.document.write('<p><a href="javascript:alert(self.location.href)">View location</a>.</p>');
	newwindow2.document.write('<p><a href="javascript:self.close()">Close</a> the popup.</p>');
	newwindow2.document.write('</BODY></hTML>');
	newwindow2.document.close();
}


function photoPopup(imgurl,caption,credit,width,height) {
	if (width>800) {width=800;}
	if (height>750) {height=750;}
	height = height+25;
	
	
	/*var popupbody = '<html><head><base href="http://www.northwestern.edu/magazine/" /><link href="styles/magazine.css" rel="stylesheet" type="text/css" />';
	popupbody += '<title>Magazine Photo</title></head><body class="print">';
	popupbody += '<img src="'+imgurl+'" /><p>'+caption+'</p><cite>'+credit+'</cite></body></html>';*/
	
	
	var lphoto = window.open('window.location','name','width='+width+',height='+height+',scrollbars=no,resizable=yes,menubar=no,toolbar=no');
	
	//lphoto.document.open();
	//lphoto.document.write(popupbody);
	lphoto.document.write('<html>Does this work?</html>');
	lphoto.document.close();
	//return false;
	//lphoto.focus();
	
	//lphoto.document.write('<html><head><base href="http://www.northwestern.edu/magazine/" /><link href="styles/magazine.css" rel="stylesheet" type="text/css" />');
	//lphoto.document.write('<title>Magazine Photo</title></head><body onload="self.focus()" class="print">');
	//lphoto.document.write('<img src="'+imgurl+'" /><p>'+caption+'</p><cite>'+credit+'</cite></body></html>');
	//lphoto.document.close();
	//lphoto.focus();
}

