function checkform() {
  for (i=0;i<fieldstocheck.length;i++) {
    if (eval("document.subscribeform.elements['"+fieldstocheck[i]+"'].type") == "checkbox") {
      if (document.subscribeform.elements[fieldstocheck[i]].checked) {
      } else {
        alert("Please enter your "+fieldnames[i]);
        eval("document.subscribeform.elements['"+fieldstocheck[i]+"'].focus()");
        return false;
      }
    }
    else {
      if (eval("document.subscribeform.elements['"+fieldstocheck[i]+"'].value") == "") {
        alert("Please enter your "+fieldnames[i]);
        eval("document.subscribeform.elements['"+fieldstocheck[i]+"'].focus()");
        return false;
      }
    }
  }
  for (i=0;i<groupstocheck.length;i++) {
    if (!checkGroup(groupstocheck[i],groupnames[i])) {
      return false;
    }
  }
  
  if(! compareEmail())
  {
    alert("Email Addresses you entered do not match");
    return false;
  }
  return true;
}

var fieldstocheck = new Array();
var fieldnames = new Array();
function addFieldToCheck(value,name) {
  fieldstocheck[fieldstocheck.length] = value;
  fieldnames[fieldnames.length] = name;
}
var groupstocheck = new Array();
var groupnames = new Array();
function addGroupToCheck(value,name) {
  groupstocheck[groupstocheck.length] = value;
  groupnames[groupnames.length] = name;
}

function compareEmail()
{
  return (document.subscribeform.elements["email"].value == document.subscribeform.elements["emailconfirm"].value);
}
function checkGroup(name,value) {
  option = -1;
  for (i=0;i<document.subscribeform.elements[name].length;i++) {
    if (document.subscribeform.elements[name][i].checked) {
      option = i;
    }
  }
  if (option == -1) {
    alert ("Please enter your "+value);
    return false;
  }
  return true;
}

/*     FLASH CONTENT     */


function flashLoader(flashMovie, flashVars, flashHeight, flashWidth, flashAlign, flashQuality, flashBGColor, flashID, flashScale) {
	var flashPluginSpace = 'http://www.macromedia.com/go/getflashplayer';
	document.write('<OBJECT type="application/x-shockwave-flash"  classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" WIDTH="' + flashWidth + '" HEIGHT="' + flashHeight + '" id="' + flashID + '" ALIGN="' + flashAlign + '">');
	document.write('<PARAM NAME="FlashVars" VALUE="' + flashVars + '">');
	document.write('<PARAM NAME="movie" VALUE="' + flashMovie + '">');
	document.write('<PARAM NAME="quality" VALUE="' + flashQuality + '">');
	if (flashScale == null) {
	    var flashScale = '';
	    var flashScaleParam = '';
	} else {
    	document.write('<PARAM NAME="scale" VALUE="' + flashScale + '">');
        var flashScaleParam = ' scale="' + flashScale + '"';
	}
	document.write('<PARAM NAME="bgcolor" VALUE="' + flashBGColor + '">');
	document.write('<param name="wmode" value="transparent">');
	document.write('<param name="allowScriptAccess" value="always">');
	document.write('<EMBED src="' + flashMovie + '" quality="' + flashQuality + '"' + flashScaleParam + ' bgcolor="' + flashBGColor + '"  WIDTH="' + flashWidth + '" HEIGHT="' + flashHeight + '" NAME="' + flashID + '" ALIGN="' + flashAlign + '" TYPE="application/x-shockwave-flash" PLUGINSPAGE="' + flashPluginSpace + '" FlashVars="' + flashVars + '" wmode="transparent" allowScriptAccess="always"></EMBED>');
	document.write('</OBJECT>');
}

/*     TESTIMONIAL ROTATOR     */

// JavaScript Document
(function($){
  $.fn.quotator = function(options){
    var container = this;
    var defaults = 
    {
      speed : 10000,
      json : "http://www.get-it-together-llc.com/scripts/about_testimonials.js"
    }
    
    var options = $.extend(defaults, options);
    
    var quotes_json = options.json;
    var quotes;
    
    $.getJSON(quotes_json, function(data){
    var quotesobject = eval(data.quotes);
    var index = Math.floor(Math.random()*3);
    
    
    setInterval(changeQuote, options.speed);
    
    container.html(quotesobject[index].quote + "<div id='author'>" + quotesobject[index].author + "</div>");
    
    
    function changeQuote(){
      container.fadeOut(function(){
        container.html(quotesobject[index].quote + "<div id='author'>" + quotesobject[index].author + "</div>").fadeIn();
      });
      
      if(index == quotesobject.length - 1){
        index = Math.floor(Math.random()*3);
      } else{
        index++;
      }
    }
      
  });
  return container;
}
})(jQuery);
