/*

  Main Javascript file for EEC Analyzer site
  Site designed by Mike Skovgaard http://mikeskov.com

*/

// Create footer text:
var create_footer = function() {
	var txt1 = document.createElement('div');
	txt1.className='footerText';
  var myDate=new Date();
  var fullyear = myDate.getFullYear();
  if (fullyear < 1000) {fullyear += 1900;}
	txt1.innerHTML='Copyright &copy; Clint Garrity '+fullyear;
	txt1.style.top='25px';
	txt1.style.left='0px';
	document.getElementById('footer').appendChild(txt1);			
	var txt2 = document.createElement('div');
	txt2.className='footerText';
	txt2.innerHTML='Site design by Mike Skovgaard - <a href="http://mikeskov.com">http://mikeskov.com</a>';
	txt2.style.top='45px';
	txt2.style.left='0px';
	txt2.style.fontSize='12px';
	txt2.style.color='#c0bfdd';
	document.getElementById('footer').appendChild(txt2);		
}

// Add content corners & flame:
var create_content = function(path) {
	  var tbar = document.createElement('div');
	 	tbar.style.position='absolute';
	 	tbar.style.display='block';
	 	tbar.style.height='2px';
	 	tbar.style.width='800px';
	 	tbar.style.top='0px';
	 	tbar.style.left='2px';
	 	tbar.style.zIndex='1';
	 	tbar.style.backgroundColor='#6a6875';  
	 	document.getElementById('content').appendChild(tbar);	 	
	  var rbar = document.createElement('div');
	 	rbar.style.position='absolute';
	 	rbar.style.display='block';
	 	rbar.style.height='300px';
	 	rbar.style.width='2px';
	 	rbar.style.top='2px';
	 	rbar.style.right='0px';
	 	rbar.style.zIndex='1';
	 	rbar.style.backgroundColor='#6a6875';  
	 	document.getElementById('content').appendChild(rbar);	 		 	
		var tl = document.createElement('div');
	 	tl.style.backgroundImage="url("+path+"images/content_top_left.gif)";
	 	tl.style.position='absolute';
	 	tl.style.display='block';
	 	tl.style.height='21px';
	 	tl.style.width='20px';
	 	tl.style.top='0px';
	 	tl.style.left='0px';
	 	tl.style.zIndex='2';
	 	document.getElementById('content').appendChild(tl);
		var tr = document.createElement('div');
	 	tr.style.backgroundImage="url("+path+"images/content_top_right.gif)";
	 	tr.style.position='absolute';
	 	tr.style.display='block';
	 	tr.style.height='21px';
	 	tr.style.width='20px';
	 	tr.style.right='0px';
	 	tr.style.top='0px';
	 	tr.style.zIndex='3';
	 	document.getElementById('content').appendChild(tr);	 		
		var bl = document.createElement('div');
	 	bl.style.backgroundImage="url("+path+"images/content_bottom_left.gif)";
	 	bl.style.position='absolute';
	 	bl.style.display='block';
	 	bl.style.height='21px';
	 	bl.style.width='20px';
	 	bl.style.left='-1px';
	 	bl.style.bottom='0px';
	 	bl.style.zIndex='4';
	 	document.getElementById('content').appendChild(bl);		 	
		var br = document.createElement('div');
	 	br.style.backgroundImage="url("+path+"images/content_bottom_right.gif)";
	 	br.style.position='absolute';
	 	br.style.display='block';
	 	br.style.height='21px';
	 	br.style.width='20px';
	 	br.style.right='0px';
	 	br.style.bottom='0px';
	 	br.style.zIndex='5';
	 	document.getElementById('content').appendChild(br);		 	
		var fl = document.createElement('div');
    fl.id='flame';
	 	document.getElementById('content').appendChild(fl);
}

// Add buttons for our main menu:
var create_menu = function(path) {
  var create_button = function(bname,btop,bindex,alink) {
		var elm = document.createElement('div');
		elm.className='button';
	 	elm.style.top=btop+'px';
	 	elm.style.zIndex=bindex;
	 	elm.id=bname;
	 	var aelm = document.createElement('a');
	 	aelm.href=alink;
	 	aelm.className='buttonImg';
	 	document.getElementById('buttons').appendChild(elm);
    elm.appendChild(aelm);
	}	
  create_button('home',143,50,path);
  create_button('shop',193,51,path+'shop');
  create_button('tech',243,52,path+'tech');
  create_button('links',293,53,path+'links');
  create_button('downloads',343,54,path+'../DocMan/GuestOut.php');
  create_button('contact',393,55,path+'contact');      
  create_button('photos',443,56,path+'photos'); 
}

var do_init = function(path) {
	window.onunload = EventCache.flush; //make sure we dump our events on close
	create_content(path); //create rounded corders for content window
  create_menu(path); //create main menu
  create_footer(); //create footer
}

