
function changeURL(new_url) {
       window.open(new_url);
}



function toggleFavorite(site) {
    var favoriteText = document.getElementById("favorite_site_text");
    var favoriteIcon = document.getElementById("favorite_site_icon");
    var favoriteLink = document.getElementById("favorite_site_link");
    var ajaxLoader = document.getElementById('ajax_loader_toggle_favorites');

    var HttpRequest;
    try{
        HttpRequest = new XMLHttpRequest();
    } catch(e){
        try{
            HttpRequest = new ActiveXObject("Msxml2.XMLHTTP");
        } catch(e){
            try{
                HttpRequest = new ActiveXObject("Microsoft.XMLHTTP");
            } catch(e){
                alert("Your browser is to old or does not support Ajax.");
            }
        }
    }
    HttpRequest.onreadystatechange=function()
    {
        if(HttpRequest.readyState==1) {
            favoriteIcon.style.display = 'none';
            ajaxLoader.style.display = 'inline';
        }
        if(HttpRequest.readyState==4)
        {
            favoriteIcon.style.display = 'inline';
            ajaxLoader.style.display = 'none';
            if(HttpRequest.responseText == "2") {
                favoriteIcon.src = '/images/icons/add.png';
                favoriteText.innerHTML ='Add Site to Favorites';
                favoriteLink.className = 'round_link strong_link';
            }
            if(HttpRequest.responseText == "1") {
                favoriteIcon.src = '/images/icons/delete.png';
                favoriteText.innerHTML ='Remove From Favorites';
                favoriteLink.className = 'round_link';
            }
        }
    }
    HttpRequest.open("GET","/index.php?plugin=plugin_ajax&pg=togglefavorite&site=" + site,true);
    HttpRequest.send(null);
}

