/******************************************************************************
 **                     LP CONFIGURATION v4.0.r100521                        **
 **       Standard Version.  ©2010 Mediagistic.  All rights reserved.        **
 **                   http://www.mediagisticpageone.com                      **
 *****************************************************************************/

formExtEmail = 'juanita*gentryheatinginc.com;ksmith*gentryheatinginc.com;duane*gentryheatinginc.com';
formIntEmail = 'SEM*mediagisticleads.com';
formLeadCampaign = '219';
formAcctNumber = '101459';
GoogleAnalyticsUA = 'UA-23931488-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( '#wrapper', 300, function(){
		$('#LeadName').focus();	
	});
	MG_formShowHide('mg-sched-options','chk');
	
	$('#wrapper').append('<div id="trans"></div>');
	$("div#mg-formcontainer, div#trans").fadeIn(300);	
	$('div#mg-sched-wrap').append('<a class="close" onclick="closeForm()"></a>');
	$("#btnSubmit").val('');
}
function closeForm(){
	$('a.close').remove();	
	$("div#mg-formcontainer").fadeOut(300);
	$("div#trans").fadeOut(300, function(){
		$(this).remove();	
	});
}
$(document).ready(function() {     
$('#wrapper').append('<div id="mg-formcontainer" style="display:none" class="numbertwo"></div>'); 
	setTimeout(function(){
		$("#btnSubmit").val('');	
	}, 100);
	 var ctn = $('#ctn').val();    
	 var num = $('#rn').text();
	$('body *').replaceText( num, ctn );
	$('#trans').live('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);

