function OpenWindowCenter(url, name, width, height) {
  var opt = "height=" + height + ",innerHeight=" + height + ",width=" + width + ",innerWidth=" + width;
  
  if (window.screen) {
    var ah = screen.availHeight - 30;
    var aw = screen.availWidth - 10;
    var xc = (aw - width) / 2;
    var yc = (ah - height) / 2;
    opt += ",left=" + xc + ",screenX=" + xc + ",top=" + yc + ",screenY=" + yc;
  }
  
  return window.open(url, name, opt);
}

// if height = 0 then height = maximized
function OpenWindowCenterX(url, name, width, height, scrollbar) {
  var opt, sbar; 
  
  if (scrollbar == 1) {
	  sbar = ", scrollbars=1";
  } else {
	  sbar = "";
  }
  
  if (window.screen) {
    var ah = screen.availHeight - 30;
    var aw = screen.availWidth - 10;

    var xc = (aw - width) / 2;
    
	if (ah > 1024) { 
	    ah = 1024 - 30; 
	} 
	
	if (height == 0) {
		height = ah - 80;
	}
	
	var yc = (ah - height) / 2;
	
	opt = "height=" + height + ",innerHeight=" + height + ",width=" + width + ",innerWidth=" + width;
    opt += ",left=" + xc + ",screenX=" + xc + ",top=" + yc + ",screenY=" + yc + sbar;
	
  } else {
	if (height == 0) {
		height = width;
	}
	opt = "height=" + height + ",innerHeight=" + height + ",width=" + width + ",innerWidth=" + width + sbar;  
  }
  
  return window.open(url, name, opt);
}

function Open800(url, name) {
	if (name == 'fdb') {
		url = "http://www.flashdemobuilder.com/"+url;
	} else if (name == 'fdb2') {
		url = url;
	} else if (name == 'ia3') {
		url = "http://www.inalbum.com/"+url;
	} else if (name == 'fvs') {
		url = "http://www.flashvideostudio.com/"+url;
	} 
	OpenWindowCenterX(url, name, 800, 0, 1);
}

function Open800b(url, name, height) {
	if (name == 'fdb') {
		url = "http://www.flashdemobuilder.com/"+url;
	} else if (name == 'ia3') {
		url = "http://www.inalbum.com/"+url;
	} else if (name == 'fvs') {
		url = "http://www.flashvideostudio.com/"+url;
	} 
	OpenWindowCenterX(url, name, 800, height, 1);
}

function FlashPlayer(swfname, site, swfwidth, swfheight) {
  var sh  = swfheight+4;
  var sw  = swfwidth+4;
  var opt = "height=" + sh + ", width=" + sw;

  if (site == 'fvsrel') {
        swfname = swfname +".swf";
  } else
  if (site == "fdb") {
	 swfname = "http://misc.flashdemobuilder.com/fdb/examples/"+swfname+".swf";
  } else if (site == "fdb2") {
	 swfname = "http://www.flashdemobuilder.com/fdb2/samples/"+swfname+".swf";
  } else if (site == "ffl") {
	 swfname = "http://www.increditools.com/flash_fluid_effect/samples/"+swfname+".swf";
  } else if (site == "fps") {
	 swfname = "http://www.increditools.com/flash_particle_studio/samples/"+swfname+".swf";
  } else if (site == "fvs") {
	 swfname = "http://www.flashvideostudio.com/samples/"+swfname+".swf";
  } else if (site == "ia3") {
	 swfname = "http://www.inalbum.com/examples30/"+swfname+".swf";
  } else if (site == "iface") {
	 swfname = "http://www.incrediface.com/examples/"+swfname+".swf";
  } else if (site == "ifx") {
	 swfname = "http://www.incrediflash.com/examples/"+swfname+".swf";
  } else if (site == "ibs") {
	 swfname = "http://www.flashbannerstudio.com/iibb/samples/"+swfname+".swf";
  } else if (site == "invideo") {
	 swfname = "http://www.increditools.com/invideo_studio/iv/samples/"+swfname+".swf";
  } else if (site == "pfs") {
	 swfname = "http://www.pptflashstudio.com/example/"+swfname+".swf";
  }
	
  if (window.screen) {
    var ah = screen.availHeight - 30;
    var aw = screen.availWidth - 10;
    var xc = (aw - sw) / 2;
    var yc = (ah - sh) / 2;
    opt += ",left=" + xc + ",screenX=" + xc + ",top=" + yc + ",screenY=" + yc;
  }
  
  if (site == 'fvsrel')
  {
      return window.open("http://www.increditools.com/flash_video_studio/flash/flash_player.php?swf="+swfname+"&w="+swfwidth+"&h="+swfheight, "FlashPlayer"+Math.floor(Math.random()*500), opt);
  }
  return window.open("http://www.increditools.com/flash_player.php?swf="+swfname+"&w="+swfwidth+"&h="+swfheight, "FlashPlayer"+Math.floor(Math.random()*500), opt);
}

function ImageViewer(imgname, site, imgwidth, imgheight) {

	if (site == "fdb") {
		imgname = "http://www.flashdemobuilder.com/sshots/"+imgname+".jpg";
	} else if (site == "fdb2") {
		imgname = "http://www.flashdemobuilder.com/fdb2/sshots/"+imgname+".jpg";
	} else if (site == "feb") {
		imgname = "http://www.increditools.com/flash_exe_builder/sshots/"+imgname+".jpg";
	} else if (site == "ffl") {
		imgname = "http://www.increditools.com/flash_fluid_effect/sshots/"+imgname+".jpg";
	} else if (site == "fms") {
		imgname = "http://www.increditools.com/flash_music_studio/sshots/"+imgname+".jpg";
	} else if (site == "fps") {
		imgname = "http://www.increditools.com/flash_particle_studio/screenshots/"+imgname+".jpg";
	} else if (site == "fvs") {
		imgname = "http://www.flashvideostudio.com/sshots20/"+imgname+".jpg";
	} else if (site == "ifxjpg") {
		imgname = "http://www.incrediflash.com/sshots/ifx/"+imgname+".jpg";
	} else if (site == "ifx") {
		imgname = "http://www.incrediflash.com/sshots/ifx/"+imgname+".png";
	} else if (site == "ia3") {
		imgname = "http://www.inalbum.com/sshots30/"+imgname+".jpg";
	} else if (site == "ibs") {
		imgname = "http://www.flashbannerstudio.com/sshots/"+imgname+".jpg";
	} else if (site == "invideo") {
		imgname = "http://www.increditools.com/invideo_studio/sshots/"+imgname+".jpg";
	} else if (site == "pfs") {
		imgname = "http://www.pptflashstudio.com/pfs/sshots/"+imgname+".jpg";
	} else if (site == "ia3b") {
		imgname = "http://www.inalbum.com/images30/"+imgname+".jpg";
	}
	
  var sh  = imgheight+4;
  var sw  = imgwidth+4;
  var opt = "height=" + sh + ", width=" + sw;
  
  if (window.screen) {
    var ah = screen.availHeight - 30;
    var aw = screen.availWidth - 10;
    var xc = (aw - sw) / 2;
    var yc = (ah - sh) / 2;
    opt += ",left=" + xc + ",screenX=" + xc + ",top=" + yc + ",screenY=" + yc;
  }
  
  return window.open("http://www.increditools.com/image_viewer.php?img="+imgname+"&w="+imgwidth+"&h="+imgheight, "ImageViewer"+Math.floor(Math.random()*500), opt);	
}

/*******************************
IMAGEPOP
(c) 2003, Peter Bailey, http://www.peterbailey.net
Modified by Skyzyx Genesis, http://www.skyzyx.com

- Works in IE5+, Gecko 0.94+ (maybe earlier?)
- Downlevel for Opera.
- Probably works in KHTML browsers

How to use: <a href="images/7.jpg" onclick="imgPop(this.href); return false;">Pic 7</a>
*******************************/

function imgPop(imageURL)
{
	if (document.getElementById && navigator.userAgent.toLowerCase().indexOf('opera') == -1)
	{
		var imgWin = window.open('about:blank','imgWin','width=200, height=200, left=100, top=100');

		with (imgWin.document)
		{
			writeln('<html><head><title>Loading...</title>');
			writeln('<style type="text/css"><!-- body { margin: 0px; } --></style></head>');
			writeln('<body onload="self.focus();"><img id="pic" style="display:none" /></body></html>');
			close();		
		}

		var img = new Image();
		img.onload = function() { sizeImgWin(imgWin, img); };
		img.src = imageURL;
	}
	else window.open(imageURL);
}
	
function sizeImgWin(win, img)
{
   	var new_w = img.width;
	var new_h = img.height;
	var old_w = win.innerWidth || win.document.body.offsetWidth;
	var old_h = win.innerHeight || win.document.body.offsetHeight;

	if (!new_w) { new_w = old_w; }
	if (!new_h) { new_h = old_h; }

	new_w -= old_w; new_h -= old_h;
	win.resizeBy(new_w,new_h);
	win.document.title = img.src.substring(img.src.lastIndexOf("/")+1);
	var pic = win.document.getElementById('pic');
	pic.src = img.src;
	pic.style.display = 'block';

	sw=screen.width;
	sh=screen.height;

	var leftPos=((sw-new_w)/2)-100; // Exactly centered.
	var topPos=((sh-new_h)/2)-(100+(((sh-new_h)/2)*0.1)); // Centered, then moved up 10%
	win.moveTo(leftPos, topPos);
}