function getSizes() {
  var 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;
  }
  return new Array(myWidth, myHeight);
}


function grayOut(vis, options) {
  // Pass true to gray out screen, false to ungray
  // options are optional.  This is a JSON object with the following (optional) properties
  // opacity:0-100         // Lower number = less grayout higher = more of a blackout 
  // zindex: #             // HTML elements with a higher zindex appear on top of the gray out
  // bgcolor: (#xxxxxx)    // Standard RGB Hex color code
  // grayOut(true, {'zindex':'50', 'bgcolor':'#0000FF', 'opacity':'70'});
  // Because options is JSON opacity/zindex/bgcolor are all optional and can appear
  // in any order.  Pass only the properties you need to set.
  var options = options || {}; 
  var zindex = options.zindex || 50;
  var opacity = options.opacity || 70;
  var opaque = (opacity / 100);
  var bgcolor = options.bgcolor || '#000000';
  var dark=document.getElementById('darkenScreenObject');
  if (!dark) {
	var windowSize=getSizes();
    // The dark layer doesn't exist, it's never been created.  So we'll
    // create it here and apply some basic styles.
    // If you are getting errors in IE see: http://support.microsoft.com/default.aspx/kb/927917
    var tbody = document.getElementsByTagName("body")[0];
    var tnode = document.createElement('div');           // Create the layer.
        tnode.style.position='absolute';                 // Position absolutely
        tnode.style.top='0px';                           // In the top
        tnode.style.left='0px';                          // Left corner of the page
        tnode.style.overflow='hidden';                   // Try to avoid making scroll bars            
        tnode.style.display='none';                      // Start out Hidden
        tnode.id='darkenScreenObject';                   // Name it so we can find it later
    tbody.appendChild(tnode);                            // Add it to the web page
	var tnode2 = document.createElement('div');           // Create the layer.
        tnode2.style.position='fixed';
		                 // Position absolutely
        tnode2.style.top=(windowSize[1]/2)+"px";                           // In the top
        tnode2.style.left='50%';					 // Left corner of the page
								                   // Try to avoid making scroll bars            
        tnode2.style.display='none';          // Start out Hidden
        tnode2.id='SpecialFeature';                   // Name it so we can find it later
	if (Prototype.Browser.IE) {
		tnode2.style.position='absolute';
		tnode2.style.top=((windowSize[1]/2)+document.body.scrollTop)+"px";
		}


    //tbody.appendChild(tnode);                            // Add it to the web page
	tbody.appendChild(tnode2);                            // Add it to the web page
    dark=document.getElementById('darkenScreenObject');  // Get the object.
	topdark=document.getElementById('SpecialFeature');  // Get the object.
  }
  if (vis) {
    // Calculate the page width and height 
    if( document.body && ( document.body.scrollWidth || document.body.scrollHeight ) ) {
        var pageWidth = document.body.scrollWidth+'px';
		if ( document.body.scrollHeight > document.getElementsByTagName("table")[0].scrollHeight) {
		var pageHeight = document.body.scrollHeight+'px';
		} else {
        var pageHeight = document.getElementsByTagName("table")[0].scrollHeight+'px';
		}

    } else if( document.body.offsetWidth ) {
      var pageWidth = document.body.offsetWidth+'px';
      var pageHeight = document.body.offsetHeight+'px';
    } else {
       var pageWidth='100%';
       var pageHeight='100%';
    } 
  
    //set the shader to cover the entire page and make it visible.
    dark.style.opacity=opaque;                      
    dark.style.MozOpacity=opaque;                   
    dark.style.filter='alpha(opacity='+opacity+')'; 
    dark.style.zIndex='50';        
    dark.style.backgroundColor=bgcolor;  
    dark.style.width= pageWidth;
    dark.style.height= pageHeight;
    dark.style.display='block';
	topdark.style.zIndex='777777';
	topdark.style.display='block';                          
  } else {
     dark.style.display='none';
  }
}

function closeFeature(){ 
	var flashAds=document.getElementsByTagName('object');
	 for( var i = 0; i < flashAds.length; i++ ) 
 { 
	flashAds[i].style.visibility="visible";
	}
var flashAds=document.getElementsByTagName('embed');
	 for( var i = 0; i < flashAds.length; i++ ) 
 { 
	flashAds[i].style.visibility="visible";
	}

	document.getElementById("SpecialFeature").style.visibility="hidden";
	document.getElementById("SpecialFeature").innerHTML="";
	grayOut(false);
	
}


function showEGG(egg) {
	var flashAds=document.getElementsByTagName('object');
	 for( var i = 0; i < flashAds.length; i++ ) 
 { 
	flashAds[i].style.visibility="hidden";
	}
var flashAds=document.getElementsByTagName('embed');
	 for( var i = 0; i < flashAds.length; i++ ) 
 { 
	flashAds[i].style.visibility="hidden";
	}

	grayOut(true, {'bgcolor':'#FF99CC'});
	if (Prototype.Browser.IE) {
		var windowSize=getSizes();
		document.getElementById("SpecialFeature").style.top=((windowSize[1]/2)+document.body.scrollTop)+"px";
		}
sfeature='<div style=\"position:relative; top:-235px; left:-325px; \"><div style=\"width: 645px;text-align: right; font-family: times; font-variant:small-caps; font-weight: bold; color: black; padding-right: 5px;background-color: #CCCCCC; padding-top: 2px; padding-bottom:2px;\" onClick=\"closeFeature();\">Close</div><div><iframe id=\'theframe\' src=\"http://www.normantranscript.net/scripts/showegg.php?egg='+egg+'\" frameborder=0 scrolling=\"no\" width=\"650\" height=\"470\" ></iframe></div></div>';

document.getElementById("SpecialFeature").innerHTML=sfeature;

document.getElementById('theframe').src="http://www.normantranscript.net/scripts/showegg.php?egg="+egg;

document.getElementById("SpecialFeature").style.visibility="visible";




}


function showAD(egg) {
	var flashAds=document.getElementsByTagName('object');
	 for( var i = 0; i < flashAds.length; i++ ) 
 { 
	flashAds[i].style.visibility="hidden";
	}
var flashAds=document.getElementsByTagName('embed');
	 for( var i = 0; i < flashAds.length; i++ ) 
 { 
	flashAds[i].style.visibility="hidden";
	}
	
grayOut(true, {'bgcolor':'#FF99CC'});
	if (Prototype.Browser.IE) {
		var windowSize=getSizes();
		document.getElementById("SpecialFeature").style.top=((windowSize[1]/2)+document.body.scrollTop)+"px";
		}
if ((egg!=1) && (egg!=6)){
sfeature='<div style=\"position:relative; top:-235px; left:-325px; \"><div style=\"width: 645px;text-align: right; font-family: times; font-variant:small-caps; font-weight: bold; color: black; padding-right: 5px;background-color: #CCCCCC; padding-top: 2px; padding-bottom:2px;\" onClick=\"closeFeature();\">Close</div><div><iframe allowTransparency="true" id=\'theframe\' src=\"http://www.normantranscript.net/specialprojects/egghunts/ads/'+egg+'.html\" frameborder=0 scrolling=\"no\" width=\"650\" height=\"500\" ></iframe></div></div>';

} else {
sfeature='<div style=\"position:relative; top:-235px; left:-197px; \"><div style=\"width: 395px;text-align: right; font-family: times; font-variant:small-caps; font-weight: bold; color: black; padding-right: 5px;background-color: #CCCCCC; padding-top: 2px; padding-bottom:2px;\" onClick=\"closeFeature();\">Close</div><div><iframe allowTransparency="true" id=\'theframe\' src=\"http://www.normantranscript.net/specialprojects/egghunts/ads/'+egg+'.html\" frameborder=0 scrolling=\"no\" width=\"395\" height=\"470\" ></iframe></div></div>';


}
document.getElementById("SpecialFeature").innerHTML=sfeature;

document.getElementById('theframe').src="http://www.normantranscript.net/specialprojects/egghunt/ads/"+egg+".html";

document.getElementById("SpecialFeature").style.visibility="visible";




}

function drawEgg1() {
var styles= 49;			do {			var style=(Math.floor(Math.random()*(styles+1)))+1;			} while ((style<1) || (style>49));
		var tnode3 = document.createElement('div');           // Create the layer.
        tnode3.style.position='absolute';
		                 // Position absolutely
        tnode3.style.top="-100px";                           // In the top
        tnode3.style.left='100px';					 // Left corner of the page
								                   // Try to avoid making scroll bars            
        tnode3.style.display='none';          // Start out Hidden
        tnode3.id='EG1';                   // Name it so we can find it later
		tnode3.innerHTML='<a id="egg1link" href="javascript:void(0);" onclick="showEGG(\''+style+'\');"><div id="egg1" class="dragme"><img  border="0" src="http://www.normantranscript.net/specialprojects/egghunt/eggs/'+style+'.png"></div></a>';
		tnode3.style.zIndex="150";
		document.getElementsByTagName("div")[1].appendChild(tnode3);
	


}

function drawEgg2() {
var styles= 49;			do {			var style=(Math.floor(Math.random()*(styles+1)))+1;			} while ((style<1) || (style>49));
		var tnode4 = document.createElement('div');           // Create the layer.
        tnode4.style.position='absolute';
		                 // Position absolutely
        tnode4.style.top="-100px";                           // In the top
        tnode4.style.left='200px';					 // Left corner of the page
								                   // Try to avoid making scroll bars            
        tnode4.style.display='none';          // Start out Hidden
        tnode4.id='EG2';                   // Name it so we can find it later
		tnode4.innerHTML='<a id="egg1link" href="javascript:void(0);" onclick="showEGG(\''+style+'\');"><div id="egg2" class="dragme"><img  border="0" src="http://www.normantranscript.net/specialprojects/egghunt/eggs/'+style+'.png"></div></a>';
		tnode4.style.zIndex="150";
		document.getElementsByTagName("div")[1].appendChild(tnode4);




	}

function drawEgg3() {
var styles= 8;			do {			var style=(Math.floor(Math.random()*(styles+1)))+1;			} while ((style<1) || (style>8));

		var tnode5 = document.createElement('div');           // Create the layer.
        tnode5.style.position='absolute';
		                 // Position absolutely
        tnode5.style.top="-100px";                           // In the top
        tnode5.style.left='300px';					 // Left corner of the page
								                   // Try to avoid making scroll bars            
        //tnode5.style.display='none';          // Start out Hidden
        tnode5.id='EG3';                   // Name it so we can find it later
		tnode5.innerHTML='<a id="egg1link" href="javascript:void(0);" onclick="showAD(\''+style+'\');"><div id="egg3" class="dragme"><img  border="0" src="http://www.normantranscript.net/specialprojects/egghunt/eggs/'+style+'.png"></div></a>';
		tnode5.style.zIndex="150";
		document.getElementsByTagName("div")[1].appendChild(tnode5);



	}

function fillInEgg(i, style) {
document.getElementById('EG'+i).innerHTML='<a id="egg'+i+'link" href="javascript:void(0);" onclick="showEGG(\''+style+'\');"><div id="egg'+i+'" class="dragme"><img  border="0" src="http://www.normantranscript.net/specialprojects/egghunt/eggs/'+style+'.png"></div></a>';document.getElementById('EG'+i).style.zIndex="100";


}





function randomEgg() {
	drawEgg1();
	drawEgg2();
	drawEgg3();
	
}
	