	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);
		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.OnLoading = function(){
			msg_show(objectid + '_head_msg');
		}
		
		this.OnSuccess = function()
      {	
			msg_hide(objectid + '_head_msg');
			content_replace(objectid, this.GetResponseText());
		}

      this.GetData = function(id)
      {	
			getstr = "?id=" + id+ "&cpage="+cpage+"&objectid="+objectid +"&ownerid="+ownerid + "&item=" + item + "&item_id=" + item_id + "&sid="  + Math.random(); 
         this.InitializeRequest('GET', "ajax/GetGalleryByID.php"+ getstr);
         this.Commit(null);
      }
   }
   GetGalleryByID_object.prototype = new ajax();
	GetGalleryByID = new GetGalleryByID_object();

	ChangeCMGallery_object = function() {
		
		var objectid;
		this.OnLoading = function(){
			//msg_show(objectid + '_head_msg');
		}
		
		this.OnSuccess = function()
      {	
			//msg_hide(objectid + '_head_msg');
			content_replace(objectid, this.GetResponseText());
		}

      this.GetData = function(type, id, obj)
      {	
			objectid = obj;	
			getstr = "?type=" + type + "&id=" + id + "&sid="  + Math.random(); 
         this.InitializeRequest('GET', "ajax/GetCMGallery.php"+ getstr);
         this.Commit(null);
      }
   }
   ChangeCMGallery_object.prototype = new ajax();
	ChangeCMGallery = new ChangeCMGallery_object();

	GetGalleryByPage_object = function() {
		
		this.OnLoading = function(){
			msg_show(objectid + '_head_msg');
		}
		
		this.OnSuccess = function()
      {	
			msg_hide(objectid + '_head_msg');
			content_replace(objectid, this.GetResponseText());
		}

      this.GetData = function(cpage)
      {	
			getstr = "?id=" + id+ "&cpage="+cpage+"&objectid="+objectid +"&ownerid="+ownerid + "&item=" + item + "&item_id=" + item_id + "&sid="  + Math.random(); 
         this.InitializeRequest('GET', "ajax/GetGalleryByID.php"+ getstr);
         this.Commit(null);
      }
   }
   GetGalleryByPage_object.prototype = new ajax();
	GetGalleryByPage = new GetGalleryByPage_object();
	
	GetGalleryByTabID_object = function() {
		
		this.GetData = function(tab_id, cpage)
      {	
			getstr = "?tab_id=" + tab_id + "&cpage=" + cpage + "&objectid=" + objectid+ "&ownerid=" + ownerid + "&item=" + item + "&item_id=" + item_id  + "&sid="  + Math.random();
         this.InitializeRequest('GET', "ajax/GetGalleryByID.php" + getstr);
         this.Commit(null);
      }
   }
   GetGalleryByTabID_object.prototype = new GetGalleryByID_object();
	GetGalleryByTabID = new GetGalleryByTabID_object();
	

	GetYourPhotoFrame_object = function() {
		
		this.GetData = function(ownerid, snapid)
      {
         this.InitializeRequest('GET', "ajax/GetYourPhotoFrame.php?ownerid="+ownerid+"&snapid="+snapid);
         this.Commit(null);
      }
   }
   GetYourPhotoFrame_object.prototype = new GallerySet_object();
	GetYourPhotoFrame = new GetYourPhotoFrame_object();

	GetYourItem_object = function() {
		
		this.GetData = function(item, id, object)
      {
         this.InitializeRequest('GET', "ajax/GetYourItem.php?item_id=" + id + "&item=" + item + "&object_id=" + object);
         this.Commit(null);
      }
   }
   GetYourItem_object.prototype = new GallerySet_object();
	GetYourItem = new GetYourItem_object();

	GetYourItemFrame_object = function() {
		
		this.OnSuccess = function(){
			//msg_hide(this.msgid);
			//document.getElementById("page_position").value = this.url;
			var gal = document.getElementById(this.objectid);
			gal.innerHTML = this.GetResponseText(); 
			player_create();
		}
	
		this.GetData = function(id, owner_id, object)
      {
			getstr =  "?item_id=" + id + "&object_id=" + object + "&owner_id=" + owner_id;
         this.InitializeRequest('GET', "ajax/GetYourItemFrame.php" + getstr);
         this.Commit(null);
      }
   }
   GetYourItemFrame_object.prototype = new GallerySet_object();
	GetYourItemFrame = new GetYourItemFrame_object();

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

		this.OnLoading = function(){
			//document.write(this.msgid);
			content_replace(this.msgid, this.msgLoading);
			msg_show(this.msgid);
		}
		
		this.OnSuccess = function()
      {	
			var gal = document.getElementById(this.objectid);
			gal.innerHTML = this.GetResponseText();
			msg_hide(this.msgid);
		}
				
		this.GetData = function(item, id, object){
			this.InitializeRequest('GET', "ajax/GetYourItemRating.php?item_id=" + id + "&item=" + item + "&object_id=" + object);
         this.Commit(null);
      }
   }
   GetYourItemRating_object.prototype = new GallerySet_object();
	GetYourItemRating = new GetYourItemRating_object();

	EditPhoto_object = function() {
		
		this.GetData = function(ownerid, snapid)
      {
         this.InitializeRequest('GET', "ajax/EditPhoto.php?ownerid="+ownerid+"&snapid="+snapid);
         this.Commit(null);
      }
   }
   EditPhoto_object.prototype = new GallerySet_object();
	EditPhoto = new EditPhoto_object();
	
	GetComments_object = function() {
		
		this.GetData = function(item, item_id, cpage, ownerid, object_id)
      {
         this.InitializeRequest('GET', "ajax/GetComments.php?ownerid="+ownerid+"&item_id="+item_id+"&cpage="+cpage+"&item="+item+"&object_id="+object_id+"&sid="  + Math.random());
			this.Commit(null);
      }
   }
   GetComments_object.prototype = new GallerySet_object();
	GetComments = new GetComments_object();
	
	SendComments_object = function() {
		var obj;
		var msg;
		var item;
		var cpage;
		var ownerid;
		

		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.OnSuccess = function()
      {	
			document.getElementById("counter").value = document.getElementById("max_limit").value;
			GetComments.Set(this.obj, this.msg);
			GetComments.GetData(this.item, this.item_id, this.cpage, this.ownerid, this.obj);
			msg_show('flr_com_bsend','inline');	
			message('general', document.getElementById('msg_add_' + this.obj).value);
		}
		
		this.SendData = function(object)
      {
			this.item = document.getElementById(object + "_what").value;
			var poststr = 
							"txtcontent=" + encodeURI( document.getElementById("txtcontent").value ) +
                    	"&what=" + encodeURI( this.item ) +
						  	"&id=" + encodeURI( document.getElementById(object + "_id").value ) +
							"&uid=" + encodeURI( document.getElementById(object + "_uid").value ) +	
							"&act=" + encodeURI( document.getElementById(object + "_act").value );
			document.getElementById("txtcontent").value = '';
			this.InitializeRequest('POST', document.location.href, true );
			this.Commit(poststr);
		}
   
	}
   SendComments_object.prototype = new GallerySet_object();
	SendComments = new SendComments_object();

	DeleteComments_object = function() {
		var obj;
		var msg;
		var item;
		var cpage;
		var ownerid;
		

		this.SetRefresh = function (obj, msg, cpage, ownerid)
		{
			this.obj = obj;
			this.msg = msg;
			this.cpage = cpage;
			this.ownerid = ownerid;
		}
		this.OnSuccess = function()
      {	
			GetComments.Set(this.obj, this.msg);
			GetComments.GetData(this.item, this.item_id, this.cpage, this.ownerid, this.obj);
			message('general', document.getElementById('msg_del_' + this.obj).value);
		}
		
		this.SendData = function(item, item_id, cid, act )
      {
			this.item = item;
			this.item_id = item_id;
			var getstr = 
							"item=" + item +
                    	"&item_id=" + item_id +
						  	"&cid=" + cid +
							"&act=" + act +
							"&sid="  + Math.random();
			this.InitializeRequest('GET', 'index.php?' + getstr, true );
			this.Commit(null);
			
		}
   
	}
   DeleteComments_object.prototype = new GallerySet_object();
	DeleteComments = new DeleteComments_object();

	SendRating_object = function() {
		
		var obj;
		var msg;
		var msgid;
		var item_id;
		var item;
		var object;
		var msgid2;
		
		this.Set = function(objectid, msgid ,msgLoading){
			this.objectid = objectid;
			this.msgLoading = msgLoading ? msgLoading : 'Loading...';
			this.msgid = msgid + "_head_msg";
			this.msgid2 = msgid; 
		}		

		this.OnLoading = function(){
			content_replace(this.msgid, this.msgLoading);
			msg_show(this.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.OnSuccess = function()
      {	
			msg_hide(this.msgid);
			GetYourItemRating.Set(this.obj, this.msgid2, this.msg);
			GetYourItemRating.GetData(this.item, this.item_id, this.object);		
		}
		

		this.SendData = function(object, rateval)
      {
			this.object = object;
			var poststr = 
							"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);
			this.InitializeRequest('POST', document.location.href, true );
			this.Commit(poststr);
			this.Hidden('rating_12345');
		}
   
	}
   SendRating_object.prototype = new GallerySet_object();
	SendRating = new SendRating_object();
	
	
	GalleryItemAction_object = function() {
		
		this.SendData = function(item, itemid, act){
			var poststr = 
							"item=" + encodeURI(item) +
						  	"&item_id=" + encodeURI(itemid) +
							"&act=" + encodeURI(act);
			this.InitializeRequest('POST', document.location.href, true );
			this.Commit(poststr);
		}
   }
   GalleryItemAction_object.prototype = new ajax();
	GalleryItemAction = new GalleryItemAction_object();	

	GalleryItemDelete_object = function() {
		
		this.OnSuccess = function(){
		}
   }
   GalleryItemDelete_object.prototype = new GalleryItemAction_object();
	GalleryItemDelete = new GalleryItemDelete_object();	
	
	
	