/************************************************************************************************
*																								*
*	standard/js/standard_general.js																*
*	07/07/04 - CM																				*
*	Contains inits for sitewide JS and standard functions used 									*
*																								*
*																								*
*************************************************************************************************/

// ********** Sets up globals

var day_string = new Array();
day_string[0] = "Sunday";
day_string[1] = "Monday";
day_string[2] = "Tuesday";
day_string[3] = "Wednesday";
day_string[4] = "Thursday";
day_string[5] = "Friday";
day_string[6] = "Saturday";

var month_string = new Array();
month_string[0] = "January";
month_string[1] = "February";
month_string[2] = "March";
month_string[3] = "April";
month_string[4] = "May";
month_string[5] = "June";
month_string[6] = "July";
month_string[7] = "August";
month_string[8] = "September";
month_string[9] = "October";
month_string[10] = "November";
month_string[11] = "December";

var month_short_string = new Array();
month_short_string[0] = "Jan";
month_short_string[1] = "Feb";
month_short_string[2] = "Mar";
month_short_string[3] = "Apr";
month_short_string[4] = "May";
month_short_string[5] = "Jun";
month_short_string[6] = "Jul";
month_short_string[7] = "Aug";
month_short_string[8] = "Sep";
month_short_string[9] = "Oct";
month_short_string[10] = "Nov";
month_short_string[11] = "Dec";

// Get useragent var and init browser_type var for detecting browser
var userAgent = navigator.userAgent.toLowerCase();
var browser_type = "";
var browser_ver = "";
var browser_minver = "0";

var browser_regexp = (window.RegExp) ? true : false; // Check for RegExp compatibility
var browser_dom = ""; // Check for DOM support
var dom_objects = new Array(); // Setup array for cached objects called by get_object

// ********** Get the browser currently being used
if(userAgent.indexOf('opera') != -1) {
	browser_type = "opera"; // Check for Opera
	if(userAgent.indexOf("6.") != -1) browser_ver = "6"; // Check for Opera 6
	if(userAgent.indexOf("opera 7.") != -1) {
		var s = userAgent.substr(userAgent.indexOf("opera 7."));
		s = s.substr(userAgent.indexOf(".")-1, 2);
		browser_ver = "7"; // Check for Opera 7
		browser_minver = s;
		if(browser_minver.length==1) browser_minver=browser_minver+"0";
	}
	if(userAgent.indexOf("opera 8.") != -1) browser_ver = "8"; // Check for Opera 8
} else if((userAgent.indexOf('safari') != -1) || (navigator.vendor == "Apple Computer, Inc.")) {
	browser_type = "saf"; // Check for Safari
	var s = userAgent.substr(userAgent.indexOf("safari"));
	s = s.substr(userAgent.indexOf("/")-1);
	var l = s.indexOf(" ");
	s = s.substr(0, l);
	browser_minver = -(-s)+0;
	browser_ver = (browser_minver<412) ? "1" : "2";

} else if(userAgent.indexOf('webtv') != -1) {
	browser_type = "webtv"; // Check for WebTV
} else if(userAgent.indexOf('konqueror') != -1) {
	browser_type = "kon"; // Check for Konqueror
}

if((userAgent.indexOf('msie') != -1) && browser_type!="opera" && browser_type!="saf" && browser_type!="webtv") {
	browser_type = "ie"; // Check for IE
	if(userAgent.indexOf("msie 4.") != -1) browser_ver = "4"; // Check for IE 4
	if(userAgent.indexOf("msie 5.") != -1) browser_ver = "5"; // Check for IE 5
	if(userAgent.indexOf("msie 5.5") != -1) browser_ver = "5.5"; // Check for IE 5.5
	if(userAgent.indexOf("msie 6") != -1) browser_ver = "6"; // Check for IE 6
	if(userAgent.indexOf("msie 7") != -1) browser_ver = "7"; // Check for IE 6
} else if((navigator.product == 'Gecko') && (browser_type!="saf")) {
	browser_type = "moz"; // Check for Mozilla
} else if((userAgent.indexOf('compatible') == -1) && (userAgent.indexOf('mozilla') != -1)
			&& browser_type!="opera" && browser_type!="webtv" && browser_type!="saf") {
	browser_type = "ns"; // Check for Netscape
}
if((browser_type=="ns") && (parseInt(navigator.appVersion) == 4)) browser_ver = "4"; // Check for Netscape 4

// ********** Get the support for getting objects
// Note that we're not using the browser type in case the useragent string is not accurate
if (document.getElementById) {
	browser_dom = "std";
} else if (document.all) {
	browser_dom = "ie4";
} else if (document.layers) {
	browser_dom = "ns4";
}

//alert(browser_type+" "+browser_ver);

// ********** Abstract function for getting objects
// 	id 				: id of object
//	refresh_cache 	: force the object to be fetched (optional)
function get_object(id, refresh_cache) {
	if (refresh_cache || typeof(dom_objects[id])=="undefined") {
		switch (browser_dom) {
			case "std":
				dom_objects[id] = document.getElementById(id);
				break;

			case "ie4":
				dom_objects[id] = document.all[id];
				break;

			case "ns4":
				dom_objects[id] = document.layers[id];
				break;
		}
	}
	return dom_objects[id];
}

scrOfX = 0;
last = false;
function get_x_scroll(last) {
    var x = 0, y = 0;
	// Actually trying to do browser detection seems to break IE... surprise surprise. IE7, FF2 and Opera work with this.
	// Others will simply see the picture cut off and will need to scroll themselves.
//	if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
		// IE6 standards compliant mode
  		if (document.documentElement.scrollLeft==0 && last==false){
			x = document.documentElement.scrollLeft+1;
		} else {
			x = document.documentElement.scrollLeft;
		}
//    } else if( typeof( window.pageYOffset ) == 'number' ) {
        // Netscape
//        x = window.pageXOffset;
//    } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
        // DOM
//        x = document.body.scrollLeft;
//    }
	return x;
}

// ********** Scroll all the way horizontally
	lastscroll = -1;
	thisscroll = 0;
	thetimer = null;
function horiz_full_scroll(direction) {
		if(thetimer) clearTimeout(thetimer);
		if(direction==undefined) direction=1;
		if (direction==1){
			if (thisscroll > lastscroll){
				lastscroll = get_x_scroll(true);
				window.scrollBy(10,0);
				thisscroll = get_x_scroll(false);

				//alert(thisscroll+" "+lastscroll);
				thetimer = setTimeout('horiz_full_scroll('+direction+')', 20);
			} else {
				if (thisscroll==lastscroll) {
					lastscroll = -1;
					thisscroll = get_x_scroll(false);
				}
			}
		} else {
			if (lastscroll == -1) lastscroll = thisscroll+1;
			if (thisscroll < lastscroll){
				lastscroll = get_x_scroll();
				window.scrollBy(-10,0);
				thisscroll = get_x_scroll();
				//alert(thisscroll+" "+lastscroll);
				thetimer = setTimeout('horiz_full_scroll('+direction+')', 20);
			} else {
				if (thisscroll==lastscroll) {
					lastscroll = -1;
					thisscroll = get_x_scroll();
				}
			}
		}
}
lastscroll = 0;
thisscroll = 1;
function scrollit() {
	if (thisscroll > lastscroll){
		lastscroll = document.documentElement.scrollLeft;
		window.scrollBy(5,0);
		if (document.documentElement.scrollLeft==0){
			thisscroll = document.documentElement.scrollLeft+1;
		} else {
			thisscroll = document.documentElement.scrollLeft;
		}
		setTimeout('scrollit()', 25);
	} else {
		//alert('done!');
		lastscroll = 0;
		thisscroll = 1;
	}
}

// Creates and returns DOM objects (elements) and will append a text node automatically if the 3rd argument is supplied
function object_add(tag_name, attribute_array, text_node) {
	var obj_element = document.createElement(tag_name);
	var obj_attribute;
	if(attribute_array!=null) {
		for(attr in attribute_array) {
			obj_attribute = document.createAttribute(attr);
			obj_attribute.nodeValue=attribute_array[attr];
			obj_element.setAttributeNode(obj_attribute);
		}
	}
	if(text_node!=null) {
		var text_value = document.createTextNode(text_node);
		obj_element.appendChild(text_value);
	}
	return obj_element;
}


function url_encode(s) {
	if(browser_ver==5 && browser_type=="ie") {
		return escape(s);
	} else {
		return encodeURI(s);
	}
}

function ajax_factory() {
	var ajax=false;
	/*@cc_on @*/
	/*@if (@_jscript_version >= 5)
	// JScript gives us Conditional compilation, we can cope with old IE versions.
	// and security blocked creation of the objects.
	 try {
	  ajax = new ActiveXObject("Msxml2.XMLHTTP");
	 } catch (e) {
	  try {
	   ajax = new ActiveXObject("Microsoft.XMLHTTP");
	  } catch (E) {
	   ajax = false;
	  }
	 }
	@end @*/
	if (!ajax && typeof XMLHttpRequest!='undefined') {
	  ajax = new XMLHttpRequest();
	}
	return ajax;
}

function pad(topad, maxchars, padchar) {
	var m = maxchars-topad.length;

	for(var i=0;i<m;i++) {
		topad=padchar+topad;
	}

	return topad;

}

function select_text(obj, chr_start, chr_length, str_replace) {
	if(browser_type=="ie") {
		var r = obj.createTextRange();
		r.move("textedit",-1);
		r.move("character", chr_start);
		r.moveEnd("character", chr_length);
		r.select();
		if(str_replace) r.text=str_replace;
	} else {
		var r = document.createRange();
		obj.setSelectionRange(chr_start, chr_start+chr_length)
		if(str_replace) {
			var iStart = obj.selectionStart;
			obj.value = obj.value.substring(0, iStart) + str_replace + obj.value.substring(obj.selectionEnd, obj.value.length);
			obj.setSelectionRange(iStart + str_replace.length, iStart + str_replace.length);
		}
	}
	obj.focus();
}

function set_cursor_position(elem, caretPos) {
    if(elem != null) {
        if(elem.createTextRange) {
            var range = elem.createTextRange();
            range.move('character', caretPos);
            range.select();
        }
        else {
            if(elem.selectionStart) {
                elem.focus();
                elem.setSelectionRange(caretPos, caretPos);
            }
            else
                elem.focus();
        }
    }
}

function get_cursor_pos(textElement) {
	var textarea = textElement;
	textarea.focus();
	var returnValue = null;
	// get selection in firefox, opera
	if (typeof(textarea.selectionStart) == 'number') {
		returnValue = textarea.selectionStart;
	} else if(document.selection) {
		var selection_range = document.selection.createRange().duplicate();
		if (selection_range.parentElement() == textarea) { // Check that the selection is actually in our textarea
			// Create three ranges, one containing all the text before the selection,
			// one containing all the text in the selection (this already exists), and one containing all
			// the text after the selection.
			var before_range = document.body.createTextRange();
			before_range.moveToElementText(textarea); // Selects all the text
			before_range.setEndPoint("EndToStart", selection_range); // Moves the end where we need it

			var after_range = document.body.createTextRange();
			after_range.moveToElementText(textarea); // Selects all the text
			after_range.setEndPoint("StartToEnd", selection_range); // Moves the start where we need it

			var before_finished = false, selection_finished = false, after_finished = false;
			var before_text, untrimmed_before_text, selection_text, untrimmed_selection_text, after_text, untrimmed_after_text;

			// Load the text values we need to compare
			before_text = untrimmed_before_text = before_range.text;
			selection_text = untrimmed_selection_text = selection_range.text;
			after_text = untrimmed_after_text = after_range.text;

			// Check each range for trimmed newlines by shrinking the range by 1 character and seeing
			// if the text property has changed. If it has not changed then we know that IE has trimmed
			// a \r\n from the end.
			do {
				if (!before_finished) {
					if (before_range.compareEndPoints("StartToEnd", before_range) == 0) {
						before_finished = true;
					} else {
						before_range.moveEnd("character", -1)
						if (before_range.text == before_text) {
							untrimmed_before_text += "\r\n";
						} else {
							before_finished = true;
						}
					}
				}
				if (!selection_finished) {
					if (selection_range.compareEndPoints("StartToEnd", selection_range) == 0) {
						selection_finished = true;
					} else {
						selection_range.moveEnd("character", -1)
						if (selection_range.text == selection_text) {
							untrimmed_selection_text += "\r\n";
						} else {
							selection_finished = true;
						}
					}
				}
				
				if (!after_finished) {
					if (after_range.compareEndPoints("StartToEnd", after_range) == 0) {
						after_finished = true;
					} else {
						after_range.moveEnd("character", -1)
						if (after_range.text == after_text) {
							untrimmed_after_text += "\r\n";
						} else {
							after_finished = true;
						}
					}
				}

			} while ((!before_finished || !selection_finished || !after_finished));

			// Untrimmed success test to make sure our results match what is actually in the textarea
			// This can be removed once you're confident it's working correctly
			var untrimmed_text = untrimmed_before_text + untrimmed_selection_text + untrimmed_after_text;
			var untrimmed_successful = false;
			if (textarea.value == untrimmed_text) {
				untrimmed_successful = true;
			}
			// ** END Untrimmed success test

			var startPoint = untrimmed_before_text.length;
			returnValue = startPoint;

		}
	}
	return returnValue;
}



function open_float_win(url, width, height, windowname, dont_reload, force_scroll) {
	var dimensions = "";
	var float_win = get_object('float_win');
	if(float_win) {
		var float_title = get_object('float_title');
		var float_page = get_object('float_page');
		float_win.style.display="block";
		//alert ('!!');
		float_page.src=url;
		float_page.style.width=float_win.style.width;
	}
}



function findPosX(obj) {
	var curleft = 0;
	if (obj && obj.offsetParent) {
		while (obj.offsetParent) {
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	} else if (obj && obj.x)
		curleft += obj.x;
	return curleft;
}

function findPosY(obj) {
	var curtop = 0;
	if (obj && obj.offsetParent) {
		while (obj.offsetParent) {
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	} else if (obj && obj.y)
		curtop += obj.y;
	return curtop;
}

var win_state = new Array();
var win_timer = new Array();
var interval = 1;
var win_y_first = 0;
var win_x_first = 0;
var posx = 0;
var posy = 0;


function win_move_mode(obj_id, mode) {
	win_state[obj_id]=mode;
	var obj = get_object(obj_id);
	if(mode=="on") {
		win_x_pos = findPosX(obj);
		win_y_pos = findPosY(obj);
		win_x_first = posx;
		win_y_first = posy;
	}
}

function get_mouse_pos(e) {
	if (!e) {
		var e = window.event;
//		alert("hello");
	}
	if (e.pageX || e.pageY)	{
		posx = e.pageX;
		posy = e.pageY;
	} else if (e.clientX || e.clientY)	{
		posx = e.clientX + document.body.scrollLeft;
		posy = e.clientY + document.body.scrollTop;
	}
	e.cancelBubble = false;
}


function win_move(obj_id) {
	if(win_state[obj_id]=="on") {
		var obj = get_object(obj_id);
		//alert((findPosX(obj)+(window.screenX-win_x_first)));
		if(browser_type=="ie") document.selection.clear();
		obj.style.left = win_x_pos - (win_x_first-posx)+"px";
		obj.style.top = win_y_pos - (win_y_first-posy)+"px";
	}
}





function do_event(eventobj) {
	if (!eventobj || browser_type=="ie") {
		window.event.returnValue = false;
		window.event.cancelBubble = true;
		return window.event;
	} else {
		eventobj.stopPropagation();
		eventobj.preventDefault();
		return eventobj;
	}
}

function open_win(url, width, height, windowname, dont_reload, force_scroll) {
	var dimensions = "";
	(width) ? dimensions += ",width=" + width : dimensions += ",width=900";
	(height) ? dimensions += ",height=" + height : dimensions += ",height=700" ;
	(windowname) ? win = windowname : win = "popup_"+(Math.round(Math.random()*1000));
	dont_reload = (dont_reload==true);
	x = window.open('', win, "statusbar=yes,menubar=no,toolbar=no,scrollbars="+((force_scroll==true) ? "yes" : "auto")+",resizable=yes" + dimensions);

	if(x) {
		if((dont_reload==true && x.location!=url) || dont_reload==false) x = window.open(url, win);
		x.focus();
		return x;
	}

}
var dyn_box_list=new Array();


function dyn_dropdown_toggle(id) {
	var dyn_dropdown_box = get_object(id+"_box");
	var dyn_dropdown_display = get_object(id+"_display");
	var display_x = findPosX(dyn_dropdown_display);
	var display_y = findPosY(dyn_dropdown_display);

	dyn_dropdown_box.style.top=(dyn_dropdown_display.offsetHeight+display_y)+"px";
	dyn_dropdown_box.style.left=display_x+"px";
	//$(dyn_dropdown_box).toggle('blind',200).css({opacity:0.9});
	$(dyn_dropdown_box).show().css({opacity:0.9});
	dyn_box_list[id]=(dyn_dropdown_box.style.display=="block");
}

function dyn_dropdown_closeall() {
	var x;
	for(x in dyn_box_list) {
		dyn_dropdown_close(x);
	}
}

function nl2br(text){
	text = escape(text);
	if(text.indexOf('%0D%0A') > -1){
		re_nlchar = /%0D%0A/g ;
	} else if(text.indexOf('%0A') > -1){
		re_nlchar = /%0A/g ;
	} else if(text.indexOf('%0D') > -1){
		re_nlchar = /%0D/g ;
	} else {
		return unescape(text);
	}
	return unescape( text.replace(re_nlchar,'<br />\n') );
}

function dyn_dropdown_select(id, value) {
	var dyn_dropdown_box = get_object(id+"_box");
	var dyn_dropdown_display = get_object(id+"_display");
	var dyn_dropdown_value = get_object(id);
	var dyn_dropdown_item = get_object(id+"_"+value+"_item");

	dyn_dropdown_value.value=value;
	dyn_dropdown_close(id);

	dyn_dropdown_display.childNodes[0].data=dyn_dropdown_item.childNodes[0].data;

}

function dyn_dropdown_close(id) {
	var dyn_dropdown_box = get_object(id+"_box");
	dyn_dropdown_box.style.display="none";
	dyn_box_list[id]=false;
}

function set_cookie(name, value, expires, path, domain, secure) {
	var cur_cookie = name + "=" + escape(value) +
		((expires) ? "; expires=" + expires.toGMTString() : "") +
		((path) ? "; path=" + path : "") +
		((domain) ? "; domain=" + domain : "") +
		((secure) ? "; secure" : "");
	document.cookie = cur_cookie;
}


function get_cookie(name) {
	var dc = document.cookie;
	var prefix = name + "=";
	var begin = dc.indexOf("; " + prefix);
	if (begin == -1) {
		begin = dc.indexOf(prefix);
		if (begin != 0) return null;
	} else {
		begin += 2;
	}
	var end = document.cookie.indexOf(";", begin);
	if (end == -1) end = dc.length;

	return unescape(dc.substring(begin + prefix.length, end));
}


function delete_cookie(name, path, domain) {
	if (get_cookie(name)) {
		document.cookie = name + "=" +
		((path) ? "; path=" + path : "") +
		((domain) ? "; domain=" + domain : "") + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
	}
}



function frame_breakout() {
	if (window.top.location != document.location) {
		//var answer = confirm("We recommend this site is not run from within another site (e.g. Hotmail). Run site in complete window?");

			window.top.location.href = document.location.href;

	}
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
	if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}


function isFunction(a) {
    return typeof a == 'function';
}

function isNumber(a) {
    return typeof a == 'number' && isFinite(a);
}

function isObject(a) {
    return (a && typeof a == 'object') || isFunction(a);
}

function isUndefined(a) {
    return typeof a == 'undefined';
}

function copyText(theSel) {
	prompt("Press Ctrl+C to copy to Clipboard", theSel);
   	return;
}

/* IEPrompt to make a prompt box to avoid IE security */
///////////////////////////////////////////////////////////
// Usage IEprompt("dialog descriptive text", "default starting value");
//
// IEprompt will call promptCallback(val)
// Where val is the user's input or null if the dialog was canceled.
///////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////
// This source code has been released into the public domain
// January 14th, 2007.
// You may use it and modify it freely without compensation
// and without the need to tell everyone where you got it.
///////////////////////////////////////////////////////////


///////////////////////////////////////////////////////////
// You must create a promptCallback(val) function to handle
// the user input.  If you don't this script will fail and
// Bunnies will die.
///////////////////////////////////////////////////////////


///////////////////////////////////////////////////////////
// These are global scope variables, they should remain global.
///////////////////////////////////////////////////////////
var _dialogPromptID=null;
var _blackoutPromptID=null;
///////////////////////////////////////////////////////////

function IEprompt(innertxt,def,callbackfunc) {

   that=this;

   // Check to see if this is MSIE 7.   This isn't a great general purpose
   // detection system but it works well enough just to find MSIE 7.
   var _isIE7=(navigator.userAgent.indexOf('MSIE 7')>0);

   this.wrapupPrompt = function (cancled) {
      // wrapupPrompt is called when the user enters or cancels the box.
      // It's called only by the IE7 dialog box, not the non IE prompt box
      if (_isIE7) {
         // Make sure we're in IE7 mode and get the text box value
         val=document.getElementById('iepromptfield').value;
         // clear out the dialog box
         _dialogPromptID.style.display='none';
         // clear out the screen
         _blackoutPromptID.style.display='none';
         // clear out the text field
         document.getElementById('iepromptfield').value = '';
         // if the cancel button was pushed, force value to null.
         if (cancled)
         	 val = '';
         else
       	 // call the user's function
         	 eval(callbackfunc);



      }
      return false;
   }

   //if def wasn't actually passed, initialize it to null
   if (def==undefined) { def=''; }

   if (_isIE7) {
      // If this is MSIE 7.0 then...
      if (_dialogPromptID==null) {
         // Check to see if we've created the dialog divisions.
         // This block sets up the divisons
         // Get the body tag in the dom
         var tbody = document.getElementsByTagName("body")[0];
         // create a new division
         tnode = document.createElement('div');
         // name it
         tnode.id='IEPromptBox';
         // attach the new division to the body tag
         tbody.appendChild(tnode);
         // and save the element reference in a global variable
         _dialogPromptID=document.getElementById('IEPromptBox');
         // Create a new division (blackout)
         tnode = document.createElement('div');
         // name it.
         tnode.id='promptBlackout';
         // attach it to body.
         tbody.appendChild(tnode);
         // And get the element reference
         _blackoutPromptID=document.getElementById('promptBlackout');
         // assign the styles to the blackout division.
         _blackoutPromptID.style.opacity='.9';
         _blackoutPromptID.style.position='absolute';
         _blackoutPromptID.style.top='0px';
         _blackoutPromptID.style.left='0px';
         _blackoutPromptID.style.backgroundColor='#555555';
         _blackoutPromptID.style.filter='alpha(opacity=90)';
         _blackoutPromptID.style.height=(document.body.offsetHeight<screen.height) ? screen.height+'px' : document.body.offsetHeight+20+'px';
         _blackoutPromptID.style.display='block';
         _blackoutPromptID.style.zIndex='50';
         // assign the styles to the dialog box
         _dialogPromptID.style.border='1px solid #003399';
         _dialogPromptID.style.backgroundColor='#DDDDDD';
         _dialogPromptID.style.position='absolute';
         _dialogPromptID.style.width='330px';
         _dialogPromptID.style.zIndex='100';
      }
      // This is the HTML which makes up the dialog box, it will be inserted into
      // innerHTML later. We insert into a temporary variable because
      // it's very, very slow doing multiple innerHTML injections, it's much
      // more efficient to use a variable and then do one LARGE injection.
      var tmp = '<div style="background-color: #99BBFF; color: #000; font-family: verdana; font-size: 10pt; font-weight: bold; height: 18px; padding:4px; border-bottom:1px solid #003399">Input Required</div>';
      tmp += '<div style="padding: 10px">'+innertxt + '<BR><BR>';
      tmp += '<form action="" onsubmit="return that.wrapupPrompt()">';
      tmp += '<input id="iepromptfield" name="iepromptdata" type=text size=46 value="'+def+'">';
      tmp += '<br><br><center>';
      tmp += '<input type="submit" value="&nbsp;&nbsp;&nbsp;OK&nbsp;&nbsp;&nbsp;">';
      tmp += '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
      tmp += '<input type="button" onclick="that.wrapupPrompt(true)" value="&nbsp;Cancel&nbsp;">';
      tmp += '</form></div>';
      // Stretch the blackout division to fill the entire document
      // and make it visible.  Because it has a high z-index it should
      // make all other elements on the page unclickable.
      _blackoutPromptID.style.height=(document.body.offsetHeight<screen.height) ? screen.height+'px' : document.body.offsetHeight+20+'px';
      _blackoutPromptID.style.width='100%';
      _blackoutPromptID.style.display='block';
      // Insert the tmp HTML string into the dialog box.
      // Then position the dialog box on the screen and make it visible.
      _dialogPromptID.innerHTML=tmp;
      _dialogPromptID.style.top=parseInt(document.documentElement.scrollTop+(screen.height/3))+'px';
      _dialogPromptID.style.left=parseInt((document.body.offsetWidth-315)/2)+'px';
      _dialogPromptID.style.display='block';
      // Give the dialog box's input field the focus.
      document.getElementById('iepromptfield').focus();
   } else {
      // we are not using IE7 so do things "normally"
      val = prompt(innertxt,def);
      eval(callbackfunc);
   }
}
    function showTooltip(x, y, contents) {
    	if(!get_object("tooltip", true)) {
        $('<div id="tooltip">' + contents + '</div>').css( {
            position: 'absolute',
            display: 'none',
            top: y + 5,
            left: x + 5,
            border: '1px solid #fdd',
            padding: '2px',
            'background-color': '#fee',
            opacity: 0.80
        }).appendTo("body").fadeIn(200);
		}
    }

function toggle_screen(state, show_loading) {
    return;
    /*
	if(state) {
		$.dimScreen(150, 0.4);
		if(show_loading)
			$("#__dimScreen").html('<img src="/images/loading.gif" alt="Loading..." id="__dimLoading" />');
	} else {
		$.dimScreenStop();
	} */
}

/* CC needed for validation purposes - source http://cass-hacks.com/articles/code/js_url_encode_decode/ */
function URLEncode (clearString) {
  var output = '';
  var x = 0;
  clearString = clearString.toString();
  var regex = /(^[a-zA-Z0-9_.]*)/;
  while (x < clearString.length) {
    var match = regex.exec(clearString.substr(x));
    if (match != null && match.length > 1 && match[1] != '') {
    	output += match[1];
      x += match[1].length;
    } else {
      if (clearString[x] == ' ')
        output += '+';
      else {
        var charCode = clearString.charCodeAt(x);
        var hexVal = charCode.toString(16);
        output += '%' + ( hexVal.length < 2 ? '0' : '' ) + hexVal.toUpperCase();
      }
      x++;
    }
  }
  return output;
}

/* CC needed for validation purposes - source http://cass-hacks.com/articles/code/js_url_encode_decode/ */
function URLDecode (encodedString) {
  var output = encodedString;
  var binVal, thisString;
  var myregexp = /(%[^%]{2})/;
  while ((match = myregexp.exec(output)) != null
             && match.length > 1
             && match[1] != '') {
    binVal = parseInt(match[1].substr(1),16);
    thisString = String.fromCharCode(binVal);
    output = output.replace(match[1], thisString);
  }
  return output;
}

/* CC needed again for validation */
function php_urlencode( str ) {
    // http://kevin.vanzonneveld.net
    // +   original by: Philip Peterson
    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // *     example 1: urlencode('Kevin van Zonneveld!');
    // *     returns 1: 'Kevin+van+Zonneveld%21'

    var ret = str;

    ret = ret.toString();
    ret = encodeURIComponent(ret);
    ret = ret.replace(/%20/g, '+');

    return ret;
}

function php_urldecode( str ) {
    // http://kevin.vanzonneveld.net
    // +   original by: Philip Peterson
    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // *     example 1: urldecode('Kevin+van+Zonneveld%21');
    // *     returns 1: 'Kevin van Zonneveld!'

    var ret = str;

    ret = ret.replace(/\+/g, '%20');
    ret = decodeURIComponent(ret);
    ret = ret.toString();

    return ret;
}

function php_addslashes( str ) {
    // http://kevin.vanzonneveld.net
    // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: Ates Goral (http://magnetiq.com)
    // +   improved by: marrtins
    // +   improved by: Nate
    // +   improved by: Onno Marsman
    // *     example 1: addslashes("kevin's birthday");
    // *     returns 1: 'kevin\'s birthday'

    return (str+'').replace(/([\\"'])/g, "\\$1").replace(/\0/g, "\\0");
}

