	var closeForm = "<a href=\"#\" onclick=\"$('.formContainer').fadeOut('fast'); return false;\"><img src=\"/images/button_close.gif\" border=\"0\" style=\"float: right; margin-top: -10px;\" /></a>";

	//	takes the query string from a url and puts the key/value pairs into an associative array 
	var getKeyValues = function(qStr) {
		var intLen = qStr.length;
		var queryStr = qStr.substr(qStr.search(/(\?)/)+1, intLen);
		var aryVals = queryStr.split("&");
		
		var aryK = new Array();
		for (var x=0; x<aryVals.length; x++) {
			kv = aryVals[x].split("=");
			aryK[kv[0]] = kv[1];
		}

		return aryK;
	}

	function randomString(string_length) {
		var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
		var randomstring = '';
		for (var i=0; i<string_length; i++) {
			var rnum = Math.floor(Math.random() * chars.length);
			randomstring += chars.substring(rnum,rnum+1);
		}
		return randomstring;
	}
	
	var loadForm = function(el) {
		var linkPos = el.position();
		var top = (linkPos.top) - 30;
//		var left = ($("body").outerWidth(true)-400)/2;
		var left = (linkPos.left) + 120;
		 //($("body").outerWidth(true)-400)/2;
			
		if (el.attr("class").match("admin") != null) {
			var aryKey = getKeyValues(el.attr("href"));				// get the href, break up the query string into a key/value array
			$(".formContainer").html(closeForm + adminForm).attr("style", "top:" + top + "px; left: " + left + "px;").fadeIn('slow');	// closeForm var from cm_general.js
			getAdmin(aryKey["aid"]);
		}

		if (el.attr("class").match("frmQL") != null) {
			var aryKey = getKeyValues(el.attr("href"));				// get the href, break up the query string into a key/value array
			$(".formContainer").html(closeForm + quickLinkForm).attr("style", "top:" + top + "px; left: " + left + "px;").fadeIn('slow');	// closeForm var from cm_general.js
			getQL(aryKey["qlid"]);
		}
		
		if (el.attr("class").match("frmURL") != null) {
			var aryKey = getKeyValues(el.attr("href"));				// get the href, break up the query string into a key/value array
			$(".formContainer").html(closeForm + linkForm).attr("style", "top:" + top + "px; left: " + left + "px;").fadeIn('slow');	// closeForm var from cm_general.js
			getLink(aryKey["index"]);
		}
	}

	
	$(document).ready(function() {
		watermark();
	});

		
	var watermark = function() {
		$(".wmrk").each(function(i) {
			var beginStyle = $(this).attr("style");
			if ($(this).val() == "")
				$(this).attr("style", "color: #bbb;" + beginStyle).val($(this).attr("title"));
			
			$(this).bind("focus", function(e) {
				if ($(this).val() == $(this).attr("title")) {
					$(this).val("");
					$(this).attr("style", beginStyle);
				}
			});
			$(this).bind("blur", function(e) {
				if ($(this).val() == "") {
					$(this).attr("style", "color: #bbb;" + beginStyle).val($(this).attr("title"));
				}
			});
		});
	}
