var outerDIV = ""; //transparent part of clay
var innerDIV = ""; //text part of clay
var winW = ""; //window width
var winH = ""; //window height
var delayCount = 0; //used to delay onkeyup
var delayMenuCount = 0;
var overMain = 0;
var overSub = 0;
var subArrow = "blue";


function ieWarning() {
	moldClay(464, 160, '<div class="white-text" style="text-align: left;">It appears you are using an older edition of Internet Explorer. This version lacks security updates and new features required to run this page. You may update <a href="http://www.microsoft.com/windows/downloads/ie/getitnow.mspx" target="_blank">here</a>.<br /><br /><a href="#" onclick="clearClay();">Close</a>', "none");	
}

function goToCircle(url) {
	if (!clickingDesc) window.location = url;
}

function addslashes(str) {
	str=str.replace(/\'/g,'\\\'');
	str=str.replace(/\"/g,'\\"');
	str=str.replace(/\\/g,'\\\\');
	str=str.replace(/\0/g,'\\0');
	return str;
}

function replaceClass(curObj, newClass) {
	curObj.className = newClass;
}

function defaultText(obj, text) {
	if (obj.value == text) obj.value = "";
	else if (obj.value == "") obj.value = text;
	
}

/*
 * To be sure all rollovers are using the correct limelight URL, this function
 * can determine if you're on the sandbox or production server. 
 */
function llMedia() {
	return 'http://behance.vo.llnwd.net/';
}

var prepend = llMedia();		//-> to be sure we request the media from the right server
image11 = new Image();
image11.src = prepend + "menu/galleryOff.gif";

image12 = new Image();
image12.src = prepend + "menu/__portfolioOff.gif";

image13 = new Image();
image13.src = prepend + "menu/circlesOff.gif";

image14 = new Image();
image14.src = prepend + "menu/tipOff.gif";

image15 = new Image();
image15.src = prepend + "menu/joblist2Off.gif";

image16 = new Image();
image16.src = prepend + "menu/_moreOff.gif";

image21 = new Image();
image21.src = prepend + "menu/galleryOn.gif";

image22 = new Image();
image22.src = prepend + "menu/__portfolioOn.gif";

image23 = new Image();
image23.src = prepend + "menu/circlesOn.gif";

image24 = new Image();
image24.src = prepend + "menu/tipOn.gif";

image25 = new Image();
image25.src = prepend + "menu/giglistOn.gif";

image26 = new Image();
image26.src = prepend + "menu/_moreOn.gif";

var refreshNav = 1;

function MouseEvent(e) 
{
	if(e) {
	  this.e = e; 
	} else {
	  this.e = window.event; 
	}
	
	if(e.pageX) { //NOT IE
		this.x = e.pageX; 
	} 
	else { //for IE
		scrollX = document.documentElement.scrollLeft;	
		this.x = e.clientX + scrollX; 
	}
	
	
	if(e.pageY) { //NOT IE
		this.y = e.pageY; 
	} 
	else { //for IE
		scrollY = document.documentElement.scrollTop;	
		this.y = e.clientY + scrollY; 
	}
	
	if(e.target) {
	  this.target = e.target; 
	} else {
	  this.target = e.srcElement;
	}
}

function resetNav(e) {
	if (!$('loadingScreen') && !ajaxLoading) {
		var e = new MouseEvent(e);
		if (e.y < 100 || e.y > 190) {
			if (refreshNav == 1) {
				if ($('projectToolBar') && !$('circleBg')) { //if viewing project not in contest
					$('projectToolBar').style.display = 'block';
					$('menuSubDIV').style.display = "none";
				}
				var curMain = currentMainPage+'TxtImg';
				obj = $('menuTabs');
				divs = obj.getElementsByTagName('img');
				for (i=0;i<divs.length;i++) {
					curDiv = divs[i].id;
					if (!curDiv.match("navdiv") && curDiv != "") {
						if ($(curDiv)) {
							curImgObj = $(curDiv);
							
							curSub = curDiv.replace("TxtImg", "Sub");
							if ( $(curSub)) {
								curSubObj = $(curSub);
								if (curDiv == curMain) {
									curImgObj.src = curImgObj.src.replace("Off", "On");
									curSubObj.style.display = 'block';
								}
								else {
									curImgObj.src = curImgObj.src.replace("On", "Off");
									curSubObj.style.display = 'none';
								}
							}
						}
					}
				}
				src = $('thinktankTxtImg').src;
				if (src.match('/menu/_moreOn.gif')) {
					$('mainSubNavTbl').style.backgroundColor = "#fe0d00";
					subArrow = "orange";
				}
				else {
					$('mainSubNavTbl').style.backgroundColor = "#009cec";
					subArrow = "blue";
				}
				
				obj = $('mainSubNavDIV');
				imgs = obj.getElementsByTagName('img');
				for (i=0;i<imgs.length;i++) {
					
					if (imgs[i].id == currentSubPage+'Img') {
						if (subArrow == "orange") imgs[i].src='/images/buttons/navArrowOr.gif';
						else imgs[i].src='/images/buttons/navArrow.gif';
					}
					else
						imgs[i].src='/images/buttons/blank.gif';
				}
				refreshNav = 0;
			}
		}
		else refreshNav = 1;
	}
}

function selectNav(e, curDIV) {
	var e = new MouseEvent(e);
	obj = $('menuTabs');
	divs = obj.getElementsByTagName('div');
	
	
	
	for (i=0;i<divs.length;i++) {
		curSubDiv = divs[i].id;
		if (!curSubDiv.match("navdiv") && curSubDiv != "") {
			curSub = curSubDiv.replace("DIV", "Sub");
			curSubObj = $(curSub);
			curImg = curSub.replace("Sub", "TxtImg");
			curImgObj = $(curImg);

			if (divs[i].id == curDIV) {
				curImgObj.src = curImgObj.src.replace("Off", "On");
				curSubObj.style.display = 'block';
				
			}
			else {
				curImgObj.src = curImgObj.src.replace("On", "Off");
				curSubObj.style.display = 'none';
			}
			
		}
	}
	
	src = $('thinktankTxtImg').src;
	if (src.match("/menu/_moreOn.gif")) {
		$('mainSubNavTbl').style.backgroundColor = "#fe0d00";
		$('mainSubNavTbl').style.bgColor = "#fe0d00";
	}
	else {
		$('mainSubNavTbl').style.backgroundColor = "#009cec";
	}

	
	if ($('projectToolBar') && !$('circleBg')) { //if viewing project not in contest
		$('projectToolBar').style.display = 'none';
		$('menuSubDIV').style.display = "block";
	}
	
}

function selectSubNav(curLink, dontUnderline) {
	var obj = $('mainSubNavDIV');
	
	
	var as = obj.getElementsByTagName('a');
	var asLength = as.length;
	
	var linkID = curLink+'Link';
	
	for (i=0;i<asLength;i++) {
		var thisID = as[i].id;	
		if (!thisID.match("Linkcom")) {
			var selLink = $(thisID);
			
			if (thisID == linkID) {
				if (selLink.className != "navSelected-link") {
					selLink.style.textDecoration='underline';
				}
			}
			else {
				selLink.style.textDecoration='none';
			}
		}
	}
}



function stopEnter() {
	var nav = (conf_browser != "ie") ? true : false;
	if (nav) {
	   window.captureEvents(Event.KEYDOWN);
	   window.onkeydown = NetscapeEventHandler_KeyDown;
	} else {
	   document.onkeydown = MicrosoftEventHandler_KeyDown;
	}
}


function NetscapeEventHandler_KeyDown(e) {
  if (e.which == 13 && e.target.type != 'textarea' && e.target.type != 'submit') { return false; }
}

function MicrosoftEventHandler_KeyDown() {
  if (event.keyCode == 13 && event.srcElement.type != 'textarea' && event.srcElement.type != 'submit')
    return false;
}  


function goEnter(e, callback) {
	if(e && e.which){ //if which property of event object is supported (NN4)
		e = e
		characterCode = e.which //character code is contained in NN4's which property
	} else {
		characterCode = e.keyCode //character code is contained in IE's keyCode property
	}

	if (characterCode != 13) {
		return false;
	} else {
		eval(callback);

	}
	
}


function changeImage(imgName, imgID)
{
  $(imgID).src = imgName;
}

function showHide(isChecked, divArea)
{
	if (isChecked == true)
		$(divArea).style.display = 'block';
	else
		$(divArea).style.display = 'none';
}

function showArea(divArea)
{
	if ($(divArea))
		$(divArea).style.display = 'block';
}
function inlineArea(divArea)
{
	if ($(divArea))
		$(divArea).style.display = 'inline';
}
function hideArea(divArea)
{
	if ($(divArea))
		$(divArea).style.display = 'none';
}

function enterSubmit(e, submit)
{
	if(e && e.which){ //if which property of event object is supported (NN4)
	e = e
	characterCode = e.which //character code is contained in NN4's which property
	}
	else{
	characterCode = e.keyCode //character code is contained in IE's keyCode property
	}
	if (characterCode == 13)
	{
		if (submit == "valSideSignIn") valSideSignIn();
		if (submit == "valSignIn") valSignIn();
		if (submit == "valCheckoutOne") valCheckoutOne();
		if (submit == "valUniNews") valUniNews();
	}
}

function escapeClose(e, block)
{
	if(e && e.which){ //if which property of event object is supported (NN4)
	e = e
	characterCode = e.which //character code is contained in NN4's which property
	}
	else{
	characterCode = e.keyCode //character code is contained in IE's keyCode property
	}
	if (characterCode == 27)
	{
		if (block == "friend")
			switchTellFriend();
		else if (block == "propose")
			switchProposeEdit();
		else if (block == "idea")
			switchIdea();
		else if (block == "cvv")
			switchcvvHelp();
		else clearClay();
			
	}
}

function switchArea(divArea)
{
	if ($(divArea)) {
		if ($(divArea).style.display == 'block' || $(divArea).style.display == '')
			$(divArea).style.display = 'none';
		else
			$(divArea).style.display = 'block';
	}
}



var XMLHttpRequestObject=null;

function reportBug() {
	var url = "/reportingBug?reportingBug=1";
	var bugName = $('bugName').value;
	var bugEmail = $('bugEmail').value;
	var bugDesc = $('bugDesc').value;
	var params = "bugName="+encodeURI(bugName)+"&bugEmail="+encodeURI(bugEmail)+"&bugDesc="+encodeURI(bugDesc);
	
	new Ajax.Request(url, {
		method : 'post',
		parameters : params,
		onComplete : function() {
			clearClay();
			moldClay(400, 80, 'Thank You for Reporting a Bug', 2000);
		}
	});
}

function giveFeedback() {
	var url = "/givingFeedback?reportingBug=1";
	var feedbackName = $('feedbackName').value;
	var feedbackEmail = $('feedbackEmail').value;
	var feedbackDesc = $('feedbackDesc').value;
	var params = "feedbackName="+encodeURI(feedbackName)+"&feedbackEmail="+encodeURI(feedbackEmail)+"&feedbackDesc="+encodeURI(feedbackDesc);

	new Ajax.Request(url, {
		method : 'post',
		parameters : params,
		onComplete : function() {
			clearClay();
			moldClay(400, 80, 'Thank You for Giving Feedback.', 2000);
		}
	});
}

function GetXmlHttpObject()
{ 
	if (window.XMLHttpRequest)
	{
		XMLHttpRequestObject=new XMLHttpRequest();
	}
	else if (window.ActiveXObject)
	{
		XMLHttpRequestObject=new ActiveXObject("Microsoft.XMLHTTP");
	}
	return XMLHttpRequestObject;
} 

function clearClay() { //gets rid of children of clay and makes it disappear
	if ($('clay')) {
		Clay = $('clay');
		if (Clay.style.display != 'none') {
			outer = (top.$('outerDIV')) ? top.$('outerDIV') : null;
			inner = (top.$('innerDIV')) ? top.$('innerDIV') : null;
			if (outer != null) outer.remove();
			if (inner != null) inner.remove();
			sels = top.document.getElementsByTagName('select');
			for (i=0;i<sels.length;i++) {
				if (sels[i].name == "order_by") sels[i].style.width = '125px';	
			}
		}
		$(Clay).remove();
	}
}




function getDimensions() //gets dimensions & positions of window
{
	if (parseInt(navigator.appVersion)>3) {
		if (navigator.appName=="Netscape") {
			winW = top.window.innerWidth;
			winH = top.window.innerHeight;
			scrollPosY = top.window.pageYOffset;
			scrollPosX = top.window.pageXOffset;
		}
		if (navigator.appName.indexOf("Microsoft")!=-1) {
			winW = top.document.documentElement.clientWidth;
			winH = top.document.documentElement.clientHeight;
			scrollPosY = top.document.documentElement.scrollTop;
			scrollPosX = top.document.documentElement.scrollLeft;
		}
	}
}

function moldClay(outerWidth, outerHeight, action, the_id, redirect) { //creates clay and determines what to fill it with
	
	
	outerDIV = ($('outerDIV')) ? $('outerDIV').innerHTML : null;
	if (outerDIV == null) {
		var ClayCreation = document.createElement('div');
		ClayCreation.id = "clay";
		ClayCreation.style.position = "absolute";
		document.body.appendChild(ClayCreation);
		
		Clay = $('clay');
		getDimensions();

		var outerDIV =  top.document.createElement('div'); //create DIV
		
		
		innerDIV =  top.document.createElement('div'); //create DIV
		
		//assign IDs to manipulate
		innerDIV.id = 'innerDIV';
		innerDIV.name = 'innerDIV';
		
		//style
		innerDIV.style.position = 'absolute';
		innerDIV.style.width =  (outerWidth-34-30)+'px';
		innerDIV.style.height = (outerHeight-34-30)+'px';
		innerDIV.style.color = '#FFFFFF';
		innerDIV.style.backgroundColor = '#2A2A28';
		innerDIV.style.zIndex = 100;
		innerDIV.style.padding = 15+'px';
		innerDIV.style.top = 17+'px';
		innerDIV.style.left = 17+'px';
		
		var innerHeight = innerDIV.style.height;
		innerHeight = innerHeight.replace(/[A-Za-z]+/, '');
		innerHeight = parseInt(innerHeight);
		
		//assign IDs to manipulate
		outerDIV.id = 'outerDIV';
		outerDIV.name = 'outerDIV';
		
		//style
		outerDIV.style.position = 'absolute';
		outerDIV.style.width =  outerWidth+'px';
		outerDIV.style.height = outerHeight+'px';
		outerDIV.style.backgroundColor = '#CCCCCC';
		outerDIV.style.top = 0+'px';
		outerDIV.style.left = 0+'px';
		outerDIV.style.zIndex = 99;
		outerDIV.style.opacity = '.55';
		outerDIV.style.filter ='alpha(opacity=55)';
		
		
		
		
		Clay.appendChild(outerDIV); //add outerDIV to Clay
		Clay.appendChild(innerDIV); //add innerDIV to Clay
		
		
		//adjust clay to same dimensions as outer div
		Clay.style.width = outerWidth+'px';
		Clay.style.height = outerHeight+'px';

		
		//place clay horizontally centered
		ScrollWin = scrollPosX + (winW/2);
		newInnerLeft = (ScrollWin) - ((outerWidth-12)/2);
		Clay.style.left = newInnerLeft+"px";
		
		//place clay vertically centered
		ScrollWin = scrollPosY + (winH/2);
		newInnerTop = (ScrollWin) - ((outerHeight-12)/2);
		Clay.style.top = newInnerTop+"px";
		
		var myText = "";
		var delay = 0;
		if (action == "giveFeedback") { //with behance
			replaceOrderBy();
			new Ajax.Request('/replacement/giveFeedback?reportingBug=1', {
				method : 'get',
				onComplete : function (transport) {
					$('innerDIV').update(transport.responseText);	
				}
			});
		}
		else {
			myText = action;
			var closeThis = 1;
			delay = the_id;
		}

		if (myText != "") {
           innerDIV.innerHTML = myText;
           if (closeThis) {
               if (delay != "none") {
                   if (!delay || delay == 0) delay = 1500;
                   setTimeout("clearClay()", delay);
               }
           }
       } 
		Clay.style.display = 'block';
	}
	else clearClay();
}

Event.observe(window, 'load', function(e) {
	if ($('galleryDIV')) {
		var e = new MouseEvent(e);
		var extra_event = (conf_browser == "ie") ? null : e;
		
		$('galleryDIV').onmouseover = function (extra_evt) {
			if (extra_evt == null) extra_evt = event;
			if (!ajaxLoading) selectNav(extra_evt,'galleryDIV');
		}
		$('portfolioDIV').onmouseover = function (extra_evt) {
			if (extra_evt == null) extra_evt = event;
			if (!ajaxLoading) selectNav(extra_evt,'portfolioDIV');
		}
		$('circleDIV').onmouseover = function (extra_evt) {
			if (extra_evt == null) extra_evt = event;
			if (!ajaxLoading) selectNav(extra_evt,'circleDIV');
		}
		$('tipexchangeDIV').onmouseover = function (extra_evt) {
			if (extra_evt == null) extra_evt = event;
			if (!ajaxLoading) selectNav(extra_evt,'tipexchangeDIV');
		}
		$('giglistDIV').onmouseover = function (extra_evt) {
			if (extra_evt == null) extra_evt = event;
			if (!ajaxLoading) selectNav(extra_evt,'giglistDIV');
		}
		$('thinktankDIV').onmouseover = function (extra_evt) {
			if (extra_evt == null) extra_evt = event;
			if (!ajaxLoading) selectNav(extra_evt,'thinktankDIV');
		}
		
		var subDIV = $('mainSubNavDIV');
		var subDIVs = subDIV.getElementsByTagName('div');
		
		for (var sd=0;sd<subDIVs.length;sd++) {
			var curSD = subDIVs[sd];
			var as = curSD.getElementsByTagName('a');
			for (var ac=0;ac<as.length;ac++) {
				var curA = as[ac];
				var curAID = curA.id;
				if (!curAID.match('Linkcom')) {//not thinktank link
					$(curAID).onmouseover = function () {
						var currentLink = this.id;
						currentLink = currentLink.replace('Link', '');
						selectSubNav(currentLink);
						
					}
					$(curAID).onmouseout = function () {
						selectSubNav(currentSubPage);
					}
				}
			}
		}
	}
});

function replaceOrderBy() {
	if (top.$('order_by') != null && top.$('order_by') != "undefined") 
		top.$('order_by').style.width = '0px';	
}

function ieWarning() {
	moldClay(464, 160, '<div class="white-text" style="text-align: left;">It appears you are using an older edition of Internet Explorer. This version lacks security updates and new features required to run this page. You may update <a href="http://www.microsoft.com/windows/downloads/ie/getitnow.mspx" target="_blank">here</a>.<br /><br /><a href="#" onclick="clearClay();">Close</a>', "none");	
}

function getFrameByName(frameName) {
	for (var fl=0;fl<window.frames.length;fl++) {
		var curName = window.frames[fl].name;
		if (curName == frameName) {    
			var curFrame = window.frames[fl];        
		}
	   
	}
	return curFrame;
}

function saveCompleteMess() {
	moldClay(150, 80, 'Save Complete', 1500);	
}

function centerPopup(outerWidth, outerHeight, callback) { //creates clay and determines what to fill it with
	outerDIV = ($('outerDIV')) ? $('outerDIV').innerHTML : null;
	if (outerDIV == null) {
		var ClayCreation = document.createElement('div');
		ClayCreation.id = "clay";
		ClayCreation.style.position = "absolute";
		document.body.appendChild(ClayCreation);
		
		Clay = $('clay');
		getDimensions();

		var outerDIV =  top.document.createElement('div'); //create DIV
		
		
		innerDIV =  top.document.createElement('div'); //create DIV
		
		//assign IDs to manipulate
		innerDIV.id = 'innerDIV';
		innerDIV.name = 'innerDIV';
		
		//style
		innerDIV.style.position = 'absolute';
		innerDIV.style.width =  (outerWidth-34-30)+'px';
		innerDIV.style.height = (outerHeight-34-30)+'px';
		innerDIV.style.color = '#FFFFFF';
		innerDIV.style.backgroundColor = '#2A2A28';
		innerDIV.style.zIndex = 100;
		innerDIV.style.padding = 15+'px';
		innerDIV.style.top = 17+'px';
		innerDIV.style.left = 17+'px';
		
		var innerHeight = innerDIV.style.height;
		innerHeight = innerHeight.replace(/[A-Za-z]+/, '');
		innerHeight = parseInt(innerHeight);
		
		//assign IDs to manipulate
		outerDIV.id = 'outerDIV';
		outerDIV.name = 'outerDIV';
		
		//style
		outerDIV.style.position = 'absolute';
		outerDIV.style.width =  outerWidth+'px';
		outerDIV.style.height = outerHeight+'px';
		outerDIV.style.backgroundColor = '#CCCCCC';
		outerDIV.style.top = 0+'px';
		outerDIV.style.left = 0+'px';
		outerDIV.style.zIndex = 99;
		outerDIV.style.opacity = '.55';
		outerDIV.style.filter ='alpha(opacity=55)';
		
		
		
		
		Clay.appendChild(outerDIV); //add outerDIV to Clay
		Clay.appendChild(innerDIV); //add innerDIV to Clay
		
		
		//adjust clay to same dimensions as outer div
		Clay.style.width = outerWidth+'px';
		Clay.style.height = outerHeight+'px';

		
		//place clay horizontally centered
		ScrollWin = scrollPosX + (winW/2);
		newInnerLeft = (ScrollWin) - ((outerWidth-12)/2);
		Clay.style.left = newInnerLeft+"px";
		
		//place clay vertically centered
		ScrollWin = scrollPosY + (winH/2);
		newInnerTop = (ScrollWin) - ((outerHeight-12)/2);
		Clay.style.top = newInnerTop+"px";
		eval(callback);
		Clay.style.display='block';

	}
	else clearClay();
}

function getAutoDimensions(objID) {
	obj = $(objID);
	var xy = new Array();
	xy[0] = (obj.clientWidth) ? obj.clientWidth : obj.innerWidth;
	xy[1] = (obj.clientHeight) ? obj.clientHeight : obj.innerHeight;
	return xy;

}

function getAbsolutePosition(objID) {
	var obj = top.$(objID);
	var leftY = topY = 0;
	if (obj.offsetParent) {
		leftY = obj.offsetLeft;
		topY = obj.offsetTop;
		while (obj = obj.offsetParent) {
			leftY += obj.offsetLeft;
			topY += obj.offsetTop;
		}
	}	
	var ap = new Array();
	ap[0] = leftY;
	ap[1] = topY;
	return ap;
}

function saveForm(myText, postTo, myDIV, myForm, target) {
	var target = (target) ? target : null;
	var params = $H($(myForm).serialize(true));
	params.set('target',target);
	var params = params.toQueryString();
	ajaxLoading = 1;
	if (myText != '') 
	{
		centerPopup(200, 80, "$('innerDIV').update('Saving Change...');");
		//changeP(postTo, myDIV, myForm, 'yes', target);
		new Ajax.Request(postTo, {
			method : 'post',
			parameters : params,
			onComplete : function(transport) {
				if (myDIV != '') $(myDIV).update(transport.responseText);
				$('innerDIV').update('Change Saved.');
				setTimeout("clearClay()", 1500);
				ajaxLoading = 0;
			}
		});
	}
	else {
		new Ajax.Request(postTo, {
			method : 'post',
			parameters : params,
			onComplete : function(transport) {
				$(myDIV).update(transport.responseText);
				ajaxLoading = 0;
			}
		});
		
	}
}

function addComment(url, myDIV, myForm, type) {
	var params = $H($(myForm).serialize(true)).merge({'type':$F('type')});
	new Ajax.Request(url, {
		method : 'post',
		parameters : params,
		onComplete : function() {
			new Ajax.Request("/pagination/nextComment?type="+$F('type')+"&the_id="+$F('the_id')+"&offset=0", {
				method : 'get',
				onComplete : function(transport) {
					$(myDIV).update(transport.responseText);	
				}
			});
			if ($F('type') == "member") { $('commentBlock').style.display='none'; }
		}
	});
}

function correctOuterDIVHeight() {
	var myInnerDIV = document.getElementById('innerDIV');
	myInnerDIV.style.height='auto';
	var myInnerHeight = myInnerDIV.getHeight();
	var myOuterDIV = document.getElementById('outerDIV');
	myOuterDIV.style.height = (myInnerHeight+34)+'px';
}

/****WATCHLIST Adding / Removal
ajax/watchers/.... newer code, /ajax/replacements/... older code (replace later)
Old = creatives, other = watchers
*****/
function removeWatchlist(memb_id, username) {
	new Ajax.Request('/ajax/watchers/watchlist/addToWatch.php?memb_id='+memb_id+'&remove=1', {
		method : 'get',
		onComplete : function (transport) {
			$(username+'_Watch').update(transport.responseText);	
		}
	});
}

function addToWatchlist(memb_id, username) {
	new Ajax.Request('/ajax/watchers/watchlist/addToWatch.php?memb_id='+memb_id, {
		method : 'get',
		onComplete : function (transport) {
			$(username+'_Watch').update(transport.responseText);	
		}
	});
}


function removeWatchlistOld(memb_id, username) {
	new Ajax.Request('/ajax/replacements/removeFromWatch.php?memb_id='+memb_id, {
		method : 'get',
		onComplete : function (transport) {
			$(username+'_Watch').update(transport.responseText);	
		}
	});
}

function addToWatchlistOld(memb_id, username) {
	new Ajax.Request('/ajax/replacements/addToWatch.php?memb_id='+memb_id, {
		method : 'get',
		onComplete : function (transport) {
			$(username+'_Watch').update(transport.responseText);	
		}
	});
	
}

function sendContentSpam(the_id, type) {
	var reason = '';
	if ($('reason1') && $('reason1').checked == true) reason = $F('reason1');
	if ($('reason2') && $('reason2').checked == true) reason = $F('reason2');
	if ($('reason3') && $('reason3').checked == true) reason = $F('reason3');
	new Ajax.Request('/replacement/spamSend?the_id='+the_id+'&reason='+reason+'&type='+type+'&comments='+$F('spamReason'), {
		method : 'get',
		onComplete : function (transport) {
			$('innerDIV').update(transport.responseText);	
			setTimeout("clearClay();", 1500);
		}
	});
}

function userSpamBox(the_id) {
	replaceOrderBy();
	//changeHTML('/replacement/createSpam?memb_id='+the_id, 'innerDIV');
	new Ajax.Request('/replacement/createSpam?memb_id='+the_id, {
		method : 'get',
		onComplete : function (transport) {
			$('innerDIV').update(transport.responseText);	
		}
	});
}

function addTo(action, url, title, from) {
	var baseLoc = 'http://www.behance.net';
	var from = (from) ? from : 'top menu';
	if (action == "bookmark")
	{
		if (window.sidebar) { // Mozilla Firefox Bookmark
			window.sidebar.addPanel(title, baseLoc+url,"");
		} else if( window.external ) { // IE Favorite
			window.external.addFavorite(baseLoc+url, title); }
		else  { 
			$('toolError').innerHTML = "<p>&nbsp;</p><p>Safari does not support this feature.</p><p>Please hit CMD + D.</p>";
			// Opera Hotlist
			return true; }
	} else {
		window.open('/includes/addTo.php?action='+action+'&url='+url+'&title='+title+'&from='+from, '_blank');
	}
}


function sharePageAction(redirect) {
	new Ajax.Request('/replacement/sharePage?redirect='+redirect+'&friend_emails='+$F('friend_emails')+'&your_email='+$F('your_email')+'&your_name='+document.getElementById('your_name').value+'&send_copy='+$('send_copy').checked+'&additional_comments='+$F('additional_comments'), {
		method : 'get',
		onComplete : function (transport) {
			$('innerDIV').update(transport.responseText);	
			setTimeout("clearClay();", 1500);
		}
	});
}