
function doMenu() {
	$(function() {
	   var zIndexNumber = 1000;
	   $("li").each(function() {
			   $(this).css('zIndex', zIndexNumber);
		});
	});

	var sel = '';
	var spa = '';
	var col = '';
	var rnds = '';
	var rnde = '';
	$("a.topmm").hover(function() {
		$(this).parent().find("span.dropdownmn").addClass('dropdownmnsel');
		$(this).parent().find("a.topmm").addClass('topmmsel');
		$(this).parent().find("span.rndstart").addClass('rndstartsel');
		$(this).parent().find("span.rndend").addClass('rndendsel');
	}, function() { //hober out
		$(this).parent().find("span.dropdownmn").removeClass('dropdownmnsel');
		$(this).parent().find("a.topmm").removeClass('topmmsel');
		$(this).parent().find("span.rndstart").removeClass('rndstartsel');
		$(this).parent().find("span.rndend").removeClass('rndendsel');
	});
	
	$("ul.subnav").hover(function() {
		$(this).parent().find("span.dropdownmn").addClass('dropdownmnsel');
		$(this).parent().find("a.topmm").addClass('topmmsel');
		$(this).parent().find("span.rndstart").addClass('rndstartsel');
		$(this).parent().find("span.rndend").addClass('rndendsel');
	}, function() { //hober out
		$(this).parent().find("span.dropdownmn").removeClass('dropdownmnsel');
		$(this).parent().find("a.topmm").removeClass('topmmsel');
		$(this).parent().find("span.rndstart").removeClass('rndstartsel');
		$(this).parent().find("span.rndend").removeClass('rndendsel');
	});

	$("ul.topnav li span.dropdownmnsel").click(function() {
		$(this).parent().find("ul.subnav").show();
		$(this).parent().hover(function() {
		}, function(){	
			$(this).parent().find("ul.subnav").slideUp('fast'); //When the mouse hovers out of the subnav, move it back up
		});
	});
		
	$("ul.topnav li span.dropdownmn").click(function() { //When trigger is clicked...
		
		//Following events are applied to the subnav itself (moving subnav up and down)
		$(this).parent().find("ul.subnav").show(); //Drop down the subnav on click

		$(this).parent().hover(function() {
		}, function(){	
			$(this).parent().find("ul.subnav").slideUp('fast'); //When the mouse hovers out of the subnav, move it back up
		});

		//Following events are applied to the trigger (Hover events for the trigger)
		}).hover(function() { 
			$(this).parent().find("a.topmm").addClass('topmmsel');
			$(this).addClass('dropdownmnsel');
			$(this).parent().find("span.rndstart").addClass('rndstartsel');
			$(this).parent().find("span.rndend").addClass('rndendsel');
		}, function(){	//On Hover Out
			$(this).parent().find("a.topmm").removeClass('topmmsel');
			$(this).removeClass('dropdownmnsel');
			$(this).parent().find("span.rndstart").removeClass('rndstartsel');
			$(this).parent().find("span.rndend").removeClass('rndendsel');
	});
}

$(document).ready(function() {
	$("a#resendvalidation").fancybox({ 'hideOnContentClick': false,'frameWidth': 360, 'frameHeight':100 }); 
	$("a.iframe_addremovefriend").fancybox({ 'hideOnContentClick': false,'frameWidth': 250, 'frameHeight':80 }); 
	$("a.iframe_composemsg").fancybox({ 'hideOnContentClick': false,'frameWidth': 550, 'frameHeight':360 }); 
	$("a#composemsg").fancybox({ 'hideOnContentClick': false,'frameWidth': 550, 'frameHeight':360 }); 
	$("a#advertise").fancybox({ 'hideOnContentClick': false,'frameWidth': 600, 'frameHeight':450 }); 
	$("a#contactus").fancybox({ 'hideOnContentClick': false,'frameWidth': 600, 'frameHeight':450 }); 
	$(".popupuploadimg").fancybox({ 'hideOnContentClick': false,'frameWidth': 600, 'frameHeight':450 }); 
	$("a#inline").fancybox({ 'hideOnContentClick': false }); 
	$("a.group").fancybox({ 'zoomSpeedIn': 300, 'zoomSpeedOut': 300, 'overlayShow': false }); 
	doMenu();
});

function urlencode(str) {
return escape(str).replace(/\+/g,'%2B').replace(/%20/g, '+').replace(/\*/g, '%2A').replace(/\//g, '%2F').replace(/@/g, '%40');
}

function confirmRMUserGroup(uid,url) {
	if (confirm('Are you sure you want to remove ('+uid+') from the group?')) {		
		location.href=url + '&return=' + urlencode(window.location);
	}
}