﻿$(document).ready(function() {
    if ($.browser.msie && $.browser.version == '6.0') $('#feedbacktab').css('position', 'absolute');

    highlightMenu("menubuy");

    var pollHeight = $("#poll").height();
    var launchingsoonHeight = $("#launchingsoon").height();
    var onthemarketHeight = $("#onthemarket").height();
    var maxHeight = Math.max(pollHeight, launchingsoonHeight, onthemarketHeight);
    //var maxHeight = Math.max(pollHeight, onthemarketHeight);
    $("#poll").css("height", maxHeight);
    $("#launchingsoon").css("height", maxHeight);
    $("#onthemarket").css("height", maxHeight);

    $('#sb_whatnew').css('display', 'block');
    //Used for catfish
    $('#closeme').click(function() {
        $('#catfish').css('display', 'none');
        return false;
    });

    $('#btnPollVote').click(function() {
        $pollquestion = $('#ct_pollquestion').val();
        $pollanswer = $('input[name=pollAnswer]:checked').val();

        if ($pollanswer === undefined) {
            alert("Pelease select poll answer!");
        }
        else {
            $('#ct_poll').html('<span align="center"><br /><br /><div class="loader" title="Loading....."></div></span>')
            $.ajax({
                url: 'ajax_server/svr_default.aspx',
                data:
              '&question=' + $pollquestion +
              '&answer=' + $pollanswer
              ,
                type: 'GET',
                datatype: 'text',
                timeout: 10000,
                error: function() {
                    $('#ct_poll').empty();
                    ////$('#loader').css("display", "none");
                    //alert('There is something wrong with the server, please try again...');
                },
                success: function(data) {
                    $('#ct_poll').empty();
                    $('#ct_poll').html(data);
                }
            });
        }
    });

    window.onscroll = window_scroll;
})

function picResize(img, maxh, maxw) {
    var ratio = maxh / maxw;
    if (img.height / img.width > ratio) {
        // height is the problem
        if (img.height > maxh) {
            img.width = Math.round(img.width * (maxh / img.height));
            img.height = maxh;
        }
    } else {
        // width is the problem
        if (img.width > maxh) {
            img.height = Math.round(img.height * (maxw / img.width));
            img.width = maxw;
        }
    }
}

function Feeback(iframeid) {
    ShowPopUp("/iframe/feedbacks.aspx", 468, 615, iframeid);
}

function ChangeFeedbackImage(obj, url) {
    obj.src = url;
}

   
