/**
 * @author screamge
 */


var Favorites = function (){
	this.http = this.getHTTPObject ();
}

Favorites.prototype = {
	getHTTPObject: function () {
	
	if (window.XMLHttpRequest) {
	     var xmlhttp = new XMLHttpRequest();
	} else if (window.ActiveXObject) {
	     var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	}	 
	return xmlhttp;
	},
	
	loaddata: function (lang, type, obj, sort){
	this.object = obj;
	this.language = lang;
	if (type != '') {
		this.types = type;
	}
	
	if (sort == undefined && this.sort == undefined) {
		this.sort = 'a';
	}
	else if (sort != undefined){
		this.sort = sort;
	}
	
	
	
	var r = Math.random ();
	var mes = 'fav_mod_2.php?lang=' + lang + '&type=' + this.types + '&s=' + this.sort + '&r=' + r;
	
	
	this.http.open("GET", mes, true);
	this.http.onreadystatechange = this.delegate (this, this.onloadform);
	this.http.send(null);
	}, 
	
	
	onloadform: function (){
	if (this.http.readyState == 4) {
		var text = this.http.responseText;				
		this.object.innerHTML = text;
	}
	}, 
	
	
	delegate: function (obj, method ) {
    return function() { return method.call(obj); }
  	}
} 




