	var tag_state = true;
	var cloud_loaded = false;
	function showMore(){
		if(tag_state){
			loadCloud("cloud_area_org","org");
			document.getElementById("tag_cloud_disorg").style.display="none";
			document.getElementById("tag_cloud_organized").style.display="block";
			document.getElementById("showmore_button").src=baseURL+"images/ShowLessTags_over.gif"
			tag_state = false;
		}
		else{
			loadCloud("cloud_area_disorg","disorg");
			document.getElementById("tag_cloud_disorg").style.display="block";
			document.getElementById("tag_cloud_organized").style.display="none";
			document.getElementById("showmore_button").src=baseURL+"images/ShowMoreTags_over.gif";
			tag_state = true;
		}
	}
	function flipIn(which){
			which.src = baseURL+"images/"+which.src.split("images/")[1].split(".")[0]+"_over.gif";
		}
	function flipOut(which){
			which.src = baseURL+"images/"+which.src.split("images/")[1].substring(0,(which.src.split("images/")[1].length-9))+".gif";
		}
		
	function stfSender(page){ 
		var myAjax = new Ajax.Request(baseURL+"communicator.php",
			{
				method:	'get',
				parameters: 'rnd=' + Math.round(Math.random()*12344) + '&act=stf&iName=' + $("stf_form").iName.value + '&iEmail=' + $("stf_form").iEmail.value + '&useremail=' + $("stf_form").useremail.value + '&username=' + $("stf_form").username.value + '&page=' + page,
				onComplete: showResponse
			});
			
		}
	function showResponse(oResponse){
			$("stf_message").style.display = "block";
			if(oResponse.responseText.indexOf("success")>-1)
				{
					$("stf_message").innerHTML = "Great! Your message has been sent to your someone. <span class='red'>Send to some more?</span>";
					fadeOutItem("iName",0);
					fadeOutItem("iEmail",0);
				}
			else
				$("stf_message").innerHTML = "Something went wrong......hmmm";	
			setTimeout("$(\"stf_message\").style.display = \"none\"",8000);
		}
	
	function fadeOutItem(which,counter){
				counter=counter+2;
				$(which).style.color="rgb("+(255*(counter*.01)) +","+(255*(counter*.01))+","+(255*(counter*.01))+")";
				if(counter==100)
						{
						$(which).value = "";
						$(which).style.color="#000";
						}
				else
					setTimeout("fadeOutItem('"+which+"',"+counter+")",5);
				}
	var destination ="";
	function loadCloud(where,type){
			//alert("cloud_area");
			destination = where;
			var myAjax = new Ajax.Request(baseURL+"communicator.php",
			{
				method:	'get',
				parameters: 'rnd=' + Math.round(Math.random()*12344) + '&act=load_cloud_' + type + '&count=200',
				onComplete: showCloud
			});
			cloud_loaded = true;
		}
	function showCloud(oResponse){
			$(destination).innerHTML = oResponse.responseText;
			//alert(oResponse.responseText);
		}
		
	function appendToInput(text, input)
	{
		var value = trim(input.value);
		
		//alert(text + input.value);
		
		if (!value.length)
			value = text;
		else
			value = value + ", " + text;
			
		input.value = value;
	}
	
	function trim(inputString) {
	   // Removes leading and trailing spaces from the passed string. If something besides
	   // a string is passed in (null, custom object, etc.) then return the input.
	   if (typeof inputString != "string") { return inputString; }
	   var retValue = inputString;
	   var ch = retValue.substring(0, 1);
	   while (ch == " ") { // Check for spaces at the beginning of the string
	      retValue = retValue.substring(1, retValue.length);
	      ch = retValue.substring(0, 1);
	   }
	   ch = retValue.substring(retValue.length-1, retValue.length);
	   while (ch == " ") { // Check for spaces at the end of the string
	      retValue = retValue.substring(0, retValue.length-1);
	      ch = retValue.substring(retValue.length-1, retValue.length);
	   }   
	   return retValue; // Return the trimmed string back to the user
   }
   
   function nextClip(id)
   {
   		var url = baseURL + "communicator.php";
   		var pars = "act=getNextTip&id=" + id;
   		
   		var myAjax = new Ajax.Request(
   			url,
   			{
   				method: 'get',
   				parameters: pars,
   				onComplete: showTip
   			});
   }
   
   function showTip(resp)
   {
   		//alert(resp.responseText);
   		$("planning_tip").innerHTML = resp.responseText;
   }
   
   function nextMiniTip(id)
   {
   		var url = baseURL + "communicator.php";
   		var pars = "act=getNextMiniTip&id=" + id;
   		
   		var myAjax = new Ajax.Request(
   			url,
   			{
   				method: 'get',
   				parameters: pars,
   				onComplete: showMiniTip
   			});
   }
   
   function showMiniTip(resp)
   {
   		//alert(resp.responseText);
   		$("mini_tips").innerHTML = resp.responseText;
   }
   
   function popWindow(url)
   {
   		window.open(url, "", "width=470,height=600,resizable=no,status=yes,scrollbars=yes");
   }
   
   function flipCat(anchor)
   {
   		div = anchor.parentNode;
   		
   		if (!div.flipped)
   			div.flipped = 1;
   		
   		if (div.flipped == 1)
   		{
   			div.flipped = 2;
   			//alert(anchor.innerHTML.substring(0, anchor.innerHTML.length-1));
   			anchor.innerHTML = anchor.innerHTML.substring(0, anchor.innerHTML.length-1) + '-';
   		}
   		else
   		{
   			div.flipped = 1;
   			anchor.innerHTML = anchor.innerHTML.substring(0, anchor.innerHTML.length-1) + '+';
   		}
   			
   		//alert(div.flipped);
   		
   		divs = div.getElementsByTagName('div');
   		
   		//alert(divs.length);
   		
   		for (i = 0; i < divs.length; ++i)
   		{
	   		if (div.flipped == 2)
	   			divs[i].style.display = "block";
	   		else
	   			divs[i].style.display = "none";
   		}
   }
   
   var btNavItems =  new Array("va_link", "bt_top","bt_rare","bt_random");
var btNavObjects = new Array();	
var btSet =  false;
function loadBT(which){
	if(!btSet)
		setUpBTNav();
	resetBTNav()
	AddClassName(which, "selected");
	loadNewBT(which.id);
	}
function resetBTNav(){
	for(i=0;i<btNavObjects.length;i++)
		RemoveClassName(btNavObjects[i], "selected")
	}
function setUpBTNav(){
	btSet = true;
	for(i=0;i<btNavItems.length;i++)
		btNavObjects[i] = $(btNavItems[i]);
	}
function loadNewBT(type){
	//alert(type);
	$("btLinks").innerHTML = "<img src='"+baseURL+"images/loading_animated2.gif' alt='loading items..'>";
	var myAjax = new Ajax.Request(baseURL+"communicator.php",
			{
				method:	'get',
				parameters: 'rnd=' + Math.round(Math.random()*12344) + '&act=getBT&type='+type,
				onComplete: refreshBT
			});
	}
function refreshBT(response){
	$("btLinks").innerHTML = response.responseText;
}
function addToWorkSpace(which){
	//alert(which);
	var myAjax = new Ajax.Request(baseURL+"communicator.php",
			{
				method:	'get',
				parameters: 'rnd=' + Math.round(Math.random()*12344) + '&act=saveToWorkspace&id='+which,
				onComplete: responseToSave
			});

}
function responseToSave(response){	
	//alert(response.responseText);
	if(response.responseText =="success"){	
		$("saveToLink").innerHTML = "<a href='"+baseURL+"workspace/index.html'><img src='"+baseURL+"images/SavedToMyWorkspace.gif' style='padding-top:3px;' alt='saved to workspace' /></a>";
	}
}
function editNote(){
	$('note_edit').style.display='block';
	$('notepadContent').style.display='none';
			
}
function saveNotepad(note){
	//alert(escape("this is the nte - > " + note));
	var myAjax = new Ajax.Request(baseURL+"communicator.php",
			{
				method:	'post',
				postBody: 'rnd=' + Math.round(Math.random()*12344) + '&act=receiveNotes&text='+note,
				onComplete: responseNotepad
			});

}
function responseNotepad(response){	
		//alert(response.responseText);
		$("notepadContent").innerHTML = response.responseText;
		$("note_edit").style.display = "none";
		$('notepadContent').style.display='block';
	}
var link;
function deleteSavedProfile(which,name){
	if(confirm("Are you sure you want to remove " + name)){
	link = which;
	var myAjax = new Ajax.Request(baseURL+"communicator.php",
			{
				method:	'get',
				parameters: 'rnd=' + Math.round(Math.random()*12344) + '&act=deleteSavedProfile&id='+which,
				onComplete: responseSavedProfile
			});
	responseSavedProfile();
	}
}
var cdown = 0;
function deleteLink(){
	$("saved_link_"+link).innerHTML = "deleting";	
	cdown = cdown +1;
	for(i=0;i<cdown;i++)
		$("saved_link_"+link).innerHTML = $("saved_link_"+link).innerHTML + ".";	
	if(cdown<20)
		setTimeout("deleteLink()",50);
	else{
		$("saved_link_"+link).style.display='none';
		cdown = 0;
	}
}
function responseSavedProfile(response){
	deleteLink(link);
}

function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}


function showUserInfo(anchor)
{
	if (!anchor.infoDiv)
	{
		div = document.createElement('div');
		anchor.infoDiv = div;
		div.style.display = 'none';
		anchor.infoDiv.style.position = 'absolute';
		anchor.infoDiv.style.backgroundColor = '#fff';
		pos = findPos(anchor);
		
		anchor.infoDiv.style.left =  pos[0] + 'px';
		
		calcTop = anchor.scrollHeight + pos[1];
		anchor.infoDiv.style.top =  calcTop + 'px';
		
		anchor.infoDiv.style.height = '40px';
		//anchor.infoDiv.style.paddingLeft = '10px';
		anchor.infoDiv.style.paddingRight = '10px';
		anchor.infoDiv.style.paddingTop = '5px';
		
		document.body.appendChild(div);
		anchor.infoDiv.innerHTML = anchor.getAttribute('name') + '<br />' + anchor.getAttribute('email');
	}
	
	if (anchor.infoDiv.style.display == 'block')
		anchor.infoDiv.style.display = 'none';
	else
		anchor.infoDiv.style.display = 'block';
}
		
// ----------------------------------------------------------------------------
// HasClassName
//
// Description : returns boolean indicating whether the object has the class name
//    built with the understanding that there may be multiple classes
//
// Arguments:
//    objElement              - element to manipulate
//    strClass                - class name to add
//
function HasClassName(objElement, strClass)
   {

   // if there is a class
   if ( objElement.className )
      {

      // the classes are just a space separated list, so first get the list
      var arrList = objElement.className.split(' ');

      // get uppercase class for comparison purposes
      var strClassUpper = strClass.toUpperCase();

      // find all instances and remove them
      for ( var i = 0; i < arrList.length; i++ )
         {

         // if class found
         if ( arrList[i].toUpperCase() == strClassUpper )
            {

            // we found it
            return true;

            }

         }

      }

   // if we got here then the class name is not there
   return false;

   }
// 
// HasClassName
// ----------------------------------------------------------------------------


// ----------------------------------------------------------------------------
// AddClassName
//
// Description : adds a class to the class attribute of a DOM element
//    built with the understanding that there may be multiple classes
//
// Arguments:
//    objElement              - element to manipulate
//    strClass                - class name to add
//
function AddClassName(objElement, strClass, blnMayAlreadyExist)
   {

   // if there is a class
   if ( objElement.className )
      {

      // the classes are just a space separated list, so first get the list
      var arrList = objElement.className.split(' ');

      // if the new class name may already exist in list
      if ( blnMayAlreadyExist )
         {

         // get uppercase class for comparison purposes
         var strClassUpper = strClass.toUpperCase();

         // find all instances and remove them
         for ( var i = 0; i < arrList.length; i++ )
            {

            // if class found
            if ( arrList[i].toUpperCase() == strClassUpper )
               {

               // remove array item
               arrList.splice(i, 1);

               // decrement loop counter as we have adjusted the array's contents
               i--;

               }

            }

         }

      // add the new class to end of list
      arrList[arrList.length] = strClass;

      // add the new class to beginning of list
      //arrList.splice(0, 0, strClass);
      
      // assign modified class name attribute
      objElement.className = arrList.join(' ');

      }
   // if there was no class
   else
      {

      // assign modified class name attribute      
      objElement.className = strClass;
   
      }

   }
// 
// AddClassName
// ----------------------------------------------------------------------------


// ----------------------------------------------------------------------------
// RemoveClassName
//
// Description : removes a class from the class attribute of a DOM element
//    built with the understanding that there may be multiple classes
//
// Arguments:
//    objElement              - element to manipulate
//    strClass                - class name to remove
//
function RemoveClassName(objElement, strClass)
   {

   // if there is a class
   if ( objElement.className )
      {

      // the classes are just a space separated list, so first get the list
      var arrList = objElement.className.split(' ');

      // get uppercase class for comparison purposes
      var strClassUpper = strClass.toUpperCase();

      // find all instances and remove them
      for ( var i = 0; i < arrList.length; i++ )
         {

         // if class found
         if ( arrList[i].toUpperCase() == strClassUpper )
            {

            // remove array item
            arrList.splice(i, 1);

            // decrement loop counter as we have adjusted the array's contents
            i--;

            }

         }

      // assign modified class name attribute
      objElement.className = arrList.join(' ');

      }
   // if there was no class
   // there is nothing to remove

   }
// 
// RemoveClassName
// ----------------------------------------------------------------------------

function showProfilePlayer(clipName)
{
	$("profile_movie").style.display="block";
	$("profile_movie").style.top="228px";
	$("profile_movie").style.left="50%";
	$("profile_content").style.position="relative";
	$("profile_content").style.left="-195px";
	var so = new SWFObject("http://www.theskilledlife.com/swfs/profile_player.swf", "profile", "368", "281", "8", "#666666");
	//so.addParam("wmode", "transparent");
	so.addParam("quality", "best");
	so.addVariable("clip", clipName);
	so.write("profile_content");
}

function hideProfilePlayer()
{
	$("profile_movie").style.display="none";
	so = null;
}