
/*******************
* Stars for ratings
********************/

	star_full= new Image(16,14);
	star_full.src="http://www.dailycomedy.com/img/star_orange.gif";  

	star_half= new Image(16,14);
	star_half.src="http://www.dailycomedy.com/img/star_half_orange.gif";

	star_empty= new Image(16,14);
	star_empty.src="http://www.dailycomedy.com/img/star_grey.gif";

	star_0_1= new Image(16,14);
	star_0_1.src="http://www.dailycomedy.com/img/star_0_1.gif";

	star_0_2= new Image(16,14);
	star_0_2.src="http://www.dailycomedy.com/img/star_0_2.gif"; 

	star_0_3= new Image(16,14);
	star_0_3.src="http://www.dailycomedy.com/img/star_0_3.gif"; 

	star_0_4= new Image(16,14);
	star_0_4.src="http://www.dailycomedy.com/img/star_0_4.gif"; 

	star_0_5= new Image(16,14);
	star_0_5.src="http://www.dailycomedy.com/img/star_0_5.gif";

	function rate(rateid,rating)
	{
		imgName = "s1" + rateid;
		if (rating >= 1)
		{
			document[imgName].src = star_full.src;
		} 
		else
		{
			document[imgName].src = star_0_1.src;
		}

		imgName = "s2" + rateid;
		if (rating > 1.5)
		{
			document[imgName].src = star_full.src;
		} 
		else if (rating > 1)
		{
			document[imgName].src = star_half.src;
		}
		else if (rating == 0)
		{
			document[imgName].src = star_0_2.src;
		}
		else
		{
			document[imgName].src = star_empty.src;
		}

		imgName = "s3" + rateid;
		if (rating > 2.5)
		{
			document[imgName].src = star_full.src;
		} 
		else if (rating > 2)
		{
			document[imgName].src = star_half.src;
		}
		else if (rating == 0)
		{
			document[imgName].src = star_0_3.src;
		}
		else
		{
			document[imgName].src = star_empty.src;
		}

		imgName = "s4" + rateid;
		if (rating > 3.5)
		{
			document[imgName].src = star_full.src;
		} 
		else if (rating > 3)
		{
			document[imgName].src = star_half.src;
		}
		else if (rating == 0)
		{
			document[imgName].src = star_0_4.src;
		}
		else
		{
			document[imgName].src = star_empty.src;
		}

		imgName = "s5" + rateid;
		if (rating > 4.5)
		{
			document[imgName].src = star_full.src;
		} 
		else if (rating > 4)
		{
			document[imgName].src = star_half.src;
		}
		else if (rating == 0)
		{
			document[imgName].src = star_0_5.src;
		}
		else
		{
			document[imgName].src = star_empty.src;
		}

	}

	// checks if user is searching for nothing...
	function validateSearch(frm)
	{
		error = "";

		if(!frm)
		{
			alert("No search form specified!");
			return false;
		}

		if(frm.keyword.value == "" || frm.keyword.value == "Search")
		{
			alert("Please, enter keyword into the search box");
			frm.keyword.focus();
			return false;
		}

		return true;
	} // end function validateSearch()

	function validateQSearch(frm)
	{
		error = "";

		if(!frm)
		{
			alert("No search form specified!");
			return false;
		}

		if(frm.topic.value == "" || frm.topic.value == "Search")
		{
			alert("Please, enter topic into the search box");
			frm.topic.focus();
			return false;
		}

		return true;
	} // end function validateSearch()



	// validates the login form...
	function validateLogin(frm)
	{
		error = "";

		if(!frm)
		{
			alert("No login form specified!");
			return false;
		}

		if(frm.stage_name.value == "" || frm.stage_name.value == "Username")
		{
			alert("Please, enter your Username");
			frm.stage_name.focus();
			return false;
		}

		if(frm.password.value == "" || frm.password.value == "********")
		{
			alert("Please, enter your password");
			frm.password.focus();
			return false;
		}

		return true;
	} // end function validateLogin()

	// asks about comment deleting
	function checkDeleteComment()
	{
		if(confirm("Are you sure you want to delete this comment?"))
		{
			return false;
		}
		else
		{
			return true;
		}
	} // end function checkDeleteCommen()



	// onBlur methods for the login fields
	function doFocusLoginForm(formElement)
	{
		if(formElement.name == 'stage_name')
		{
			if(formElement.value == "Username")
			{
				formElement.value = "";
			}
		}

		if(formElement.name == 'password')
		{
			if(formElement.value == "********")
			{
				formElement.value = "";
			}
		}

		return true;
	} // end function doFocusLoginForm


	// onBlur methods for the login fields
	function doBlurLoginForm(formElement)
	{
		if(formElement.name == 'stage_name')
		{
			if(formElement.value == "")
			{
				formElement.value = "Username";
			}
		}

		if(formElement.name == 'password')
		{
			if(formElement.value == "")
			{
				formElement.value = "********";
			}
		}

		return true;
	} // end doBlurLoginForm



	// validates the newsletter signup form...
	function validateNewsletterSignup(frm)
	{
		error = "";

		if(!frm)
		{
			alert("No form specified!");
			return false;
		}

		if(frm.name.value == "" || frm.name.value == "Your first name")
		{
			alert("Please, enter your First Name");
			frm.name.focus();
			return false;
		}

		if(frm.from.value == "" || frm.from.value == "E-mail address *")
		{
			alert("Please, enter your E-mail address");
			frm.from.focus();
			return false;
		}

		if (!validateNewsletterEmail(frm))
		{
			alert("The email address does not appear to be valid. Please check and try again");
			return false;
		}

		return true;
	} // end function validateNewsletterSignup()


	function validateNewsletterEmail(frm)
	{
		var re, good;
		re=/.+\@.+\..+/;
		good = re.exec(frm.from.value);
		return (good);
	}

	// onBlur methods for the login fields
	function doFocusNewsletterSignupForm(formElement)
	{
		if(formElement.name == 'name')
		{
			if(formElement.value == "Your first name")
			{
				formElement.value = "";
			}
		}

		if(formElement.name == 'from')
		{
			if(formElement.value == "E-mail address *")
			{
				formElement.value = "";
			}
		}

		return true;
	} // end function doFocusNewsletterSignupForm


	// onBlur methods for the newsletter signup fields
	function doBlurNewsletterSignupForm(formElement)
	{
		if(formElement.name == 'name')
		{
			if(formElement.value == "")
			{
				formElement.value = "Your first name";
			}
		}

		if(formElement.name == 'from')
		{
			if(formElement.value == "")
			{
				formElement.value = "E-mail address *";
			}
		}

		return true;
	} // end doBlurNewsletterSignupForm


	// checkEmpty methods for the quicksearch
	function checkEmptyQuickSearchForm(form)
	{

		error = "";

		if(form.topic.value == "" || form.topic.value == " Pick Anything or Anyone" || form.topic.value == "        This Box!       " )
		{

			error = "We'd be happy to do a search for you\nbut you have to put something in the box first";
			form.topic.value = "        This Box!       ";
			alert(error);
			return false;
		}

		return true;
	} // end function doFocusQuickSearchForm


	// onFocus methods for the quicksearch
	function doFocusQuickSearchForm(formElement)
	{
		if(formElement.name == 'topic')
		{
			if(formElement.value == " Pick Anything or Anyone" || formElement.value == "        This Box!       " )
			{
				formElement.value = "";
			}
		}

		return true;
	} // end function doFocusQuickSearchForm


	// onBlur methods for the quicksearch
	function doBlurQuickSearchForm(formElement)
	{
		if(formElement.name == 'topic')
		{
			if(formElement.value == "")
			{
				formElement.value = " Pick Anything or Anyone";
			}
		}


		return true;
	} // end doBlurQuickSearchForm



	// onBlur methods for the search fields
	function doFocusSearchForm(formElement)
	{
		if(formElement.name == 'keyword')
		{
			if(formElement.value == "Search")
			{
				formElement.value = "";
			}
		}

		return true;
	} // end function doFocusSearchForm


	// onBlur methods for the search fields
	function doBlurSearchForm(formElement)
	{
		if(formElement.name == 'keyword')
		{
			if(formElement.value == "")
			{
				formElement.value = "Search";
			}
		}

		return true;
	} // end doBlurSearchForm


	// changes the tabs on the right
	function showCat(divid)
	{

		var categories = new Array();
		var imagesNames = new Array();
		categories[1] = 'Newest';
		categories[2] = 'Popular';
		categories[3] = 'Funniest';
		// images_names are OFF status. ON status is added automatically.
		imagesNames[1] = 'tab_newest';
		imagesNames[2] = 'tab_popular';
		imagesNames[3] = 'tab_funniest';

		document.getElementById('tabs_' + divid).style.zIndex = categories.length;
		var newZindex = categories.length - 1;

		for (var i in categories)
		{
			imageName = imagesNames[i];
			if (i != divid)
			{
				document.getElementById('tabs_' + i).style.zIndex = newZindex;
				newZindex--;

				document.getElementById(imageName + '_image').src = "/img/" + imageName + ".jpg";
			} else
			{
				document.getElementById(imageName + '_image').src = "/img/" + imageName + "_on.jpg";
			}
		}
	} // end function showCat()



	// changes the big tabs on the bottom (homepage)
	function showCatBig(divid)
	{
		var categoriesBig = new Array();
		var imagesNamesBig = new Array();
		categoriesBig[1] = 'Staff Picks';
		categoriesBig[2] = 'Newest Jokes';
		categoriesBig[3] = 'Popular Jokes';

		// images_names are OFF status. ON status is added automatically.
		imagesNamesBig[1] = 'tab_editors_picks';
		imagesNamesBig[2] = 'tab_newest_jokes';
		imagesNamesBig[3] = 'tab_popular_jokes';

		document.getElementById('tabs_big_' + divid).style.zIndex = categoriesBig.length;
		var newZindexBig = categoriesBig.length - 1;

		for (var i in categoriesBig)
		{
			imageNameBig = imagesNamesBig[i];
			if (i != divid)
			{
				document.getElementById('tabs_big_' + i).style.zIndex = newZindexBig;
				newZindexBig--;

				document.getElementById(imageNameBig + '_image').src = "/img/" + imageNameBig + ".jpg";
			} else
			{
				document.getElementById(imageNameBig + '_image').src = "/img/" + imageNameBig + "_on.jpg";
			}
		}
	} // end function showCatBig()



	// changes the big tabs on the bottom (videos pages)
	function showCatBigVideos(divid)
	{
		var categoriesBig = new Array();
		var imagesNamesBig = new Array();
		categoriesBig[1] = 'Newest Videos';
		categoriesBig[2] = 'Funniest Videos';
		categoriesBig[3] = 'Most Watched Videos';

		// images_names are OFF status. ON status is added automatically.
		imagesNamesBig[1] = 'tab_newest_videos';
		imagesNamesBig[2] = 'tab_funniest_videos';
		imagesNamesBig[3] = 'tab_most_watched_videos';

		document.getElementById('tabs_big_' + divid).style.zIndex = categoriesBig.length;
		var newZindexBig = categoriesBig.length - 1;

		for (var i in categoriesBig)
		{
			imageNameBig = imagesNamesBig[i];
			if (i != divid)
			{
				document.getElementById('tabs_big_' + i).style.zIndex = newZindexBig;
				newZindexBig--;

				document.getElementById(imageNameBig + '_image').src = "/img/" + imageNameBig + ".jpg";
			} else
			{
				document.getElementById(imageNameBig + '_image').src = "/img/" + imageNameBig + "_on.jpg";
			}
		}
	} // end function showCatBigVideos()

	// changes the tabs on the right
	function showCatFavFanPhot(divid)
	{

		var categories = new Array();
		var imagesNames = new Array();
		categories[1] = 'Favorites';
		categories[2] = 'Fans';
		categories[3] = 'Photos';

		// images_names are OFF status. ON status is added automatically.
		imagesNames[1] = 'tab_favorites';
		imagesNames[2] = 'tab_fans';
		imagesNames[3] = 'tab_photos';

		document.getElementById('tabs_fav_fan_phot_' + divid).style.zIndex = categories.length;
		var newZindex = categories.length - 1;

		for (var i in categories)
		{
			imageName = imagesNames[i];
			if (i != divid)
			{
				document.getElementById('tabs_fav_fan_phot_' + i).style.zIndex = newZindex;
				newZindex--;

				document.getElementById(imageName + '_image').src = "/img/" + imageName + ".jpg";
			} else
			{
				document.getElementById(imageName + '_image').src = "/img/" + imageName + "_on.jpg";
			}
		}
	} // end function showCatFavFanPhot()

	// changes the tabs on the right
	function showCatFavFan(divid)
	{

		var categories = new Array();
		var imagesNames = new Array();
		categories[1] = 'Favorites';
		categories[2] = 'Fans';

		// images_names are OFF status. ON status is added automatically.
		imagesNames[1] = 'tab_favorites';
		imagesNames[2] = 'tab_fans';

		document.getElementById('tabs_fav_fan_' + divid).style.zIndex = categories.length;
		var newZindex = categories.length - 1;

		for (var i in categories)
		{
			imageName = imagesNames[i];
			if (i != divid)
			{
				document.getElementById('tabs_fav_fan_' + i).style.zIndex = newZindex;
				newZindex--;

				document.getElementById(imageName + '_image').src = "/img/" + imageName + ".jpg";
			} else
			{
				document.getElementById(imageName + '_image').src = "/img/" + imageName + "_on.jpg";
			}
		}
	} // end function showCatFavFan()

	// changes the tabs on the right
	function showCatVidPhot(divid)
	{
		var categoriesBig = new Array();
		var imagesNamesBig = new Array();
		categoriesBig[1] = 'Videos';
		categoriesBig[2] = 'Photos';

		// images_names are OFF status. ON status is added automatically.
		imagesNamesBig[1] = 'tab_videos';
		imagesNamesBig[2] = 'tab_photos';

		document.getElementById('tabs_vid_phot_' + divid).style.zIndex = categoriesBig.length;
		var newZindexBig = categoriesBig.length - 1;

		for (var i in categoriesBig)
		{
			imageNameBig = imagesNamesBig[i];
			if (i != divid)
			{
				document.getElementById('tabs_vid_phot_' + i).style.zIndex = newZindexBig;
				newZindexBig--;

				document.getElementById(imageNameBig + '_image').src = "/img/" + imageNameBig + ".jpg";
			} else
			{
				document.getElementById(imageNameBig + '_image').src = "/img/" + imageNameBig + "_on.jpg";
			}
		}
	} // end function showCatVidPhot()


	// changes the tabs on the right
	function showCatVideosPhotos(divid)
	{

		var categoriesVideosPhotos = new Array();
		var imagesNamesVideosPhotos = new Array();
		categoriesVideosPhotos[1] = 'Videos';
		categoriesVideosPhotos[2] = 'Photos';
		// images_names are OFF status. ON status is added automatically.
		imagesNamesVideosPhotos[1] = 'tab_videos';
		imagesNamesVideosPhotos[2] = 'tab_photos';

		document.getElementById('tabs_videos_photos_' + divid).style.zIndex = categoriesVideosPhotos.length;
		var newZindexVideosPhotos = categoriesVideosPhotos.length - 1;

		for (var i in categoriesVideosPhotos)
		{
			imageNameVideosPhotos = imagesNamesVideosPhotos[i];
			if (i != divid)
			{
				document.getElementById('tabs_videos_photos_' + i).style.zIndex = newZindexVideosPhotos;
				newZindexVideosPhotos--;

				document.getElementById(imageNameVideosPhotos + '_image').src = "/img/" + imageNameVideosPhotos + ".jpg";
			} else
			{
				document.getElementById(imageNameVideosPhotos + '_image').src = "/img/" + imageNameVideosPhotos + "_on.jpg";
			}
		}
	} // end function showCatVideosPhotos()






	// changes the tabs on the left (view_video_main.tpl)
	function showVideosTabs(divid)
	{

		var categories = new Array();
		var imagesNames = new Array();
		categories[1] = 'Related videos';
		categories[2] = 'More from this user';
		categories[3] = 'Playlist';
		// images_names are OFF status.ON status is added automatically.
		imagesNames[1] = 'tab_related_videos';
		imagesNames[2] = 'tab_more_from_this_user';
		imagesNames[3] = 'tab_playlist';

		document.getElementById('tabs_' + divid).style.zIndex = categories.length;
		var newZindex = categories.length - 1;

		for (var i in categories)
		{
			imageName = imagesNames[i];
			if (i != divid)
			{
				document.getElementById('tabs_' + i).style.zIndex = newZindex;
				newZindex--;

				document.getElementById(imageName + '_image').src = "/img/" + imageName + ".jpg";
			} else
			{
				document.getElementById(imageName + '_image').src = "/img/" + imageName + "_on.jpg";
			}
		}
	} // end function showVideosTabs()

	function showTab(divid,total)
	{

		document.getElementById('vtabs_' + divid).style.zIndex = total;
		document.getElementById('vtabs_' + divid).style.visibility = "visible";
		var newZindex = total - 1;

		for (i=1; i<=total; i++) 
		{
			if (i != divid)
			{
				document.getElementById('vtabs_' + i).style.zIndex = newZindex;
				newZindex--;
				document.getElementById('vtabs_' + i).style.visibility = "hidden";

				document.getElementById('nav_arrow_' + i).src = "/img/clear.gif";
			} else
			{
				document.getElementById('nav_arrow_' + i).src = "/img/nav_arrow_up.gif";
			}
		}
	} // end function showVideosTabs()


	// shows a hidden page element (usually used for displaying some hidden DIVs)
	function showElement(elmnt)
	{
		if(document.getElementById(elmnt))
		{
			document.getElementById(elmnt).style.display = 'block';
		}
	}



	// hides a page element (usually used for hiding some DIVs)
	function hideElement(elmnt)
	{
		if(document.getElementById(elmnt))
		{
			document.getElementById(elmnt).style.display = 'none';
		}
	}



	// opens a pop-up window
	function openWizard(url,winName,winWidth,winHeight)
	{
		if(winName == null) winName = '';
		if(!(winWidth > 0)) winWidth = 700;
		if(!(winHeight > 0)) winHeight = 550;

		if(url != null)
			window.open(url,winName,'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=' + winWidth + ',height=' + winHeight);
	}



	// logout user
	function doLogout()
	{
		window.location = '/logout';
	}


	// proceed to editing profile page
	function doEditProfile()
	{
		window.location = '/updateprofile';
	}


	// proceed to managing jokes page
	function doManageJokes()
	{
		window.location = '/myjokes';
	}


	// proceed to add new joke page
	function doAddJokeTag(tag)
	{
	
	
		window.location = '/wf/index.php?cmd=joke&action=add&tag=' + tag;
		
	}

	// proceed to add new joke page
	function doAddJoke()
	{
		
		window.location = '/myjokes/add';
		
	}



	// proceed to add new joke page
	function doModifyJoke(jokeID)
	{
		if(!(jokeID > 0))
		{
			alert("Error. Invalid Joke ID.");
			return false;
		}
		window.location = '/wf/index.php?cmd=joke&action=modify&id=' + jokeID;
	}



	// proceed to delete joke
	function doDeleteJoke(frm,jokeID)
	{
		if(!(document.getElementById(frm)))
		{
			alert("Error. No form specified.");
			return false;
		}

		if(!(jokeID > 0))
		{
			alert("Error. Invalid Joke ID.");
			return false;
		}

		if(confirm("Are you sure you want to delete this joke?"))
		{
			document.getElementById(frm).cmd.value = "joke";
			document.getElementById(frm).elements.action.value = "delete";
			document.getElementById(frm).elements.id.value = jokeID;
			document.getElementById(frm).submit();
		}
		return false;
	}



	// proceed to manage messages page
	function doManageMessages()
	{
		window.location = "/mymessages";
	}

	// proceed to delete joke
	function doDeleteMessage(frm,messageID)
	{
		if(!(document.getElementById(frm)))
		{
			alert("Error. No form specified.");
			return false;
		}

		if(!(messageID > 0))
		{
			alert("Error. Invalid Message ID.");
			return false;
		}

		if(confirm("Are you sure you want to delete this message?"))
		{
			document.getElementById(frm).cmd.value = "message";
			document.getElementById(frm).elements.action.value = "delete";
			document.getElementById(frm).elements.id.value = messageID;
			document.getElementById(frm).submit();
		}
		return false;
	}



	// proceed to manage friends page
	function doManageFriends()
	{
		window.location = "/wf/index.php?cmd=manage_friends";
	}


	// proceed to manage favorites page
	function doManageFavorites()
	{
		window.location = "/wf/index.php?cmd=manage_favorites";
	}


	// proceed to manage photos page
	function doManagePhotos()
	{
		window.location = "/wf/index.php?cmd=manage_photos";
	}

	// proceed to modify photo details
	function doModifyPhoto(photoID)
	{
		if(!(photoID > 0))
		{
			alert("Error. Invalid Photo ID.");
			return false;
		}
		window.location = '/wf/index.php?cmd=manage_photos&action=modify&id=' + photoID;
	}

	// proceed to delete photo
	function doDeletePhoto(frm,photoID)
	{
		if(!(document.getElementById(frm)))
		{
			alert("Error. No form specified.");
			return false;
		}

		if(!(photoID > 0))
		{
			alert("Error. Invalid Photo ID.");
			return false;
		}

		if(confirm("Are you sure you want to delete this photo?"))
		{
			document.getElementById(frm).cmd.value = "manage_photos";
			document.getElementById(frm).elements.action.value = "delete";
			document.getElementById(frm).elements.id.value = photoID;
			document.getElementById(frm).submit();
		}
		return false;
	}

	// proceed to modify video details
	function doModifyVideo(videoID)
	{
		if(!(videoID > 0))
		{
			alert("Error. Invalid Video ID.");
			return false;
		}
		window.location = '/wf/index.php?cmd=manage_videos&action=modify&id=' + videoID;
	}

	// proceed to delete video
	function doDeleteVideo(frm,videoID)
	{
		if(!(document.getElementById(frm)))
		{
			alert("Error. No form specified.");
			return false;
		}

		if(!(videoID > 0))
		{
			alert("Error. Invalid Video ID.");
			return false;
		}

		if(confirm("Are you sure you want to delete this video?"))
		{
			document.getElementById(frm).cmd.value = "manage_videos";
			document.getElementById(frm).elements.action.value = "delete";
			document.getElementById(frm).elements.id.value = videoID;
			document.getElementById(frm).submit();
		}
		return false;
	}


	// proceed to modify mp3 details
	function doModifyMP3(mp3ID)
	{
		if(!(mp3ID > 0))
		{
			alert("Error. Invalid MP3 ID.");
			return false;
		}
		window.location = '/wf/index.php?cmd=manage_mp3&action=modify&id=' + mp3ID;
	}

	// proceed to delete mp3
	function doDeleteMP3(frm,mp3ID)
	{
		if(!(document.getElementById(frm)))
		{
			alert("Error. No form specified.");
			return false;
		}

		if(!(mp3ID > 0))
		{
			alert("Error. Invalid MP3 ID.");
			return false;
		}

		if(confirm("Are you sure you want to delete this mp3?"))
		{
			document.getElementById(frm).cmd.value = "manage_mp3";
			document.getElementById(frm).elements.action.value = "delete";
			document.getElementById(frm).elements.id.value = mp3ID;
			document.getElementById(frm).submit();
		}
		return false;
	}


	// proceed to manage videos page

	function doManageVideosTag(tag)
	{

		window.location = '/wf/index.php?cmd=manage_videos&tag=' + tag;
	}

	function doManageVideos()
	{
		
		window.location = "/wf/index.php?cmd=manage_videos";
	}


	// proceed to manage mp3's page
	function doManageMP3()
	{
		window.location = "/wf/index.php?cmd=manage_mp3";
	}


	// proceed to manage events (calendar) page
	function doMyCalendar()
	{
		window.location = "/wf/index.php?cmd=calendar";
	}


	// proceed to add new event page
	function doAddEvent()
	{
		window.location = '/wf/index.php?cmd=calendar&action=add';
	}



	// proceed to modify event page
	function doModifyEvent(eventID)
	{
		if(!(eventID > 0))
		{
			alert("Error. Invalid Event ID.");
			return false;
		}
		window.location = '/wf/index.php?cmd=calendar&action=modify&id=' + eventID;
	}



	// proceed to delete event
	function doDeleteEvent(frm,eventID)
	{
		if(!(document.getElementById(frm)))
		{
			alert("Error. No form specified.");
			return false;
		}

		if(!(eventID > 0))
		{
			alert("Error. Invalid Event ID.");
			return false;
		}

		if(confirm("Are you sure you want to delete this joke?"))
		{
			document.getElementById(frm).cmd.value = "calendar";
			document.getElementById(frm).elements.action.value = "delete";
			document.getElementById(frm).elements.id.value = eventID;
			document.getElementById(frm).submit();
		}
		return false;
	}


	// used to check all checkboxes (ex: friends on user friends page)
	function checkAllBoxes(formElement)
	{
		var items_to_delete = document.getElementsByName(formElement);
		var len = items_to_delete.length;

		for(i=0; i<len; i++)
		{
			items_to_delete[i].checked = true;
		}
	}



	// used to uncheck all checkboxes (ex: friends on user friends page)
	function uncheckAllBoxes(formElement)
	{
		var items_to_delete = document.getElementsByName(formElement);
		var len = items_to_delete.length;

		for(i=0; i<len; i++)
		{
			items_to_delete[i].checked = false;
		}
	}

	function viewUserProfile(userID)
	{
		if(!(userID > 0))
		{
			alert("Invalid User ID.");
			return false;
		}

		window.location = '/wf/index.php?cmd=view_user&id=' + userID;
	}


	function goMyAccount()
	{
		window.location = '/myaccount';
	}


	function goViewMyProfile()
	{
		window.location = '/wf/index.php?cmd=view_my_profile';
	}


	function viewAllUserJokes(userID)
	{
		if(!(userID > 0))
		{
			alert("Invalid User ID.");
			return false;
		}

		window.location = '/wf/index.php?cmd=user_jokes&id=' + userID;
	}


	function viewAllUserEvents(userID)
	{
		if(!(userID > 0))
		{
			alert("Invalid User ID.");
			return false;
		}

		window.location = '/wf/index.php?cmd=user_calendar&id=' + userID;
	}


	function viewAllUserPhotos(userID)
	{
		if(!(userID > 0))
		{
			alert("Invalid User ID.");
			return false;
		}

		window.location = '/viewphotos/' + userID;
	}


	function viewAllUserVideos(userID)
	{
		if(!(userID > 0))
		{
			alert("Invalid User ID.");
			return false;
		}

		window.location = '/viewvideos/' + userID;
	}


	function viewAllUserFriends(userID)
	{
		if(!(userID > 0))
		{
			alert("Invalid User ID.");
			return false;
		}

		window.location = '/wf/index.php?cmd=user_friends&id=' + userID;
	}


	function viewAllUserFavorites(userID)
	{
		if(!(userID > 0))
		{
			alert("Invalid User ID.");
			return false;
		}

		window.location = '/userfavorites/' + userID;
	}

	function viewAllUserFans(userID)
	{
		if(!(userID > 0))
		{
			alert("Invalid User ID.");
			return false;
		}

		window.location = '/userfans/' + userID;
	}

	function viewAllMembers()
	{
		window.location = '/newestmembers';
	}


	function doCredits()
	{
		window.location = '/credits';
	}


	function doSupport()
	{
		window.location = '/support';
	}


	function doContact()
	{
		window.location = '/contact';
	}


	function doTermsOfService(isPopup)
	{
		if(isPopup)
		{
			window.open('/wf/index.php?cmd=terms_of_service&popup','terms_of_service','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=600,height=400');
		} else
		{
			window.location = '/tos';
		}
	}


	function doPrivacyPolicy()
	{
		window.location = '/privacy';
	}


	function doAboutUs()
	{
		window.location = '/about';
	}


	function doObjectionable()
	{
		window.location = '/objectionable';
	}


	function doFeedback()
	{
		window.location = '/feedback';
	}


	function doHelp()
	{
		window.location = '/help';
	}

	function doSendMessage(userID)
	{
		if(!(userID > 0))
		{
			alert("Invalid User ID.");
			return false;
		}

		window.open('/wf/index.php?cmd=send_message&id=' + userID,'send_message','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=600,height=400');
	}

	function PlayMP3(jokeID)
	{
		if(!(jokeID > 0))
		{
			alert("Invalid Joke ID.");
			return false;
		}

		window.open('/wf/index.php?cmd=play_mp3&id=' + jokeID,'play_mp3','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=600,height=400');
	}


/*
Select and Copy form element script- By Dynamicdrive.com
For full source, Terms of service, and 100s DTHML scripts
Visit http://www.dynamicdrive.com
*/

function HighlightAll(theField) {

//specify whether contents should be auto copied to clipboard (memory)
//Applies only to IE 4+
//0=no, 1=yes
var copytoclip=0

var tempval=eval("document."+theField)
tempval.focus()
tempval.select()
if (document.all&&copytoclip==1){
therange=tempval.createTextRange()
therange.execCommand("Copy")
window.status="Contents highlighted and copied to clipboard!"
setTimeout("window.status=''",1800)
}
}