var ratingComplete = false;
//this is for the rating submission, this enforces a rating be submitted with a review
function checkRating(){
	// called from ars.ajax.proc.php - line 61
	//alert("Completed: " + document.form1.texty.value.length);
	//return false;
	if(ratingComplete == false){
		alert("Please fill out a rating for your review to show up");
		return false;
	}
	else if(document.form1.texty.value.length < 75){
		alert("Your review does not meet the minumum length, please add to it.");
		return false;
	}
	else{
		//alert("Your review will be submitted and posted as pending until approved.");
		return true;
	}
}

var cleared = false;
//clears the review box, but only on the first click
function clearBox(){
	
	if(cleared == false){
		document.form1.texty.value = "";
		cleared = true;
	}	
	
	return;
}

//============================================================================================

var ContentHeight = 200;
var TimeToSlide = 250.0;

var openAccordion = '';

function runAccordion(){
  var nID = "subContentDiv";
  if(openAccordion == nID)
    nID = '';
    
  setTimeout("animate(" 
      + new Date().getTime() + "," + TimeToSlide + ",'" 
      + openAccordion + "','" + nID + "')", 33);
  
  openAccordion = nID;
}

function animate(lastTick, timeLeft, closingId, openingId)
{  
  var curTick = new Date().getTime();
  var elapsedTicks = curTick - lastTick;
  
  var opening = (openingId == '') ? 
      null : document.getElementById(openingId);
  var closing = (closingId == '') ? 
      null : document.getElementById(closingId);
 
  if(timeLeft <= elapsedTicks)
  {
    if(opening != null)
      opening.style.height = ContentHeight + 'px';
    
    if(closing != null)
    {
      closing.style.display = 'none';
      closing.style.height = '0px';
    }
    return;
  }
 
  timeLeft -= elapsedTicks;
  var newClosedHeight = 
      Math.round((timeLeft/TimeToSlide) * ContentHeight);

  if(opening != null)
  {
    if(opening.style.display != 'block')
      opening.style.display = 'block';
    opening.style.height = 
        (ContentHeight - newClosedHeight) + 'px';
  }
  
  if(closing != null)
    closing.style.height = newClosedHeight + 'px';

  setTimeout("animate(" + curTick + "," + timeLeft + ",'" 
      + closingId + "','" + openingId + "')", 33);
}

function show(id)
{
	el = document.getElementById(id);
	if (el.style.display == 'none')
	{
		el.style.display = '';
		el = document.getElementById('more' + id);
	} else {
		el.style.display = 'none';
		el = document.getElementById('more' + id);
	}
}
