// JavaScript Document based on sample from http://www.alistapart.com/articles/switchymclayout
// Used to establish framework for possible future switchable body style

window.onload   = setScreenClass ; 
window.onresize = prwfResize ;  
    
   
/**
  Note that anything under 800x600 is rendered as 800x600 (min size) and could be replaced by ultralow later
*/
function setScreenClass(){  
	var imageWidth ; 
	var imageHeight ; 
	var fmt = document.documentElement.clientWidth;	
	var ht  = document.documentElement.clientHeight;
 	var cls = (fmt<=240)?'low800x600':
	(fmt>240&&fmt<=320)?'low800x600':
	(fmt>320&&fmt<=640)?'low800x600':
	(fmt>640&&fmt<=800)?'low800x600': 
	(fmt>1024&&fmt<=1152)?'med1280x800':
	(fmt>1152&&fmt<=1280)?'med1280x800':
	(fmt>1280&&fmt<=1440)?'wide1440':
	(fmt>1440)?'wide1440':'normal';
	//document.getElementById('count').innerHTML=fmt+'px x '+ht + '-> '+cls; 
	//display in browser  
	document.body.className=cls;     	
	if      (cls == 'normal'     ){ imageWidth=508; imageHeight=350; }
	else if (cls == 'med1280x800' || cls == 'wide1440'){ imageWidth=725; imageHeight=500; }
	else if (cls == 'low800x600') { imageWidth=348; imageHeight=240; }
	else{ imageWidth=145; imageHeight=100;	}
 	document.getElementById('image1').innerHTML=getTag(imageWidth, imageHeight); 
};


function prwfResize(){ 
    var imageWidth ; 
	var imageHeight ; 
	var fmt = document.documentElement.clientWidth;	
	var ht  = document.documentElement.clientHeight;
 	var cls = (fmt<=240)?'low800x600':
	(fmt>240&&fmt<=320)?'low800x600':
	(fmt>320&&fmt<=640)?'low800x600':
	(fmt>640&&fmt<=800)?'low800x600': 
	(fmt>1024&&fmt<=1152)?'med1280x800':
	(fmt>1152&&fmt<=1280)?'med1280x800':
	(fmt>1280&&fmt<=1440)?'wide1440':
	(fmt>1440)?'wide1440':'normal';
	//document.getElementById('count').innerHTML=fmt+'px x '+ht + '-> '+cls; 
	//display in browser  
	document.body.className=cls;    	
	if      (cls == 'normal'     ){ imageWidth=508; imageHeight=350; }
	else if (cls == 'med1280x800' || cls == 'wide1440'){ imageWidth=725; imageHeight=500; }
	else if (cls == 'low800x600') { imageWidth=348; imageHeight=240; }
	else{ imageWidth=145; imageHeight=100;	}
	setImageSize(imageWidth, imageHeight);
}
 
 
 
function showPic (whichpic) {
if (document.getElementById) {
	imgtag =  getObject('placeholder');
	imgtag.src = whichpic.href;
if (whichpic.title) {
    document.getElementById('desc').childNodes[0].nodeValue = whichpic.title;
  } 
  else {
    document.getElementById('desc').childNodes[0].nodeValue = whichpic.childNodes[0].nodeValue;
  }
  return false;
}
else {
  return true;
}
}
 

function getObject( obj ) {
  var strObj
  if ( document.all ) {
    strObj = document.all.item( obj );
  } else if ( document.getElementById ) {
    strObj = document.getElementById( obj );
  }
  return strObj;
}
 
function popupArtsite(){
	var w = document.documentElement.clientWidth;	
	var h  = document.documentElement.clientHeight;
	var params = 'width=' + w + ',height=' + h; 
	window.open('personalsite/personal.html', 'artsite', params);
}
