    var posted_comment = false;
    var posted_shared_tip = false;
    var posted_shared_tip_comment = false;
    var max_length_message = "Your tip title may not exceed 40 characters including space.";
    
/* BEGIN comment */

	function showCommentBox() {
        
        //hide our asset since it messes with the thickbox
        if (document.getElementById("tips_main_asset_div")) {
            var main_div_asset = document.getElementById("tips_main_asset_div");
            main_div_asset.style.visibility = "hidden";
        }
        
        //hide our top banner ad asset since it messes with the thickbox
        if (document.getElementById("topBannerAd")) {
            var top_banner = document.getElementById("topBannerAd");
            top_banner.style.visibility = "hidden";
        }
        
        //hide our top right rail ad asset since it messes with the thickbox
        if (document.getElementById("tips_topbar_right")) {
            var tips_topbar_right = document.getElementById("tips_topbar_right");
            tips_topbar_right.style.visibility = "hidden";
        }
        
        //hide our second right rail ad asset since it messes with the thickbox
        if (document.getElementById("yrail_ads")) {
            var right_rail_ad = document.getElementById("yrail_ads");
            right_rail_ad.style.visibility = "hidden";
        }
        
		$('#comment_box').css('display', 'block');
	}
    
    function postComment() {
        
        var comment = document.getElementById('tv_comment').value;

        if (comment.length > 250) {
            alert(max_length_message + "  You entered " + comment.length + ".");
        } else if (comment.length == 0) {
            alert("please enter a comment.");
        } else {
            var get_string = tv_base_url + "/index.php/tips/tip/action/postComment/tip_id/" + tv_tip_id + "/msg/"  + escape(comment);
            $.get(get_string, function(data) {
                if (data != 'false') {
                    $('#comment_box').css('display', 'none');
                    $('#comment_success').css('display', 'block');
                    document.getElementById('tv_comment').value = '';
                    posted_comment = true;
                } else {
                }
            });
        }
    }
    
    function cancelComment() {
        tb_remove();
        if (posted_comment) {
            window.location.reload();
        }
    }
    
/* END comment */
/* BEGIN shared tip */
	function showShareTipBox() {

        //hide our asset since it messes with the thickbox
        if (document.getElementById("tips_main_asset_div")) {
            var main_div_asset = document.getElementById("tips_main_asset_div");
            main_div_asset.style.visibility = "hidden";
        }
        
        //hide our top banner ad asset since it messes with the thickbox
        if (document.getElementById("topBannerAd")) {
            var top_banner = document.getElementById("topBannerAd");
            top_banner.style.visibility = "hidden";
        }
        
        //hide our top right rail ad asset since it messes with the thickbox
        if (document.getElementById("tips_topbar_right")) {
            var tips_topbar_right = document.getElementById("tips_topbar_right");
            tips_topbar_right.style.visibility = "hidden";
        }
        
        //hide our second right rail ad asset since it messes with the thickbox
        if (document.getElementById("yrail_ads")) {
            var right_rail_ad = document.getElementById("yrail_ads");
            right_rail_ad.style.visibility = "hidden";
        }
        
		$('#shared_tip_box').css('display', 'block');
	}
    
    function postSharedTip() {
        
        var tip_title = document.getElementById('tv_tip_title').value;
        var tip_body = document.getElementById('tv_tip_body').value;
        if (tip_title.length > 40) {
            alert(max_length_message + "  You entered " + tip_title.length + ".");
        } else if (tip_title.length == 0) {
            alert("please enter a tip title.");
        } else if (tip_body.length == 0) {
            alert("please enter a tip body.");
        } else {
            var get_string = tv_base_url + "/index.php/tips/tip/action/postSharedTip/program_id/" + tv_program_id + "/tip_title/" + escape(tip_title) + "/tip_body/"  + escape(tip_body);
            $.get(get_string, function(data) {
                if (data != 'false') {
                    $('#shared_tip_box').css('display', 'none');
                    $('#shared_tip_success').css('display', 'block');
                    document.getElementById('tv_comment').value = '';
                    posted_shared_tip = true;
                } else {
                }
            });
        }//end else
    }//end postSharedTip
    
    function cancelSharedTip() {
        if (posted_shared_tip) {
            tb_remove();
            document.getElementById('tv_tip_title').value = '';
            document.getElementById('tv_tip_body').value = '';
        } else {
            tb_remove();
        }
    }    
    
	// reset tips thickbox back to normal.
	function resetSharedTip() {
		$('#shared_tip_box').css('display', 'block');
		$('#shared_tip_success').css('display', 'none');
		document.getElementById('tv_tip_title').value = '';
		document.getElementById('tv_tip_body').value = '';
	}

    
/* END shared tip */
/* BEGIN shared tip comment */

    function showSharedTipCommentBox() {
        //hide our asset since it messes with the thickbox
        if (document.getElementById("tips_main_asset_div")) {
            var main_div_asset = document.getElementById("tips_main_asset_div");
            main_div_asset.style.visibility = "hidden";
        }
        
        //hide our top banner ad asset since it messes with the thickbox
        if (document.getElementById("topBannerAd")) {
            var top_banner = document.getElementById("topBannerAd");
            top_banner.style.visibility = "hidden";
        }
        
        //hide our top right rail ad asset since it messes with the thickbox
        if (document.getElementById("tips_topbar_right")) {
            var tips_topbar_right = document.getElementById("tips_topbar_right");
            tips_topbar_right.style.visibility = "hidden";
        }
        
        //hide our second right rail ad asset since it messes with the thickbox
        if (document.getElementById("yrail_ads")) {
            var right_rail_ad = document.getElementById("yrail_ads");
            right_rail_ad.style.visibility = "hidden";
        }

		$('#shared_tip_comment_box').css('display', 'block');
	}
    
    function postSharedTipComment() {
        
        var comment = document.getElementById('tv_shared_tip_comment').value;

        if (comment.length > 250) {
            alert(max_length_message + "  You entered " + comment.length + ".");
        } else if (comment.length == 0) {
            alert("please enter a comment.");
        } else {
            var get_string = tv_base_url + "/index.php/tips/tip/action/postSharedTipComment/shared_tip_id/" + tv_shared_tip_id + "/msg/"  + escape(comment);
            $.get(get_string, function(data) {
                if (data != 'false') {
                    $('#shared_tip_comment_box').css('display', 'none');
                    $('#shared_tip_comment_success').css('display', 'block');
                    document.getElementById('tv_comment').value = '';
                    posted_shared_tip_comment = true;
                } else {
                }
            });
        }
    }
    
    function cancelSharedTipComment() {
        tb_remove();
        if (posted_shared_tip_comment) {
            window.location.reload();
        }
    }

/* END shared tip comment */
/* BEGIN comment box not tip page */
    function showCommentNotTipPageError() {
        //hide our asset since it messes with the thickbox
        if (document.getElementById("tips_main_asset_div")) {
            var main_div_asset = document.getElementById("tips_main_asset_div");
            main_div_asset.style.visibility = "hidden";
        }
        
        //hide our top banner ad asset since it messes with the thickbox
        if (document.getElementById("topBannerAd")) {
            var top_banner = document.getElementById("topBannerAd");
            top_banner.style.visibility = "hidden";
        }
        
        //hide our top right rail ad asset since it messes with the thickbox
        if (document.getElementById("tips_topbar_right")) {
            var tips_topbar_right = document.getElementById("tips_topbar_right");
            tips_topbar_right.style.visibility = "hidden";
        }
        
        //hide our second right rail ad asset since it messes with the thickbox
        if (document.getElementById("yrail_ads")) {
            var right_rail_ad = document.getElementById("yrail_ads");
            right_rail_ad.style.visibility = "hidden";
        }

		$('#comment_box_not_tip_page').css('display', 'block');
	}
    
    function cancelCommentNotTipPageError() {
        tb_remove();
	}
/* END comment box not tip page */
/* BEGIN star functions */
    
    function change_star(star_over) {

        var stars = document.getElementsByName('rating_stars');
        var messages = [];
        messages.push('not helpful');
        messages.push('somewhat helpful');
        messages.push('helpful');
        messages.push('very helpful');
        messages.push('extremely helpful');
    
        for (var i = 0; i < 5; i++) {
            stars[i].src = tv_base_url + '/themes/tips_user/images/center/gray_star.jpg';
        }
    
        for (var i = 0; i < star_over; i++) {
            stars[i].src = tv_base_url + '/themes/tips_user/images/center/gold_star.jpg';
        }
        
        var rate_this_tip_image = document.getElementById('rate_this_tip_image');
        if (i == 0) {
            rate_this_tip_image.src = tv_base_url + "/themes/tips_user/images/center/ratethistip.jpg";
        } else if (i == 1) {
            rate_this_tip_image.src = tv_base_url + "/themes/tips_user/images/center/nothelpful.jpg";
        } else if (i == 2) {
            rate_this_tip_image.src = tv_base_url + "/themes/tips_user/images/center/somewhathelpful.jpg";
        } else if (i == 3) {
            rate_this_tip_image.src = tv_base_url + "/themes/tips_user/images/center/helpful.jpg";
        } else if (i == 4) {
            rate_this_tip_image.src = tv_base_url + "/themes/tips_user/images/center/veryhelpful.jpg";
        } else if (i == 5) {
            rate_this_tip_image.src = tv_base_url + "/themes/tips_user/images/center/extremelyhelpful.jpg";
        }
            
    }
    
    function clear_stars() {
        var stars = document.getElementsByName('rating_stars');
        
        for (var i = 0; i < 5; i++) {
            stars[i].src = tv_base_url + '/themes/tips_user/images/center/gray_star.jpg';
        }
    
        for (var i = 0; i < usr_star_rating; i++) {
            stars[i].src = tv_base_url + '/themes/tips_user/images/center/gold_star.jpg';
        }
        
        var rate_this_tip_image = document.getElementById('rate_this_tip_image');
        rate_this_tip_image.src = tv_base_url + "/themes/tips_user/images/center/ratethistip.jpg";
        /*
        
        for (var i = 0; i < 5; i++) {
            stars[i].src = tv_base_url + '/themes/tips_user/images/center/gray_star.jpg';
        }
        
        for (var i = 0; i < usr_star_rating; i++) {
            stars[i].src = tv_base_url + '/themes/tips_user/images/center/gold_star.jpg';
        }
        */
    }    
/* END star functions */

/******/

    function showEmailVerificationSent() {
        $('#email_verification_sent').css('display', 'block');
        tb_show("", "#TB_inline?height=570&width=500&inlineId=feedback_content", false);
    }
    
    function showAccountLoginSent() {
        $('#account_login_sent').css('display', 'block');
        tb_show("", "#TB_inline?height=570&width=500&inlineId=feedback_content", false);
    }

    function showEmailVerificationReSent() {
        $('#email_verification_resent').css('display', 'block');
        tb_show("", "#TB_inline?height=570&width=500&inlineId=feedback_content", false);
    }
    
    function showAccountNotActivated() {
        $('#account_not_activated').css('display', 'block');
        tb_show("", "#TB_inline?height=570&width=500&inlineId=feedback_content", false);
    }
    
    function showProfileUpdated() {
        $('#profile_updated').css('display', 'block');
        tb_show("", "#TB_inline?height=570&width=500&inlineId=feedback_content", false);
    }
    
    function showAgeWarning() {
        $('#age_warning').css('display', 'block');
        tb_show("", "#TB_inline?height=570&width=500&inlineId=feedback_content", false);
    }
    
    function closeFeedbackWindow() {
        tb_remove();
    }
    /*
    function popAutoSub(url) {
        window.open(url);
    }
    */

