var id='skybox';
var millisec=1500;
var timera=null;
var timerb=null;
var count=0;
var ender=0;
var terminate=0;
var on='DYI/images/on.gif'
var off='DYI/images/off.gif'
var active='DYI/images/active.gif'
var cursound=on;
var curalt='Mute Sound';

function cacheImages(){
 if(!document.images){
  return;
 }else{
  var img_names=new Array(
  'DYI/images/bg.jpg',
  'DYI/images/tbg.png',
  'DYI/images/crest.png',
  'DYI/images/on.gif',
  'DYI/images/off.gif',
  'DYI/images/active.gif'
  );
  var imgs=new Array();
  for(i=0;i<img_names.length;i++){
   imgs[i]=new Image();
   imgs[i].src=img_names[i];
  }
 }
}

function yearSet(){
c=2009;
cd=new Date();
y=cd.getYear();
 if(y<1000){y+=1900;}
 test=y-c;
 if(test>95){
  update=(test-95);
  c=c+update;
 }
 if(c==y){
  gop=y;
 }else if(y<c){
  gop=c;
 }else{
  gop=c+'-'+y;
 }
 document.getElementById('year').innerHTML=gop;
}

function qconfig(){
 var qtext=new Array();
  qtext[0]='We, the People, are the rightful masters of both the Congress and the Courts.&nbsp;&nbsp;Not to overthrow the Constitution, but to overthrow the men who have perverted it.'
  qtext[1]='Enlighten the people, generally, and tyranny and oppressions of body and mind will vanish like spirits at the dawn of day.'
  qtext[2]='I know no safe depository of the ultimate powers of the society but the people themselves; and if we think them not enlightened enough to exercise their control with a wholesome discretion, the remedy is not to take it from them, but to inform their discretion by education.&nbsp;&nbsp;This is the true corrective of abuses of constitutional power.'
  qtext[3]='[T]he flames kindled on the 4 of July 1776, have spread over too much of the globe to be extinguished by the feeble engines of despotism; on the contrary, they will consume these engines and all who work them.'
  qtext[4]='The constitutions of most of our States assert that all power is inherent in the people; that they may exercise it by themselves in all cases to which they think themselves competent, or they may act by representatives, freely and equally chosen; that it is their right and duty to be at all times armed; that they are entitled to freedom of person, freedom of religion, freedom of property, and freedom of the press.'
  qtext[5]='[T]o preserve the republican form and principles of our Constitution and cleave to the salutary distribution of powers which that [the Constitution] has established... are the two sheet anchors of our Union.&nbsp;&nbsp;If driven from either, we shall be in danger of foundering.'
  qtext[6]='Liberty cannot be preserved without a general knowledge among the people, who have a right, from the frame of their nature, to knowledge, as their great Creator, who does nothing in vain, has given them understandings, and a desire to know; but besides this, they have a right, an indisputable, unalienable, indefeasible, divine right to that most dreaded and envied kind of knowledge; I mean, of the characters and conduct of their rulers.'
  qtext[7]='[D]emocracy will soon degenerate into an anarchy, such an anarchy that every man will do what is right in his own eyes and no man\'s life or property or reputation or liberty will be secure, and every one of these will soon mould itself into a system of subordination of all the moral virtues and intellectual abilities, all the powers of wealth, beauty, wit and science, to the wanton pleasures, the capricious will, and the execrable cruelty of one or a very few.'
  qtext[8]='[D]emocracies have ever been spectacles of turbulence and contention; have ever been found incompatible with personal security, or the rights of property; and have, in general, been as short in their lives as they have been violent in their deaths.'
  qtext[9]='I love the man that can smile in trouble, that can gather strength from distress, and grow brave by reflection.&nbsp;&nbsp;\'Tis the business of little minds to shrink; but he whose heart is firm, and whose conscience approves his conduct, will pursue his principles unto death.'
  qtext[10]='Tyranny, like hell, is not easily conquered; yet we have this consolation with us, that the harder the conflict, the more glorious the triumph.'
  qtext[11]='The sacred rights of mankind are not to be rummaged for, among old parchments, or musty records.&nbsp;&nbsp;They are written, as with a sun beam, in the whole volume of human nature, by the hand of the divinity itself; and can never be erased or obscured by mortal power.'
  qtext[12]='The Constitution is not an instrument for the government to restrain the people, it is an instrument for the people to restrain the government - lest it come to dominate our lives and interests.'
 var qname=new Array();
  qname[0]='Abraham Lincoln'
  qname[1]='Thomas Jefferson'
  qname[2]='Thomas Jefferson'
  qname[3]='Thomas Jefferson'
  qname[4]='Thomas Jefferson'
  qname[5]='Thomas Jefferson'
  qname[6]='John Adams'
  qname[7]='John Adams'
  qname[8]='James Madison'
  qname[9]='Thomas Paine'
  qname[10]='Thomas Paine'
  qname[11]='Alexander Hamilton'
  qname[12]='Patrick Henry'

 pQ=Math.floor(Math.random()*(qtext.length));
 document.getElementById('qtext').innerHTML=qtext[pQ];
 document.getElementById('qname').innerHTML=qname[pQ];
}

var tl=new Array(
'Knowledge',
'Intelligence',
'Wisdom',
'Strength',
'Facts',
'Law',
'Truth'
);

var def=new Array(
'The circumstance or condition of apprehending truth or fact through reasoning.',
'To think abstractly as measured by objective criteria; the skilled use of reason.',
'Accumulated philosophic or scientific learning; insight; good judgement.',
'Capacity for exertion or endurance; the quality or state of being strong; power to resist force.',
'The quality of being actual; information presented as having objective reality; to actually exist or to have occurred.',
'A principle governing action or procedure; a means of redressing wrongs; something established as being compatible or enforceable through a controlling authority.',
'The state of being the case; fact; the body of real things, events, and facts; the property of being in accord with fact or reality.'
);

function modSound(){
 if(cursound=='DYI/images/on.gif'){
// Turning Off...
  cursound=off;
  curalt='Unmute Sound';
  thisS=document.getElementById('liven');
  thisS.Stop();
 }else{
// Turning On...
  cursound=on;
  curalt='Mute Sound';
  thisS=document.getElementById('liven');
  thisS.Play();
 }
 flasher();
}

function flasher(){
 document.getElementById('mute').src=cursound;
 document.getElementById('mute').title=curalt;
 document.getElementById('mute').alt=curalt;
}

function padSet(){
setW=window.innerWidth != null ? window.innerWidth : document.documentElement && document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body != null ? document.body.clientWidth : null;
 if(setW>860){
  setW=Math.floor((setW-860)/2);
 }else{
  setW=50+'px';
 }
 document.getElementById('sw').style.paddingLeft=setW+'px';
}

var time=null;
function setUp(n){
 clearTimeout(time);
 time=null;
 displayInfo(n);
}

function displayInfo(n){
 n1='c'+n;
 var i=document.getElementById(id).style;
 i.opacity=0;
 i.MozOpacity=0;
 i.KhtmlOpacity=0;
 i.filter='alpha(opacity=0)';
 var o2=document.getElementById('st').style;
 o2.opacity=0;
 o2.MozOpacity=0;
 o2.KhtmlOpacity=0;
 o2.filter='alpha(opacity=0)';
 document.getElementById('st').className=n1;
 document.getElementById('st').innerHTML=tl[n];
 document.getElementById('cloudwriter').className=n1;
 document.getElementById('cloudwriter').innerHTML=def[n];
 document.getElementById(id).style.display='block';
 ccI();
}

function ccI(){
terminate=0;
strt=0;
end=100;
var speed=Math.round(millisec/100);
var timer=0;
 for(i=strt;i<=end;i++){
  if(terminate){break;}
  time=setTimeout('changeO('+i+')',(timer*speed));
  timer++;
 }
 if(!ender){
  fadeOut();
 }
}

function changeO(i){
 var rate=i/100;
 var o1=document.getElementById(id).style;
 var o2=document.getElementById('st').style;
 o1.opacity=rate;
 o2.opacity=rate;
 o1.MozOpacity=rate;
 o2.MozOpacity=rate;
 o1.KhtmlOpacity=rate;
 o2.KhtmlOpacity=rate;
 o1.filter='alpha(opacity='+i+')';
 o2.filter='alpha(opacity='+i+')';
}

function fadeOut(){
 time=setTimeout('ccO()',10000);
}

function ccO(){
strt=100;
end=0;
var speed=Math.round(millisec/100);
var timer=0;
 for(i=strt;i>=end;i--){
  if(terminate){break;}
  time=setTimeout('changeO('+i+')',(timer*speed));
  timer++;
 }
 if(ender){
  pillar();
 }else{
  delayer();
 }
}

function pillar(){
 var o2=document.getElementById('st').style;
 o2.opacity=0;
 o2.MozOpacity=0;
 o2.KhtmlOpacity=0;
 o2.filter='alpha(opacity=0)';
 document.getElementById('st').className='dyi';
 document.getElementById('st').innerHTML='DYI<br /><span id="gM">goMotivate</span>';
 focusP2();
}

function focusP2(){
 terminate=0;
 strt=0;
 end=100;
 var speed=Math.round(millisec/100);
 var timer=0;
 for(i=strt;i<=end;i++){
  if(terminate){break;}
  time=setTimeout('changeP2('+i+')',(timer*speed));
  timer++;
 }
}

function changeP2(i){
 var rate=i/100;
 var o2=document.getElementById('st').style;
 o2.opacity=rate;
 o2.MozOpacity=rate;
 o2.KhtmlOpacity=rate;
 o2.filter='alpha(opacity='+i+')';
}

function focusP1(){
 var o=document.getElementById('decorate').style;
 o.opacity=0;
 o.MozOpacity=0;
 o.KhtmlOpacity=0;
 o.filter='alpha(opacity=0)';
 o.display='block';
 strt=0;
 end=90;
 var speed=Math.round(millisec/100);
 var timer=0;
 for(i=strt;i<=end;i++){
  if(terminate){break;}
  time=setTimeout('changeP1('+i+')',(timer*speed));
  timer++;
 }
}

function changeP1(i){
 var rate=i/100;
 var o=document.getElementById('decorate').style;
 o.opacity=rate;
 o.MozOpacity=rate;
 o.KhtmlOpacity=rate;
 o.filter='alpha(opacity='+i+')';
}

function delayer(){
 time=setTimeout('motions()',3500);
}

function exit(){
 var o2=document.getElementById('st').style;
 o2.opacity=0;
 o2.MozOpacity=0;
 o2.KhtmlOpacity=0;
 o2.filter='alpha(opacity=0)';
}

function motions(){
 if(count<7){
  displayInfo(count);
  count++;
 }else{
  ender=1
  pillar();
 }
}

function display(i){
 clearTimeout(time);
 time=null;
 v=document.getElementById(i).style.display;
 if(v=='block'){
  counter=0;
  terminate=0;
  document.getElementById('tab').style.paddingTop='10px';
  document.getElementById('tab').style.paddingBottom='0px';
  document.getElementById('tab').innerHTML='O<br />P<br />E<br />N';
  document.getElementById(i).style.display='none';
  document.getElementById('clear').style.display='block';
  time=setTimeout('setUp(0)',3500);
 }else{
  ender=1;
  terminate=1;
  document.getElementById(id).style.display='none';
  document.getElementById('tab').style.paddingTop='5px';
  document.getElementById('tab').style.paddingBottom='5px';
  document.getElementById('tab').innerHTML='C<br />L<br />O<br />S<br />E';
  document.getElementById('clear').style.display='none';
  document.getElementById(i).style.display='block';
  pillar();
 }
}

window.onload=function(){
 cacheImages();
 focusP1();
 delayer();
}
document.write('<embed id="liven" type="audio/mp3" src="DYI/liven.mp3" width="0" height="0" autoplay="true" controller="false" loop="true" volume="20" enablejavascript="true" pluginspage="http://www.apple.com/quicktime/download"></embed>');