function SetupTour(){
	// when the DOM is ready...
	$(document).ready(function () {
		var $panels = $('#slider .scrollContainer > div');
		var $container = $('#slider .scrollContainer');

		// if false, we'll float all the panels left and fix the width 
		// of the container
		var horizontal = true;

		// float the panels left if we're going horizontal
		if (horizontal) {
		  $panels.css({
		    'float' : 'left',
		    'position' : 'relative' // IE fix to ensure overflow is hidden
		  });

		  // calculate a new width for the container (so it holds all panels)
		  $container.css('width', $panels[0].offsetWidth * $panels.length);
		}

		// collect the scroll object, at the same time apply the hidden overflow
		// to remove the default scrollbars that will appear
		var $scroll = $('#slider .scroll').css('overflow', 'hidden');

		// apply our left + right buttons
		$scroll
		  .before('<img class="scrollButtons left" src="/images/Tour/prev_arrow.gif" />')
		  .after('<img class="scrollButtons right" src="/images/Tour/next_arrow.gif" />');

		// handle nav selection
		function selectNav() {
		  $(this)
		    .parents('ul:first')
		      .find('a')
		        .removeClass('selected')
		      .end()
		    .end()
		    .addClass('selected');
		}

		$('#slider .navigation').find('a').click(selectNav);

		// go find the navigation link that has this target and select the nav
		function trigger(data) {
		  var el = $('#slider .navigation').find('a[href$="' + data.id + '"]').get(0);
		  selectNav.call(el);
		}

		if (window.location.hash) {
		  trigger({ id : window.location.hash.substr(1) });
		} else {
		  $('ul.navigation a:first').click();
		}

		// offset is used to move to *exactly* the right place, since I'm using
		// padding on my example, I need to subtract the amount of padding to
		// the offset.  Try removing this to get a good idea of the effect
		var offset = parseInt((horizontal ? 
		  $container.css('paddingTop') : 
		  $container.css('paddingLeft')) 
		  || 0) * -1;


		var scrollOptions = {
		  target: $scroll, // the element that has the overflow

		  // can be a selector which will be relative to the target
		  items: $panels,

		  navigation: '.navigation a',

		  // selectors are NOT relative to document, i.e. make sure they're unique
		  prev: 'img.left', 
		  next: 'img.right',

		  // allow the scroll effect to run both directions
		  axis: 'xy',

		  onAfter: trigger, // our final callback

		  offset: offset,

		  // duration of the sliding effect
		  duration: 500,

		  // easing - can be used with the easing plugin: 
		  // http://gsgd.co.uk/sandbox/jquery/easing/
		  easing: 'swing'
		};

		// apply serialScroll to the slider - we chose this plugin because it 
		// supports// the indexed next and previous scroll along with hooking 
		// in to our navigation.
		$('#slider').serialScroll(scrollOptions);

		// now apply localScroll to hook any other arbitrary links to trigger 
		// the effect
		$.localScroll(scrollOptions);

		// finally, if the URL has a hash, move the slider in to position, 
		// setting the duration to 1 because I don't want it to scroll in the
		// very first page load.  We don't always need this, but it ensures
		// the positioning is absolutely spot on when the pages loads.
		scrollOptions.duration = 1;
		$.localScroll.hash(scrollOptions);

	});
}

function embedQuickIntro(html){
	$(html).modal({
       // position: [100,],
       closeHTML: "<a href='#' class='closeModal'>Close</a>"
     });
}

function modalVideo(html){
  $(html).modal({
    closeHTML: "<a href='#' class='closeModal'>Close</a>"
  })
}

function insertVideo(id, video){
	$(document).ready(function(){
		$(id).html(video)
	});
}


/* Copyright (c) 2006-2007 Mathias Bank (http://www.mathias-bank.de)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) 
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 * 
 * Version 2.1
 * 
 * Thanks to 
 * Hinnerk Ruemenapf - http://hinnerk.ruemenapf.de/ for bug reporting and fixing.
 * Tom Leonard for some improvements
 * 
 */
jQuery.fn.extend({
/**
* Returns get parameters.
*
* If the desired param does not exist, null will be returned
*
* To get the document params:
* @example value = $(document).getUrlParam("paramName");
* 
* To get the params of a html-attribut (uses src attribute)
* @example value = $('#imgLink').getUrlParam("paramName");
*/ 
 getUrlParam: function(strParamName){
	  strParamName = escape(unescape(strParamName));
	  
	  var returnVal = new Array();
	  var qString = null;
	  
	  if ($(this).attr("nodeName")=="#document") {
	  	//document-handler
		
		if (window.location.search.search(strParamName) > -1 ){
			
			qString = window.location.search.substr(1,window.location.search.length).split("&");
		}
			
	  } else if ($(this).attr("src")!="undefined") {
	  	
	  	var strHref = $(this).attr("src")
	  	if ( strHref.indexOf("?") > -1 ){
	    	var strQueryString = strHref.substr(strHref.indexOf("?")+1);
	  		qString = strQueryString.split("&");
	  	}
	  } else if ($(this).attr("href")!="undefined") {
	  	
	  	var strHref = $(this).attr("href")
	  	if ( strHref.indexOf("?") > -1 ){
	    	var strQueryString = strHref.substr(strHref.indexOf("?")+1);
	  		qString = strQueryString.split("&");
	  	}
	  } else {
	  	return null;
	  }
	  	
	  
	  if (qString==null) return null;
	  
	  
	  for (var i=0;i<qString.length; i++){
			if (escape(unescape(qString[i].split("=")[0])) == strParamName){
				returnVal.push(qString[i].split("=")[1]);
			}
			
	  }
	  
	  
	  if (returnVal.length==0) return null;
	  else if (returnVal.length==1) return returnVal[0];
	  else return returnVal;
	}
});

function getURLParam( name )
{
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
    return "";
  else
    return results[1];
}

function GetHubspotID() {
  var results = document.cookie.match ( '(^|;) ?hubspotutk=([^;]*)(;|$)' );
  if (results && results[2]) {
    $('#hubspot_user_token').val(results[2]);
  } else if (window['hsut']) {
    $('#hubspot_user_token').val(window['hsut']);
  }
  return true;
}

function SetVerticalHeightForList() {
  $("#user-types ul li.dummy").hide();
  $("#user-types ul li.dummy").height(0);
  $("#user-types ul li.last").addClass("rounded-bottom");
  var list_height = $("#user-types ul.ui-tabs-nav").height()
  var tab_height = $("#user-types div.tab:visible").height();
  if ((tab_height + 31) > list_height) {
    $("#user-types ul li.last").removeClass("rounded-bottom");
    $("#user-types ul li.dummy").show();
    var height = tab_height - list_height + 31;
    $("#user-types ul li.dummy").height(height);
  }
}

