/** JS Function **/
// AJAX COMMON
var ico_loading = "/images/loading_small.gif";
var ajax = {
	data:	null,
	args: 	null,
	call:function(_data, _args)
	{
		this.data	= _data;
		this.args	= _args;
		if (typeof _args.method == 'undefined' && _args.method == '')
		{
			_args.method = "GET";
		}
		var message = (typeof(_args.message) != 'undefined' && _args.message != "")? _args.message : "";
		$("#"+_args.loading) ? ajax.loading(_args.loading, 1) : void(0);
		try 
		{
			$.ajax({
				type: 		(typeof(_args.method) == 'undefined')? "GET" : _args.method,
			  	url: 		_args.url,
			  	dataType:	"json",
			  	cache: 		true,
			  	data:		_data,
			  	timeout: 	60000,
			  	onTimeout: function()
			  	{
			  		ajax.timeout();
			  	},
				error: function(request, error) 
				{
					$("#" + _args.loading)? ajax.loading(_args.loading, 0) : void(0);
					if (error = "timeout") 
					{
					   	$("#errormsg")? $("#errormsg").append("The request timed out, please resubmit") : void(0);
					}
					else 
					{
						$("#errormsg")? $("#errormsg").append("ERROR: " + error) : void(0);
					}
				},
				success: function(request) 
				{
					$("#" + _args.loading)? ajax.loading(_args.loading, 0) : void(0);
					if(typeof(_args.func) != 'undefined' && _args.func != "") 
					{
						try
						{
							eval(""+_args.func+"(request);");
							
						} catch (ex) {}
						
					}
					else 
					{
						if(request.status == 1)
						{
							$("#"+_args.container)? $("#"+_args.container).html(request.rs) : void(0);			
						}
					}
				}
			});	
		} 
		catch(ex)
		{
			// TODO
		}
	},
	loading: function(elem, status)
	{
		if(status == 1)
		{
			$("#" + elem).css("opacity", "0.5");
			$("#" + elem).css("background-image", "url("+ico_loading+")");
			$("#" + elem).css("background-position", "center center");
			$("#" + elem).css("background-repeat", "no-repeat");
		}
		else
		{
			$("#" + elem).css("opacity", "1");
			$("#" + elem).css("background-image", "");
			$("#" + elem).css("background-position", "");
			$("#" + elem).css("background-repeat", "");
		}
		return false;
	},
	timeout: function()
	{
		if(this.data != null && this.args != null)
		{
			this.call(this.data, this.args);
		}
	},
	genKey: function()
	{
		if(typeof(this.args['key']) && this.args['key'] != '')
		{
			return $.trim(this.args['key']);
		}
	}
}
/*************/
// JS Calendar
/************/
var calendar = {
	cur_key		: null,
	getMonthView: function(u, m, y)
	{
		this.cur_key	= m + '_' + y;
		var bcache 		= null;
		try
		{
			bcache	= $.jCache.getItem(this.cur_key);
		}
		catch(ex){}
		if (typeof(bcache) == 'undefined' || bcache == null)
		{
			var url 	= appsDomain + '/' + ownerUser + '/ajax/handle';
			var data = "obj=calendar&act=getMonthView&username="+ownerUser+"&m="+m+"&y="+y;
			ajax.call(data, {
				url			: url,
				func		: 'calendar.MonthViewCallback',
				loading		: 'boxcalendar'
			});
		}
		else
		{
			this.MonthViewCallback(bcache);
		}
	},
	MonthViewCallback: function(response)
	{
		$('#cal_btmtitle').show();
		if(response.rs != null)
		{
			$.jCache.setItem(this.cur_key, response);
			$('#boxcalendar').html(response.rs);
			if(typeof(APPS_PAGE) != 'undefined')
			{
				common.ProcessClicks('boxcalendar');
			}
		}
	},
	GetCalendar: function (d, m, y)
	{
		this.cur_key	= m + '_' + y;
		var url 	= appsDomain + '/' + ownerUser + '/ajax/handle';
		var data 	= "obj=calendar&act=getMonthView&username="+ownerUser+"&d="+d+"&m="+m+"&y="+y;
		ajax.call(data, {
			url			: url,
			func		: 'calendar.CalendarCallback',
			loading		: 'boxcalendar'
		});	
	},
	CalendarCallback: function (response)
	{
		$('#cal_btmtitle').show();
		if(response.rs != null)
		{
			$.jCache.setItem(this.cur_key, response);
			$('#boxcalendar').html(response.rs);
			if(typeof(APPS_PAGE) != 'undefined')
			{
				common.ProcessClicks('boxcalendar');
			}
		}
	},
	isTip: false,
	ShowTip: function(elm, flag, act)
	{
		if(flag == 0)
		{
			if(calendar.isTip == false)
			{
				if(typeof(act) != 'undefined')
				{
					$('#cal_tooltip').hide();
				}
				else
				{
					window.setTimeout("calendar.ShowTip(null, 0, true);", 100);
				}
			}
			$('#cal_tooltip').bind("mouseout", function(){
				$(this).hide();
				calendar.isTip = false;
			});
			$('#cal_tooltip').bind("mouseover", function(){
				$(this).show();
				calendar.isTip = true;
			});			
		}
		else if (flag == 1)
		{
			if(elm != null)
			{
				var pos		= $(elm).position();
				var listTil = $(elm).attr("rel").split('|-|');
				var listKey = $(elm).attr("keys").split('|');
				var strTil	= '';
				$.each(listTil, function(ind, val){
					strTil += '<img src="' + appsDomain + '/images/zme_iconblog.gif" />&nbsp;<a class="zbctrl" onmouseover="calendar.ShowTip(null, 1);" href="' +appsDomain+'/'+ownerUser+ '/blog/detail/id/' + listKey[ind] + '" target="_parent">' + val + '</a><br />';
				});
				$('#cal_tooltip').css({left: (pos.left-170)+'px', top:pos.top+'px', position: 'absolute'});
				$('#cal_tooltip').empty();
				$('#cal_tooltip').append($(strTil));
				if(typeof(APPS_PAGE) != 'undefined')
				{
					common.ProcessClicks('cal_tooltip');
				}
			}
			$('#cal_tooltip').show();
		}
		return false;
	}
}
/*************/
// JS Cookies
/************/
var zcookie = {
	Create: function (name, value, days) 
	{
		if (days) {
			var date = new Date();
			date.setTime(date.getTime()+(days*24*60*60*1000));
			var expires = "; expires="+date.toGMTString();
		}
		else 
		{
			var expires = "";
		}
		document.cookie = name+"="+value+expires+"; path=/";
	},
	Read: function (name) 
	{
		var nameEQ = name + "=";
		var ca = document.cookie.split(';');
		for(var i=0;i < ca.length;i++) 
		{
			var c = ca[i];
			while (c.charAt(0)==' ') 
			{	
				c = c.substring(1,c.length);
			}
			if (c.indexOf(nameEQ) == 0)
			{
				return c.substring(nameEQ.length,c.length);
			}
		}
		return null;
	},
	Erase: function (name) 
	{
		this.Create(name,"",-1);
	}
}
/*************/
// JS Common
/************/
var common = {
	emotionURL:		'http://static.me.zing.vn',
	ShowIcoAvatar: function(atc)
	{
		(atc==1) ? $('#icoAvatar').show() : $('#icoAvatar').hide();
	},
	ZME_pass: function(s)
	{
	    var url  =  "http://api.me.zing.vn/widget2.php?u=" + s;
	    var script = document.createElement("script");        
	    script.setAttribute("src",url);
	    script.setAttribute("type","text/javascript");                
	    var body_element = document.getElementsByTagName("body");
	    body_element[0].appendChild(script);	
	},
	ZME_widget: function ()
	{
		var k = document.getElementsByTagName("a");
		var avatar = new Array();
		for (var i=0; i<k.length; i++) 
		{
			var att 	= k[i].getAttribute("rel");
			var html 	= k[i].innerHTML; 
			if (att != null && html.indexOf("img")==-1 && html.indexOf("IMG")==-1)
			{
				var Me = att.substr(0,5).toUpperCase();
				var Usn =  att.substr(5) ;
				if (Me=="ZMEA_")
				{
					 var im  = document.createElement('img');
					 im.src = "http://api.me.zing.vn/images/loading.gif";
					 im.id = Usn + "_ZMEA"  + i ;
					 im.border = "0";
					 if (zme_avatar_width)
					 {
					 	im.width = zme_avatar_width;
					 }
					 if (zme_avatar_heigth)
					 {
					 	im.height = zme_avatar_heigth;
					 }
					 k[i].appendChild(im);
					 this.ZME_pass(im.id);
				 }
			}
		}
	},
	Messaging: function(message, duration)
	{
		window.parent.scrollTo(0,0);
		if(typeof duration == 'undefined') 
		{
			var duration = 5000;
		}
		$("#gb_message").html(message);
		$("#gb_message").slideDown('slow');
		window.setTimeout("common.HideMessaging();", parseInt(duration));
	},
	HideMessaging: function()
	{
		$("#gb_message").slideUp('slow');
	},
	ResizeFrame: function()
	{
		var h = $('#mainContent').height();
		if(h < 937)
		{
			h = 937;
		}
		if(h>= 32767)
		{
			parent.$('#blog').attr("height",  "32000");
			parent.$('#blog').attr("scrolling", "yes");	
		}
		else
		{
			parent.$('#blog').attr("height",  (h+50));
			parent.$('#blog').attr("scrolling", "no");
		}
	},
	LoadAvatar: function()
	{
		var data = "obj=user&act=loadAvatar&username="+ownerUser;
		ajax.call(data, {
			url		: appsDomain + '/' + ownerUser + '/ajax/handle',
			func	: 'common.LoadAvatarCallback',
			loading : 'divAvatar'
		});	
	},
	LoadAvatarCallback: function(response)
	{
		if (response.rs != false)
		{
			var avatar 	= response.rs.avatar;
			var html 	= '<img onclick="javascript:window.parent.location.href=\''+meDomain+'/apps/blog?params='+ownerUser+'\';" id="appsAvatar" width="180" src="'+avatar+'" alt="Avatar" style="cursor:pointer;"/>';
			$('#divAvatar').append(html);
		}
	},
	GetTextTime: function(textTime, textDate)
	{
		//14:17:57 31/07/2009
		var timeText 	= '';
		
		var curInfo 	= curDate.split('/');
		var dateInfo 	= textDate.split('/');
			
		var timeInfo	= textTime.split(':');
		var timeCur		= curTime.split(':');
		
		var secondInfo 	= (parseInt(timeInfo[0])*60*60) + (parseInt(timeInfo[1])*60) + parseInt(timeInfo[2]);
		var secondCur 	= (parseInt(timeCur[0])*60*60) + (parseInt(timeCur[1])*60) + parseInt(timeCur[2]);
		
		var limitTime	= 24 * 60 * 60;
		var pastTime	= 0;
				
		if(curInfo[0] == dateInfo[0])
		{
			pastTime = parseInt(secondCur) - parseInt(secondInfo);
			//alert(pastTime);
			if (pastTime> 0 && pastTime <= 60) 
			{
				timeText = pastTime + ' giây trước';
			}
			else if (pastTime> 60 && pastTime <= 3600) 
			{
				timeText = Math.ceil((pastTime / 60)) + ' phút trước';
			}
			else if (pastTime> 3600 && pastTime <= 24*3600)
			{
				timeText = Math.ceil((pastTime / (60*60))) + ' tiếng trước';
			}
			else 
			{
				timeText = '1 giây trước';
			}
		}
		else 
		{	
			timeText	= (parseInt(timeInfo[0])> 12) ? (parseInt(timeInfo[0])-12) : timeInfo[0];
			timeText 		+= ':' + timeInfo[1] + ' ';
			if (parseInt(timeInfo[0])>=1 && parseInt(timeInfo[0]) <= 10) 
			{
				timeText += 'sáng';
				if (parseInt(timeInfo[0])==10 && parseInt(timeInfo[1])> 59) 
				{
					timeText += 'trưa';
				}
			}
			else if (parseInt(timeInfo[0])>= 11 && parseInt(timeInfo[0]) <= 13) 
			{
				timeText += 'trưa';
				if (parseInt(timeInfo[0])==13 && parseInt(timeInfo[1])> 59) 
				{
					timeText += 'chiều';
				}
			}
			else if (parseInt(timeInfo[0])>= 13 && parseInt(timeInfo[0]) <= 18) 
			{
				timeText += 'chiều';
				if (parseInt(timeInfo[0])==18 && parseInt(timeInfo[1])> 59) 
				{
					timeText += 'tối';
				}
			}
			else 
			{
				timeText += 'tối';
			}
		}
		return timeText;
	},
	GetTextDate: function(textDate)
	{
		var curInfo 	= curDate.split('/');
		var timeInfo 	= textDate.split('/');
		var dateText	= '';
		
		if(curInfo[0] != timeInfo[0])
		{
			if((curInfo[0] - timeInfo[0]) == 1) 
			{
				if(curInfo[1] == timeInfo[1])
				{
					dateText = 'hôm qua';
				}
				else 
				{
					dateText = timeInfo[0] + '/' + timeInfo[1] + '/' + timeInfo[2];
				}
			}
			else 
			{
				dateText = timeInfo[0] + '/' + timeInfo[1] + '/' + timeInfo[2];
			}
		}
		return dateText;
	},
	HitCounterBlog: function(jData)
	{
		$("#blogDetailHitCounter").html(jData.ItemCounter);
	},
	ShareBlog: function(bid)
	{
		var feedTitle = "Chia sẻ Blog cho bạn bè";
		var imgBlog		= $("#image_blog_"+bid) ? $("#image_blog_"+bid).attr('src') : "";
		var ownerBlog	= $("#owner_blog_"+bid).val();
		var blogTile	= $("#title_blog_"+bid).val();
		var feedForm 	= '<div id="feed">' + 
		'<div id="makefriendPopup" class="cntBlog">' +
		'	<div class="marginblog">' +
		'		<div class="marginblog">' +
		'			<div class="rwFriend">';
		//alert(imgBlog);
		if(typeof imgBlog != 'undefined' && imgBlog != "")
		{
			var list_img	= imgBlog.split('.');
	    	var mini_img	= list_img[0] +'.'+list_img[1] +'.'+list_img[2] +'.'+list_img[3]+'_130'+'.'+list_img[4];
			feedForm += '<div class="avatar">' +
			'					<a href="' + meDomain + '/apps/blog?params=' + ownerBlog + '/blog/detail/id/' + bid + '" target="_blank">' +
			'					<img src="' + mini_img + '" width="50" height="50" onerror="this.src=\'' + appsDomain + '/images/zme_pical.png\'" border="0" />' +
			'					</a>' +
			'				</div>';
		}
		feedForm += '<div class="message">Chia sẻ blog <a href="' + meDomain + '/apps/blog?params=' + ownerBlog + '/blog/detail/id/' + bid + '" target="_blank">' + blogTile + '</a> với bạn bè trên Zing Me</div>' +
		'				<br class="clr"/>' +
		'			</div>' +
		'			<div class="typeMessa">' +
		'				<br class="clr"/>' +
		'				<div class="note">Viết lời nhắn<span class="key">(Giới hạn <strong id="countMessage">300</strong> ký tự)</span></div>' +
		'				<textarea style="width: 380px; height: 50px;" id="contentFeed" name="contentFeed" onkeyup="top.frames[0].common.LimitChars();"></textarea>' +
		'			</div>' +
		'			<br class="clr"/>' +
		'		</div>' +
		'	</div>' +
		'</div>' +
		'</div>';
		parent.Boxy.confirm(feedForm, function() { 
			var shareContent	= common.CheckContent(parent.$("#contentFeed").val());
			/*if(shareContent.replace(/ /g, '') == '')
			{
				parent.Boxy.alert('<div style="margin: 0 20px 0 20px">Bạn chưa nhập lời nhắn.</div>',function(){},{"title": "Chú ý", "cancelTitle":"Đóng"});
				common.ShareBlog(bid);
				return;
			}*/
			
			var data = "obj=blog&act=shareBlog&username=" + appsUser + "&ownername=" + ownerBlog + "&bid="+bid + "&content="+shareContent;
			ajax.call(data, {
				url		: appsDomain + '/' + appsUser + '/ajax/handle',
				method	: 'POST',
				func	: 'common.ShareBlogCallback',
				loading : 'makefriendPopup'
			});	
			
		}, {"title": feedTitle, "okTitle":"Chia sẻ", "cancelTitle":"Hủy" });
		return false;
	},
	ShareBlogCallback: function(response)
	{
		if(response.rs != false)
		{
			parent.Boxy.alert('<div style="margin: 0 20px 0 20px">Chia sẻ thành công.</div>',function(){},{autoClose:2000, "title": "Chia sẻ blog", "cancelTitle":"Đóng"});
		}
		else
		{
			parent.Boxy.alert('<div style="margin: 0 20px 0 20px">Chia sẻ không thành công.</div>',function(){},{autoClose:2000, "title": "Chia sẻ blog", "cancelTitle":"Đóng"});
		}
	},
	LimitChars: function()
	{
		var lenContent = parent.$("#contentFeed").val().length;
		if(lenContent <= 300)
		{
			var remaindChars = 300 - parseInt(lenContent);
			parent.$("#countMessage").html(remaindChars);
		}
		else
		{
			var txt	= parent.$("#contentFeed").val().substring(0, 299);
			parent.$("#contentFeed").val(txt);
			parent.$("#contentFeed").blur();
		}
		return false;
	},
	ResetHref: function()
	{
		// Check A tag element	
		$.each($(".noidung a"), function (ind, elm){
			if (elm.target == "" || elm.target.indexOf('self') != -1)
			{
				elm.target = "_blank";
			}
		});
	},
	CheckContent: function(content)
	{
		content	= $.trim(content);
		content = this.ReplaceSmiley(content);
		content	= content.replace(/&lt;/g, '5#');
		content	= content.replace(/&gt;/g, '6#');
		content	= content.replace(/\&/g, 'l#');
		content	= content.replace(/\?/g, '2#');
		content	= content.replace(/\'/g, '3#');
		content	= content.replace(/\"/g, '4#');
		content	= content.replace(/</g, '5#');
		content	= content.replace(/>/g, '6#');
		
		for(var i=0; i<10; i++)
		{
			content = content.replace(/  /g, " ");
			content = content.replace(/\n\n/g, "\n");
		}
		//alert(content);
		return content;
	},
	ReplaceSmiley: function (dataStr)
	{
		var search = new Array(":)", ":~", ":b", ":B", ":|", "8-)", ":((", ":$", ":x", ":X", ":z", ":Z", ":'(", ":@", ":p", ":P", ":d", ":D", ":O", ":o", ":(", ":+", "--b", "--B", ":q", ":Q", ":t", ":T", ";p", ";P", ";-d", ";-D");var replace_arr = new Array("<img src='" + this.emotionURL + "/images/smilley/default/14.gif' border='0'>", "<img src='" + this.emotionURL + "/images/smilley/default/1.gif' border='0'>", "<img src='" + this.emotionURL + "/images/smilley/default/2.gif' border='0'>", "<img src='" + this.emotionURL + "/images/smilley/default/2.gif' border='0'>", "<img src='" + this.emotionURL + "/images/smilley/default/3.gif' border='0'>", "<img src='" + this.emotionURL + "/images/smilley/default/4.gif' border='0'>", "<img src='" + this.emotionURL + "/images/smilley/default/5.gif' border='0'>", "<img src='" + this.emotionURL + "/images/smilley/default/6.gif' border='0'>", "<img src='" + this.emotionURL + "/images/smilley/default/7.gif' border='0'>", "<img src='" + this.emotionURL + "/images/smilley/default/7.gif' border='0'>", "<img src='" + this.emotionURL + "/images/smilley/default/8.gif' border='0'>", "<img src='" + this.emotionURL + "/images/smilley/default/8.gif' border='0'>", "<img src='" + this.emotionURL + "/images/smilley/default/9.gif' border='0'>", "<img src='" + this.emotionURL + "/images/smilley/default/11.gif' border='0'>", "<img src='" + this.emotionURL + "/images/smilley/default/12.gif' border='0'>", "<img src='" + this.emotionURL + "/images/smilley/default/12.gif' border='0'>", "<img src='" + this.emotionURL + "/images/smilley/default/13.gif' border='0'>", "<img src='" + this.emotionURL + "/images/smilley/default/13.gif' border='0'>", "<img src='" + this.emotionURL + "/images/smilley/default/0.gif' border='0'>", "<img src='" + this.emotionURL + "/images/smilley/default/0.gif' border='0'>", "<img src='" + this.emotionURL + "/images/smilley/default/15.gif' border='0'>", "<img src='" + this.emotionURL + "/images/smilley/default/16.gif' border='0'>", "<img src='" + this.emotionURL + "/images/smilley/default/96.gif' border='0'>", "<img src='" + this.emotionURL + "/images/smilley/default/96.gif' border='0'>", "<img src='" + this.emotionURL + "/images/smilley/default/18.gif' border='0'>", "<img src='" + this.emotionURL + "/images/smilley/default/18.gif' border='0'>", "<img src='" + this.emotionURL + "/images/smilley/default/19.gif' border='0'>", "<img src='" + this.emotionURL + "/images/smilley/default/19.gif' border='0'>", "<img src='" + this.emotionURL + "/images/smilley/default/20.gif' border='0'>", "<img src='" + this.emotionURL + "/images/smilley/default/20.gif' border='0'>", "<img src='" + this.emotionURL + "/images/smilley/default/21.gif' border='0'>", "<img src='" + this.emotionURL + "/images/smilley/default/21.gif' border='0'>");dulieu = dataStr;for(j=0; j< search.length; j++){while( dulieu.indexOf(search[j]) != -1 ){dulieu = dulieu.replace(search[j], replace_arr[j]);}}return dulieu;
	},
	ProcessClicks: function (ediv, status) 
	{
		if(typeof(ediv) != 'undefined' && typeof(status) != 'undefined')
		{
			$.each(parent.$('#container a'), function(ind, elm){
				if(typeof $(elm).attr("url") != 'undefined')
		  		{
			  		$(elm).attr("href", $(elm).attr("url"));
		  		}
			  	$(elm).unbind('click');
			});
		}
		else if(typeof(ediv) != 'undefined' && typeof(status) == 'undefined')
		{
			$.each($('#'+ediv+' a.zbctrl'), function(ind, elm){
		  	
		  		if(typeof($(elm).attr("url")) == 'undefined')
		  		{
			  		$(elm).attr("url", $(elm).attr("href"));
			  		$(elm).attr("href", "javascript:void(0)");
		  		}
			  	$(elm).bind('click', function(e){
			  		common.HandleClick(e, this);
			  	});
		  	
		  	});
		}
		else
		{
			$.each(parent.$('#container a'), function(ind, elm){
				if(typeof $(elm).attr("target") == 'undefined' || $(elm).attr("target") != '_blank' || $(elm).attr("target") == '')
		  		{
			  		$(elm).attr("url", $(elm).attr("href"));
			  		$(elm).attr("href", "javascript:void(0)");
		  		}
			  	$(elm).bind('click', function(e){
			  		common.HandleClick(e, this);
			  		return true;
			  	});
			});
			
		  	$.each($('#mainContent a.zbctrl'), function(ind, elm){
		  	
		  		if(typeof($(elm).attr("url")) == 'undefined')
		  		{
			  		$(elm).attr("url", $(elm).attr("href"));
			  		$(elm).attr("href", "javascript:void(0)");
		  		}
			  	$(elm).bind('click', function(e){
			  		common.HandleClick(e, this);
			  		return true;
			  	});
		  	
		  	});
		}
	},
	HandleClick: function(e, elm)
	{
		if(typeof(APPS_PAGE) != 'undefined' && APPS_PAGE=='add')
		{
			var til 	= $.trim($("#title").val()).replace(/ /g, "");
			var content = $.trim(tinyMCE.get('content').getContent()).replace(/ /g, "");
			content 	= content.replace(/\n/g, "");
			if(til.length > 0 || content.length > 0)
			{
				window.parent.Boxy.confirm("<div class='txtComple'>Nội dung bài blog của bạn đã thay đổi.<br/><br/>Bạn có muốn tiếp tục bài viết này không ?</div>", function() { 
					
					window.parent.location.href = $(elm).attr("url");
					
				},{"title":"Chú ý", "okTitle":"Bỏ qua", "cancelTitle":"Tiếp tục", center: true});
				
			}
			else
			{
				if($.browser.msie && $.browser.version == '6.0')
				{
					var link = $(elm).attr("url");
					if(link.indexOf('?params=') != -1 && link.indexOf('blog') != -1)
					{
						var lu 	= link.split('?params=');
						link 	= appsDomain + '/' + lu[1];
						eval("window.location.href = link;");
					}
					else
					{
						link = appsDomain + '/' + appsUser + '/blog/redirect?refurl=' + link;
						eval("window.location.href = link;");
					}
				}
				else
				{
					window.parent.location.href = $(elm).attr("url");
				}
			}
		}
		return false;
	},
	SwapImage: function (elm, mode)
	{
		if(mode == 'act')
		{
			//$(elm).attr("src", $(elm).attr("src").replace(/inactive/g, 'active'));
			$(elm).css('background-color', '#476DA4');
			$(elm).css('color', '#FFFFFF');
		}
		else if(mode == 'in')
		{
			//$(elm).attr("src", $(elm).attr("src").replace(/active/g, 'inactive'));
			$(elm).css('background-color', '#FFFFFF');
			$(elm).css('color', '#476DA4');
		}
	}
}
