	
	var xmlhttp=false;
	/*@cc_on @*/
	/*@if (@_jscript_version >= 5)
	try {
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		try {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (E) {
			xmlhttp = false;
		}
	}
	@end @*/

	if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
		xmlhttp = new XMLHttpRequest();
	}

	function getmyhtml(serverPage, objID) {
		var obj = document.getElementById(objID);
		xmlhttp.open("GET", serverPage);
		xmlhttp.onreadystatechange = function() {
			if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
				obj.innerHTML = xmlhttp.responseText;
			}
		}
		xmlhttp.send(null);
	}
	
	//Function to create an XMLHttp Object.
	function getxmlhttp (){
		//Create a boolean variable to check for a valid microsoft active X instance.
		var xmlhttp = false;
		
		//Check if we are using internet explorer.
		try {
			//If the javascript version is greater than 5.
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			//If not, then use the older active x object.
			try {
				//If we are using internet explorer.
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (E) {
				//Else we must be using a non-internet explorer browser.
				xmlhttp = false;
			}
		}
		
		//If we are using a non-internet explorer browser, create a javascript instance of the object.
		if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
			xmlhttp = new XMLHttpRequest();
		}
		
		return xmlhttp;
	}
	
	//Function to determine whether or not we are checking/un-checking a box.
	function setOption (whichOption, theBox, marketId, sid, tid, side, hor, theSrc, stat, mes){
		var theUrl = "clients/flash_change_pref.php?indid=" + marketId + "&option=" + whichOption + "&sid=" + sid + "&tid=" + tid + "&side=" + side + "&hor=" + hor + "&src=" + theSrc + "&stat=" + stat + "&mes=" + mes;
		if (theBox.checked){
			theUrl += "&towhat=1";
		} else {
			theUrl += "&towhat=0";
		}
		//alert(theUrl);
		
		window.location = theUrl;
	}
	
	function setOutlooksOption (whichOption, _checked, marketId, sid, tid, side, hor, theSrc, page, stat, mes){
		theSrc = theSrc.replace(/&/g,"**");
		var theUrl = "clients/flash_change_pref.php?indid=" + marketId + "&option=" + whichOption + "&sid=" + sid + "&tid=" + tid + "&side=" + side + "&hor=" + hor + "&src=" + theSrc + "&stat=" + stat + "&mes=" + mes;
		//alert("function.js: "+theSrc);
		if (_checked){
			theUrl += "&towhat=1";
		} else {
			theUrl += "&towhat=0";
		}
		//alert(theUrl);
		
		window.location = theUrl;
	}
	
	//Function to expand/contract sub-categories.
	function processSubCat (markId, forceOpen, tId){
		//Check if the menu is currently open or closed.
		var curImg = document.getElementById("cross"+markId);
		var curDiv = document.getElementById("openclosecross"+markId);
		if (curDiv){
			if (curDiv.innerHTML.length == 0 || forceOpen){
				curDiv.style.overflow = "visible";
				//Open it.
				//Run an Ajax request.
				var xmlhttp = getxmlhttp();
				xmlhttp.open("GET", "clients/flash_ind_sub_cat.php?sid="+markId+"&tid="+tId+"&curscid="+markId);
				xmlhttp.onreadystatechange = function() {
					if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
						curDiv.innerHTML = xmlhttp.responseText;
						if (curImg){
							curImg.src = "images/signals/whiteminus.gif";
						}
						return true;
					}
				}
				xmlhttp.send(null);
			} else {
				//Close it.
				curDiv.innerHTML = "";
				curDiv.style.overflow = "hidden";
				if (curImg){
					curImg.src = "images/signals/whiteplus.gif";
				}
			}
		}
	}
	
	//Function to expand/contract the alert settings in the sub-cats.
	function processSubComp (markId){
		var curHide = document.getElementById("hidemes"+markId);
		var curDiv = document.getElementById("openclosecross"+markId);
		var curImg = document.getElementById("hidestuff"+markId);
		if (curHide && curDiv){
			if (parseInt (curHide.value) == 0){
				//Open it.
				mes = 1;
				if (curImg){
					curImg.src = "images/signals/blueminus.gif";
				}
			} else {
				//Close it.
				mes = 0;
				if (curImg){
					curImg.src = "images/signals/blueplus.gif";
				}
			}
			var xmlhttp = getxmlhttp();
			xmlhttp.open("GET", "clients/flash_ind_sub_cat.php?sid="+markId+"&mes="+mes+"&curscid="+markId);
			xmlhttp.onreadystatechange = function() {
				if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
					curDiv.innerHTML = xmlhttp.responseText;
					
					return true;
				}
			}
			xmlhttp.send(null);
		}
	}
	
	//Function to expand to the full size individual signal.
	function expandFull (markId, sigId, tId, daId){
		var curDiv = document.getElementById("fullsignal");
		if (curDiv){
			//See if we are expanding or contracting.
			var hideStuff = document.getElementById("hideside");
			var outStanding = document.getElementById("viewoutstanding");
			var topHeader = document.getElementById("topheaderslide");
			var insideTd = document.getElementById("insidetable");
			var blueBar = document.getElementById("blue_bar");
			var posDetails = document.getElementById("pos_details");
			if (parseInt (hideStuff.value) == 0){
				//Open.
				expand = 1;
			} else {
				//Close.
				expand = 0;
				
			}
			var xmlhttp = getxmlhttp();
			xmlhttp.open("GET", "clients/flash_ind_signal.php?sid="+markId+"&exp="+expand+"&indid="+sigId+"&tid="+tId+"&daid="+daId);
			xmlhttp.onreadystatechange = function() {
				if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
					curDiv.innerHTML = xmlhttp.responseText;
					if (parseInt (hideStuff.value) == 0){
						if (outStanding){
							outStanding.style.width = "945px";
							outStanding.style.maxWidth = "945px";
						}
						if (topHeader){
							topHeader.style.width = "945px";
							topHeader.style.maxWidth = "945px";
						}
						if (insideTd){
							insideTd.style.width = "727px";
							insideTd.style.maxWidth = "727px";
						}
						if (blueBar){
							blueBar.style.width = "727px";
							blueBar.style.backgroundColor = "#FF0000";
						}
						if (posDetails){
							posDetails.style.width = "727px";
						}
						//If we are opening it, set it to close in 2 minutes.
						setTimeout ("expandFull ("+markId+","+sigId+","+tId+","+daId+")",120000);
					} else {
						if (outStanding){
							outStanding.style.width = "750px";
							outStanding.style.maxWidth = "750px";
						}
						if (topHeader){
							topHeader.style.width = "750px";
							topHeader.style.maxWidth = "750px";
						}
						if (insideTd){
							insideTd.style.width = "538px";
							insideTd.style.maxWidth = "538px";
						}
						if (blueBar){
							blueBar.style.width = "538px";
						}
						if (posDetails){
							posDetails.style.width = "538px";
						}
					}
					return true;
				}
			}
			xmlhttp.send(null);
		}
	}
	
	//Function to reload the current signals.
	function reloadSignals (){
		var curDiv = document.getElementById("allsignals");
		var xmlhttp = getxmlhttp();
		xmlhttp.open("GET", "clients/flash_all_signals.php");
		xmlhttp.onreadystatechange = function() {
			if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
				if (curDiv){
					curDiv.innerHTML = xmlhttp.responseText;
				}
			}
		}
		xmlhttp.send(null);
	}
	
	//Function to reload a sub-category.
	function reloadSub (theId){
		var curDiv = document.getElementById("openclosecross"+theId);
		var xmlhttp = getxmlhttp();
		xmlhttp.open("GET", "clients/flash_ind_sub_cat.php?sid="+theId+"&curscid="+theId);
		xmlhttp.onreadystatechange = function() {
			if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
				if (curDiv){
					curDiv.innerHTML = xmlhttp.responseText;
				}
			}
		}
		xmlhttp.send(null);
	}
	
	//Function to expand for the admins.
	function expandAllFull (markId, tId, theFilters){
		
		var curDiv = document.getElementById("allsignals");
		if (curDiv){
			//Break out the filters.
			var filterStr = "";
			var filterArr = Array ("side","hor","src","stat","side_market","side_date","side_time","side_pl");
			var filterBreak = theFilters.split ("-");
			for (var i = 0; i < filterArr.length; i++){
				filterStr += "&"+filterArr[i]+"="+filterBreak[i];
			}
			
			//See if we are expanding or contracting.
			var hideStuff = document.getElementById("hideside");
			var outStanding = document.getElementById("viewoutstanding");
			var topHeader = document.getElementById("topheaderslide");
			var insideTd = document.getElementById("insidetable");
			var checkEx = document.getElementById("admin_expand");
			if (parseInt (hideStuff.value) == 0){
				//Open.
				expand = 1;
				if (checkEx){
					checkEx.value = 1;
				}
			} else {
				//Close.
				expand = 0;
				if (checkEx){
					checkEx.value = 0;
				}
				
			}
			var xmlhttp = getxmlhttp();
			xmlhttp.open("GET", "clients/flash_all_signals.php?exad="+expand+"&tid="+tId+filterStr);
			xmlhttp.onreadystatechange = function() {
				if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
					curDiv.innerHTML = xmlhttp.responseText;
					if (parseInt (hideStuff.value) == 0){
						if (outStanding){
							outStanding.style.width = "1085px";
							outStanding.style.maxWidth = "1085px";
						}
						if (topHeader){
							topHeader.style.width = "1085px";
							topHeader.style.maxWidth = "1085px";
						}
						if (insideTd){
							insideTd.style.width = "873px";
							insideTd.style.maxWidth = "873px";
						}
						//If we are opening it, set it to close in 2 minutes.
						setTimeout ("expandFull ("+markId+")",120000);
					} else {
						if (outStanding){
							outStanding.style.width = "850px";
							outStanding.style.maxWidth = "850px";
						}
						if (topHeader){
							topHeader.style.width = "850px";
							topHeader.style.maxWidth = "850px";
						}
						if (insideTd){
							insideTd.style.width = "679px";
							insideTd.style.maxWidth = "679px";
						}
					}
					return true;
				}
			}
			xmlhttp.send(null);
		}
	}
	
	function Browser() {
	
		var ua, s, i;
	
		this.isIE    = false;
		this.isNS    = false;
		this.version = null;
	
		ua = navigator.userAgent;
	
		s = "MSIE";
		if ((i = ua.indexOf(s)) >= 0) {
			this.isIE = true;
			this.version = parseFloat(ua.substr(i + s.length));
			return;
		}
	
		s = "Netscape6/";
		if ((i = ua.indexOf(s)) >= 0) {
			this.isNS = true;
			this.version = parseFloat(ua.substr(i + s.length));
			return;
		}
	
		// Treat any other "Gecko" browser as NS 6.1.
		
		s = "Gecko";
		if ((i = ua.indexOf(s)) >= 0) {
			this.isNS = true;
			this.version = 6.1;
			return;
		}
	}
	
	var browser = new Browser();
	
	// Global object to hold drag information.
	
	var dragObj = new Object();
	dragObj.zIndex = 0;
	
	function dragStart(event, id) {
	
		var el;
		var x, y;
		
		// If an element id was given, find it. Otherwise use the element being
		// clicked on.
		
		if (id){
			dragObj.elNode = document.getElementById(id);
		} else {
			if (browser.isIE){
				dragObj.elNode = window.event.srcElement;
			}
			if (browser.isNS){
				dragObj.elNode = event.target;
			}
		
			// If this is a text node, use its parent element.
			
			if (dragObj.elNode.nodeType == 3){
				dragObj.elNode = dragObj.elNode.parentNode;
			}
		}
		
		// Get cursor position with respect to the page.
		
		if (browser.isIE) {
			x = window.event.clientX + document.documentElement.scrollLeft + document.body.scrollLeft;
			y = window.event.clientY + document.documentElement.scrollTop + document.body.scrollTop;
		}
		if (browser.isNS) {
			x = event.clientX + window.scrollX;
			y = event.clientY + window.scrollY;
		}
		
		// Save starting positions of cursor and element.
		
		dragObj.cursorStartX = x;
		dragObj.cursorStartY = y;
		dragObj.elStartLeft  = parseInt(dragObj.elNode.style.left, 10);
		dragObj.elStartTop   = parseInt(dragObj.elNode.style.top,  10);
		
		if (isNaN(dragObj.elStartLeft)) dragObj.elStartLeft = 0;
		if (isNaN(dragObj.elStartTop))  dragObj.elStartTop  = 0;
		
		// Update element's z-index.
		
		dragObj.elNode.style.zIndex = ++dragObj.zIndex;
		
		// Capture mousemove and mouseup events on the page.
		
		if (browser.isIE) {
			document.attachEvent("onmousemove", dragGo);
			document.attachEvent("onmouseup",   dragStop);
			window.event.cancelBubble = true;
			window.event.returnValue = false;
		}
		if (browser.isNS) {
			document.addEventListener("mousemove", dragGo,   true);
			document.addEventListener("mouseup",   dragStop, true);
			event.preventDefault();
		}
	}
	
	function dragGo(event) {
	
		var x, y;
		
		// Get cursor position with respect to the page.
		
		if (browser.isIE) {
			x = window.event.clientX + document.documentElement.scrollLeft + document.body.scrollLeft;
			y = window.event.clientY + document.documentElement.scrollTop + document.body.scrollTop;
		}
		if (browser.isNS) {
			x = event.clientX + window.scrollX;
			y = event.clientY + window.scrollY;
		}
		
		// Move drag element by the same amount the cursor has moved.
		if ((dragObj.elStartLeft + x - dragObj.cursorStartX) > 0){
			dragObj.elNode.style.left = (dragObj.elStartLeft + x - dragObj.cursorStartX) + "px";
		}
		if ((dragObj.elStartTop  + y - dragObj.cursorStartY) > 0){
			dragObj.elNode.style.top  = (dragObj.elStartTop  + y - dragObj.cursorStartY) + "px";
		}
		
		if (browser.isIE) {
			window.event.cancelBubble = true;
			window.event.returnValue = false;
		}
		if (browser.isNS){
			event.preventDefault();
		}
	}
	
	function dragStop(event) {
	
		// Stop capturing mousemove and mouseup events.
		
		if (browser.isIE) {
			document.detachEvent("onmousemove", dragGo);
			document.detachEvent("onmouseup",   dragStop);
		}
		if (browser.isNS) {
			document.removeEventListener("mousemove", dragGo,   true);
			document.removeEventListener("mouseup",   dragStop, true);
		}
	}
	
	//Function to close (hence delete) a popup window.
	function closePop (theId, popId, subStr){
		var yesNo = confirm ("Are you sure you wish to close this pop-up?");
		if (yesNo){
			//Kill it.
			var xmlhttp = getxmlhttp();
			xmlhttp.open("GET", "clients/kill_pop.php?id="+theId);
			xmlhttp.onreadystatechange = function() {
				if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
					//Close the popup.
					if (xmlhttp.responseText != ""){
						//alert (xmlhttp.responseText);
					} else {
						popdown (popId);
					}
					return true;
				}
			}
			xmlhttp.send(null);
			var curDiv = document.getElementById("allsignals");
			if (curDiv){
				curDiv.innerHTML = "<div style=\"text-align: center; margin-top: 10px;\"><img src=\"images/biggerspinner.gif\" alt=\"\" style=\"border: none;\" /><br />Loading...</div>";
			}
			//Now, go through all of the possible opened sub-cats and reload them.
			var subSplit = subStr.split (",");
			for (var j = 0; j < subSplit.length; j++){
				if (subSplit[j] != ""){
					//Check if the class is visible.
					var tempObj = document.getElementById("cross"+subSplit[j]);
					if (tempObj){
						if (tempObj.src.substr ((tempObj.src.length-29),tempObj.src.length) == "images/signals/whiteminus.gif"){
							//Reload.
							var tempLoad = document.getElementById("openclosecross"+subSplit[j]);
							if (tempLoad){
								tempLoad.innerHTML = "<div style=\"text-align: center; margin-top: 10px;\"><img src=\"images/biggerspinner.gif\" alt=\"\" style=\"border: none;\" /><br />Loading...</div>";
								reloadSub (subSplit[j]);
							}
						}
					}
				}
			}
			//Reload the signals.
			reloadSignals ();
		}
	}
	
	//Function to remove a pop-up.
	function popdown (theid){
		var theElement = document.getElementById(theid);
		if (theElement){
			opacity(theid, 100, 0, 500);
			setTimeout ("removeElement('" + theid + "')",501);
		} else {
			//Check for parent versions.
			var parElement = parent.document.getElementById(theid);
			if (parElement){
				opacity(theid, 100, 0, 500);
				setTimeout ("removeElement('" + theid + "')",501);
			}
		}
		//Remove any hidden iframe as well.
		var hideIFrame = document.getElementById("iframe"+theid);
		if (hideIFrame){
			removeElement (hideIFrame.id);
		}
	}
	
	function removeElement (theid){
		var em = document.getElementById(theid);
		if (!em){
			em = parent.document.getElementById(theid);
		}
		if (em){
			em.parentNode.removeChild(em);
		}
	}
	
	function opacity(id, opacStart, opacEnd, millisec) {
		//speed for each frame
		var speed = Math.round(millisec / 100);
		var timer = 0;
	
		//determine the direction for the blending, if start and end are the same nothing happens
		if(opacStart > opacEnd) {
			for(i = opacStart; i >= opacEnd; i--) {
				setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
				timer++;
			}
		} else if(opacStart < opacEnd) {
			for(i = opacStart; i <= opacEnd; i++){
				setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
				timer++;
			}
		}
	}
	
	//change the opacity for different browsers
	function changeOpac(opacity, id) {
		var iniObj = document.getElementById(id);
		if (iniObj){
			var object = iniObj.style;
			object.opacity = (opacity / 100);
			object.MozOpacity = (opacity / 100);
			object.KhtmlOpacity = (opacity / 100);
			object.filter = "alpha(opacity=" + opacity + ")";
		} else {
			var parObj = parent.document.getElementById(id);
			if (parObj){
				var object = parObj.style;
				object.opacity = (opacity / 100);
				object.MozOpacity = (opacity / 100);
				object.KhtmlOpacity = (opacity / 100);
				object.filter = "alpha(opacity=" + opacity + ")";
			}
		}
	}
	
	//Function to open a window through which the admin can do certain functionality.
	function openAdminWin (theFunction, markId, signalId){
		var yesNo = true;
		if (theFunction == "archive"){
			yesNo = false;
			yesNo = confirm ("Are you sure you want to archive this record?");
		}
		if (yesNo){
			var theURL = "clients/validate_transit.php?func="+theFunction+"&indid="+markId;
			if (signalId){
				if (signalId.length > 0){
					theURL += "&sigid="+signalId;
				}
			}
			window.open (theURL, "adminWin", "status=1, toolbar=0, scrollbars=1, width=775, height=600, top=0, left=0");
		}
	}
	
	//Function to find the x coordinate of an object.  Pass in by ID.
	function findPosX(obj){
		var tempObj = document.getElementById(obj);
		if (tempObj){
			obj = tempObj;
			var curleft = 0;
			if (obj.offsetParent){
				while (obj.offsetParent){
					curleft += obj.offsetLeft
					obj = obj.offsetParent;
				}
			} else if (obj.x){
				curleft += obj.x;
			}
			return curleft;
		} else {
			return false;
		}
	}
	
	//Function to find the y coordinate of an object.  Pass in by ID.
	function findPosY(obj){
		var tempObj = document.getElementById(obj);
		if (tempObj){
			obj = tempObj;
			var curtop = 0;
			if (obj.offsetParent){
				while (obj.offsetParent){
					curtop += obj.offsetTop
					obj = obj.offsetParent;
				}
			} else if (obj.y){
				curtop += obj.y;
			}
			return curtop;
		} else {
			return false;
		}
	}
	
	//Function to create a helpful pop up.
	function createFaxPop (iconId, which){
		
		if (document.getElementById('faxhelp')){
			popdown ('faxhelp');
		} else {
		
			//Create the div.
			var newPop = document.createElement ('div');
			newPop.className = "faxpop";
			
			if (iconId == "firstyahooicon"){
				newPop.style.width = "300px";
				newPop.style.height = "175px";
			}
			
			//Set the id.
			newPop.id = "faxhelp";
					
			var posx = 0;
			var posy = 0;
						
			//Set the exact coordinates.
			posx += findPosX (iconId);
			posy += findPosY (iconId);
			
			if (isNaN (posx)){
				posx = 0;
			}
			if (isNaN (posy)){
				posy = 0;
			}
		
			newPop.style.left = posx + "px";
			newPop.style.top = posy + "px";
			
			// Update element's z-index.
			newZIndex = (dragObj.zIndex + 10);
			newPop.style.zIndex = ++newZIndex;
			
			//Append the div to the body.
			document.body.appendChild (newPop);
			
			//Fade it in.
			opacity('faxhelp', 0, 100, 500);
			
			//Fire the request.
			getmyhtml (which,'faxhelp');
		}
	}
	
	//Function to pop up the accept or not accept box.
	function popAccept (iconId){
		if (document.getElementById('acceptpop')){
			popdown ('acceptpop');
		} else {
			
			//First, make sure the check box gets unchecked.
			var acceptBox = document.getElementById("acceptbox");
			if (acceptBox){
				acceptBox.checked = false;
			}
		
			//Create the div.
			myShim = document.createElement ("iframe");
			//myShim.style.display = "none";
			myShim.style.left = "0px";
			myShim.style.top = "0px";
			myShim.style.position = "absolute";
			myShim.src = "";
			myShim.id = "iframeacceptpop";
			myShim.frameBorder = "0";
			myShim.scrolling = "no";
			myShim.style.filter='progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)';
			myShim.style.width = "auto";
			myShim.style.height = "auto";
			myShim.style.border = "none";
			var newPop = document.createElement ('div');
			newPop.className = "faxpop";
			
			//Set the id.
			newPop.id = "acceptpop";
					
			var posx = 0;
			var posy = 0;
						
			//Set the exact coordinates.
			posx += findPosX (iconId);
			posy += findPosY (iconId);
			
			if (isNaN (posx)){
				posx = 0;
			}
			if (isNaN (posy)){
				posy = 0;
			}
		
			newPop.style.left = posx + "px";
			newPop.style.top = posy + "px";
			
			myShim.style.left = posx + "px";
			myShim.style.top = posy + "px";
			
			//newPop.style.width = "500px";
			//newPop.style.height = "300px";
			newPop.style.width = "600px";
			newPop.style.height = "450px";
			
			// Update element's z-index.
			newZIndex = (dragObj.zIndex + 10);
			newPop.style.zIndex = ++newZIndex;
			
			//Append the div to the body.
			myShim.zIndex = ++newZIndex;
			document.body.appendChild (myShim);
			document.body.appendChild (newPop);
			
			//Fade it in.
			opacity('acceptpop', 0, 100, 500);
			
			//Fire the request.
			getmyhtml ('help/acceptance.php','acceptpop');
			
			var curDiv = document.getElementById("acceptpop");
			if (curDiv){
				myShim.style.width = curDiv.clientWidth + "px";
				myShim.style.height = curDiv.clientHeight + "px";
			}
		}
	}
	
	//Function to confirm or disagree to the accept form.
	function confAccept (theAnswer){
		var checkAccept = document.getElementById("acceptbox");
		if (checkAccept){
			if (theAnswer == 1){
				checkAccept.checked = true;
			} else {
				checkAccept.checked = false;
			}
		}
		popdown ("acceptpop");
	}
	
	//Function to show/hide the cvn image.
	function showHideCVN (showOrHide, iconId){
		if (document.getElementById('acceptpop') || showOrHide == 0){
			popdown ('cvnpop');
		} else {
			
			//Create the div.
			var newPop = document.createElement ('div');
			newPop.className = "faxpop";
			
			//Set the id.
			newPop.id = "cvnpop";
					
			var posx = 0;
			var posy = 0;
						
			//Set the exact coordinates.
			posx += findPosX (iconId);
			posy += findPosY (iconId);
			
			if (isNaN (posx)){
				posx = 0;
			}
			if (isNaN (posy)){
				posy = 0;
			}
			
			posy -= 95;
			posx += 190;
		
			newPop.style.left = posx + "px";
			newPop.style.top = posy + "px";
			
			newPop.style.width = "259px";
			newPop.style.height = "180px";
			newPop.style.borderWidth = "0px";
			
			// Update element's z-index.
			newZIndex = (dragObj.zIndex + 10);
			newPop.style.zIndex = ++newZIndex;
			
			newPop.innerHTML = "<img src=\"images/cvn_big.gif\" alt=\"\" title=\"\" style=\"border: none;\" />";
			
			//Append the div to the body.
			document.body.appendChild (newPop);
			
			//Fade it in.
			opacity('cvnpop', 0, 100, 500);
			
		}
	}
	
	//Function to reload the markets on the subscribe page.
	function reloadMarkets (packId,_type,obj){
			
		if (obj && packId == 0) {
			document.getElementById(obj).innerHTML = "N/A";
		} else if (packId != ""){
			var xmlhttp = getxmlhttp();
			//xmlhttp.open("GET", "subscribe/get_market_list.php?packid="+packId);
			if(_type == "update") {
				xmlhttp.open("GET", "subscribe/get_market_list.php?packid="+packId+"&update=true");
			} else if(_type == "newsignals") {
				xmlhttp.open("GET", "subscribe/get_market_list.php?packid="+packId+"&update=true&newsignals=true");
			} else if(_type == "pdf") {
				xmlhttp.open("GET", "subscribe/get_market_list.php?packid="+packId+"&pdf=true");
			} else {
				xmlhttp.open("GET", "subscribe/get_market_list.php?packid="+packId);
			}
			
			toLoad = document.getElementById("marketsel");
			if (_type == "newsignals" && !obj) {
				toLoad = document.getElementById("ClientToSignal");
			}
			if (obj) {
				toLoad = document.getElementById(obj);
			}
						
			xmlhttp.onreadystatechange = function() {
				if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
					if (toLoad){
						toLoad.innerHTML = xmlhttp.responseText;
						if (_type == "update") {
							_type = "newsignals";
							reloadMarkets (packId,_type);
						}
					}
					return true;
				}
			}
			xmlhttp.send(null);
		}
	}
	
	//Function to change out the chart area.
	function changeChart (toWhat, theUrl){
		var toHide = Array ("chart_forecast","load_flash","load_saxo");
		switch (toWhat){
			case (1):
				var curLoad = document.getElementById("chart_forecast");
				break;
			case (2):
				var curLoad = document.getElementById("load_flash");
				break;
			case (3):
				var curLoad = document.getElementById("load_saxo");
				break;
		}
		//First, hide everything.
		for (var i = 0; i < toHide.length; i++){
			var tempLoad = document.getElementById(toHide[i]);
			if (tempLoad){
				tempLoad.style.display = "none";
			}
		}
		if (curLoad){
			curLoad.style.display = "block";
		}
		/*
		if (toWhat == 2){
			curLoad.innerHTML = "<div style=\"text-align: center; margin-top: 10px; width: 775px;\"><img src=\"images/biggerspinner.gif\" alt=\"\" style=\"border: none;\" /><br />Loading...</div>";
			//Ajax in the url.
			var xmlhttp = getxmlhttp();
			xmlhttp.open("GET", theUrl);
			xmlhttp.onreadystatechange = function() {
				if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
					curLoad.innerHTML = xmlhttp.responseText;
					return true;
				}
			}
			xmlhttp.send(null);
		}
		*/
	}
	
	function changeChart__2 (theUrl){
		window.open(theUrl, "flashwindow", "navigation=no, toolbar=no, menubar=no, status=no, location=no, width=800, height=700");
	}
	
	//Function to filter the statistic results.
	function filterStatResults (digg){
		
		//Get the form.
		var theForm = document.getElementById("market_form");
		var idStr = "";
		if (theForm){
			//Go through all check boxes.
			for(var i = 0; i < theForm.elements.length; i++){
				if (theForm.elements[i].type == "checkbox"){
					//Find the id.
					if (theForm.elements[i].checked){
						curId = theForm.elements[i].name.substr (6,theForm.elements[i].name.length);
						idStr += curId + "-";
					}
				}
			}
			var tIdBox = document.getElementById("tid");
			if (tIdBox){
				var tid = tIdBox.value;
			}
			
			//Get all sorting options.
			var sortStr = "";
			var sortDateOpen = document.getElementById("sort_open");
			if (sortDateOpen){
				sortStr += "&sort_open="+sortDateOpen.value;
			}
			var sortDateClosed = document.getElementById("sort_closed");
			if (sortDateClosed){
				sortStr += "&sort_closed="+sortDateClosed.value;
			}
			var sortHorizon = document.getElementById("sort_horizon");
			if (sortHorizon){
				sortStr += "&sort_horizon="+sortHorizon.value;
			}
			var sortSource = document.getElementById("sort_source");
			if (sortSource){
				sortStr += "&sort_source="+sortSource.value;
			}
			
			//Fire two Ajax requests.
			var toLoad2 = document.getElementById("cur_stats");
			if (toLoad2){
				if (digg == "1"){
					toLoad2.innerHTML = "<div style=\"text-align: center; margin-top: 10px;\"><img src=\"../images/biggerspinner.gif\" alt=\"\" style=\"border: none;\" /><br />Loading...</div>";
				} else {
					toLoad2.innerHTML = "<div style=\"text-align: center; margin-top: 10px;\"><img src=\"images/biggerspinner.gif\" alt=\"\" style=\"border: none;\" /><br />Loading...</div>";
				}
				var xmlhttp2=false;
				/*@cc_on @*/
				/*@if (@_jscript_version >= 5)
				try {
					xmlhttp2 = new ActiveXObject("Msxml2.XMLHTTP");
				} catch (e) {
					try {
						xmlhttp2 = new ActiveXObject("Microsoft.XMLHTTP");
					} catch (E) {
						xmlhttp2 = false;
					}
				}
				@end @*/
			
				if (!xmlhttp2 && typeof XMLHttpRequest != 'undefined') {
					xmlhttp2 = new XMLHttpRequest();
				}
				var theLoc = "";
				if (digg == "1"){
					theLoc = "../clients/stats_top.php?perm_vals="+idStr+"&tid="+tid+sortStr;
				} else {
					theLoc = "clients/stats_top.php?perm_vals="+idStr+"&tid="+tid+sortStr;
				}
				xmlhttp2.open("GET", theLoc);
				xmlhttp2.onreadystatechange = function() {
					if (xmlhttp2.readyState == 4 && xmlhttp2.status == 200) {
						toLoad2.innerHTML = xmlhttp2.responseText;
						return true;
					}
				}
				xmlhttp2.send(null);
			}
			var toLoad = document.getElementById("main_disp");
			if (toLoad){
				if (digg == "1"){
					toLoad.innerHTML = "<div style=\"text-align: center; margin-top: 10px;\"><img src=\"../images/biggerspinner.gif\" alt=\"\" style=\"border: none;\" /><br />Loading...</div>";
				} else {
					toLoad.innerHTML = "<div style=\"text-align: center; margin-top: 10px;\"><img src=\"images/biggerspinner.gif\" alt=\"\" style=\"border: none;\" /><br />Loading...</div>";
				}
				var theLoc2 = "";
				if (digg == "1"){
					theLoc2 = "../clients/stats_main.php?perm_vals="+idStr+"&tid="+tid+sortStr;
				} else {
					theLoc2 = "clients/stats_main.php?perm_vals="+idStr+"&tid="+tid+sortStr;
				}
				var xmlhttp = getxmlhttp();
				xmlhttp.open("GET", theLoc2);
				xmlhttp.onreadystatechange = function() {
					if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
						toLoad.innerHTML = xmlhttp.responseText;
						return true;
					}
				}
				xmlhttp.send(null);
			}
		}
	}
	
	function setBackground(who,_className) {
		//alert(who.id + ", " + who.bgcolor);
		who.className = _className;
	}
	/*
	
	function checkboxOnBad(objNum,obj,name) {
	//if(resetCheckboxes()) {
		if(obj.src == "images/checkbox_on.gif") {
			obj.src="images/checkbox_off.gif";
			//document.supportitems[name + '_method'].value = "off";
		} else {
			obj.src="images/checkbox_on.gif";
			//document.supportitems[name + '_method'].value = "on";
		}
		setOption (objNum,obj,'<?=$markdata['marketid']?>','<?=$_GET['sid']?>','<?=$_GET['tid']?>','<?=$_GET['side']?>','<?=$_GET['hor']?>','<?=$_GET['src']?>','<?=$_GET['stat']?>','<?=$_GET['mes']?>');
		//document.supportitems['method'].value = name;
	//}
	}
	
	
	function checkboxOn(objNum,obj,name) {
		if(obj.src == "images/checkbox_on.gif") {
			obj.src="images/checkbox_off.gif";
		} else {
			obj.src="images/checkbox_on.gif";
		}
		//alert("done");
		setOption (objNum,obj,'<?=$markdata['marketid']?>','<?=$_GET['sid']?>','<?=$_GET['tid']?>','<?=$_GET['side']?>','<?=$_GET['hor']?>','<?=$_GET['src']?>','<?=$_GET['stat']?>','<?=$_GET['mes']?>');
	}
	*/
	/*
	function resetCheckboxes() {
		document.getElementById('emailcheckbox').src="images/checkbox_off.gif";
		document.getElementById('yahoocheckbox').src="images/checkbox_off.gif";
		document.getElementById('smscheckbox').src="images/checkbox_off.gif";
		return true;
	}
	*/
