
      var isIE5=navigator.userAgent.toUpperCase().indexOf("MSIE 5")!=-1;

      var targetElementID="toend", targetElementStyleOffset=0;

      function adjustHeight() {
       if (document.getElementById) {
         var targetElement=document.getElementById(targetElementID),
           documentHeight, totalOffset;

       if (targetElement && document.documentElement.offsetHeight
         && targetElement.offsetHeight && targetElement.offsetTop) {
          documentHeight=document.documentElement.offsetHeight;
         if (targetElement.offsetHeight<documentHeight-targetElement.offsetTop) {
        if (isIE5)
          totalOffset=targetElement.offsetTop;
          else totalOffset=targetElement.offsetTop+targetElementStyleOffset;
        targetElement.style.height=String(documentHeight-totalOffset)+'px';
      }
    }
  }
}

      window.onresize=adjustHeight;
      window.onload=adjustHeight;

			
			
			

var W3CDOM = (document.getElementsByTagName && document.createElement);

window.onload = function () {
	document.forms[0].onsubmit = function ()	{
		return validate()
	}
	showPrice();
        showHousing();
}

function init ()
{
	document.forms[0].onsubmit = function () {
		return validate()
	}
	showPrice();
        showHousing();
}

function validate()
{
	validForm = true;
	firstError = null;
	errorstring = '';
	var x = document.forms[0].elements;
	var onereg = new Array("firstname", "lastname", "email", "email2", "gender", "city", "state", "country", "zip", "housing");
	//create an array of required fields, cycle through each looking for values
		for (i=0;i<onereg.length;i++)
		{
			if (!x[onereg[i]].value) writeError(x[onereg[i]],'Required Field');
		}
		if (x['email'].value.indexOf('@') == -1)
			writeError(x['email'],'Not a valid Email');
		if (x['email2'].value != x['email'].value)
		    writeError(x['email2'],'Emails do not match');
		if (x['shirta'].value && !x['shirtb'].value)
			writeError(x['shirtb'],'Size is required');
/*
		if (!x['bluespartner'].value && x['bluescontest'].checked)
			writeError(x['bluespartner'],'Name required');	
		if (!x['lindypartner'].value && x['lindycontest'].checked)
			writeError(x['lindypartner'],'Name required');	
		if (!x['fastpartner'].value && x['fastcontest'].checked)
			writeError(x['fastpartner'],'Name required');	
		if (!x['jjlevel'].value && x['jjcontest'].checked)
			writeError(x['jjlevel'],'Level required');	
		if (!x['jjleader'].value && x['jjcontest'].checked)
			writeError(x['jjleader'],'Required');	
*/
		if (!W3CDOM)
		alert(errorstring);
		if (firstError)
			firstError.focus();
		if (validForm)
			{
			document.personal.submit();
			}
		return false; // return false anyway to prevent actual form submission. Don't do this at home!
}
	
//end of validate function

function writeError(obj,message)
{
	validForm = false;
	if (obj.hasError) return;
	if (W3CDOM)
	{
		obj.className += ' error';
		obj.onchange = removeError;
		var sp = document.createElement('span');
		sp.className = 'error';
		sp.appendChild(document.createTextNode(message));
		obj.parentNode.appendChild(sp);
		obj.hasError = sp;
		showHousing();
	}
	else
	{
		errorstring += obj.name + ': ' + message + '\n';
		obj.hasError = true;
	}
	if (!firstError)
		firstError = obj;
}

function removeError()
{
	this.className = this.className.substring(0,this.className.lastIndexOf(' '));
	this.parentNode.removeChild(this.hasError);
	this.hasError = null;
	this.onchange = null;
	showHousing();
}

function showHousing()
{
   document.getElementById('guest').style.display = 'none';
   document.getElementById('host').style.display = 'none';
   document.getElementById('hotel').style.display = 'none';
   if (document.forms[0].elements['housing'].value == 'need') 
	   {
       document.getElementById('guest').style.display = 'block'; 
	   }
   if (document.forms[0].elements['housing'].value == 'canhouse') 
	   {
  		 document.getElementById('host').style.display = 'block';
		 }
   if (document.forms[0].elements['housing'].value == 'hotel') 
	   {
  		 document.getElementById('hotel').style.display = 'block';
		 }
}  





function showClasses()
{
   document.getElementById('allClasses').style.display = 'none';
   if (document.forms[1].elements['pass_type'].value == 'AllAccess') 
	   {
       document.getElementById('allClasses').style.display = 'block'; 
	   }
}  


function showPrice()
{
   var check = 100.00;
   var paypal = 100.00;
   var shirta = document.forms[0].elements['shirta'].value;
   var payment = document.forms[0].elements['payment'].value;  
   var student = document.forms[0].elements['student'].value;   
	 
	 var shirta = document.forms[0].elements['shirta'].value;   
	 var hidden = document.forms[0].elements['shirtb'].value;   
	 var regtype = document.forms[0].elements['regtype'].value;   
	 var costb = document.forms[0].elements['costb'].value;   
	 var shirtacost = document.forms[0].elements['shirtacost'].value;   
	 var studentdiscount = document.forms[0].elements['studentdiscount'].value;   
	 var basediscount = document.forms[0].elements['basediscount'].value;   
	 var regDisc = document.forms[0].elements['regDisc'].value;   
	 
	 
   if (shirta) {if (shirta == 'T-shirt') {var shirtacost = 15; } 
     else {var shirtacost = 15; } }
	else { var shirtacost = 0; }
	
	
	
	var d = new Date();

var curr_date = d.getDate();
var curr_month = (1+d.getMonth());
var curr_year = d.getFullYear();
var regType = "allAccess";

if (curr_month < 10) {var today =(curr_year + "0" + curr_month + curr_date);}
else {var today =(curr_year + curr_month + curr_date);}


var insBirdEnd       =("20081011");
var earlyBirdEnd     =("20081108");
var oversleptBirdEnd =("20081206");
var slackerBirdEnd   =("20090106");


if (today < insBirdEnd) {
		var basediscount = 75;
		var studentdiscount = 0;
		var regDisc = "Insomnia Bird";
}

else if (today < earlyBirdEnd)  {
		var basediscount = 50;
		var studentdiscount = 25;
		var regDisc = "Early Bird";
}

else if (today < oversleptBirdEnd)  {
		var basediscount = 25;
		var studentdiscount = 25;
		var regDisc = "Overslept Bird";
}

else if (today < slackerBirdEnd)  {
		var basediscount = 0;
		var studentdiscount = 25;
		var danceOnly = 80
		var danceFri = 25
		var danceSat = 30
		var danceSun = 25
		var regDisc = "Slacker Bird";}
	
	
	
	
	
  if (student == 'no') {var studentdiscount = 0; } 
	
	var costb = 175 + shirtacost - studentdiscount - basediscount;
	
   /*
   if (document.forms[0].elements['jjcontest'].checked) { costb = costb + 5; }
   if (document.forms[0].elements['solocontest'].checked) { costb = costb + 5; }
   if (document.forms[0].elements['bluescontest'].checked) { costb = costb + 5; }
   if (document.forms[0].elements['lindycontest'].checked) { costb = costb + 5; }
   if (document.forms[0].elements['fastcontest'].checked) { costb = costb + 5; }
   */
   var costc = costb;
   document.getElementById('currenttotal').innerHTML = "Total: $"+costc ;
	 document.getElementById('shirta').innerHTML = shirta ;
	 document.getElementById('hidden').innerHTML = "<input type='hidden' id='shirtb' name='shirtb' value='" + shirtb + "' />" ;
	 document.getElementById('regtype').innerHTML = "<input type='hidden' id='regtype' name='regtype' value='" + regtype + "' />" ;
	 document.getElementById('costb').innerHTML = "<input type='hidden' id='costb' name='costb' value='" + costb + "' />" ;
	 document.getElementById('shirtacost').innerHTML = "<input type='hidden' id='shirtacost' name='shirtacost' value='" + shirtacost + "' />" ;
	 document.getElementById('studentdiscount').innerHTML = "<input type='hidden' id='studentdiscount' name='studentdiscount' value='" + studentdiscount + "' />" ;
	 document.getElementById('basediscount').innerHTML = "<input type='hidden' id='basediscount' name='basediscount' value='" + basediscount + "' />" ;
	 document.getElementById('regDisc').innerHTML = "<input type='hidden' id='regDisc' name='regDisc' value='" + regDisc + "' />" ;
}


function populate(o) {
  d=document.getElementById('de');
  if(!d){return;}                 
  var mitems=new Array();
  mitems['Select']=[''];
  mitems['By car']=['Select','I need a ride.','I will drive but I only have room for myself.','I will drive. I can take 1 extra person.','I will drive. I can take 2 people.','I will drive. I can take 3 people.','I will drive. I can take 4 people.','I will drive. I can take 5 or more people.'];
  mitems['By airplane']=['Select','I plan to fly into San Diego (SAN)','I plan to fly into Orange County (John Wayne)','I plan to fly into Los Angeles (LAX)','I plan to fly into Ontario (ONT)','I plan to fly into Burbank/Bob Hope Airport','I plan to fly into an airport not listed here'];
  mitems['By party bus']=['From which city?','From Seattle (approx $200)','From Portland (approx $200)','From San Francisco (approx $200)'];
  d.options.length=0;
  cur=mitems[o.options[o.selectedIndex].value];
  if(!cur){return;}
  d.options.length=cur.length;
  for(var i=0;i<cur.length;i++) {
    d.options[i].text=cur[i];
    d.options[i].value=cur[i];
  }
}


