ASuggestions = function() {
    this.SubmitSuggestion = function(sSubmitUrl) {
        var sPost = $("#suggestion_table input[name='idea']").val();
        sPost = $.trim(sPost);
        var sCaptcha = $("#suggestion_table input[name='captcha']").val();

        if (sPost != '') {
        	var oRequest = {};
        	oRequest['sug_post'] = sPost;
        	oRequest['sug_captcha'] = sCaptcha;
        	oRequest['mode'] = 'json';

            var sReceiver = $('#fthere');
        	$.post(sSubmitUrl, oRequest, function(oData) {
                if (oData.status == 1) {
                    sReceiver.html(oData.post);
                }
        	}, 'json');
        }
    }

    this.mo_get_win_width = function() {
        var myWidth = 0;
        if( typeof( window.innerWidth ) == 'number' ) //Non-IE
            myWidth = window.innerWidth;
        else if( document.documentElement && document.documentElement.clientWidth ) //IE 6+ in 'standards compliant mode'
            myWidth = document.documentElement.clientWidth;
        else if( document.body && document.body.clientWidth) //IE 4 compatible
            myWidth = document.body.clientWidth;
        return myWidth;
    }

    this.mo_get_win_height = function() {
        var myHeight = 0;
        if( typeof( window.innerHeight ) == 'number' ) //Non-IE
            myHeight = window.innerHeight;
        else if( document.documentElement && document.documentElement.clientHeight ) //IE 6+ in 'standards compliant mode'
            myHeight = document.documentElement.clientHeight;
        else if( document.body && document.body.clientHeight) //IE 4 compatible
            myHeight = document.body.clientHeight;
        return myHeight;
    }

    this.mo_get_scrol = function() {
        var yPos = 0;
        if (self.pageYOffset) {
            yPos = self.pageYOffset;
        } else if (document.documentElement && document.documentElement.scrollTop){
            yPos = document.documentElement.scrollTop;
        } else if (document.body) {
            yPos = document.body.scrollTop;
        }
        return yPos;
    }

    this.mo_show_box = function() {
        if (!$('#dolPopupFog').length) {
            $('<div id="dolPopupFog" style="display: none;">&nbsp;</div>')
                .prependTo('body')
                .css({
                    position: 'fixed',
                    top: 0,
                    left: 0,
                    width: $(window).width(),
                    height: '100%',
                    opacity: '0.8',
                    backgroundColor: '#000',
                    zIndex: 999,
                });
        }
        $('#dolPopupFog').fadeIn(500);

        var l = this.mo_get_win_width()/2 - 350;
        var t = this.mo_get_win_height()/2 - 200 + this.mo_get_scrol();
        document.getElementById('mysug_box').style.top  = t+'px';
        document.getElementById('mysug_box').style.left = l+'px'; 
        document.getElementById('mysug_box').style.display='block';
    }

    this.mo_hide_box = function() {
        $('#dolPopupFog').fadeOut(250);
        document.getElementById('mysug_box').style.display='none';
    }
}

var oSuggestion = new ASuggestions();
