var Wall = {
	member_id : 0,
	owner_id : 0,
	tab : null,
	page : 1,
	symbol : null,
	id : null,
	havefile : 0,
	part : null,
	running : 0,
	interalID : 0,
	loadingtab : 0,
	value : '',
	filter : 'wall',
	errDataTooLong : 'Dữ liệu bạn nhập vào quá giới hạn cho phép là 500 ký tự',
	errDataEmpty : 'Xin vui lòng nhập vào nội dung',
	errFileType : 'File không hợp lệ',
	strConfirmDel : 'Bạn có chắc chắn muốn xóa?',
	errServerError : 'Có vấn đề xảy ra với hệ thống. Hàng động bạn vừa thực hiện chưa được cập nhật!',
	errNoTAllow : 'Bạn không có quyền thực hiện chức năng này',
	errCanNotDelComment : 'Không thể xóa được comment',
	alert_loading : 'Hệ thống đang xử lý, xin vui lòng chờ trong giây lát',
	
	setMemberID : function(id){
		this.member_id = id;
	},
	setOwnerID : function(id){
		this.owner_id = id;
	},
	setRunning : function(status){
		this.running = status;
	},
	setupload : function(part, havefile, name)
	{
		if(part=='link'){			
			$('.btnsend').hide();
			$('#link_view_link').html('');	
			$('#link_input_'+name).show();	
			$('#link_url_link').val('http://');
			$('#link_url_music').val('http://');
			$('#link_url_video').val('http://');
		}else{ 
			$('.btnsend').show();
		}	
		this.symbol = part;
		this.havefile = havefile;
	},
	delupload : function()
	{
		this.symbol = '';
		this.havefile = 0;
		$('.btnsend').show();		
	},
	checkwall : function(empty)
	{
		this.running=1;
		if(empty != 1 && this.value=='' )
		{
			this.running=0;
			alert(this.errDataEmpty);
			return false;
		}
		if(this.value.length>500)
		{
			this.running=0;
			alert(this.errDataTooLong);
			return false;
		}
		$('#input_wall').val('');
		return true;
	},
	upload : function()
	{	
		if(this.running ==0)
		{
			this.value = $('#input_wall').val();
			this.running=1;
			if(this.symbol=='link'){
				this.uploadLink();
			}else if(this.symbol=='photo'){
				this.uploadPhoto();
                        }else if(this.symbol=='music'){
				this.uploadMusic();			
			}else if(this.symbol=='fungift'){
				sendGift();
			}else if(this.symbol=='video'){
				id = $('#'+this.tab+'_id').val();
				this.uploadWall(1,this.tab,id);
			}else if(this.symbol=='wall' || this.symbol==null || this.symbol==''){
				this.uploadWall(0,'wall');
			}	
			this.symbol = 'wall';
		}		
	},
	postLink : function(name)
	{
		var url = $('#link_url_'+name).val();	
		if(!checkLink(url)){
			alert('Xin vui lòng nhập link!');
			this.running =0;
			return false;
		}		
		$.ajax({
				url : YUME+'/wall/postlink',
				type : 'POST',
				data : {link: url, act: name},				
				dataType:'json',
				beforeSend : function()
				{	
					turnloadingon();
					$('#link_url_'+name).val('http://');
				},
				success : function(data)
				{		   
				  Wall.symbol='link';
				  turnloadingoff();	
				  if(data.error!='')
				  {
						alert('Link của bạn không đúng!');
						this.running =0;
						return false;
				  }
				  if(data.act!='link'){
					  $('#att'+data.act).hide();	
					  $('#attlink').show();	
				  }
				  $('.btnsend').show();
				  $('#link_input_link').hide();
				  $('#link_view_link').html(data.html);				  
				}
			})
		
	},
	loaddatatab: function(name){
		if($('#wall_'+name).html()==''){
			Wall.tab = name;
			$.ajax({
			   url : YUME+'/wall/loaddatatab',
			   type : 'POST',
			   data : {tab:name},
			   beforeSend : function()
			   {
				    turnloadingon();
			   },
			   success : function(data)
			   {
				    turnloadingoff();
				  $('#wall_'+Wall.tab).html(data);
				  if(Wall.tab=='video_video' || Wall.tab=='video_list'){
					ym2checkImg('#attvideo .ym2imgitem');  
				  }
			   }
		   })
		}
	},
	uploadWall : function(c,a,id)
		{
		if(!this.checkwall(c)){			
			return;
		}	
		$.ajax({
				url : YUME+'/wall/ajaxupload',
				type : 'POST',
				data : {wall_post: this.value, act : a, owner_id : Wall.owner_id,id:id},
				beforeSend : function()
				{
					turnloadingon();
				},
				success : function(data)
				{
				   Wall.running = 0;
				   turnloadingoff();
				   Wall.load1item(data);				   
				   $('.localattach .atitem').slideUp(400,function(){
						$('#mainitem').fadeIn();
					});
				}
			})
	},
	uploadLink : function()
	{
		if(!this.checkwall(1)){			
			return;
		}	
		var image_share = $('#chkpicpreview').is(':checked')?'':$('#image_share').val();
		$.ajax({
				url : YUME+'/wall/ajaxupload',
				type : 'POST',
				data : {wall_post: this.value, link:$('#link_share').val(), title:$('#title_share').val(), desc:$('#desc_share').val(),flash:$('#flash_share_00').val(), img: image_share, act : 'link', type:$('#type_share').val(), owner_id : Wall.owner_id},
				beforeSend : function(){										
					turnloadingon();
				},
				success : function(data){				  
				   Wall.running = 0;
				   Wall.symbol = 'wall';
				   var num = parseInt(data);
				   if(!isNaN(num) && num>0){
						Wall.load1item(data);
				   }
				   turnloadingoff();				  
				   jQuery('.localattach .atitem').slideUp(400,function(){
						jQuery('#mainitem').fadeIn();
					});				  
				}
			})	;	
	},
	uploadPhoto : function()
	{
		var arrExt = new Array('.jpeg','.gif', '.jpg')
		var isvalid = checkextension('photo', arrExt);
		if($('#photo').val()!='')
		{
			if(!this.checkwall(1)){			
				return;
			}
			this.interalID = setInterval('checkfile()', 1000);
			$('#'+this.symbol+'_wall').val(this.value);			
			if(isvalid){	
				document.form_photo.owner_id.value=this.owner_id;
				document.form_photo.submit();
				turnloadingon();
			}else{
				alert(this.errFileType);
				clearInterval(this.interalID);
				this.setRunning(0);
				return false;
			}
		}else{
			this.uploadWall(0,'wall');
		}
		$('#photo').val('');		
	},
	uploadMusic : function()
	{
		if(this.tab=='music_song' || this.tab=='music_list'){
			var song = $('input[name="'+this.tab+'_id"][@checked]').val();
			this.uploadWall(1,this.tab,song);
		}
		else if($('#music').val()!='')
		{
			if(!this.checkwall(1)){			
				return;
			}
			this.interalID = setInterval('checkfile()', 1000);
			var arrExt = new Array('.wma','.mp3');
			$('#'+this.symbol+'_wall').val(this.value);
			var isvalid = checkextension('music', arrExt);
			if(isvalid){
				document.form_music.owner_id.value=this.owner_id;
				document.form_music.submit();
				turnloadingon();
			}else{
				turnloadingoff();
				alert(this.errFileType);
				clearInterval(this.interalID);
				this.setRunning(0);
				return false;
			}
		}else{
			this.uploadWall(0,'wall');
		}
		jQuery('#music').val('');		
	},
	uploadFungift : function(intGiftId, strGiftName, strGiftImage,strFriendId,strFriendName, strEmail)
	{
		if(!this.checkwall(1))
		{			
			return;
		}		
		$.ajax({
				url : YUME+'/wall/ajaxupload',
				type : 'POST',
				data : {wall_post: this.value, act : 'fungift', owner_id : Wall.owner_id, gift_id : intGiftId, gift_name : strGiftName, gift_image : strGiftImage, friend_id : strFriendId, friend_name : strFriendName, email : strEmail},
				beforeSend : function()
				{						
						turnloadingon();
				},
				success : function(data)
				{
				   Wall.running = 0;
				   Wall.setupload('wall', 0)
				   var num = parseInt(data);
				 	if(!isNaN(num) && num>0)
						Wall.load1item(data);
					else{
						alert(data)
					}
				    jQuery('.localattach .atitem').slideUp(400,function(){
							jQuery('#mainitem').fadeIn();
					});
				}
			})
	},
	comment : function(sID)
	{
		var comment = document.getElementById('comment_content_'+sID);
		if(comment.value.length>500)
		{
			alert(this.errDataTooLong);
			return false;
		}
		if(comment.value.length==0){
			return false;
		}
		var isdirect = document.getElementById('isdirect_'+sID).value;
		var refererID = document.getElementById('referer_id_'+sID).value;
		var subjecttype = document.getElementById('subject_type_'+sID).value;
		var title = (subjecttype=="MY_BLOG" || subjecttype=="MY_MUSIC" || subjecttype=="MY_PHOTO")?document.getElementById('symbollink_title_'+sID).value:'';
		//var blog_userid = (subjecttype=="MY_BLOG")?document.getElementById('blog_userid_'+sID).value:0;
		var subject_owner_id = document.getElementById('subject_owner_id_'+sID).value;
		$.ajax({
				url : YUME+'/wall/commentsubject',
				type : 'POST',
				data : {subject_id: sID, comment : comment.value, isdirect:isdirect, refererID:refererID, subjecttype:subjecttype, owner_id: Wall.owner_id, title:title, subject_owner_id:subject_owner_id},
				beforeSend : function()
				{
				},
				success : function(data)
				{
				   //Wall.running = 0;
				   comment.value = '';
				   //document.getElementById('comment_view_'+sID).innerHTML = data;
				   if (data !='')
				   	$('#comment_view_'+sID).html(data);
				}
			})
	},
	commentDetail : function(sID)
	{
		var comment = document.getElementById('comment_content_'+sID);
		if(comment.value.length>500)
		{
			alert(this.errDataTooLong);
			return false;
		}
		if(comment.value.length==0){
			return false;
		}
		var isdirect = document.getElementById('isdirect_'+sID).value;
		var refererID = document.getElementById('referer_id_'+sID).value;
		var subjecttype = document.getElementById('subject_type_'+sID).value;
		$.ajax({
				url : YUME+'/wall/commentsubject',
				type : 'POST',
				data : {subject_id: sID, comment : comment.value, isdirect:isdirect, refererID:refererID, subjecttype:subjecttype, owner_id: Wall.owner_id},
				beforeSend : function()
				{
				},
				success : function(data)
				{
				   comment.value = '';
				   if(data!='')
					$.ajax({
							url : YUME+'/wall/ajaxallsubjectcomment',
							type : 'POST',
							data : {subject_id: sID},
							beforeSend : function()
							{},
							success : function(data)
							{
							   jQuery('#listAllComment').html(data);
							}
						})

				}
			})
	},
	viewcommentarea : function(sID)
	{
		document.getElementById('comment_area_'+sID).style.display = 'block';
		document.getElementById('comment_content_'+sID).focus();
	},
	deletecomment : function(cID, sID)
	{
		var isdirect = document.getElementById('isdirect_'+sID).value;
		var refererID = document.getElementById('referer_id_'+sID).value;
		var subjecttype = document.getElementById('subject_type_'+sID).value;
		var blog_userid = (subjecttype=="MY_BLOG")?document.getElementById('blog_userid_'+sID).value:0;
		var subject_owner_id = document.getElementById('subject_owner_id_'+sID).value;
		var title = (subjecttype=="MY_BLOG" || subjecttype=="MY_MUSIC" || subjecttype=="MY_PHOTO")?document.getElementById('symbollink_title_'+sID).value:'';
		$.ajax({
				url : YUME+'/wall/deletecomment',
				type : 'POST',
				data : {subject_id: sID, comment_id : cID, isdirect:isdirect, refererID:refererID, subjecttype:subjecttype, owner_id: Wall.owner_id, title:title, subject_owner_id:subject_owner_id},
				beforeSend : function()
				{

				},
				success : function(data)
				{
				   //alert(data)
				   //Wall.running = 0;
				   //jQuery('#comment_view_'+sID).html(data);
				   if(data!='')
				   	document.getElementById('comment_view_'+sID).innerHTML = data;
				}
			})
	},
	
	deletecommentall : function(cID, sID)
	{
		var isdirect = document.getElementById('isdirect_'+sID).value;
		var refererID = document.getElementById('referer_id_'+sID).value;
		var subjecttype = document.getElementById('subject_type_'+sID).value;
		var blog_userid = (subjecttype=="MY_BLOG")?document.getElementById('blog_userid_'+sID).value:0;
		var page_type = 'detail';
		$.ajax({
				url : YUME+'/wall/deletecomment',
				type : 'POST',
				data : {subject_id: sID, comment_id : cID, isdirect:isdirect, refererID:refererID, subjecttype:subjecttype, owner_id: Wall.owner_id, blog_userid : blog_userid, page_type : page_type},
				beforeSend : function()
				{

				},
				success : function(data)
				{
					if(data=='deleted')
					{
						jQuery('#itemComment_'+cID).hide(500);
					}
					else
					{
						
					}
				}
			})
	},
	
	deleteSubject : function(intSubjectId, intUserId, intWallOwnerId)
	{
		if(confirm(this.strConfirmDel))
		{
		$.ajax({
				url : YUME+'/wall/deletesubject',
				type : 'POST',
				data : {subject_id: intSubjectId, wall_owner_id : intWallOwnerId},
				beforeSend : function()
				{},
				success : function(data)
				{				   	
					if(data=='deleted')
				   	{
				   	   jQuery('#'+intUserId+'_'+intSubjectId).hide(500);
				   	}
				   	else if(data=='error')
				   	{
						alert(this.errServerError);	
					}
				   	else if(data=='notallow')
				   	{
						alert(this.errNoTAllow);	
					}
					else
					{
						alert(this.errServerError);	
					}
				}
			})
		}
	},
	/*
	loadmusic : function(type)
	{
		if(type=='song'){
			var action = 'ajaxloadmusicsong';
		}else if(type=='playlist'){
			var action = 'ajaxloadmusicplaylist';
		}
		$.ajax({
		   url : YUME+'/wall/'+action,
		   type : 'POST',
		   data : {a:'abc'},
		   beforeSend : function()
		   {
		   },
		   success : function(data)
		   {
			   $('#'+Wall.tab).html(data);
		   }
	   })
	},
	loadphoto : function(type)
	{
		//var acttion = '';
		if(type=='photo'){
			var action = 'ajaxloadphoto';
		}else if(type=='photoalbum'){
			var action = 'ajaxloadphotoalbum';
		}
		$.ajax({
		   url : YUME+'/wall/'+action,
		   type : 'POST',
		   data : {page:Wall.page},
		   beforeSend : function()
		   {
		   },
		   success : function(data)
		   {
			  $('#'+Wall.tab).html(data);
		   }
	   })
	},
	loadvideo : function(type)
	{
		if(type=='video'){
			var action = 'ajaxloadvideo';
		}else if(type=='videoalbum'){
			var action = 'ajaxloadvideoalbum';
		}
		$.ajax({
		   url : YUME+'/wall/'+action,
		   type : 'POST',
		   data : {a:'abc'},
		   beforeSend : function()
		   {
		   },
		   success : function(data)
		   {
			  $('#'+Wall.tab).html(data);
		   }
	   })
	},/*/
	
	loadfungift : function()
	{
		Wall.tab = 'attfungift';
		var action = 'ajaxloadfungift';
		$.ajax({
		   url : YUME+'/wall/'+action,
		   type : 'POST',
		   data : {page:Wall.page, owner_id : Wall.owner_id },
		   beforeSend : function()
		   {
		   },
		   success : function(data)
		   {
			  $('#'+Wall.tab).html(data);
		   }
	   })
	},
	loadgiftbycate : function(sID,intPage)
	{
		if(sID!=0)
		{
			objHtml = $("li[@id^='W_Gift_Cate_'] a.W_Gift_Cate_Selected");
			objGiftCate = $("li#W_Gift_Cate_"+sID);
			if(objGiftCate.length>0)
			{
				objHtml.clone().addClass('W_Gift_Cate_Selected').end().removeClass('W_Gift_Cate_Selected');
				$("li#W_Gift_Cate_"+ sID+" a").addClass('W_Gift_Cate_Selected');	
			}
		}
		var intCateId = (sID==0) ? $("#W_Gift_Cate_Id").val():sID;
		Wall.tab = 'W_GiftList';
		var action = 'ajaxloadgiftbycate';
		$.ajax({
		   url : YUME+'/wall/'+action,
		   type : 'POST',
		   data : {cate_id: intCateId,page:intPage},
		   beforeSend : function()
		   {
		   },
		   success : function(data)
		   {
			  $('#'+Wall.tab).html(data);
		   }
	   })
	},
	selectgift : function(sID)
	{
		objHtml = $("li[@id^='W_Gift_Detail_'].active");
		objHtml.clone().addClass('active').end().removeClass('active');
			$("li#W_Gift_Detail_"+ sID).addClass('active');
	},
	loadfriends : function(intPage)
	{
		strKeyword = $.trim($('#W_Gift_Show_Friends').val()) ? $.trim($('#W_Gift_Show_Friends').val()):'';
		Wall.tab = 'W_GiftList_Friends';
		var action = 'ajaxloadfriends';
		$.ajax({
		   url : YUME+'/wall/'+action,
		   type : 'POST',
		   data : {page:intPage,keyword:strKeyword},
		   beforeSend : function()
		   {
		   },
		   success : function(data)
		   {
			  $('#'+Wall.tab).html(data);
		   }
	   })
	},
	/*loadTab: function(id, page)
	{
		this.tab = id;
		this.page = page;//(page!='undefined' && page!='')?page:1;
		if(this.tab=='attmusic01'){
			this.loadmusic('song');
		}else if(this.tab=='attmusic02'){
			this.loadmusic('playlist');
		}else if(this.tab=='attphoto01'){
			this.loadphoto('photo');
		}else if(this.tab=='attphoto02'){
			this.loadphoto('photoalbum');
		}else if(this.tab=='attvideo01'){
			this.loadvideo('video');
		}else if(this.tab=='attvideo02'){
			this.loadvideo('videoalbum');
		}else if(this.tab=='attfungift'){
			this.loadfungift('attfungift');
		}
	},*/
	loadWall : function(view_tab, last_id)
	{
		this.filter = view_tab;
		$.ajax({
				   url : YUME+'/'+strOrigYumerUsername+'/ajaxloadwall/',
				   data : {filter:view_tab, last_id:last_id,page:this.page},
				   type: "POST",
				   success : function(data)
							{
								jQuery('#content_home').html(data);
								ym2btnUnder();
								unSelectTab();
								$('#wall_view_'+view_tab).addClass('inactive');
								ym2_txtAreaComment('textarea.txtcomment');
							}
			   });
	},
	load1item : function(subject_id)
	{
		if(!isNaN(subject_id)){
		$.ajax({
						   url : YUME+'/home/ajax1item/',
						   data : {subject_id:subject_id, part:'profile'},
						   type: "POST",
						   success : function(data)
						   			{
										$('.btnsend').show();
										turnloadingoff();	
										jQuery('#content_home').prepend(data);
										ym2btnUnder();
										//jQuery('textarea.txtcomment').autogrow({minHeight:32});
									ym2_txtAreaComment('textarea.txtcomment');
										$('#wall2wall').show();
									}
			   });
		}
	},
	next_page : function(last_id)
	{
		this.page++;
		//this.loadWall(this.filter, last_id);
		//$('#nextPage_'+last_id).html('');
		$(".inright",$('#nextPage_'+last_id)).html('<img src="images/graphics/ajax_loading.gif">');
		$.ajax({
						   url : YUME+'/'+strOrigYumerUsername+'/ajaxloadwall/',
						   data : {filter:this.filter, last_id:last_id,page:this.page},
						   type: "POST",
						   success : function(data)
						   			{
										$('#nextPage_'+last_id).html('');
										jQuery('#content_home').append(data);										
										ym2btnUnder();
										//jQuery('textarea.txtcomment').autogrow({minHeight:32});
										ym2_txtAreaComment('textarea.txtcomment');
									}
			   });

	}
}

function unSelectTab()
{
	$('#wall_view_all').removeClass('inactive');
	$('#wall_view_me').removeClass('inactive');
	$('#wall_view_friends').removeClass('inactive');
}

function insertAtCursor(myField, myValue)
{
  //IE support
  if (document.selection) {

    myField.focus();

    sel = document.selection.createRange();

    sel.text = myValue;

  }
  //MOZILLA/NETSCAPE support
  else if (myField.selectionStart || myField.selectionStart == 0) 
  {
	var startPos = myField.selectionStart;

    var endPos = myField.selectionEnd;
    myField.value = myField.value.substring(0, startPos)

                  + myValue

                  + myField.value.substring(endPos, myField.value.length);
  } 
  else 
  {

    myField.value += myValue;

  }

}

function checkextension(id, arrExtension)
{
	var value = $('#'+id).val();
	var pos = value.lastIndexOf('.');
	var len = value.length - pos;	
	var ext = value.substr(pos,len).toLowerCase();
	for(i=0; i<arrExtension.length;i++)
	{
		if(ext == arrExtension[i])
			return true;
	}
	return false;
}

function checkfile()
{
	//alert(document.getElementById("upload").contentWindow.document.childNodes[0].childNodes[1].innerHTML);
	if(!document.getElementById("upload")){
		return;
	}else if(!document.getElementById("upload").contentWindow.document){
		return;
	}
	var str = document.getElementById("upload").contentWindow.document.body.innerHTML;
	if(str!='')
	{
		clearInterval(Wall.interalID);
		Wall.setRunning(0);
		var num = parseInt(str);
		if(!isNaN(num) && num>0)
			Wall.load1item(num);
		else{
			alert(str)
		}
		//Wall.loadWall(Wall.filter);
		jQuery('.localattach .atitem').slideUp(400,function(){
			jQuery('#mainitem').fadeIn();
		});
		turnloadingoff();
		//deleteframe();
		document.getElementById("upload").contentWindow.document.body.innerHTML = '';
		document.getElementById("upload").src = YUME+"/wall/ajaxupload";
	}
}

function createframe()
{
	document.getElementById('iframe_upload').innerHTML = '<iframe id="upload" name="upload" src="'+YUME+'/wall/ajaxupload" style="height:200px;width:500px;border:none"></iframe>';
}

function deleteframe()
{
	document.getElementById('iframe_upload').innerHTML = '';
}

function closetagfindFriend()
{
	jQuery('#closetabfindfriend').click(function(){
			jQuery('#f_smail').parent().remove();
		}
	)
}

function turnloadingon()
{
	document.getElementById('img_loading').style.display = 'block';
}

function turnloadingoff()
{
	document.getElementById('img_loading').style.display = 'none';
}

closetagfindFriend();

function switchToFlashPlayer(strPath, strDivId, strFolderData, strUsername, strFileName)
{
	var strHtml = '<object height="28" align="middle" width="230" id="mp3player" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"><param value="always" name="allowScriptAccess"/><param value="flash_player/simple_play.swf?songName='+MUSICSTREAM+'/'+strPath+'/'+strFolderData+'/'+strUsername+'/'+strFileName+'&amp;mAuto=true" name="movie"/><param value="best" name="quality"/><param value="#ffffff" name="bgcolor"/><param value="opaque" name="wmode"/><embed height="28" align="middle" width="230" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" allowscriptaccess="always" name="simple_play_Flash8" wmode="transparent" quality="high" src="flash_player/simple_play.swf?songName='+MUSICSTREAM+'/'+strPath+'/'+strFolderData+'/'+strUsername+'/'+strFileName+'&amp;mAuto=true"/></object>';
	$('#'+strDivId).html(strHtml);
}
var embed_active;
function playFlashPlayer(id)
{
	if(embed_active!=''){
		$('#flash_'+embed_active).html('');	
		$('#image_flash_'+embed_active).show();
	}
	$('#image_flash_'+id).hide();	
	$('#flash_'+id).html($('#flash_share_'+id).val().replace(/\\"/gi, '"'));
	embed_active = id;
}
function cutstring(obj)
{
	var limit = 500;
	var str = obj.value;
	if(str.length>limit)
	{
		obj.value = str.substr(0,limit);
	}
}
function lockcomment(obj){
	obj.value = '';
	ym2msgbox.show('ym_popup_wall_alert',410);
}
function openallcomment(sID)
{
	for(i=1;i<4;i++)
	{
		//document.getElementById('commentdetail_'+sID+'_'+i).style.display = 'block';
		$('#commentdetail_'+sID+'_'+i).show(500);
	}
	document.getElementById('commentleft_'+sID).style.display = 'none';
}

var loademotion = false;
function loadEmotion()
{
	if(!loademotion){
		loademotion = true;
		$.ajax({
				   url : YUME+'/wall/smiley/',
				   success : function(data)
							{
								$('#listEmoticons').html(data);
							}
		 });
	}
}
function checkLink(strLink)
{
	
	var protocol = new Array("http://", "https://");
	for(i=0; i<protocol.length; i++)
	{
		var pos = strLink.indexOf(protocol[i]);
		if(pos>-1){
			strLink = strLink.substr(protocol[i].length,strLink.length);
			if(strLink.length <6)
				return false;
			else
				return true;
		}
	}
	return true;
}

function filterWall(strFilter)
{
	Wall.page = 1;
	Wall.loadWall(strFilter);
}