function faved(strURL,res,elem) {
    var xmlHttpReq = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('POST', strURL, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {
            updatefav(self.xmlHttpReq.responseText,res);
        }
    }
    self.xmlHttpReq.send(getfaved(res,elem));
}

function getfaved(res,elem) {
    qstr = 'id=' + escape(elem)+'&class='+document.getElementById(res).className;  // NOTE: no '?' before querystring
    return qstr;
}

function updatefav(str,res){
	if(str == 1)
	{
     document.getElementById(res).setAttribute("class", "rem_favorite");
	 document.getElementById(res).setAttribute("title", "Remove from favorites");
	}
	else if(str == 0)
	{
     document.getElementById(res).setAttribute("class", "favorite");
	 document.getElementById(res).setAttribute("title", "Add to favorites");	 
	}
}


function send_quote(url)
{
 window.open(url, 'windowname', 'width=610,height=550,toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=yes,directories=no,location=no');
}	

