var height = screen.height;
var width = screen.width;
var leftpos = width / 2 - 50;
var toppos = height / 2 - 50;

function encode(str){
  return escape(str.replace(/ /g,'+'));
}

function view(what) {
  var url = 'viewer.asp?pic='+encode(what);
  var oWindow = window.open(url,'WIN','scrollbars=no,status=no,toolbar=no,resizable=1,location=no,menu=no,width=100,height=100,left=' + leftpos + ',top=' + toppos);

  if (oWindow == null || typeof(oWindow) == "undefined"){
//    alert('blocked!');    
    window.location='viewer_blocked.asp?pic='+encode(what);
  }
//  else
//    alert('not blocked! i am a ' + typeof(oWindow));    

}


function getParams() {
var idx = document.URL.indexOf('?');
var params = new Array();
if (idx != -1) {
var pairs = document.URL.substring(idx+1, document.URL.length).split('&');
for (var i=0; i<pairs.length; i++) {
nameVal = pairs[i].split('=');
params[nameVal[0]] = nameVal[1];
   }
}
return params;
}

params = getParams();





function resizeme()	{
	  var imgWidth;
	  var imgHeight;
	  var name = navigator.appName

    if (name == "Microsoft Internet Explorer") {
	    imgWidth = document.picture.width + 20;
	    imgHeight = document.picture.height + 86;
    }
    else if(name == "Netscape"){
	    imgWidth = document.picture.width + 16;
	    imgHeight = document.picture.height + 72;    
    }
    else { //modify for other browsers, eh?
	    imgWidth = document.picture.width + 16;
	    imgHeight = document.picture.height + 60;
    }


    var height = screen.height;
    var width = screen.width;

    var leftpos = width / 2 - imgWidth / 2;
    var toppos = height / 2 - imgHeight / 2; 
		  		   	  		                  
    window.moveTo(leftpos, toppos);		
    window.resizeTo(imgWidth, imgHeight);
	
  	window.focus();    			        
}
