function contentDivResize()
{
	if(document.body.clientHeight < window.innerHeight)
	{
		var main = document.getElementById('maindiv');
		main.style.height = (window.innerHeight - 40) + 'px'; //document.body.clientHeight;// window.innerHeight;
		//alert(window.innerHeight);
		var edit = document.getElementById('editdiv');
		edit.style.top = (window.innerHeight - 40) + 'px';
	}
	
	var x = getElementsByName_iefix('div', "div_content");
	for(i = 0; i < x.length; i++)
	{
		x[i].style.height = window.innerHeight - 250;
	}
	transparentbg("bg_div");
	//runTwinkle("15");
	twinklestar();
}

window.onload = contentDivResize;
window.onresize = contentDivResize;

/*This function is meant to be used when you are needing
faux getElementsByName() in IE. IE seems so use the 'id'
attribute instead of 'name' when you use getElementsByName().

tag = This tag name that the 'name' attribute you want to 
      get is attached to. Like if you called getElementsByTagName().
      
name = The value of the 'name' attribute you want.
*/
function getElementsByName_iefix(tag, name) {
     var elem = document.getElementsByTagName(tag);
     var arr = new Array();
     for(i = 0, iarr = 0; i < elem.length; i++) {
          att = elem[i].getAttribute("name");
          if(att == name) {
               arr[iarr] = elem[i];
               iarr++;
          }
     }
     return arr;
}

/*This function resets the height and width of the background
to that of it's parent element's height and width.

tbg_id = This is the value of the name attribute you named all your
         backgrounds.
*/
function transparentbg(tbg_id) {
     var bak = getElementsByName_iefix("div", tbg_id);
     for(i = 0; i < bak.length; i++) {
          bak[i].style.height = bak[i].parentNode.clientHeight + "px";
          bak[i].style.width  = bak[i].parentNode.clientWidth + "px";
     }
}

function twinklestar()
{
	var bgdiv = document.getElementById('behindbg');
	//var randomtop=Math.floor(Math.random() * 201); //document.body.clientHeight);
	//var randomleft=Math.floor(Math.random() * 801); //document.body.clientWidth);
	
	bgdiv.style.top = 74 + 'px';//randomtop + 'px';
	bgdiv.style.left = 152 + 'px';//randomleft + 'px';
	bgdiv.innerHTML = '';
	bgdiv.innerHTML = "<img src='images/twinkle3.gif' alt='' />";
	clearTimeout();
	setTimeout('clearTwinkle()', 3000);
}

function clearTwinkle()
{
	var bgdiv = document.getElementById('behindbg');
	bgdiv.innerHTML = '';
}

function runTwinkle(countremain)
{
	if(countremain > 0)
	{
		twinklestar();
		setTimeout("runTwinkle( " + (parseInt(countremain) - 1) + " )", 3000);
		//alert('here');
	}
}



