function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

var cookieCheck = readCookie('smmpopupcookie');
if (!cookieCheck){

if (typeof window.awf_Form_=='undefined') window.awf_Form_ = new Object();
awf_Form_.isPreview = false;
awf_Form_.setCookie = function(name, value, expires, path, domain, secure) {
    var curCookie = name + "=" + escape(value) +
        ((expires) ? "; expires=" + expires.toGMTString() : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
    document.cookie = curCookie;
}

awf_Form_.getCookie = function(name) {
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1) {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
    } else
        begin += 2;
    var end = document.cookie.indexOf(";", begin);
    if (end == -1)
        end = dc.length;
    return unescape(dc.substring(begin + prefix.length, end));
}
awf_Form_.showForm = function() {
    /*@cc_on
    /*@if (@_jscript_version > 5.5)
           var isIE = true;
      @else
           var deprecatedBrowser = true;
      @end @*/
    if (typeof isIE == 'undefined') {
        var isIE = false;
    }
    if (!isIE && !window.XMLHttpRequest) {
        var deprecatedBrowser = true;
    }
    if (deprecatedBrowser) {
       window.open('http://www.stockmarketmentor.com/public/OptinPopup.html','winPopUp','resizable=1,scrollbars=1,location=0,width=404,height=606');
       return true;
    }
    // Exit early for TY Landing Page option
    if (document.location.href.indexOf('meta_web_form_id') > 0) return;

    if (typeof awf_Form_.scriptAppended=='undefined') {
        try {
            var script = document.createElement('script');
            script.src = "http://forms.aweber.com/form/styled_popovers_and_lightboxes.js";
            script.type = 'text/javascript';
            document.getElementsByTagName('HEAD')[0].appendChild(script);
        } catch(e) {
            //IE5 for Mac and IE timeout issues
            try {
                document.write('<script type="text/javascript" src="' + src + '"></scr'+'ipt>');
            } catch(e) { }
        }
        awf_Form_.scriptAppended = true;
    }
    var loadForm = function() { 
    
    //awf_Form_.form = new awf_Form_.AWFormGenerator( {"_log":null,"id":"57028508","form":"<form method=\"post\" class=\"af-form-wrapper\" action=\"http:\/\/www.aweber.com\/scripts\/addlead.pl\"  >\n<div id=\"af-form-57028508\">\n<div id=\"OptinPopupC\">\n<input type=\"hidden\" name=\"meta_web_form_id\" value=\"57028508\" \/>\n<input type=\"hidden\" name=\"meta_split_id\" value=\"\" \/>\n<input type=\"hidden\" name=\"listname\" value=\"mentor_leads\" \/>\n<input type=\"hidden\" name=\"redirect\" value=\"http:\/\/www.stockmarketmentor.com\/public\/247.cfm\" id=\"redirect_ab0bcdda4e0580b32e2f4c1b455d516c\" \/>\n<input type=\"hidden\" name=\"meta_adtracking\" value=\"Chart_of_the_Day_Lightbox\" \/>\n<input type=\"hidden\" name=\"meta_message\" value=\"1\" \/>\n<input type=\"hidden\" name=\"meta_required\" value=\"name,email\" \/>\n<input type=\"hidden\" name=\"meta_tooltip\" value=\"\" \/>\n<div id=\"af-form-57028508_2\"><div class=\"af-element\">\n<label class=\"previewLabel\" for=\"awf_field-9240576\">\n<b>Name:<\/b>\n<\/label>\n<br \/>\n<input id=\"awf_field-9240576\" type=\"text\" name=\"name\" class=\"text\" value=\"\"  tabindex=\"500\" \/>\n<\/div>\n<div class=\"af-element\">\n<label class=\"previewLabel\" for=\"awf_field-9240578\">\n<b>Email Address:<\/b>\n<\/label>\n<br \/>\n<input class=\"text\" id=\"awf_field-9240578\" type=\"text\" name=\"email\" value=\"\" tabindex=\"600\"  \/>\n<\/div>\n<div class=\"af-element\">\n<input name=\"submit\" class=\"submit\" type=\"image\" src=\"http:\/\/www.stockmarketmentor.com\/public\/images\/smmOptinBtn.png\" value=\"\" tabindex=\"601\" \/>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/form>\n","styles":"#af-form-57028508 {width:443px;height:606px;background:url('http:\/\/www.stockmarketmentor.com\/public\/images\/OptinPopupBg.png') 0 0 no-repeat;font-family:arial;position:relative;}\n#OptinPopupC .af-element {color:#DF0000;font-size:12px;margin-bottom:10px;}\n#awf_field-9240578 {width:90%;padding:3px;border:1px solid #000;}\n#awf_field-9240576 {width:90%;padding:3px;border:1px solid #000;}\n\n#af-form-57028508_2 {width:230px;height:120px;position:absolute;top:400px;left:200px;}\n","height":"606","width":"404","plPath":"forms.aweber.com","delay":"3","popupURL":"http:\/\/www.stockmarketmentor.com\/public\/OptinPopup.html","formType":"lightbox","animation":"fade in","redirectId":"redirect_ab0bcdda4e0580b32e2f4c1b455d516c","returnToPage":0}  ); 

	var utmc= $.getUrlVar('utm_campaign');

	var ls = 18;
	if(utmc)
	{
	if(utmc.indexOf("fb_") > -1)
		ls = 16;
	else if(utmc.indexOf("cotd_run") > -1)
		ls = 20;
	else if(utmc.indexOf("adword") > -1)
		ls = 14;
	} 
 
    awf_Form_.form = new awf_Form_.AWFormGenerator( {"_log":null,"id":"57028508","form":"<form method=\"post\" class=\"af-form-wrapper\" action=\"https://stockmarket.infusionsoft.com/app/form/process/684c722a5d56b69b8e97fcfed12355e4\" >\n<div id=\"af-form-57028508\" name=\"Chart of the Day\"><div id=\"OptinPopupC\"><input name=\"inf_form_xid\" type=\"hidden\" value=\"684c722a5d56b69b8e97fcfed12355e4\" /><input name=\"inf_form_name\" type=\"hidden\" value=\"Chart of the Day\" />    <input id=\"_utmcampaign\" name=\"inf_custom_utmcampaign\" type=\"hidden\" value=\"" + utmc + "\" /><input id=\"LeadSourceId\" name=\"inf_field_LeadSourceId\" type=\"hidden\" value=\"" + ls + "\" /><input name=\"infusionsoft_version\" type=\"hidden\" value=\"1.23.8.42\" /><div id=\"af-form-57028508_2\"><div class=\"af-element\"><label class=\"previewLabel\" for=\"awf_field-9240576\"><b>Name:</b></label><br /><input id=\"inf_field_FirstName\" type=\"text\" name=\"inf_field_FirstName\" class=\"text\" value=\"\"  tabindex=\"500\" /></div><div class=\"af-element\"><label class=\"previewLabel\" for=\"awf_field-9240578\"><b>Email Address:</b></label><br /><input class=\"text\"  type=\"text\" id=\"inf_field_Email\" name=\"inf_field_Email\"  value=\"\" tabindex=\"501\"  /></div><div class=\"af-element\"><input name=\"submit\" class=\"submit\" type=\"image\" src=\"http://www.stockmarketmentor.com/public/images/smmOptinBtn.png\" value=\"\" tabindex=\"502\" /><br><a href=\"http://www.stockmarketmentor.com/public/department12.cfm\" target=\"_self\">Privacy Policy</a></div></div></div></div></form>\n","styles":"#af-form-57028508 {width:443px;height:606px;background:url('http:\/\/www.stockmarketmentor.com\/public\/images\/OptinPopupBg.png') 0 0 no-repeat;font-family:arial;position:relative;}\n#OptinPopupC .af-element {color:#DF0000;font-size:12px;margin-bottom:10px;}\n#awf_field-9240578 {width:90%;padding:3px;border:1px solid #000;}\n#awf_field-9240576 {width:90%;padding:3px;border:1px solid #000;}\n\n#af-form-57028508_2 {width:230px;height:120px;position:absolute;top:400px;left:200px;}\n","height":"606","width":"404","plPath":"forms.aweber.com","delay":"3","popupURL":"http:\/\/www.stockmarketmentor.com\/public\/OptinPopup.html","formType":"lightbox","animation":"fade in","redirectId":"redirect_ab0bcdda4e0580b32e2f4c1b455d516c","returnToPage":0} ); 

    };
    if (typeof awf_Form_.AWFormGenerator == 'undefined') {
        var unique_track = new Image();
        unique_track.src = "http://forms.aweber.com/form/displays.htm?id=rOwMTBysDBw=";
        if (typeof awf_Form_.FormQueue == 'undefined') { awf_Form_.FormQueue = []; }
        awf_Form_.FormQueue.push(loadForm);
    } else {
        var unique_track = new Image();
        unique_track.src = "http://forms.aweber.com/form/displays.htm?id=rOwMTBysDBw=";
        loadForm();
    }
}

if ((awf_Form_.isPreview || !awf_Form_.getCookie('awpopup_57028508')) && typeof hide_awf_Form=='undefined') {
    awf_Form_.currDate = new Date();
    awf_Form_.currDate.setTime(awf_Form_.currDate.getTime() + 86400000);        
    awf_Form_.setCookie('awpopup_57028508', '1', awf_Form_.currDate, '/', document.domain, 0);
    awf_Form_.showForm();
}

}else{
}
