/******************************************************************************
 **                     LP CONFIGURATION v4.0.r100521                        **
 **       Standard Version.  ©2010 Mediagistic.  All rights reserved.        **
 **                   http://www.mediagisticpageone.com                      **
 *****************************************************************************/

formExtEmail = 'dennis*amiair.com;corey*amiair.com';
formIntEmail = 'SEM*mediagisticleads.com';
formLeadCampaign = '213';
formAcctNumber = '194895';
GoogleAnalyticsUA = 'UA-23468640-1';

function MG_FormOptions() {
	this.isScheduler = false; // true opens scheduler section upon loading. false is default.
	this.showDate = true;
	this.showTime = true;
	this.showSaturday = true;
	this.showSunday = true;
	this.richAlerts = true;
}

// only modify these if we have conversion codes
function MG_ConversionData(){
	this.useCD = false;							// <', src: 'change to true if using WV conversion codes
	this.gID = 0000000000;						// <', src: 'should be a 10-digit INTEGER
	this.gLabel = "00000000000000000";			// <', src: 'format as STRING
	this.gValue = 0;							// <', src: 'will likely always be 0
	this.yID = "000000000000000000000000000";	// <', src: 'format as STRING
	this.mID = 587765;							// <', src: 'do not change
	this.mCP = 5050;							// <', src: 'do not change
	this.mParams = "dedup=1";					// <', src: 'do not change
}

function MG_RelevantCopy(){
	this.content = new Array;		
	this.content[0]  = 'nothing'; // if none, wipe out all other indices and set [0] as 'nothing'
}

function focusForm(){
	$.scrollTo( '#mg-formcontainer', 300, {offset:-50}, function(){
		$('#LeadName').focus();	
	});
	MG_formShowHide('mg-sched-options','chk');
	
	$('#trans').fadeIn(300);
	$('#mg-formcontainer').animate({marginLeft: '-300px'}).append('<a class="close" onclick="closeForm()"></a>');
}

function closeForm(){
	$('a.close').remove();	
	$('#mg-formcontainer').animate({marginLeft: '0px'}, function(){
		 	$('#mg-formcontainer').removeAttr("style")
	});
	MG_formShowHide('mg-sched-options','chk');
	$('#trans').fadeOut(300);	
}

$(document).ready(function() {                
	CallTrackNum = $('#ctnjs').val();
	 var num = $('#ctn').text();
	$('body *').replaceText( num, CallTrackNum );
	$('#trans').click(function(){
		closeForm();
	});
	$('.questions li').children('a').click(function(){
		var id = $(this).attr('href');
		$.scrollTo('#'+id, 300)
		return false;
	});
	$('.top').click(function(){
		$.scrollTo('#wrapper', 300)
		return false;
	});
});

(function($){
'$:nm'; 
 $.fn.replaceText = function( search, replace, text_only ) {
	 if(!search)return false;
    return this.each(function(){
      var node = this.firstChild,
        val,
        new_val,
        remove = [];
      if ( node ) {        
        // Loop over all childNodes.
        do {
          if ( node.nodeType === 3 ) {
            val = node.nodeValue;
            new_val = val.replace( search, replace );
            if ( new_val !== val ) {              
              if ( !text_only && /</.test( new_val ) ) {
                $(node).before( new_val );                
                remove.push( node );
              } else {
                node.nodeValue = new_val;
              }
            }
          }          
        } while ( node = node.nextSibling );
      }
      remove.length && $(remove).remove();
    });
  };  
})(jQuery);

