/******************************************************************************
 **                     LP CONFIGURATION v4.0.r100521                        **
 **       Standard Version.  ©2010 Mediagistic.  All rights reserved.        **
 **                   http://www.mediagisticpageone.com                      **
 *****************************************************************************/

formExtEmail = 'service*airspecialist.com';
formIntEmail = 'semannualplans*mediagisticleads.com';
formLeadCampaign = '147';
formAcctNumber = '113933';
GoogleAnalyticsUA = 'UA-6058692-55';
 

function MG_FormOptions() {
	this.isScheduler = true; // 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 useForm(){
	$.scrollTo( '#header', 300, function(){
		$('#LeadName').focus();	
	});
	if ( $.browser.msie ) { 
		$("div#mg-formcontainer, div#overlay").show();	
	}else{
		$("div#mg-formcontainer, div#overlay").fadeIn(300);	
	}
	$('div#mg-formcontainer').append('<a class="close" onclick="closeForm()" title="Close Form"></a>');
}
function closeForm(){
	$('a.close').remove();	
	if ( $.browser.msie ) { 
		$("div#mg-formcontainer, div#overlay").hide();	
	}else{
		$("div#mg-formcontainer, div#overlay").fadeOut(300);	
	}
}
$(document).ready(function() {	
	setTimeout(function(){
		$('#btnSubmit').val('');	
	},30);
	$('div#overlay').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;
	});
	var CallTrackNum = $('#rtn').val();
	var num = $('#ctn').text();
	if(CallTrackNum && num && CallTrackNum != num){
		$('body *').replaceText( num, CallTrackNum );
	}
	if ( $.browser.msie && $.browser.version <=7) {
		$('ul#menu li').hover(function () {    	
    		$('ul', this).css('display', 'block');
  		}, function () {    	
     			$('ul', this).hide();
  		});
	}else{

  		$('ul#menu li').hover(function () {
    		clearTimeout($.data(this, 'timer'));
    		$('ul', this).stop(true, true).slideDown(200).css('zIndex', 100);
  		}, function () {
    		$.data(this, 'timer', setTimeout($.proxy(function() {
     			$('ul', this).stop(true, true).slideUp(200).css('zIndex', 1);
    		}, this), 200));
  		});
	}
});

(function($){
 '$:nm'; 
 $.fn.replaceText = function( search, replace, text_only ) {
	if(!search||!replace)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);
