startList = function(){
if (document.all && document.getElementById)
{
navRoot = document.getElementById("fanballUL");
for (i=0; i<navRoot.childNodes.length; i++)
{
node = navRoot.childNodes[i];
 if (node.nodeName=="LI")
 {
 node.onmouseover=function()
 {
 this.className += " over";
 }
 node.onmouseout=function()
 {
 this.className = this.className.replace(" over", "");
 }
 }
 }
 }
}
window.onload = function(){
	startList();
}

  if (document.images)
    self.name = 'mainwindow';

  function no_error()
   {return true;}
  window.onerror=no_error;

  function Buster()
   {
     //  if (top.location != location) { top.location.href = document.location.href;  }
   }
   
var validatePage = 'validate_ds.php';

function trimString (str) {
  while (str.charAt(0) == ' ')
    str = str.substring(1);
  while (str.charAt(str.length - 1) == ' ')
    str = str.substring(0, str.length - 1);
  return str;
}

function element (id) {
  return (document.getElementById(id));
}


function redcolorinput(id)
{
  try  // for text inputs
   {
     element(id+'_caption').style.color='red';
   }
  catch (er)
    {
    };

  try // for radio btns
  {
    element(id).style.borderWidth='1px';
    element(id).style.borderColor='red';
    element(id).style.color ='';
  }
   catch (er)
   {
   }
}

function normalcolorinput(id)
{
  try //for text
    {
     element(id+'_caption').style.color='';
    }
  catch (er)
    {
    };

//  element(id).style.borderWidth='0px';
//  element(id).style.borderColor='';
//  element(id).style.color ='';
    try
     {
       element(id).style.className = 'formstyle1';
       element(id).style.borderColor='';
     }
    catch(er)
    {
    }

}

function hide(id)
{
  element(id).style.display='none';
}

function show(id)
{
  element(id).style.display='block';
}

function swap(id)
{
  element(id).style.display = (element(id).style.display=='none')?'block':'none';
}

function stateShow(val)
{

  element('state_select').style.display=(val==223)?'block':'none';
  element('state_input').style.display=(val!=223)?'block':'none';

}

hide_popup_timeout = 20; // seconds;

  function hide_popup(id)
 {
   tim =  setTimeout ("hide('"+id+"');clearTimeout(tim)", hide_popup_timeout * 1000);
 }

  function hide_popup_checkUsername()
 {
  hide_popup('checkUsername');
 }

  function hide_popup_checkEmail()
 {
  hide_popup('checkEmail');
 }

  function hide_popup_checkBirthdate()
 {
  hide_popup('checkBirthDate');
 }

 function checkUsername_ (type_)
 {
  	todo = 0;
  	if (type_==1)
    	{
     		c = element('username').value;
     		todo = (c.length > 3);
    	}
   	else
    	{
      		todo = true;
    	}

  	if (todo)
    	{
     		element('checkUsername').innerHTML='<span style="color:gray">checking...</span>';
     		setCallBack('hide_popup_checkUsername()');
     		hide('popupUsername');
     		show('checkUsername');
     		sendData(validatePage + '?type=username&value='+ element('username').value,'checkUsername');
    	}
 }

 function checkEmail_ (type_)
 {
  todo = 0;
  if (type_==1)
    {
     c = element('username').value;
     todo = (c.length > 5);
    }
    else
    {
     todo = true;
    }

  if (!todo)
     {
      element('checkEmail').innerHTML='<span style="color:gray">checking...</span>';
      show('checkEmail');
      setCallBack('hide_popup_checkEmail()');
      sendData(validatePage + '?type=email&value='+ element('emailvalue').value,'checkEmail');
     }
 }





 function checkBirthdate_ ()
 {
     setCallBack('hide_popup_checkBirthdate()');

     if (element('BirthDateYear').value!='')
     {
     element('checkBirthDate').innerHTML='<span style="color:gray">checking...</span>';
     hide('popupBirthDate');
     show('checkBirthDate');
     sendData(validatePage + '?type=adult&year='+element('BirthDateYear').value+'&month='+element('BirthDateMonth').value+'&day='+element('BirthDateDay').value,'checkBirthDate');
     }
 }
 
 function displayStateOptions(which){
 	if(which == "US"){
 		show("usState");
 		hide("caState");
 		hide("userState");
 		hide("chooseCountry");
 	}else if(which == "CAN"){
 		show("caState");
 		hide("usState");
 		hide("userState");
 		hide("chooseCountry");
 	}else if(which == "INTL"){
 		show("userState");
 		hide("caState");
 		hide("usState");
 		show("chooseCountry");
 	}
 }