imageRootPath = 'http://image.tintuconline.com.vn';
mediaRootPath = 'http://media.tintuconline.com.vn';
ajaxReqPath = 'http://ajax.tintuconline.com.vn';

function focusComment(){
    $('#sendername').focus();
}

function randomNumber(n){
    if (!n || n <= 0) n = 1;
    return Math.floor(Math.random() * n);
}

function getRND(){
    var d = new Date();
    randomstr = new String (Math.random());randomstr = randomstr.substring(1,8);
    return d.format('yyyymmddHHMMssl') + randomstr;
}


function pollVote(ev){
    var frm = $('#frmPoll');
    var act = frm.attr('action');
    var url = act + '&' + getRND();
    
    if ($(':radio:checked', frm).length == 0){
        alert('Ban phai chon cau tra loi');
        $(':radio', frm).focus();
    }else{
        //frm.submit();
        if ($.browser.version == '6.0'){
            window.open(url);
        }else{
            url += '&pollValue=' + $(':radio:checked', frm).val();
            $('#popSurvey-content').html('<ifr'+'ame src="'+url+'" width="100%" frameborder="0" scrolling="no" height="270"></ifr'+'ame>');
            AP.Core.JS.Popup.show(ev, 'popSurvey');
        }
    }
}

function pollResult(ev){
    var frm = $('#frmPoll');
    var act = frm.attr('action');
    var p = act.indexOf('ReceiveSurvey.aspx');
    if (p > -1) {
        var url = act.replace('ReceiveSurvey.aspx', 'SurveyResult.aspx');
        if ($.browser.version == '6.0'){
            window.open(url);
        }else{
            $('#popSurvey-content').html('<ifr'+'ame src="'+url+'" width="100%" frameborder="0" scrolling="no" height="270"></ifr'+'ame>');
            AP.Core.JS.Popup.show(ev, 'popSurvey');
        }
    }
}

function showSendNews(ev, cate)
{
    if (!cate || cate == '') cate = 'tinbandoc';
    var url = sendNewsUrl + cate;
    if ($.browser.version == '6.0'){
        window.open(url);
    }else{
        $('#popSendNews-content').html('<ifr'+'ame src="'+url+'" width="100%" frameborder="0" scrolling="no" height="500"></ifr'+'ame>');
        AP.Core.JS.Popup.show(ev, 'popSendNews');
    }
}
