if (!MCJQ) {
	var MCJQ = jQuery.noConflict();
}

iesucks = false;



function closeColorbox() {
	MCJQ.colorbox.close();
}

function resizeColorbox(w,h) {
	MCJQ.colorbox.resize({ innerWidth:w,innerHeight:h });
}

seltabs = new Array(2,1,1,1);
donefirstseltab = new Array();



function clickTab(n,m) {

e = document.getElementById('mybox'+n+'t'+seltabs[n]);
if (e) { e.className = ''; }

e = document.getElementById('mybox'+n+'t'+m);
if (e) { e.className = 'boxsel'; e.blur(); }

e = document.getElementById('mybox'+n+'con'+seltabs[n]);

if (e) MCJQ(e).hide();

e = MCJQ('#mybox'+n+'con'+m);

if (e) {
	if (donefirstseltab[n])
		e.show();//fadeIn();
	else
		e.show().addClass('firsttimeload');

seltabs[n]=m;
donefirstseltab[n] = true;

}

}



function toggleCB(src) {
e = document.getElementById(src);

if (src) e.checked = !e.checked;
}



function toggleDisplay(x) {
e = document.getElementById(x);
if (e) { e.style.display = e.style.display == 'none' ? 'block' : 'none'; }
}



poppyMenu = function(element) {
this.sectionname = element;

this.setactive = function(x,y) {
i = 1;
e = true;
while (e) {
e = document.getElementById(this.sectionname+i);
if (e) {
e.className = 'poppysection poppyclosed';
}
i++;
}

e = document.getElementById(this.sectionname+x);
if (e) {
e.className = 'poppysection';
}

if (y != undefined) y.blur();

}

}



	function selectAllItems()
	{
		MCJQ("#edit_item").find('input[type=checkbox]').each(function() {
			if (!MCJQ(this).is(':checked'))
				MCJQ(this).trigger('click');
		});
	}
	
	function deselectAllItems()
	{
		MCJQ("#edit_item").find('input[type=checkbox]').each(function() {
			if (MCJQ(this).is(':checked'))
				MCJQ(this).trigger('click');
		});
	}
















function wipeIf(e,str) {
if (e.val() == str) e.value = '';
if (str == 'Password') e.type = 'password';

MCJQ(e).removeClass('dimmed');
}




function getUrlVars()
{
    var vars = [], hash;
    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
    for(var i = 0; i < hashes.length; i++)
    {
        hash = hashes[i].split('=');
        vars.push(hash[0]);
        vars[hash[0]] = hash[1];
    }
    return vars;
}



function RSalert(str,title) {

	MCJQ("#RSdialog").dialog('close').find('div').html(str).end().dialog('option','title',title).dialog('open');

}




function popupAttachmentOptions(self,id,flags) {

	var e = MCJQ("#dialog_attachments");

	if (e.length == 0) {
	
		MCJQ("body").append('<div id="dialog_attachments"><div></div></div>');
		e = MCJQ("#dialog_attachments").dialog({	width:640,
												height:424,
												resizable:false,
												title:'Attachment Options'
												});
	}
	else
		e.dialog('open');
		
	
	if (MCJQ(self).closest('form').find('#attach_groups').length == 0) MCJQ(self).closest('form').append('<span id="wrapper_select_attachments" style="display:none"><select id="attach_groups"></select><select id="attach_events"></select><select id="attach_bios"></select><select id="attach_members"></select></span>');
		
		
	e.first('div').load('attach.php?do=test&item_id='+$("input[name=item_id]").val()+'&item_type='+$("input[name=item_type]").val()+'&rid='+Math.random());

}



function doInlineLogin() {


MCJQ.colorbox({ href:'login.php',title:' ',opacity:0.75,initialWidth:320,initialHeight:240,rel:'nofollow',fixed:true,iframe:true,fastIframe:false,innerWidth:320,innerHeight:180 });


}



function setAjaxToggle(e,state) {

					e = MCJQ(e);


					if (state == 1) {
						e.children('.ajax_toggle_on').show();
						e.children('.ajax_toggle_off').hide();
					}
					else
					if (state == 0) {
						e.children('.ajax_toggle_on').hide();
						e.children('.ajax_toggle_off').show();
					}
					
				}





MCJQ(document).ready(function() {


var e = MCJQ("#article_description");

if (e.find('div').first().height() >= parseInt(e.css('max-height'))) {

	$("#article_info").prepend('<div class="show_me_more"><table cellpadding="0" cellspacing="0" border="0" style="margin:0 auto"><tr><td><a onclick="MCJQ(\'#article_description\').css(\'max-height\',\'none\'); MCJQ(this).closest(\'div.show_me_more\').remove();"><div>Show full description</div></a></td></tr></table></div>');
	
}





MCJQ(document).delegate("select","blur",function(event) {

var e = MCJQ(this).find('option:selected');

	if (e) {

	if (!e.data("done")) {

		e.data("origopt",e.text()).data("done",true);

		var re = new RegExp(String.fromCharCode(160), "g");
		e.text(e.text().replace(re," "));
		
		}

	}
	

}).delegate("select","focus",function(event) {

	MCJQ(this).find('option').each(function() {

		if (MCJQ(this).data("done") == true) {}

		MCJQ(this).data("done",false);
			
	});

}).delegate("select","change",function(event) {

	MCJQ(this).blur();

});


MCJQ("body").prepend('<div id="thumb_type">&nbsp;</div><div id="img_preview">&nbsp;</div>').append('<div id="RSdialog"><div></div><div class="liq1div"></div></div>');

MCJQ("#RSdialog").dialog({	autoOpen:false,
							buttons:
							[{ text: "OK",click: function() { MCJQ(this).dialog("close"); } }]
						});
						
						





var fakeInput = document.createElement("input"),
	placeHolderSupport = ("placeholder" in fakeInput),
	clearValue = function () {
		if (searchField.val() === originalText) {
			searchField.val("");
		}
	};


if (!placeHolderSupport) {



MCJQ(document).find('input.textinput,input.t_b').each(function() {

	if (MCJQ(this).val() == '') MCJQ(this).addClass('t_b_placeholder').val(MCJQ(this).attr('placeholder'));
	MCJQ(this).data('placeholder',MCJQ(this).attr('placeholder'));
	
}).end().delegate('input','focus',function() {

	MCJQ(this).removeClass('t_b_placeholder');
	if (MCJQ(this).attr('placeholder') == MCJQ(this).val()) MCJQ(this).val('');
	
}).delegate('input','blur',function() {
	
	if (MCJQ(this).val() == '') MCJQ(this).val(MCJQ(this).data('placeholder')).addClass('t_b_placeholder');
	
});



}




MCJQ(".showmemore",".userhtml").each(function() {

MCJQ(this).after('<div class="showmemorebutton">Show More</div>');

});



MCJQ(".showmemorebutton",".userhtml").click(function(event) {

	event.preventDefault();
	event.stopPropagation();

	MCJQ(this).prev(".showmemore").css({ height:'auto' }).end().hide();

});



MCJQ(document).delegate('.bttn_follow','click',function(event) {

	var e = $(this);
	
	if (e.hasClass('ajaxload')) return false;
	
	e.addClass('ajaxload');

	$.ajax({	url:$(this).attr('href'),
				cache:false,
				dataType:'json',
				type:'GET',
				success:function(result) {
				
					e.removeClass('ajaxload');
					
					if (result.status == "ok") e.addClass('bttn_followed');
					
					if (result.status == "login") doInlineLogin();
					
					
				},
				error:function() {
				
					e.removeClass('ajaxload');
				}
				
			});


event.preventDefault();
return false;

});




var poster_popup_timer = false;
var close_poster_popup_timer = false;
var poster_popup_ajax = false;

$("body").append('<div id="poster_popup"><div id="poster_popup_arrow"></div><div id="poster_popup_content"><div id="poster_popup_body"></div><div id="poster_popup_social"></div></div></div>');

$("#poster_popup").mouseleave(function() {

	if (close_poster_popup_timer) clearTimeout(close_poster_popup_timer);

	close_poster_popup_timer = setTimeout(function() {
	
		$("#poster_popup").stop(true).animate({ opacity:0 },function() { $(this).hide(); });
	
	},250);




}).mouseenter(function() {

	if (close_poster_popup_timer) clearTimeout(close_poster_popup_timer);

});


$(document).delegate('.popup_memberinfo','mouseleave',function() {

	if (poster_popup_timer) clearTimeout(poster_popup_timer);
	
	close_poster_popup_timer = setTimeout(function() {
	
		$("#poster_popup").stop(true).animate({ opacity:0 },function() { $(this).hide(); });
	
	},250);

}).delegate('.popup_memberinfo','mouseenter',function(event) {

	if (close_poster_popup_timer) clearTimeout(close_poster_popup_timer);

	var e = $(this);

	if (e.data('lasturl') == e.attr('href')+'&do=mini_details') {
		//$("#poster_popup").stop(true).show().animate({ opacity:1 });
		//return false;
	}

	if (poster_popup_timer) clearTimeout(poster_popup_timer);

	poster_popup_timer = setTimeout(function() {

	$("#poster_popup_content").addClass('ajaxload');
	$("#poster_popup_body,#poster_popup_social").text('');

	//$("#poster_popup").css({ left:e.offset().left, top:e.offset().top - $("#poster_popup").height() }).stop(true).show().animate({ opacity:1 });
	
	
	if (e.css('display') == 'inline-block')
	$("#poster_popup").css({ left:e.offset().left+12, top:e.offset().top - $("#poster_popup").height() }).stop(true).show().animate({ opacity:1 });
	else
	$("#poster_popup").css({ top:event.pageY - $("#poster_popup").height()-10 }).stop(true).show().animate({ opacity:1 });
	
	
	
	if (poster_popup_ajax) poster_popup_ajax.abort();
	
	poster_popup_ajax = $.ajax({	url:e.attr('href')+'&do=mini_details',
				cache:false,
				dataType:'json',
				type:'GET',
				success:function(result) {
				
					//e.data('lasturl',e.attr('href')+'&do=mini_details');
				
					var str = '<table cellpadding="4" cellspacing="0"><tr><td valign="top"><img src="'+result.avatar+'"></td><td valign="top"><div class="poster_popup_title">'+result.title+'</div><a href="'+result.url+'">Home</a> | <a href="'+result.url+'&do=photos">Photos</a> | <a href="'+result.url+'&do=videos">Videos</a> | <a href="'+result.url+'&do=news">News</a> | <a href="'+result.url+'&do=blogs">Blogs</a><br>';
					
					
					if (result.follow)
						str += '<a href="'+result.url+'&do=wall&sub=follow" class="bttn_follow bttn_followed">&nbsp;</a>';
					else
						str += '<a href="'+result.url+'&do=wall&sub=follow" class="bttn_follow">&nbsp;</a>'
					
					str += '</td></tr></table><div class="poster_popup_subtitle">Recent Posts</div>';
					
					for (var item in result.news) {
					
						var news = result.news[item];
					
						str += '<span class="recent_post">&bull; <a href="'+news.url+'">'+news.title+'</a></span>';
					
					}
				
					$("#poster_popup_content").removeClass('ajaxload');
					$("#poster_popup_body").html(str);
					
					$("#poster_popup_social").html(result.share_this);
					
					if (e.css('display') == 'inline-block')
					$("#poster_popup").css({ top:e.offset().top - $("#poster_popup").height() });
					else
					$("#poster_popup").css({ top:event.pageY - $("#poster_popup").height()-10 });
					
					
//					$("#poster_popup_content").css({ height:300 });

	
					twttr.widgets.load();
					
					$(".googlemoogle").each(function() {
						gapi.plusone.render(this, { size:'medium', href:$(this).attr('href') });
					});
	
				
				}
				
			});
			
	},250);
	
}).delegate(".popup_memberinfo","mousemove",function(event) {

if ($(this).css('display') == 'inline')
	$("#poster_popup").css({ left:event.pageX });

});




var e = MCJQ(".edit_table");


MCJQ(".required_form",e).each(function() {

	if (MCJQ(this).prop("selectedIndex") == 0)
		MCJQ(this).addClass('required');

}).bind('change',function() {

	if (MCJQ(this).prop("selectedIndex") == 0)
		MCJQ(this).addClass('required');
	else
		MCJQ(this).removeClass('required');

});



MCJQ("select,input,textarea",e).focus(function() {

var e = MCJQ(this).prev(".wrapper_error");

if (!e.length)
e = MCJQ(this).parent().find(".wrapper_error");

if (e) e.hide();

}).each(function() {

if (MCJQ(this).attr('placeholder')) { MCJQ(this).attr('title',MCJQ(this).attr('placeholder')); return true; }

if (MCJQ(this).is('select')) { MCJQ(this).attr('title',MCJQ(this).find('option').first().text()); }

});



MCJQ(".toggle_tabs",e).delegate('a','click',function(event) {

	var e = MCJQ(this).closest(".toggle_tabs");
	
	MCJQ("a",e).removeClass('toggle_chosen');

	var i = e.data('rel');
	if (!i) i = 1;

	e.data('rel',MCJQ(this).attr('rel'));
	
	MCJQ(this).addClass('toggle_chosen');
	MCJQ("#"+e.attr('id')+"_"+i).hide();
	MCJQ("#"+e.attr('id')+"_"+MCJQ(this).attr('rel')).show();

	event.preventDefault();
	event.stopPropagation();
	return false;

});












if (!iesucks) {

MCJQ(".MC_ajax_edit").each(function() {

var relly = MCJQ(this).attr('rel');

if (relly) {
if (relly.substring(0,6) == 'iframe') {

	if (relly.length > 6) {
	
	var parts = relly.substring(6).split('_');
	var w = parts[0];
	var h = parts[1];
	
	MCJQ(this).colorbox({ title:' ',opacity:0.75,initialWidth:320,initialHeight:240,rel:'nofollow',fixed:true,iframe:true,fastIframe:false,innerWidth:w,innerHeight:h,maxWidth:960,maxHeight:960 });
	
	
	}
	else
	{

	var h = MCJQ(window).height()-240;
	if (h < 480) h = 480;
	
	MCJQ(this).colorbox({ title:' ',opacity:0.75,initialWidth:320,initialHeight:240,rel:'nofollow',fixed:true,iframe:true,fastIframe:false,innerWidth:MCJQ(window).width()-160,innerHeight:h,maxWidth:960,maxHeight:960 });
	
	}

	

}
else
MCJQ(this).colorbox({ title:' ',opacity:0.75,initialWidth:320,initialHeight:240,rel:'nofollow' });
}
else
MCJQ(this).colorbox({ title:' ',opacity:0.75,initialWidth:320,initialHeight:240,rel:'nofollow' });


});

}
							
						
						
MCJQ("input:submit","#colorbox").live('click',function(event) {

event.preventDefault();

if (MCJQ(".cbox_ajax_loader").length == 0) MCJQ(".cbox_ajax").prepend('<div class="cbox_ajax_loader"></div>');

MCJQ(".cbox_ajax_loader").show();

var f = MCJQ(this).closest("form");

MCJQ.ajax({	url: f.attr('action'),
			data: f.serialize(),
			context: MCJQ("#cboxLoadedContent"),
			cache:false,
			type:"POST",
			dataType:"html",
			success: function(result) {
				if (result.substring(0,2) == 'OK') {
					

					
					result = result.substring(2);
					result = MCJQ.parseJSON(result);
					
					
					if (!iesucks) {
					
					for (var t in result) {
						var e = MCJQ(".MC_ajax_return_"+t,MCJQ.colorbox.element().closest('.MC_ajax_edit_wrapper'));
						if (e.length > 0) {
							e.html(result[t]).data('origbg',e.css('color'));
							e.css('color','red').animate({color:e.data('origbg')},3000);
						}
					}
					
					if (jQuery().colorbox)
					MCJQ.colorbox.close();
					
					}
					
				}
				else {
					MCJQ(this).html(result);
					MCJQ(".cbox_ajax_loader").hide();
				}
			}
		});

});



						




function MCautocompletecallback(e) {



	var f = MCJQ("#"+e+"_choices");
	var bw = parseInt(f.css('border-left-width')) + parseInt(f.css('border-right-width'));
	f.css('width',MCJQ("#"+e).outerWidth()-bw);



	MCJQ("#"+e+'_choices')
		.load(MCJQ("#"+e).data('url')+'&autocomplete_parameter='+encodeURIComponent(MCJQ("#"+e).val()),function(response) {

			MCJQ(this).css('top',MCJQ("#"+e).outerHeight()+'px');

			if ( (response != '') && (response != '<ul></ul>') )
				MCJQ(this).empty().html(response);
			else
				MCJQ(this).empty().html('<span class="nomatch">No matches found</span>');
			
			MCJQ(this).html(MCJQ(this).html()+'<span class="closeAC">Close</span>');




			j = MCJQ(this).css('height');
			MCJQ(this).css('height','auto');
			i = MCJQ(this).innerHeight();
			MCJQ(this).css('height',j);
			
			var a1 = MCJQ("#"+e);
			var a2 = MCJQ(this).closest('.positional');
			
			MCJQ(this).css('top',a1.offset().top-a2.offset().top+a1.outerHeight()).css('left',a1.offset().left-a2.offset().left).show().animate({height:i});
			
			MCJQ("#"+e).addClass('killACroundies');
				
		});

}















MCJQ(".textinput",".wrapper_tags").each(function() {

	if (MCJQ(this).val() == '') MCJQ(this).addClass('t_b_wipeme');

});



MCJQ(".t_b_wipeme","input").each(function() {

	if (MCJQ(this).val() == '') {

		MCJQ(this).addClass('dimmed').val(MCJQ(this).attr('title')).focus(function() {
			MCJQ(this).removeClass('t_b_wipeme dimmed').val('');
		});

	}

});


	MCJQ(".JQdatepicker").each(function(i) {
		MCJQ(this).datepicker();
	});
	
	MCJQ(".radiogroup").buttonset().css('display','inline-block');


MCJQ("textarea",".wrapper_postcomment").focus(function() {
	MCJQ(this).animate({height:100});
});
		
			






	
	
	

MCJQ("img",".author_box,.miniavatar").mousemove(function(event) {



var e = MCJQ("#img_preview");


if (!MCJQ(this).data('open')) {

if (MCJQ(this).attr('title')) MCJQ(this).data('tooltip',MCJQ(this).attr('title'));
MCJQ(this).attr('title','').data('open',true);;
var user = MCJQ(this).data('tooltip');
if (!user) user = 'Anonymous';
e.html('<img src="'+MCJQ(this).attr('src')+'"><span>'+user+'</span>');

}

var y = event.pageY-24-e.height();

//if (y < (MCJQ(window).scrollTop()+4)) y = MCJQ(window).scrollTop()+4;
//if (y > (MCJQ(window).scrollTop() + MCJQ(window).height() - e.height() - 14)) y = MCJQ(window).scrollTop() + MCJQ(window).height() - e.height() - 14;


e.css('left',(event.pageX-32)+'px').css('top',y+'px').delay(250).fadeIn();

}).mouseout(function() {

MCJQ("#img_preview").stop(true,true).hide();
MCJQ(this).data('open',false);

});









//MCJQ("img",".thumb_box2,.thumb_box,.fixed_thumb,.videothumb_table").hover(function(event) {

MCJQ(document).delegate('.thumb_box2 img,.thumb_box img,.fixed_thumb img,.videothumb_table img','mouseenter',function() {

var e = MCJQ(this).closest('a');

if (!e) return;
e = e.attr('href');
if (!e) return;

if (e.indexOf('profile.php') != -1) {
	e = e.substr(e.indexOf('do=')+3);
	e = e.substring(0,e.indexOf('&'));
}
else {
	e = e.substring(e.lastIndexOf('/')+1,e.indexOf('.php'));
}



switch(e) {

case 'video':
case 'videos':
MCJQ("#thumb_type").css('background-position','0 -40px');
break;

case 'news':
MCJQ("#thumb_type").css('background-position','0 0');
break;

case 'blogs':
MCJQ("#thumb_type").css('background-position','0 -20px');
break;

case 'photos':
MCJQ("#thumb_type").css('background-position','0 0');
break;

}

var h = MCJQ(this).height();
//if (h > 100) h = 100;

MCJQ("#thumb_type").stop().hide().css('left',MCJQ(this).offset().left+MCJQ(this).width()-22).css('top',MCJQ(this).offset().top+h-22).show();

}).delegate('.thumb_box2 img,.thumb_box img,.fixed_thumb img,.videothumb_table img','mouseleave',function(event) {

	if (event.relatedTarget.id != 'thumb_type')
	MCJQ("#thumb_type").hide();

});






MCJQ("a",".thumbstack").each(function() {

var str = MCJQ(this).attr('href');

if (str) {
var ext = str.substring(str.length-4);

if ( (ext == '.jpg') || (ext == '.png') ) {

if (!iesucks)
MCJQ(this).colorbox({maxWidth:960 });
}

}
});


MCJQ(".modoptions_button").click(function(event) {

event.preventDefault();
MCJQ(this).parent().next().fadeIn();

});






//MCJQ("a",".cbox_poppy").colorbox({maxWidth:960});






















MCJQ(".MCscroller_bleft").hide().click(function(event) {

event.preventDefault();

var e = MCJQ(this).parent().find('.MCscroller_content');
if (e.is(':animated')) return;
if (parseInt(e.css('left')) < 0) {

var target = parseInt(e.css('left')) + MCJQ(this).parent().find('.MCscroller_holder').width();

if (target == 0) MCJQ(this).fadeOut(250,'easeOutQuart');

e.animate({left:target},500,'easeOutQuart');
MCJQ(this).parent().find(".MCscroller_bright").fadeIn(250,'easeOutQuart');
}

});





MCJQ(".MCscroller_bright").click(function(event) {

event.preventDefault();

var e = MCJQ(this).parent().find('.MCscroller_content');
if (e.is(':animated')) return;

var f = MCJQ(this).parent().find('.MCscroller_holder');

if (parseInt(e.css('left')) > f.width()-e.width()) {

var target = parseInt(e.css('left')) - f.width();

if (target <= f.width()-e.width()) MCJQ(this).fadeOut(250,'easeOutQuart');

e.animate({left:target},500,'easeOutQuart');
MCJQ(this).parent().find(".MCscroller_bleft").fadeIn(250,'easeOutQuart');
}

}).each(function() {

if (MCJQ(this).parent().find('.MCscroller_content').width() <= MCJQ(this).parent().find('.MCscroller_holder').width()) { MCJQ(this).hide(); }

});




MCJQ(".MCscroller_bup").hide().click(function(event) {

event.preventDefault();

var e = MCJQ(this).parent().find('.MCscroller_content');
if (e.is(':animated')) return;
if (parseInt(e.css('top')) < 0) {

var target = parseInt(e.css('top')) + MCJQ(this).parent().find('.MCscroller_holder').height();

if (target == 0) MCJQ(this).fadeOut(250,'easeOutQuart');

e.animate({top:target},500,'easeOutQuart');
MCJQ(this).parent().find(".MCscroller_bdown").fadeIn(250,'easeOutQuart');
}

});


MCJQ(".MCscroller_bdown").click(function(event) {

event.preventDefault();

var e = MCJQ(this).parent().find('.MCscroller_content');
if (e.is(':animated')) return;

var f = MCJQ(this).parent().find('.MCscroller_holder');

if (parseInt(e.css('top')) > f.height()-e.height()) {

var target = parseInt(e.css('top')) - f.height();

if (target <= f.height()-e.height()) MCJQ(this).fadeOut(250,'easeOutQuart');

e.animate({top:target},500,'easeOutQuart');
MCJQ(this).parent().find(".MCscroller_bup").fadeIn(250,'easeOutQuart');
}

}).each(function() {

if (MCJQ(this).parent().find('.MCscroller_content').height() <= MCJQ(this).parent().find('.MCscroller_holder').height()) { MCJQ(this).hide(); }

});








	


				
MCJQ("body").delegate('.ajax_toggle_button','click',function(event) {
				
						event.preventDefault();
						
						var e = MCJQ(this);
						e.closest('.ajax_toggle_box').addClass('ajax_hideme').closest('.ajax_toggle').addClass('ajax_toggle_loader');
					

						MCJQ.ajax({	url: MCJQ(this).attr('href'),
									cache:false,
									context:e.closest('.ajax_toggle_box'),
									success:function(result) {
									
										setAjaxToggle(MCJQ(this).closest('.ajax_toggle'),parseInt(result));
										MCJQ(this).removeClass('ajax_hideme').closest('.ajax_toggle').removeClass('ajax_toggle_loader');
										
									},
									error:function() {
										MCJQ(this).removeClass('ajax_hideme');
									}
								});

					
					});
					
					

MCJQ(".wrapper_errormsg",".edit_table").each(function(i) {

	MCJQ(this).delay((i+1)*500).animate({opacity:1,top:-35}).click(function() { MCJQ(this).hide(); });
	
});



//MCJQ(".wrapper_errormsg",".edit_table").animate({opacity:1,top:-35}).click(function() { MCJQ(this).hide(); });





end = new Date();






					
});
				
			

				
				




$ = jQuery.noConflict();




/*!
 * jQuery Text Overflow v0.7
 *
 * Licensed under the new BSD License.
 * Copyright 2009-2010, Bram Stein
 * All rights reserved.
 */
/*global jQuery, document, setInterval*/





(function ($) {
	var style = document.documentElement.style,
        hasTextOverflow = ('textOverflow' in style || 'OTextOverflow' in style),

		domSplit = function (root, maxIndex) {
			var index = 0, result = [],
				domSplitAux = function (nodes) {
					var i = 0, tmp;

					if (index > maxIndex) {
						return;
					}

					for (i = 0; i < nodes.length; i += 1) {
						if (nodes[i].nodeType === 1) {
							tmp = nodes[i].cloneNode(false);
							result[result.length - 1].appendChild(tmp);
							result.push(tmp);
							domSplitAux(nodes[i].childNodes);
							result.pop();
						} else if (nodes[i].nodeType === 3) {
							if (index + nodes[i].length < maxIndex) {
								result[result.length - 1].appendChild(nodes[i].cloneNode(false));
							} else {
								tmp = nodes[i].cloneNode(false);
								tmp.textContent = $.trim(tmp.textContent.substring(0, maxIndex - index));
								result[result.length - 1].appendChild(tmp);	
							}
							index += nodes[i].length;
						} else {
							result.appendChild(nodes[i].cloneNode(false));
						}
					}
				};
			result.push(root.cloneNode(false));
			domSplitAux(root.childNodes);
			return MCJQ(result.pop().childNodes);
		};

	$.extend($.fn, {
        textOverflow: function (str, autoUpdate) {
            var more = str || '&#x2026;';
            
            if (!hasTextOverflow) {
                return this.each(function () {
                    var element = MCJQ(this),

                        // the clone element we modify to measure the width 
                        clone = element.clone(),

                        // we save a copy so we can restore it if necessary
                        originalElement = element.clone(),
                        originalText = element.text(),
                        originalWidth = element.width(),
                        low = 0, mid = 0,
                        high = originalText.length,
                        reflow = function () {
                            if (originalWidth !== element.width()) {
                                element.replaceWith(originalElement);
                                element = originalElement;
                                originalElement = element.clone();
                                element.textOverflow(str, false);
                                originalWidth = element.width();								
                            }
                        };

                    element.after(clone.hide().css({
						'position': 'absolute',
						'width': 'auto',
						'overflow': 'visible',
						'max-width': 'inherit'
					}));	

                    if (clone.width() > originalWidth) {
                        while (low < high) {
                            mid = Math.floor(low + ((high - low) / 2));
							clone.empty().append(domSplit(originalElement.get(0), mid)).append(more);
                            if (clone.width() < originalWidth) {
                                low = mid + 1;
                            } else {
                                high = mid;
                            }
                        }

                        if (low < originalText.length) {
							element.empty().append(domSplit(originalElement.get(0), low - 1)).append(more);
                        }
                    }
                    clone.remove();
                    
                    if (autoUpdate) {    
                        setInterval(reflow, 200);
                    }
                });
            } else {
                return this;
            }
        }
	});
})(jQuery);




if(!Array.indexOf){
	    Array.prototype.indexOf = function(obj){
	        for(var i=0; i<this.length; i++){
	            if(this[i]==obj){
	                return i;
	            }
	        }
	        return -1;
	    }
	}



var GAJS = false;

function showSpinner(trg,delay) {

if (!trg.length) trg = MCJQ("body");
if (!delay) delay = 0;

var AJ = MCJQ("#global_ajaxload");
if (!AJ.length) { MCJQ("body").prepend('<div id="global_ajaxload" />'); AJ = MCJQ("#global_ajaxload"); }

AJ.css({ left: MCJQ(trg).offset().left+MCJQ(trg).width()/2+'px', top: MCJQ(trg).offset().top+MCJQ(trg).height()/2+'px' });

if (GAJS) clearTimeout(GAJS);
GAJS = setTimeout(function() { AJ.stop(true).css({display:'block'}).animate({ opacity:0.75 }); },delay);			

}



function hideSpinner() {

if (GAJS) clearTimeout(GAJS);

var AJ = MCJQ("#global_ajaxload");
if (!AJ) return;

AJ.stop(true).css({opacity:0,display:'none'});

}












(function($) {


$.fn.MC_makePagingAjax = function(options) {

	var defaults = {	ajax_type:'change_item_list',
						direction:'horiz',
						resize:'block',
						scrollto:'table.maincontent',
						autoscroll:false
					};
	
	var settings = $.extend(defaults,options);


	return this.each(function() {
	
		var obj = MCJQ(this);
		
		obj.unbind().delegate('.gb_pagenav a','click.MPA',function(event) {
		
			event.preventDefault();
			event.stopPropagation();
			
			if (obj.data('busy') == true) return false;
			
			showSpinner(obj);			
						
			var str = MCJQ(this).attr('href');
			if (str == "#") return;
			
			if (str.indexOf("#") != -1) str = str.substring(0,str.indexOf("#"));
			str += '&ajax='+settings.ajax_type;

			var pg = str.substring(str.indexOf('&pg=')+4);
			pg = pg.substring(0,pg.indexOf('&'));

			var currpage = parseInt(MCJQ(this).closest('.gb_pagenav').find('a.selected').text());
			
			if (settings.direction == 'horiz')
				if (pg < currpage) var transition = 'left'; else var transition = 'right';
			else
				if (pg < currpage) var transition = 'up'; else var transition = 'down';

			obj.data('busy',true);

			MCJQ(".ajax_wrapper_content",obj).stop(true).animate({opacity:0.25},function() {

			if (settings.autoscroll) {
				var target_offset = $(settings.scrollto).offset();
				var target_top = target_offset.top - 45;
				if (target_top < 0) target_top = 0;
				
				
				$('body').animate({scrollTop:target_top}, function() {


			MCJQ.ajax({	url:str,
						cache:false,
						dataType:'json',
						success:function(result) {
						
							hideSpinner();
						
							if (settings.ajax_type == 'change_item_list')
							obj.html(result.ITEM_LIST);
							else
							if (settings.ajax_type == 'change_item_list_large')
							obj.html(result.ITEM_LIST_LARGE);
							

							obj.data('busy',false).css("min-height",MCJQ(".ajax_wrapper_content",obj).outerHeight(true)+'px').stop(true);
							
							MCJQ(".ajax_wrapper_content",obj).stop(true).css('opacity','1').show('slide',{ direction: transition,easing:'easeInOutCubic' },500);
							
						},
						error:function(xhr, ajaxOptions, thrownError) {
			
							MCJQ(".ajax_wrapper_content",obj).css('opacity','1');
							obj.data('busy',false);
			
						}
						
				});
				
			});
				
			}
			else
			{
			
			
			
			
			MCJQ.ajax({	url:str,
						cache:false,
						dataType:'json',
						success:function(result) {
						
							hideSpinner();
						
							if (settings.ajax_type == 'change_item_list')
							obj.html(result.ITEM_LIST);
							else
							if (settings.ajax_type == 'change_item_list_large')
							obj.html(result.ITEM_LIST_LARGE);
							

							obj.data('busy',false).css("min-height",MCJQ(".ajax_wrapper_content",obj).outerHeight(true)+'px').stop(true);
							
							MCJQ(".ajax_wrapper_content",obj).stop(true).css('opacity','1').show('slide',{ direction: transition,easing:'easeInOutCubic' },500).data('busy',false);

							
						},
						error:function(xhr, ajaxOptions, thrownError) {
			
							MCJQ(".ajax_wrapper_content",obj).css('opacity','1');
							obj.data('busy',false);
			
						}
						
				});
			
			
			
			
			
			
			
			
			
			
			
			
			
			
			}
				
				
			
			});
			
		});

	});

}

})(jQuery);








(function($) {

$.fn.MC_createBreadcrumb = function(options) {

	var defaults = {	target:'#folders_breadcrumb',
						section:'Photos'
					};
	
	var settings = $.extend(defaults,options);


	return this.each(function() {
	
		var obj = MCJQ(this);

		var str = '';
		var e = $(".selected_album",obj);
		str += ' > ' + $.trim(e.find('.album_name').html());
		e = e.parent();
		e.parents('.album_contents_open').each(function() {
		
		var aname = $.trim($(this).first('.album_block').find('.album_name').html());
		aname = aname.substring(0,aname.lastIndexOf(' '));
		
		str = ' > ' + aname + str;
		});
		
		if (str != ' > ')
		str = settings.section + str;
		else
		str = 'There are no items to display in this folder';
	
		$(settings.target).html(str);

	});
	
}

})(jQuery);








(function($) {

$.fn.MC_getFolderContentsAjax = function(options) {

	var defaults = {	ajax_type:'change_item_list_large',
						target:'#ajax_item_list_large'
					};
	
	var settings = $.extend(defaults,options);


	return this.each(function() {
	
		var obj = MCJQ(this);
		
		obj.delegate('a','click.AFC',function(event) {
		
			event.preventDefault();
						
			var str = MCJQ(this).attr('href');
			if (str == "#") return;
			
			if (str.indexOf("#")) str = str.substring(0,str.indexOf("#"));
			str += '&ajax='+settings.ajax_type;

			var pg = str.substring(str.indexOf('&pg=')+4);
			pg = pg.substring(0,pg.indexOf('&'));

			var currpage = parseInt(MCJQ(this).closest('.gb_pagenav').find('.selected').text());

			if (settings.direction == 'horiz')
				if (pg < currpage) var transition = 'left'; else var transition = 'right';
			else
				if (pg < currpage) var transition = 'up'; else var transition = 'down';

			MCJQ(".ajax_wrapper_content",obj).animate({opacity:0.25});



			MCJQ.ajax({	url:str,
						cache:false,
						dataType:'json',
						success:function(result) {
			
							obj.html(result.ITEM_LIST_LARGE);
							
							obj.css("min-height",MCJQ(".ajax_wrapper_content",obj).outerHeight(true)+'px').stop(true);
							MCJQ(".ajax_wrapper_content",obj).css('opacity','1').show('slide',{ direction: transition,easing:'easeInOutCubic' },500);
							
						},
						error:function(xhr, ajaxOptions, thrownError) {
			
							MCJQ(".ajax_wrapper_content",obj).css('opacity','1')
			
						}
						
			});
		});

	});

}

})(jQuery);






(function($) {


$.fn.MC_getfavicon = function(options) {

	

	return this.each(function() {
	
		var obj = MCJQ(this);
	
		var link = obj.attr('href');
		link = link.replace('http://','');
		var i = link.indexOf('/');
				
		if (i != -1)
			link = link.substr(0,i);
					
		link = 'http://' + link;
				
		if (obj.text().indexOf(link) == 0) obj.text(link);		
		
		obj.before('<img class="favicon_placeholder" src="'+link+'/favicon.ico"> ').css('visibility','visible');
			
		obj.prev('.favicon_placeholder').load(function() {
			MCJQ(this).css('visibility','visible');
		})
		.error(function() {
			if (MCJQ(this).attr('src') != "http://www.runnerspace.com/i/elink2.gif")
				MCJQ(this).attr('src','http://www.runnerspace.com/i/elink2.gif').trigger('load');
		})
		;
		
	});


	
};


})(jQuery);



/* Copyright (c) 2009 Brandon Aaron (http://brandonaaron.net)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
 * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
 *
 * Version: 3.0.2
 * 
 * Requires: 1.2.2+
 */
 

(function(c){var a=["DOMMouseScroll","mousewheel"];c.event.special.mousewheel={setup:function(){if(this.addEventListener){for(var d=a.length;d;){this.addEventListener(a[--d],b,false)}}else{this.onmousewheel=b}},teardown:function(){if(this.removeEventListener){for(var d=a.length;d;){this.removeEventListener(a[--d],b,false)}}else{this.onmousewheel=null}}};c.fn.extend({mousewheel:function(d){return d?this.bind("mousewheel",d):this.trigger("mousewheel")},unmousewheel:function(d){return this.unbind("mousewheel",d)}});function b(f){var d=[].slice.call(arguments,1),g=0,e=true;f=c.event.fix(f||window.event);f.type="mousewheel";if(f.wheelDelta){g=f.wheelDelta/120}if(f.detail){g=-f.detail/3}d.unshift(f,g);return c.event.handle.apply(this,d)}})(jQuery);

