			$(document).ready(function() {
				$('img').bind('contextmenu', function(e){
					alert("Images belong to their owners!");
					return false;
				});
			});
	
	$(function () {
		var tabContainers = $('div.nudeweb-tabs > div');

		$('div.nudeweb-tabs ul.nudeweb-tabnav a').click(function () {

    	tabContainers.hide().filter(this.hash).show();

    	$('div.nudeweb-tabs ul.nudeweb-tabnav a').removeClass('selected');
    	$(this).addClass('selected');

    	return false;
		}).filter(':first').click();
		
		$('#seeallinterests').click(function () {
			tabContainers.hide().filter('#interests').show();
    	$('div.nudeweb-tabs ul.nudeweb-tabnav a').removeClass('selected');
    	$('#itab').addClass('selected');
    	
    	return false;
		});
	});      

	function startPoll(){
		$("#poll").html('Poll Question: <input class="nudeweb-inputbox" style="width: 430px;" type="text" name="polltitle"><BR /><BR /><input type="hidden" id="numoptions" name="numoptions" value="2"><div id="polloptions"><div class="nudeweb-addpolloption" id="option-1">Poll Option: <input class="nudeweb-inputbox" style="width: 350px;" type="text" name="polloptions[]"></div><div class="nudeweb-addpolloption" id="option-2">Poll Option: <input class="nudeweb-inputbox" style="width: 350px;" type="text" name="polloptions[]"></div></div><BR /><a onclick="addOption()" href="javascript:void(0);">Click Here to Add An Additional Option</A>');
								
		return false;

	}
	
	function remOption(optid){
		$("#option-"+optid).remove();
		
		return false;
	}
	
	function addOption(){
		
		var plusoptions = parseInt($("#numoptions").val());
		plusoptions = plusoptions + 1;
		$("#numoptions").val(plusoptions) 
		
		$('#polloptions').append('<div class="nudeweb-addpolloption" id="option-' + plusoptions + '">Poll Option: <input class="nudeweb-inputbox" style="width: 350px;" type="text" name="polloptions[]"> <a onclick="remOption(' + plusoptions + ')" href="javascript:void(0);">Remove</a><BR /></div>');
		
		return false;
	}

	function doLike( divid, acctid, ltype, ownerid){
		$.post("dolike.php", { 'wid' : divid, 'aid' : acctid, 'type' : ltype, 'oid' : ownerid }, function(msg){

			if( msg == '0:notloggedin'){
				alert("Not logged in!");
				return false;
			}else if( msg == "0:badtype"){
				alert("Bad type!");
				return false;
			}else if( msg == "0:alreadyliked"){
				alert("You already liked or disliked this!");
				return false;
			}else{
				// the like/dislike was successful, update the ld box & actions
				if( $("#ld-"+divid).length){
					// the like/dislike div for this already exists, change its contents to our msg
					$("#ld-"+divid).html(msg);
				}else{
					// the like/dislike div for this does not exist, create it using our msg
					$("#wn-"+divid).show();
					$("#wr-"+divid).prepend("<div id=\"ld-"+divid+"\" class=\"nudeweb-wallcomments\">" + msg + "</div>");
				}
				var newactions = "<a onclick=\"showComments('"+divid+"')\" href=\"javascript:void(0);\">Comment</a> - ";
				if( ltype == 1){
					// they liked it, let them unlike
					newactions = newactions + "<a onclick=\"doLike('"+divid+"', '"+acctid+"', '3')\" href=\"javascript:void(0);\">Unlike</a> - ";
				}
				if( ltype == 2){
					// they disliked it, let them undislike
					newactions = newactions + "<a onclick=\"doLike('"+divid+"', '"+acctid+"', '4')\" href=\"javascript:void(0);\">Undislike</a> - ";
				}
				if( ltype == 3 || ltype == 4){
					// they unliked ur undisliked it, let them like or dislike
					newactions = newactions + "<a onclick=\"doLike('"+divid+"', '"+acctid+"', '1')\" href=\"javascript:void(0);\">Like</a> - ";
					newactions = newactions + "<a onclick=\"doLike('"+divid+"', '"+acctid+"', '2')\" href=\"javascript:void(0);\">Dislike</a> - ";
				}
				newactions = newactions + "<a href=\"#\">Report</a>";
				
				$("#wa-"+divid).html(newactions);
				return false;
			}
		});
		return false;
	}

	function doPhotoLike( photoid, ownerid, ltype){
		$.post("dophotolike.php", { 'pid' : photoid, 'oid' : ownerid, 'type' : ltype }, function(msg){

			if( msg == '0:notloggedin'){
				alert("Not logged in!");
				return false;
			}else if( msg == "0:badtype"){
				alert("Bad type!");
				return false;
			}else if( msg == "0:alreadyliked"){
				alert("You already liked or disliked this!");
				return false;
			}else{
				// the like/dislike was successful, update the ld box & actions
				if( $("#ld-"+photoid).length){
					// the like/dislike div for this already exists, change its contents to our msg
					$("#ld-"+photoid).html(msg);
				}else{
					// the like/dislike div for this does not exist, create it using our msg
					$("#wn-"+photoid).show();
					$("#wr-"+photoid).prepend("<div id=\"ld-"+photoid+"\" class=\"nudeweb-wallcomments\">" + msg + "</div>");
				}
				var newactions = "";

				if( ltype == 1){
					// they liked it, let them unlike
					newactions = newactions + "<a class=\"nudeweb-buttonlink\" onclick=\"doPhotoLike('"+photoid+"', '"+ownerid+"', '3')\" href=\"javascript:void(0);\">Unlike</a> ";
				}
				if( ltype == 2){
					// they disliked it, let them undislike
					newactions = newactions + "<a class=\"nudeweb-buttonlink\" onclick=\"doPhotoLike('"+photoid+"', '"+ownerid+"', '4')\" href=\"javascript:void(0);\">Undislike</a> ";
				}
				if( ltype == 3 || ltype == 4){
					// they unliked ur undisliked it, let them like or dislike
					newactions = newactions + "<a class=\"nudeweb-buttonlink\" onclick=\"doPhotoLike('"+photoid+"', '"+ownerid+"', '1')\" href=\"javascript:void(0);\">Like</a> ";
					newactions = newactions + "<a class=\"nudeweb-buttonlink\" onclick=\"doPhotoLike('"+photoid+"', '"+ownerid+"', '2')\" href=\"javascript:void(0);\">Dislike</a> ";
				}

				newactions = newactions + "<a class=\"nudeweb-buttonlink\" id=\"newreportbutton\" rel=\"report\" href=\"modal_report.php?pid="+photoid+"&oid="+ownerid+"\">Report</a>";
				
				$("#pa-"+photoid).html(newactions);
				
				$("#newreportbutton").fancybox({
					'showNavArrows'		: false,
					'centerOnScroll'	: true,
					'overlayOpacity'	: .75,
					'autoDimensions' 	: false,
					'width'						: 350,
					'height'					: 250
				});
								
				return false;
			}
		});
		return false;
	}

	function doVideoLike( videoid, ownerid, ltype){
		$.post("dovideolike.php", { 'vid' : videoid, 'oid' : ownerid, 'type' : ltype }, function(msg){

			if( msg == '0:notloggedin'){
				alert("Not logged in!");
				return false;
			}else if( msg == "0:badtype"){
				alert("Bad type!");
				return false;
			}else if( msg == "0:alreadyliked"){
				alert("You already liked or disliked this!");
				return false;
			}else{
				// the like/dislike was successful, update the ld box & actions
				if( $("#ld-"+videoid).length){
					// the like/dislike div for this already exists, change its contents to our msg
					$("#ld-"+videoid).html(msg);
				}else{
					// the like/dislike div for this does not exist, create it using our msg
					$("#wn-"+videoid).show();
					$("#wr-"+videoid).prepend("<div id=\"ld-"+videoid+"\" class=\"nudeweb-wallcomments\">" + msg + "</div>");
				}
				var newactions = "";

				if( ltype == 1){
					// they liked it, let them unlike
					newactions = newactions + "<a class=\"nudeweb-buttonlink\" onclick=\"doVideoLike('"+videoid+"', '"+ownerid+"', '3')\" href=\"javascript:void(0);\">Unlike</a> ";
				}
				if( ltype == 2){
					// they disliked it, let them undislike
					newactions = newactions + "<a class=\"nudeweb-buttonlink\" onclick=\"doVideoLike('"+videoid+"', '"+ownerid+"', '4')\" href=\"javascript:void(0);\">Undislike</a> ";
				}
				if( ltype == 3 || ltype == 4){
					// they unliked ur undisliked it, let them like or dislike
					newactions = newactions + "<a class=\"nudeweb-buttonlink\" onclick=\"doVideoLike('"+videoid+"', '"+ownerid+"', '1')\" href=\"javascript:void(0);\">Like</a> ";
					newactions = newactions + "<a class=\"nudeweb-buttonlink\" onclick=\"doVideoLike('"+videoid+"', '"+ownerid+"', '2')\" href=\"javascript:void(0);\">Dislike</a> ";
				}

				newactions = newactions + "<a class=\"nudeweb-buttonlink\" id=\"newreportbutton\" rel=\"report\" href=\"modal_report.php?vid="+videoid+"&oid="+ownerid+"\">Report</a>";
				
				$("#pa-"+videoid).html(newactions);
				
				$("#newreportbutton").fancybox({
					'showNavArrows'		: false,
					'centerOnScroll'	: true,
					'overlayOpacity'	: .75,
					'autoDimensions' 	: false,
					'width'						: 350,
					'height'					: 250
				});
								
				return false;
			}
		});
		return false;
	}


	function showComments( divid){
		$("#wallcomment-"+divid).show(250);
		$("#wn-"+divid).show();
		$("#wcinput-"+divid).focus();
	}
	
	function postComment(thisForm){
		var wid = thisForm.wid.value;
		var oid = thisForm.oid.value;
		var aid = thisForm.aid.value;
		var comm = thisForm.comm.value;
		$.post("wallcomment.php", { 'oid' : oid , 'wid' : wid, 'comm' : comm, 'aid' : aid }, 
		function(msg){
			if( msg == '0:notloggedin'){
				alert("Not logged in!");
				return false;
			}else if( msg == '0:nocomment'){
				alert( 'You must enter a comment' );
				return false;
			}else{
				// replace our comment box with the new html returned from our php
				// $("#wallcomment-"+wid).html(msg);
				$("#comments-"+wid).append('<div class="nudeweb-wallcomments">'+msg+'</div>');
				// clear the comment entry field
				thisForm.comm.value = "";
				return false;
			}
		});
		return false;
	}

	function lcSend(thisForm){
		var rid = thisForm.rid.value;
		var msg = thisForm.msg.value;
		$.post("lc_send.php", { 'rid' : rid , 'msg' : msg },
		function(ret){
			// alert(ret);
		});
		thisForm.msg.value = '';
		$("#chatinput").focus();
		return false;
	}

	function lcUpdate( rid){
//		var rid = 0;
//		alert('pre: ' + mid);

		var randnum = Math.floor(Math.random()*100000)

		$.post("lc_get.php", { 'rid' : rid , 'rand' : randnum },
		function(ret){
//			var responseArray = ret;
			$("#chatwindow").append(ret);
			$("#chatwindow").scrollTop($("#chatwindow")[0].scrollHeight);
			lcUsersUpdate( rid);
		});

//		ts = Math.round((new Date()).getTime() / 1000);
		return false;
	}

	function lcUsersUpdate( rid){
//		var rid = 0;
		$.post("lc_userlist.php", { 'rid' : rid },
		function(ret){
			$("#userlist").html(ret);
			$("#userlist").scrollTop($("#userlist")[0].scrollHeight);
		});

		return false;
	}

	function postWall(thisForm){
		var oid = thisForm.oid.value;
		var comm = thisForm.comm.value;
		$.post("wallpost.php", { 'oid' : oid , 'comm' : comm }, 
		function(msg){
			if( msg == '0:notloggedin'){
				alert("Not logged in!");
				return false;
			}else if( msg == '0:nocomment'){
				alert( 'You must enter a comment' );
				return false;
			}else if( msg == '0:throttle'){
				alert( 'You must wait 60 seconds before making another wall post' );
				return false;
			}else{
				// replace our comment box with the new html returned from our php
				// $("#wallcomment-"+wid).html(msg);
				$("#mywall").prepend(msg);
				// clear the comment entry field
				thisForm.comm.value = "";
				return false;
			}
		});
		return false;
	}

	function photoComment(thisForm){
		var pid = thisForm.pid.value;
		var oid = thisForm.oid.value;
		var comm = thisForm.comm.value;
		$.post("photocomment.php", { 'oid' : oid , 'pid' : pid, 'comm' : comm }, 
		function(msg){
			if( msg == '0:notloggedin'){
				alert("Not logged in!");
				return false;
			}else if( msg == '0:nocomment'){
				alert( 'You must enter a comment' );
				return false;
			}else{
				// replace our comment box with the new html returned from our php
				// $("#wallcomment-"+wid).html(msg);
				$("#comments-"+pid).append('<div class="nudeweb-wallcomments">'+msg+'</div>');
				// clear the comment entry field
				thisForm.comm.value = "";
				return false;
			}
		});
		return false;
	}

	function videoComment(thisForm){
		var vid = thisForm.vid.value;
		var oid = thisForm.oid.value;
		var comm = thisForm.comm.value;
		$.post("videocomment.php", { 'oid' : oid , 'vid' : vid, 'comm' : comm }, 
		function(msg){
			if( msg == '0:notloggedin'){
				alert("Not logged in!");
				return false;
			}else if( msg == '0:nocomment'){
				alert( 'You must enter a comment' );
				return false;
			}else{
				// replace our comment box with the new html returned from our php
				// $("#wallcomment-"+wid).html(msg);
				$("#comments-"+vid).append('<div class="nudeweb-wallcomments">'+msg+'</div>');
				// clear the comment entry field
				thisForm.comm.value = "";
				return false;
			}
		});
		return false;
	}

	function albumComment(thisForm){
		var aid = thisForm.aid.value;
		var oid = thisForm.oid.value;
		var comm = thisForm.comm.value;
		$.post("albumcomment.php", { 'oid' : oid , 'aid' : aid, 'comm' : comm }, 
		function(msg){
			if( msg == '0:notloggedin'){
				alert("Not logged in!");
				return false;
			}else if( msg == '0:nocomment'){
				alert( 'You must enter a comment' );
				return false;
			}else{
				// replace our comment box with the new html returned from our php
				// $("#wallcomment-"+wid).html(msg);
				$("#comments-"+aid).append('<div class="nudeweb-wallcomments">'+msg+'</div>');
				// clear the comment entry field
				thisForm.comm.value = "";
				return false;
			}
		});
		return false;
	}

  function mailSelect(mailid){

		// check if this is in our array
		
		// if not, add it & make it yellow
    $("#mail-"+mailid).css("background-color","#ff0");
    
    // if it is, remove it & make it gray
    
    // update our selected messages count display
    
		return false;
  }
  
  function flAddFriend( frid){
		// ajax the add
		$.ajax({
		  url: 'ajax_fr_add.php?uid=' + frid,
		  success: function(data) {
				$("#fl-"+frid).html(data)
		  }
		});
		
		return false;
  }
  
  function approveFriend( frid){

    // ajax the approve 
		$.ajax({
		  url: 'ajax_fr_approve.php?frid=' + frid,
		  success: function(data) {
//		    $('.result').html(data);
//		    alert('adsf'+data);
		  }
		});
		
    // display the message
		$("#fr-"+frid).html("Friend Request Approved")
	
		return false;
	}
	
	function denyFriend( frid){
		// ajax the deny
		$.ajax({
		  url: 'ajax_fr_deny.php?frid=' + frid,
		  success: function(data) {
//		    $('.result').html(data);
//		    alert('adsf'+data);
		  }
		});
		
		// display the message
		$("#fr-"+frid).html("Friend Request Denied")
	}

	function editPhotoDesc(){
		// change the contents of this div to an edit form
//		$("#photodesc").html("edit form");
		// ^^ bad idea?
		
		// hide the description display div
			$("#photodesc").hide();
		
		// show the edit description div
			$("#descedit").show();
			
		return false;
	}

