function positionViewer() {
var windowWidth = document.body.clientWidth;
var windowHeight = document.body.clientHeight;
var scrollHeight = document.body.scrollTop;
document.all.viewer.style.height=(windowHeight);
document.all.viewer.style.width=(windowWidth);
document.all.viewer.style.top=(scrollHeight);
document.all.viewerWindow.style.height=(windowHeight - 80);
document.all.viewerWindow.style.width=(windowWidth - 80);
document.all.viewerWindow.style.top=(scrollHeight + 21);
document.all.viewerControl.style.top=(scrollHeight + windowHeight - 50);
document.all.viewerControl.style.width=(windowWidth - 80);
}

function showViewer ()
{
positionViewer();
document.all.viewer.style.display='block'; 
document.all.viewerWindow.style.display='block'; 
document.all.viewerControl.style.display='block'; 
}

function hideViewer ()
{
document.all.viewer.style.display='none';
document.all.viewerWindow.style.display='none'; 
document.all.viewerControl.style.display='none';
}

function clearViewer()
{
parent.text.location.href=""; 
parent.picture.location.href="";
}

function portfolio_window (url)
{

if (document.all && navigator.appVersion.indexOf('Win')  != -1) {
if (window.opera) {oldWay(url)}
else
{
pictureurl = 'portfolio/' + url + '1.html';
texturl = 'portfolio/' + url + '.html';
parent.text.location.href=texturl;
parent.picture.location.href=pictureurl;
positionViewer();
showViewer();}
}
else {oldWay(url)}
}


function oldWay(url){
var windowWidth = screen.width;
var windowHeight = screen.height;

pictureUrl = 'portfolio/' + url + '1.html';
textUrl = 'portfolio/' + url + '.html';

if (windowWidth < 640) {alert('Your screen or browser window may not be big enough to view this data, please adjust and try again.')}

var viewer = window.open("","viewer",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=' + (windowWidth * 0.86) + ',height=' + (windowHeight * 0.76) + ',left=' + (windowWidth * 0.07) + ',top=' + (windowHeight * 0.07) + ''); 

viewer.document.write('<html>');
viewer.document.write('<head><title>Those Meddling Kids - Portfolio Viewer</title></head>');
viewer.document.write('<frameset cols="68%,*" framespacing="0" frameborder="0" bordercolor="Black">');
viewer.document.write('<frame name="picture" src=' + pictureUrl + ' marginwidth="0" marginheight="0" scrolling="auto">');
viewer.document.write('<frame name="text" src=' + textUrl + ' marginwidth="0" marginheight="0" scrolling="auto">');
viewer.document.write('</frameset>');
viewer.document.write('</html>');
viewer.document.close();

viewer.window.focus();
}
