function toggleEvent(num) {
	var theDiv = document.getElementById('eventDiv_' + num);
	var theArrow = document.getElementById('eventArrow_' + num);
	var theName = document.getElementById('eventName_' + num);

	if(theDiv.style.display == '') {
		theDiv.style.display = 'none';
		theArrow.src = '/img/arrowright.jpg';
		theName.style.color = '#3A341E';
		} else {
			theDiv.style.display = '';
			theArrow.src = '/img/arrowdown.jpg';
			theName.style.color = '#8F5400';
		}
	}

	function toggleMedia(name) {
		var theDiv = document.getElementById(name + '_Container');
		var theArrow = document.getElementById(name + '_Arrow');
		var theName = document.getElementById(name + '_Name');

		if(theDiv.style.display == '') {
			theDiv.style.display = 'none';
			theArrow.src = '/img/arrowright.jpg';
			theName.style.color = '#3A341E';
			} else {
				theDiv.style.display = '';
				theArrow.src = '/img/arrowdown.jpg';
				theName.style.color = '#8F5400';
			}
		}

		function toggleArticle(id) {
			var theDiv = document.getElementById('article_' + id);
			var theLink = document.getElementById('article_link_' + id);

			if(theDiv.style.display == '') {
				theDiv.style.display = 'none';
				theLink.style.color = '#3A341E';
				} else {
					theDiv.style.display = '';
					theLink.style.color = '#8F5400';
				}
			}

			function clearMedia(controller, id) {
				var ask = confirm('Do you want to clear this image?');
				if(ask) {
					var ajaxRequest;  // The variable that makes Ajax possible!

					try{
						// Opera 8.0+, Firefox, Safari
						ajaxRequest = new XMLHttpRequest();
						} catch (e){
							// Internet Explorer Browsers
							try{
								ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
								} catch (e) {
									try{
										ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
										} catch (e){
											// Something went wrong
											alert("Your browser broke!");
											return false;
										}
									}
								}
								// Create a function that will receive data sent from the server
								ajaxRequest.onreadystatechange = function(){
									if(ajaxRequest.readyState == 4){
										//new Effect.Fade('currentImageDiv');
										//new Effect.Appear('newImageDiv', {queue: 'end'});
										window.location.href = '/admin/trade/edit/' + id;
										//result = ajaxRequest.responseText;
										//document.getElementById('temp_Listings').innerHTML = result;
									}
								}
								ajaxRequest.open("GET", "/admin/"+controller+"/clearMedia/" + id, true);
								ajaxRequest.send(null);
							}
						}

						function clearHomeImage(id) {
							var ask = confirm('Do you want to clear this image?');
							if(ask) {
								var ajaxRequest;  // The variable that makes Ajax possible!

								try{
									// Opera 8.0+, Firefox, Safari
									ajaxRequest = new XMLHttpRequest();
									} catch (e){
										// Internet Explorer Browsers
										try{
											ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
											} catch (e) {
												try{
													ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
													} catch (e){
														// Something went wrong
														alert("Your browser broke!");
														return false;
													}
												}
											}
											// Create a function that will receive data sent from the server
											ajaxRequest.onreadystatechange = function(){
												if(ajaxRequest.readyState == 4){
													new Effect.Fade('currentImage_' + id);
													new Effect.Appear('newImage_' + id, {queue: 'end'});
													//result = ajaxRequest.responseText;
													//document.getElementById('temp_Listings').innerHTML = result;
												}
											}
											ajaxRequest.open("GET", "/admin/home/deleteImage/" + id, true);
											ajaxRequest.send(null);
										}
									}

									function snHover(id) {
										var theDiv = document.getElementById('sn_' + id);
										var innerDivs = theDiv.getElementsByTagName('div');
										innerDivs[0].className = 'nav-l-hover';
										innerDivs[1].className = 'nav-hover';
										innerDivs[2].className = 'nav-r-hover';
									}
									function snUnhover(id) {
										var theDiv = document.getElementById('sn_' + id);
										var innerDivs = theDiv.getElementsByTagName('div');
										var currentPage = document.getElementById('activeHover');
										innerDivs[0].className = 'nav-l';
										innerDivs[1].className = 'nav';
										innerDivs[2].className = 'nav-r';
									}
