	function msg_hide(id){
		var x = document.getElementById(id);
		x.style.display = "none";
	}

	function msg_show(id, dis){
		var x = document.getElementById(id);
		if(dis){
			x.style.display = dis;
		}else{
			x.style.display = "block";
		}
	}
	
	function content_replace(id, content){
		var gal = document.getElementById(id);
		if (gal) gal.innerHTML = content; 
	}
	
	GallerySet_object = function(){
		var objectid;
		var msgLoading;
		var msgid;		
		var url;

		this.Set = function(objectid, msgLoading, url){
			this.objectid = objectid;
			this.msgLoading = msgLoading ? msgLoading : 'Loading...';
			if(url) this.url = url;
			this.msgid = objectid + "_head_msg";
		}
		this.OnLoading = function(){
			content_replace(this.msgid, this.msgLoading);
			msg_show(this.msgid);
		}
		
		this.OnSuccess = function()
      {
			msg_hide(this.msgid);
			//document.getElementById("page_position").value = this.url;
			var gal = document.getElementById(this.objectid);
			gal.innerHTML = this.GetResponseText(); 
		}
	}
	GallerySet_object.prototype = new ajax();

	GetGalleryByID_object = function() {
		
      this.GetData = function(id){	
			
			var load = new Ajax("/ajax/GetGalleryByID.php", {	
				method: 'get',
				data: "id=" + id+ "&cpage="+cpage+"&objectid="+objectid +"&ownerid="+ownerid + "&item=" + item + "&item_id=" + item_id + "&sid="  + Math.random(),
				onRequest: function(){
					msg_show(objectid + '_head_msg');
				},
				onSuccess: function(){
					msg_hide(objectid + '_head_msg');
					content_replace(objectid, this.response.text);
				}
			});
			load.request();
		}
   }
	GetGalleryByID = new GetGalleryByID_object();

	ChangeCMGallery_object = function() {
		
		var objectid;
      this.GetData = function(type, id, obj)
      {	
			objectid = obj;	
			var load = new Ajax("/ajax/GetCMGallery.php", {	
				method: 'get',
				data: "type=" + type + "&id=" + id + "&sid="  + Math.random(),
				onRequest: function(){
					//msg_show(objectid + '_head_msg');
				},
				onSuccess: function(){
					//msg_hide(objectid + '_head_msg');
					content_replace(objectid, this.response.text);
				}
			});
			load.request();
		}
   }
	ChangeCMGallery = new ChangeCMGallery_object();

	GetGalleryByPage_object = function() {
		
      this.GetData = function(cpage)
      {	
      			if ($('galleries_options')) id = $('galleries_options').value;
			var load = new Ajax("/ajax/GetGalleryByID.php", {	
				method: 'get',
				data: "id=" + id+ "&cpage="+cpage+"&objectid="+objectid +"&ownerid="+ownerid + "&item=" + item + "&item_id=" + item_id + "&sid="  + Math.random(),
				onRequest: function(){
					msg_show(objectid + '_head_msg');
				},
				onSuccess: function(){
					msg_hide(objectid + '_head_msg');
					content_replace(objectid, this.response.text);
				}
			});
			load.request();
      }
   }
	GetGalleryByPage = new GetGalleryByPage_object();
	
	GetYourItemFrame_object = function() {
		
		var objectid;
		var msgLoading;
		var msgid;		
		var url;
		var ref = this;
		this.GetData = function(id, owner_id, object)
      {
			var load = new Ajax("/ajax/GetYourItemFrame.php", {	
				method: 'get',
				data: "item_id=" + id + "&object_id=" + object + "&owner_id=" + owner_id,
				onRequest: function(){
					content_replace(ref.msgid, ref.msgLoading);
					msg_show(ref.msgid);
				},
				onSuccess: function(){
					//msg_hide(ref.msgid);
					//document.getElementById("page_position").value = ref.url;
					var gal = document.getElementById(ref.objectid);
					gal.innerHTML = this.response.text; 
					player_create();
				}
			});
			load.request();
		}
		

		this.Set = function(objectid, msgLoading, url){
			this.objectid = objectid;
			this.msgLoading = msgLoading ? msgLoading : 'Loading...';
			if(url) this.url = url;
			this.msgid = objectid + "_head_msg";
		}
   }
	GetYourItemFrame = new GetYourItemFrame_object();

	GetComments_object = function() {
		
		var objectid;
		var msgLoading;
		var msgid;		
		var url;
		var ref = this;	
		this.GetData = function(item, item_id, cpage, ownerid, object_id)
      {
			var load = new Ajax("/ajax/GetComments.php", {	
				method: 'get',
				data: "ownerid="+ownerid+"&item_id="+item_id+"&cpage="+cpage+"&item="+item+"&object_id="+object_id+"&sid="  + Math.random(),
				onRequest: function(){
					content_replace(ref.msgid, ref.msgLoading);
					msg_show(ref.msgid);
				},
				onSuccess: function(){
					msg_hide(ref.msgid);
					//document.getElementById("page_position").value = ref.url;
					var gal = document.getElementById(ref.objectid);
					gal.innerHTML = this.response.text; 
				}
			});
			load.request();
		}
		

		this.Set = function(objectid, msgLoading, url){
			this.objectid = objectid;
			this.msgLoading = msgLoading ? msgLoading : 'Loading...';
			if(url) this.url = url;
			this.msgid = objectid + "_head_msg";
		}
   }
	GetComments = new GetComments_object();
	
	SendComments_object = function() {
		var obj;
		var msg;
		var item;
		var cpage;
		var ownerid;
		var objectid;
		var msgLoading;
		var msgid;		
		var url;
		var ref = this;

		this.SetRefresh = function (obj, msg, item_id, cpage, ownerid)
		{
			this.obj = obj;
			this.msg = msg;
			this.item_id = item_id;
			this.cpage = cpage;
			this.ownerid = ownerid;
			this.item = item;
		}
		
		this.SendData = function(object)
      {
			ref.item = $(object + "_what").value;
			var load = new Ajax(document.location.href, {	
				method: 'post',
				data: 	Object.toQueryString({txtcontent:  $("txtcontent").value, what: ref.item, id: $(object + "_id").value, uid: $(object + "_uid").value, act: $(object + "_act").value}),
				onRequest: function(){
					content_replace(ref.msgid, ref.msgLoading);
					msg_show(ref.msgid);
				},
				onSuccess: function(){
					document.getElementById("counter").value = document.getElementById("max_limit").value;
					GetComments.Set(ref.obj, ref.msg);
					GetComments.GetData(ref.item, ref.item_id, ref.cpage, ref.ownerid, ref.obj);
					msg_show('flr_com_bsend','inline');	
					message('general', document.getElementById('msg_add_' + ref.obj).value);
					document.getElementById("txtcontent").value = '';
				}
			});
			load.request();
		}
		
		this.Set = function(objectid, msgLoading, url){
			this.objectid = objectid;
			this.msgLoading = msgLoading ? msgLoading : 'Loading...';
			if(url) this.url = url;
			this.msgid = objectid + "_head_msg";
		}
		
   
	}
	SendComments = new SendComments_object();	

	DeleteComments_object = function() {
		var obj;
		var msg;
		var item;
		var cpage;
		var ownerid;
		var objectid;
		var msgLoading;
		var msgid;		
		var url;
		var ref = this;

		this.SetRefresh = function (obj, msg, cpage, ownerid)
		{
			this.obj = obj;
			this.msg = msg;
			this.cpage = cpage;
			this.ownerid = ownerid;
		}
		
		this.SendData = function(item, item_id, cid, act )
      {
			this.item = item;
			this.item_id = item_id;
			
			var load = new Ajax('/index.php', {	
				method: 'get',
				data: "item=" + item +
                  "&item_id=" + item_id +
						"&cid=" + cid +
						"&act=" + act +
						"&sid="  + Math.random(),
				onRequest: function(){
					content_replace(ref.msgid, ref.msgLoading);
					msg_show(ref.msgid);
				},
				onSuccess: function(){
					GetComments.Set(ref.obj, ref.msg);
					GetComments.GetData(ref.item, ref.item_id, ref.cpage, ref.ownerid, ref.obj);
					message('general', document.getElementById('msg_del_' + ref.obj).value);
				}
			});
			load.request();
		}
		
		this.Set = function(objectid, msgLoading, url){
			this.objectid = objectid;
			this.msgLoading = msgLoading ? msgLoading : 'Loading...';
			if(url) this.url = url;
			this.msgid = objectid + "_head_msg";
		}
		
   
	}
	DeleteComments = new DeleteComments_object();
	
	GetYourItemRating_object = function() {
		
		var objectid;
		var msgLoading;
		var msgid;		
		var url;
		var ref = this;
			
		this.Set = function(objectid, msgid ,msgLoading){
			this.objectid = objectid;
			this.msgLoading = msgLoading ? msgLoading : 'Loading...';
			this.msgid = msgid + "_head_msg";
		}		

		this.GetData = function(item, id, object){
			var load = new Ajax('/ajax/GetYourItemRating.php', {	
				method: 'get',
				data: "item_id=" + id + "&item=" + item + "&object_id=" + object,
				onRequest: function(){
					content_replace(ref.msgid, ref.msgLoading);
					msg_show(ref.msgid);
				},
				onSuccess: function(){
					var gal = document.getElementById(ref.objectid);
					gal.innerHTML = this.response.text;
					msg_hide(ref.msgid);
				}
			});
			load.request();      
		}
	}
	GetYourItemRating = new GetYourItemRating_object();
	
	SendRating_object = function() {
		
		var obj;
		var msg;
		var msgid;
		var item_id;
		var item;
		var object;
		var msgid2;
		var ref = this;

		this.Set = function(objectid, msgid ,msgLoading){
			this.objectid = objectid;
			this.msgLoading = msgLoading ? msgLoading : 'Loading...';
			this.msgid = msgid + "_head_msg";
			this.msgid2 = msgid; 
		}		

		this.Hidden = function (ob_id)
		{
			obje = document.getElementById(ob_id);
			obje.style.visibility = 'hidden';
		}
		
		this.SetRefresh = function (obj, msg)
		{
			this.obj = obj;
			this.msg = msg;
			this.item_id =  document.getElementById(this.object + "_item_id").value
			this.item = document.getElementById(this.object + "_item").value;
		}
		this.SendData = function(object, rateval)
      {
			this.object = object;
			var load = new Ajax('/ajax/rate.php', {	
				method: 'post',
				data: "object_id=" + object +
						"&item=" + encodeURI( document.getElementById(object + "_item").value ) +
						"&item_id=" + encodeURI( document.getElementById(object + "_item_id").value ) +
						"&act=" + encodeURI( document.getElementById(object + "_act").value ) +
						"&rate=" + encodeURI( rateval),
				onRequest: function(){
					content_replace(ref.msgid, ref.msgLoading);
					msg_show(ref.msgid);
				},
				onSuccess: function(){
					msg_hide(ref.msgid);
					GetYourItemRating.Set(ref.obj, ref.msgid2, ref.msg);
					GetYourItemRating.GetData(ref.item, ref.item_id, ref.object);		
				}
			});
			load.request();
			this.Hidden('rating_12345');
		}
   
	}
	SendRating = new SendRating_object();
	