var activeSub=0;
var SubNum=0;

function reDo(){ window.location.reload() }
window.onresize = reDo;


//Define global variables

var timerID = null;
var timerOn = false;
var timecount = 25000;
var what = null;
var newbrowser = true;
var check = false;

function init(){


// alert ("Running Init");
if (document.layers) {
// alert ("Running Netscape 4");
layerRef="document.layers";
styleSwitch="";
visibleVar="show";
screenSize = window.innerWidth;
what ="ns4";

}else if(document.all){


// alert ("Running IE");
layerRef="document.all";
styleSwitch=".style";
visibleVar="visible";
screenSize = document.body.clientWidth + 18;
what ="ie"; 
}else if(document.getElementById){


// alert ("Running Netscape 6");
layerRef="document.getElementByID";
styleSwitch=".style";
visibleVar="visible";
what="moz"; 
}else{ 
//alert("Older than 4.0 browser.");
what="none";
newbrowser = false;
} 
window.status='Welcome to Y108.com!';
check = true;
}

// Turns the layers on and off



function showLayer(layerName){

if(check){
if (what =="none"){
return;
}
else if (what == "moz"){
document.getElementById(layerName).style.visibility="visible";
}
else{
eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="visible"');
}
}
else {// alert ("Please wait for the page to finish loading.");
return;}
} 
function hideLayer(layerName){


if(check){
if (what =="none"){
return;
}
else if (what == "moz"){
document.getElementById(layerName).style.visibility="hidden";
}
else{
eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="hidden"');
}

}
else {// alert ("Please wait for the page to finish loading.");
return;}
} 
function hideAll(){
hideLayer('layer4');
hideLayer('layer5');
hideLayer('layer6');
hideLayer('layer8');
} 
function startTime() {


if (timerOn == false) {
timerID=setTimeout( "hideAll()" , timecount);
timerOn = true;
}
} 
function stopTime() {


if (timerOn) {
clearTimeout(timerID);
timerID = null;
timerOn = false;
}
} 
function onLoad(){


init();

} 


// Form Element Scripts
//
//Highlight form element- © Dynamic Drive (www.dynamicdrive.com)
//For full source code, 100's more DHTML scripts, and TOS,
//visit http://www.dynamicdrive.com

var highlightcolor="#D9C3FF"

var ns6=document.getElementById&&!document.all
var previous=''
var eventobj

//Regular expression to highlight only form elements
var intended=/INPUT|TEXTAREA|SELECT|OPTION/

//Function to check whether element clicked is form element
function checkel(which){
if (which.style&&intended.test(which.tagName)){
if (ns6&&eventobj.nodeType==3)
eventobj=eventobj.parentNode.parentNode
return true
}
else
return false
}

//Function to highlight form element
function highlight(e){
eventobj=ns6? e.target : event.srcElement
if (previous!=''){
if (checkel(previous))
previous.style.backgroundColor=''
previous=eventobj
if (checkel(eventobj))
eventobj.style.backgroundColor=highlightcolor
}
else{
if (checkel(eventobj))
eventobj.style.backgroundColor=highlightcolor
previous=eventobj
}
}

//Function to Remove Default Text from Field
function clearText(thefield){
if (thefield.defaultValue==thefield.value)
thefield.value = ""
} 

//Function to force agreement to terms of service
var checkobj

function agreesubmit(el){
checkobj=el
if (document.all||document.getElementById){
for (i=0;i<checkobj.form.length;i++){  //hunt down submit button
var tempobj=checkobj.form.elements[i]
if(tempobj.type.toLowerCase()=="submit")
tempobj.disabled=!checkobj.checked
}
}
}

function defaultagree(el){
if (!document.all&&!document.getElementById){
if (window.checkobj&&checkobj.checked)
return true
else{
alert("Please read/accept terms to submit form")
return false
}
}
}


//this function checks the date

function checkdate() {
var err = 0
string = document.agreeform.BirthDate.value
var valid = "0123456789/"
var ok = "yes";
var temp;
for (var i=0; i< string.length; i++) {
temp = "" + string.substring(i, i+1);
if (valid.indexOf(temp) == "-1") err = 1;
}
if (string.length != 8) err=1
b = string.substring(0, 2) // month
c = string.substring(2, 3)// '/'
d = string.substring(3, 5) // day
e = string.substring(5, 6)// '/'
f = string.substring(6, 8) // year
if (b<1 || b>12) err = 1
if (c != '/') err = 1
if (d<1 || d>31) err = 1
if (e != '/') err = 1
if (f<0 || f>87) err = 1
if (b==4 || b==6 || b==9 || b==11){
if (d==31) err=1
}
if (b==2){
var g=parseInt(f/4)
if (isNaN(g)) {
err=1
}
if (d>29) err=1
if (d==29 && ((f/4)!=parseInt(f/4))) err=1
}
if (err==1) {
alert('Sorry! You must be 18 years of age or older to participate or \n If you are over 18 you have not correctly formatted your entry.  \n\nPlease check to make sure this information is correct.\n\nNO ENTRIES OF PERSONS UNDER 18 WILL BE ACCEPTED!');
}
}

// No Right Click
<!--
var message="";
///////////////////////////////////
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if 
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers) 
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}

document.oncontextmenu=new Function("return false")
// --> 
<!--


// Pop-up JavaScript Function
//
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=550,height=575');");
}
// End -->

// Pop-up JavaScript Function
//
function popUp2(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=490,height=600');");
}
// End -->

function popUp6(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=545,height=550');");
}
// End -->


function popUpStorm(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=812,height=550');");
}
// End -->