//Created by Banshee of www.ppmsite.com
var images = new Array();
images['image'] = new Array();
images['image'][0] = '<a href="http://cncnet.cnc-comm.com"><img width="500" height="150" src="http://cncnet.cnc-comm.com/images/cncnetlogo.png" alt="CnCNet" /></a>';
images['image'][1] = '<a href="http://nyerguds.arsaneus-design.com/cnc95upd/cc95p106/"><img width="500" height="150" src="http://nyerguds.arsaneus-design.com/cnc95upd/cc95p106/106bbanner.png" alt="C&amp;C95 1.06b patch" /></a>';
images['image'][2] = '<a href="http://dta.cncxs.com"><img width="500" height="150" src="http://www.cnc-comm.com/banners/dta.gif" alt="DTA" /></a>';
images['image'][3] = '<a href="http://forums.cncnz.com/index.php?showtopic=13910&st=0"><img width="500" height="150" src="http://nyerguds.arsaneus-design.com/cnc95upd/cc95p106/106cbanner.gif" alt="C&amp;C95 1.06c patch" /></a>';

function refreshDocJSTOD(section) {
  var max = images[section].length;
  imageIndex = getRandomIndex(max);
  imageIndex = imageIndex % max;
  document.write(images[section][imageIndex]);
}

function getRandomIndex(max) {
 var randomNum = Math.random();
 randomNum = randomNum * max;
 randomNum = parseInt(randomNum);
 if(isNaN(randomNum)) randomNum = 0; // for Netscape
 return randomNum;
}

var myWidth;
var myHeight;
var contentRemove = 400;

function LoadMyPage() {
	getSize();
	fixImages();
}

function getSize() {
  myWidth = 0;
  myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
}

function reFixImages(obj)
{
	getSize()
	fixImages()
}

function fixImages() {
	var images = document.body.getElementsByTagName("IMG");
	var maxWidth = myWidth-contentRemove;
	var fixcount=0;
	var nullcount=0;
	var wantalert=true;
	var badImgs = "";
	for(i=0; i<images.length; i++)
	{
		if ((images[i].width != 880) && (images[i].height != 119))
		{
			if(images[i].width> maxWidth || images[i].clientWidth>maxWidth)
			{
				fixcount = fixcount+1;
				var w = images[i].width
				var h = images[i].height
				var rat = maxWidth/w
				images[i].height = h*rat
				images[i].width = maxWidth
			}
		}
	}
}