/*******************************************************************************
 *		Project: 		Favorite plugin for sobi2
 *		
 *		Description:	Allows users and visitors to add sobi2 entries into 
 *						favorite. Favorites are displayed on the top of sobi2.
 *						You can add a link/button/image on the detailled view
 *						or vCards. The entry is added without page regen.
 *						If the user is not logged, the plugin ask the user for
 *						an email address.
 *						
 *******************************************************************************
 *
 *		Autor:			pelloquin cédric
 *						cedric@pelloquin.com
 *						www.pelloquin.com
 *		Copyright:		2009 pelloquin cédric
 *
 *		Note:			If you modify this file, please send me the new relaese
 ******************************************************************************/

function createRequestObject() {
    var ro;
    var browser = navigator.appName;
    if(browser == "Microsoft Internet Explorer"){
        ro = new ActiveXObject("Microsoft.XMLHTTP");
    }else{
        ro = new XMLHttpRequest();
    }
    return ro;
}

var http = createRequestObject();

function pecFavSndReq(url, mode) {
    http.open('get', url);
	if (mode==1) {    http.onreadystatechange = handleResponse; }
	if (mode==2) {    http.onreadystatechange = handleResponseCbo; }
    http.send(null);
} 

function handleResponse() {
    if(http.readyState == 4){
        var response = http.responseText;
		document.getElementById("pecSobiFavListContainer").innerHTML = response;
    }
}

function handleResponseCbo() {
    if(http.readyState == 4){
        var response = http.responseText;
		document.getElementById("pecSobiFavCboMod").innerHTML = response;
		document.getElementById("pecSobiFavCbo").innerHTML = response;
    }
}


