var tsDur = 9000;
var tsTransDur = 1.0;

function insertScreencast() {
var agent=navigator.userAgent.toLowerCase();
var is_iphone = (agent.indexOf('iphone')!=-1);
if (is_iphone) {return;}

document.write('<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" width="320" height="476">');
document.write('<param name="src" value="/images/products/gtk/screencast-static.jpg">');
document.write('<param name="href" value="http://assets.guitartoolkit.com/GTK122ScreencastL5.mov">');
document.write('<param name="target" value="myself">');
document.write('<param name="autoplay" value="true">');
document.write('<param name="controller" value="false">');
document.write('<param name="pluginspage" value="http://www.apple.com/quicktime/download/index.html">');
document.write('<param name="type" value="video/quicktime">');
document.write('<embed src="/images/products/gtk/screencast-static.jpg" href="http://assets.guitartoolkit.com/GTK122ScreencastL5.mov" target="myself" width="320" height="476" autoplay="true" controller="false" bgcolor="000000" showlogo="false" border="0" pluginspage="http://www.apple.com/quicktime/download/index.html" type="video/quicktime"></embed>');
document.write('</object>\n');
}

function showActivityIndicator() {
  $('form_submit_button').disable();
  $('form_activity').show();
}

function hideActivityIndicator() {
  $('form_activity').hide();
  $('form_submit_button').enable();
}

function prepTestimonial() {
  setTimeout('rotateTestimonial()', tsDur);
}
function rotateTestimonial() {
  Effect.Fade('testimonial', {duration: tsTransDur, afterFinish: function() {newTestimonial();}});  
}
function newTestimonial() {
  var rn = Math.floor(Math.random() * ts.length);
  nt = ts[rn];
  $('testimonial').innerHTML = "&ldquo;"+nt[0]+"&rdquo;";
  Effect.Appear('testimonial', {duration: tsTransDur});
  setTimeout('rotateTestimonial()', tsDur);
}
function validateSupportForm() {
  showActivityIndicator();
  t = $F('ticket_ticket_type');
  b = $F('ticket_body');
  e = $F('ticket_email');
  
  if ((t=="") || (b=="") || (e=="")) {
    alert("Sorry, all fields are required");
    hideActivityIndicator();
    return false;
  }
  if ((e.indexOf(" ")!=-1) || (e.indexOf("@") == -1) || (e.indexOf(".") == -1)) {
    alert("Sorry, invalid email address");
    hideActivityIndicator();
    return false;
  }
}
