// creating XmlHttpRequest object
// double check for IE/ActiveX and then try to use
// native object (Safari, Firefox)
var ajax_transport = false;
try {
    ajax_transport = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
    try {
        ajax_transport = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (E) {
        if (typeof XMLHttpRequest != 'undefined') {
            ajax_transport = new XMLHttpRequest();
        }
    }
}
// done creating
// ajax_transport is XmlHttpRequest object or boolean false


// this function is called when user fetches data

// this function is called, when data requested at function flag_Post() (below)
// is ready for processing
function receiveInfo()
{
    if (ajax_transport.readyState != 4)
        return;

    // Firefox may throw exception while getting XmlHttpRequest status
    try { real_status = ajax_transport.status; }
    catch (e) { return; }
    
    if (real_status != 200)
    {
        
    }
    var content = ajax_transport.responseText;
}

    
function flag_Post(url, s_path){
    if (confirm('Flag this post as inappropiate, offensive?')) {
        if (!ajax_transport) {
            document.location.href='flagpost.php?'+url;
        }
         else{
            aj_url = s_path+'/flagpost.php?'+url+"&ld=1";
            if (aj_url.charAt(0) != '/')
                aj_url = '/' + aj_url;
            ajax_transport.open("GET", aj_url, true);
            ajax_transport.onreadystatechange=receiveInfo;
            ajax_transport.send(null);
            alert('The post will be reviewed shortly by webmaster. \nThank you!');
         }        
    }
    return false;
}
