function JustSoPicWindow(imageName,imageWidth,imageHeight,alt,bgcolor,hugger,hugMargin) {
// by E Michael Brandt of ValleyWebDesigns.com - Please leave these comments intact.
// version 3.0.4
// var bg = "/images/image.jpg"; added by goldentroll.com
	if (bgcolor=="") {
		bgcolor="#FFFFFF";
	}
	var adj=10
	var w = screen.width;
	var h = screen.height;
	var byFactor=1;
	var bg = "";
	if(w<740){
	  var lift=0.90;
	}
	if(w>=740 & w<835){
	  var lift=0.91;
	}
	if(w>=835){
	  var lift=0.93;
	}
	if (imageWidth>w){	
	  byFactor = w / imageWidth;			
	  imageWidth = w;
	  imageHeight = imageHeight * byFactor;
	}
	if (imageHeight>h-adj){
	  byFactor = h / imageHeight;
	  imageWidth = (imageWidth * byFactor);
	  imageHeight = h; 
	}
	var scrWidth = w-adj;
	var scrHeight = (h*lift)-adj;
	if (imageHeight>scrHeight){
  	  imageHeight=imageHeight*lift;
	  imageWidth=imageWidth*lift;
	}
	var posLeft=0;
	var posTop=0;
	if (hugger == "hug image"){
	  if (hugMargin == ""){
	    hugMargin = 0;
	  }
	  var scrHeightTemp = imageHeight - 0 + 2*hugMargin;
	  if (scrHeightTemp < scrHeight) {
		scrHeight = scrHeightTemp;
	  } 
	  var scrWidthTemp = imageWidth - 0 + 2*hugMargin;
	  if (scrWidthTemp < scrWidth) {
		scrWidth = scrWidthTemp;
	  }
	  if (scrHeight<100){scrHeight=100;}
	  if (scrWidth<100){scrWidth=100;}
	  posTop =  ((h-(scrHeight/lift)-adj)/2);
	  posLeft = ((w-(scrWidth)-adj)/2);
 	}
	if (imageHeight> (h*lift)-adj || imageWidth> w-adj){
		imageHeight=imageHeight-adj;
		imageWidth=imageWidth-adj;
	}
	posTop = parseInt(posTop);
	posLeft = parseInt(posLeft);		
	scrWidth = parseInt(scrWidth); 
	scrHeight = parseInt(scrHeight);
	var agt=navigator.userAgent.toLowerCase();
	if (agt.indexOf("opera") != -1){
	  var args= new Array();
	  args[0]='parent';
	  args[1]=imageName;
	  var i ; document.MM_returnValue = false;
	  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
	} else {
	newWindow = window.open("vwd_justso.htm","newWindow","width="+scrWidth+",height="+scrHeight+",left="+posLeft+",top="+posTop);
	newWindow.document.open();
	newWindow.document.write('<html>' + '<META HTTP-EQUIV\="imagetoolbar" CONTENT\="no"><title>'+alt+'</title><body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" bgcolor='+bgcolor+' background='+bg+' onBlur="self.close()" onClick="self.close()"');  
	newWindow.document.write('<table width='+imageWidth+' border="0" cellspacing="0" cellpadding="0" align="center" height='+scrHeight+'><tr><td>');
	newWindow.document.write('<img src="'+imageName+'" width='+imageWidth+' height='+imageHeight+' alt="Click screen to close">'); 
	newWindow.document.write('</td></tr></table></body></html>');
	newWindow.document.close();
	newWindow.focus();
	document.MM_returnValue = false;
	}
}
//FrameBuster
     if (self != top) top.location.replace(self.location);

function WindowTools(rsz,axs,amount,offset,loop,diag,xwin,maxwin,gf,mwx,mwy)
{	// Neonix Window Tools ver 1.4.0 - www.neonix.net/nwt.mv
	if (gf == '1'){
		self.focus();
	}
	if (rsz.length != '1'){
		var rszArray = rsz.split('X');
		self.resizeTo(rszArray[1],rszArray[0]);
	}
	if (maxwin == '1'){
		self.moveTo(0,0);
		self.resizeTo(screen.availWidth,screen.availHeight);
	}
	if (mwx && mwy){
		window.moveTo(mwx,mwy);
	}
	if (axs == '0'){
		for (i=0;i<loop;i++){
			window.resizeBy('0',amount);
			window.moveBy('0',offset);	 
		}
	}
	else if (axs == '1'){
		for (i=0;i<loop;i++){
			window.resizeBy(amount,'0');
			window.moveBy(offset,'0');	 
		}
	}
	else if (axs == '2'){
		if (diag == '1' && offset.indexOf('-') == '0'){
			var v = offset; var h = - offset;
		}
		else if (diag == '1' && offset.indexOf('-') == '-1'){
			var v = offset; var h = - offset;
		}
		else {
			var v = offset; var h = offset;
		}
		for (i=0;i<loop;i++){
			window.resizeBy(amount,amount);
			window.moveBy(v,h);
		}		  
	}
    if (xwin == '1'){
		window.close();
	}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function writeCookie(name, data, noDays){
  var cookieStr = name + "="+ data
  if (writeCookie.arguments.length > 2){
    cookieStr += "; expires=" + getCookieExpireDate(noDays)
    }
  document.cookie = cookieStr
}

function readCookie(cookieName){
   var searchName = cookieName + "="
   var cookies = document.cookie
   var start = cookies.indexOf(cookieName)
   if (start == -1){ // cookie not found
     return ""
     }
   start += searchName.length //start of the cookie data
   var end = cookies.indexOf(";", start)
   if (end == -1){
     end = cookies.length
     }
   return cookies.substring(start, end)
}

function blocking(nr, cookie, vis_state)
{
	if (document.layers)
	{
		current = (document.layers[nr].display == 'none') ? vis_state : 'none';
		if (cookie != '')
			writeCookie(nr, current);
		document.layers[nr].display = current;
	}
	else if (document.all)
	{
		current = (document.all[nr].style.display == 'none') ? vis_state : 'none';
		if (cookie != '')
			writeCookie(nr, current);
		document.all[nr].style.display = current;
	}
	else if (document.getElementById)
	{
		display = (document.getElementById(nr).style.display == 'none') ? vis_state : 'none';
		if (cookie != '')
			writeCookie(nr, display);
		document.getElementById(nr).style.display = display;
	}
}


function adjust_popup()
{
	var w, h, fixedW, fixedH, diffW, diffH;
	
	if (document.all) {
		fixedW = document.body.clientWidth;
		fixedH = document.body.clientHeight;
		window.resizeTo(fixedW, fixedH);
		diffW = fixedW - document.body.clientWidth;
		diffH = fixedH - document.body.clientHeight;
	} else {
		fixedW = window.innerWidth;
		fixedH = window.innerHeight;
		window.resizeTo(fixedW, fixedH);
		diffW = fixedW - window.innerWidth;
		diffH = fixedH - window.innerHeight;
	}
	w = fixedW + diffW;
	h = fixedH + diffH;
	if (h >= screen.availHeight) w += 16;
	if (w >= screen.availWidth)  h += 16;
	w = Math.min(w,screen.availWidth);
	h = Math.min(h,screen.availHeight);
	window.resizeTo(w,h);
	window.moveTo((screen.availWidth-w)/2, (screen.availHeight-h)/2);
}
function addBookmark(title,url) {
	if (window.sidebar) {
		alert('This feature works for Internet Explorer only use Control+D to bookmark the next page');
		return true;
	} else if( document.all ) {	
		window.external.AddFavorite( url, title);
		return false;
	} else if( window.opera && window.print ) {
		alert('This feature works for Internet Explorer only use Control+T to bookmark the next page');
		return true;
	}
}
