// Determine browser.
var isMinNS4 = document.layers;
var ie=document.all&&navigator.userAgent.indexOf("Opera")==-1;
var dom=document.getElementById&&!ie&&navigator.userAgent.indexOf("Opera")==-1;


function Eval(STRING){eval(STRING);}
function strComp(STRING1,STRING2,COMPARE){if(IsNull(COMPARE)){COMPARE = 1;}if(CBool(COMPARE)){STRING1 = STRING1.toLowerCase();STRING2 = STRING2.toLowerCase();}if(STRING1==STRING2){return true;}else{return false;}}
function IsNull(ITEM){if(ITEM == null || ITEM == undefined){return true;}return false;}
function IsArray(MY_ARRAY){MY_ARRAY = MY_ARRAY.constructor.toString();if(InStr(MY_ARRAY,"Array") > 0){return true;}else{return false;}}
function CreateObject(STRING){var MY_OBJECT = new ActiveXObject(STRING);return MY_OBJECT;}
function FormatPercent(NUMBER,PLACES){NUMBER = NUMBER * 100;if(PLACES){NUMBER = Round(NUMBER,PLACES);}else{NUMBER = Round(NUMBER,2);NUMBER = FormatCurrency(NUMBER);}NUMBER += "%";return NUMBER;}
function PCase(STRING){var strReturn_Value = "";var iTemp = STRING.length;if(iTemp==0){return"";}var UcaseNext = false;strReturn_Value += STRING.charAt(0).toUpperCase();for(var iCounter=1;iCounter < iTemp;iCounter++){if(UcaseNext == true){strReturn_Value += STRING.charAt(iCounter).toUpperCase();}else{strReturn_Value += STRING.charAt(iCounter).toLowerCase();}var iChar = STRING.charCodeAt(iCounter);if(iChar == 32 || iChar == 45 || iChar == 46){UcaseNext = true;}else{UcaseNext = false;}if(iChar == 99 || iChar == 67){if(STRING.charCodeAt(iCounter-1)==77 || STRING.charCodeAt(iCounter-1)==109){UcaseNext = true;}}}return strReturn_Value;}
function Now(){var NOW = new Date().toString();var arrNOW = NOW.split("UTC");NOW = arrNOW[0];return NOW;}
function FormatCurrency(FIGURE){if(!FIGURE||FIGURE==""){return "0.00";}var strTemp = FIGURE.toString();while(strTemp.indexOf(",") > -1){strTemp = strTemp.replace(",","");}strTemp = parseFloat(strTemp);FIGURE = Round(FIGURE,2);FIGURE = FIGURE.toString();var Place = FIGURE.indexOf(".");if(Place >-1){if((FIGURE.length - Place) == 2){FIGURE += "0";}}else{FIGURE += ".00";}if(FIGURE=="0.00"){return"";}return FIGURE;}
function Round(NUMBER,PLACES){if(!IsNumeric(NUMBER)){return "0";}NUMBER = CStr(NUMBER);arrNUMBER = NUMBER.split(".");if(arrNUMBER.length==1){return NUMBER;}if(PLACES){NUMBER = Math.round(NUMBER*Math.pow(10,PLACES))/Math.pow(10,PLACES);}else{NUMBER = Math.round(NUMBER);}return NUMBER;}
function Join(ARRAY,DELIMITER){ARRAY = ARRAY.toString();if(DELIMITER){ARRAY = Replace(ARRAY,",",DELIMITER);}else{ARRAY = Replace(ARRAY,","," ");}return ARRAY;}
function GetDate(FORMAT){var m_TODAY = new Date();var m_Day = m_TODAY.getDate();var m_Month = (m_TODAY.getMonth()+1);var MY_DATE = m_Day + "/" + m_Month + "/" + m_TODAY.getYear();if(!FORMAT){FORMAT = "mm/dd/yyyy";MY_DATE = m_Month + "/" + m_Day + "/" + m_TODAY.getYear();}MY_DATE = FormatDate(MY_DATE,FORMAT);return MY_DATE;}
function FormatDate(DateToFormat,FormatAs){if(DateToFormat==""){return"";}if(!FormatAs){FormatAs="dd/mm/yyyy";}var strReturnDate;FormatAs = FormatAs.toLowerCase();DateToFormat = DateToFormat.toLowerCase();var arrDate;var arrMonths = new Array("January","February","March","April","May","June","July","August","September","October","November","December");var strMONTH;var Separator;while(DateToFormat.indexOf("st")>-1){DateToFormat = DateToFormat.replace("st","");}while(DateToFormat.indexOf("nd")>-1){DateToFormat = DateToFormat.replace("nd","");}while(DateToFormat.indexOf("rd")>-1){DateToFormat = DateToFormat.replace("rd","");}while(DateToFormat.indexOf("th")>-1){DateToFormat = DateToFormat.replace("th","");}if(DateToFormat.indexOf(".")>-1){Separator = ".";}if(DateToFormat.indexOf("-")>-1){Separator = "-";}if(DateToFormat.indexOf("/")>-1){Separator = "/";}if(DateToFormat.indexOf(" ")>-1){Separator = " ";}arrDate = DateToFormat.split(Separator);DateToFormat = "";for(var iSD = 0;iSD < arrDate.length;iSD++){if(arrDate[iSD]!=""){DateToFormat += arrDate[iSD] + Separator;}}DateToFormat = DateToFormat.substring(0,DateToFormat.length-1);arrDate = DateToFormat.split(Separator);if(arrDate.length < 3){return "";}var DAY = arrDate[0];var MONTH = arrDate[1];var YEAR = arrDate[2];if(parseFloat(arrDate[1]) > 12){DAY = arrDate[1];MONTH = arrDate[0];}if(parseFloat(DAY) && DAY.toString().length==4){YEAR = arrDate[0];DAY = arrDate[2];MONTH = arrDate[1];}for(var iSD = 0;iSD < arrMonths.length;iSD++){var ShortMonth = arrMonths[iSD].substring(0,3).toLowerCase();var MonthPosition = DateToFormat.indexOf(ShortMonth);if(MonthPosition > -1){MONTH = iSD + 1;if(MonthPosition == 0){DAY = arrDate[1];YEAR = arrDate[2];}break;}}var strTemp = YEAR.toString();if(strTemp.length==2){if(parseFloat(YEAR)>40){YEAR = "19" + YEAR;}else{YEAR = "20" + YEAR;}}if(parseInt(MONTH)< 10 && MONTH.toString().length < 2){MONTH = "0" + MONTH;}if(parseInt(DAY)< 10 && DAY.toString().length < 2){DAY = "0" + DAY;}switch (FormatAs){case "dd/mm/yyyy":return DAY + "/" + MONTH + "/" + YEAR;case "mm/dd/yyyy":return MONTH + "/" + DAY + "/" + YEAR;case "dd/mmm/yyyy":return DAY + " " + arrMonths[MONTH -1].substring(0,3) + " " + YEAR;case "mmm/dd/yyyy":return arrMonths[MONTH -1].substring(0,3) + " " + DAY + " " + YEAR;case "dd/mmmm/yyyy":return DAY + " " + arrMonths[MONTH -1] + " " + YEAR;case "mmmm/dd/yyyy":return arrMonths[MONTH -1] + " " + DAY + " " + YEAR;}return DAY + "/" + strMONTH + "/" + YEAR;;}function IsDate(DateToCheck){if(DateToCheck==""){return true;}var m_strDate = FormatDate(DateToCheck);if(m_strDate==""){return false;}var m_arrDate = m_strDate.split("/");var m_DAY = m_arrDate[0];var m_MONTH = m_arrDate[1];var m_YEAR = m_arrDate[2];if(m_YEAR.length > 4){return false;}m_strDate = m_MONTH + "/" + m_DAY + "/" + m_YEAR;var testDate=new Date(m_strDate);if(testDate.getMonth()+1==m_MONTH){return true;}else{return false;}}
function IsNumeric(VALUE){for(var ivA = 0; ivA < VALUE.length;ivA ++){if(VALUE.charCodeAt(ivA) < 48 || VALUE.charCodeAt(ivA) > 57){if(VALUE.charCodeAt(ivA) != 46 && VALUE.charCodeAt(ivA) != 32 && VALUE.charAt(ivA) != ","){return false;}}}return true;}
function Asc(CHARACTER){return CHARACTER.charCodeAt(0);}
function Chr(CHARACTER_CODE){return String.fromCharCode(CHARACTER_CODE);}
function CInt(NUMBER){return parseInt(NUMBER);}
function CStr(VALUE){return VALUE.toString();}
function CSng(NUMBER){return parseFloat(NUMBER);}
function CDbl(NUMBER){return parseFloat(NUMBER);}
function CBool(VALUE){VALUE = new String(VALUE);VALUE = VALUE.toLowerCase();if(VALUE== "1" || VALUE=="-1" || VALUE=="true" || VALUE == "yes"){return true;}else{return false;}}
function InStr(STRING,SUBSTRING,COMPARE,START){if(START){STRING = STRING.substring(START,STRING.length);}if(CBool(COMPARE) || COMPARE ==undefined){STRING = STRING.toLowerCase();SUBSTRING = SUBSTRING.toLowerCase();}if(STRING.indexOf(SUBSTRING) > -1){return STRING.indexOf(SUBSTRING)}else{return 0;}}
function LCase(STRING){return STRING.toLowerCase();}
function Left(STRING,CHARACTER_COUNT){return STRING.substring(0,CHARACTER_COUNT);}
function Right(STRING,CHARACTER_COUNT){return STRING.substring((STRING.length - CHARACTER_COUNT),STRING.length);}
function Len(STRING){return STRING.length;}
function Mid(STRING,START,END){if(!START){START=0};if(!END || END > STRING.length){END=STRING.length};if(END!=STRING.length){END = START + END};return STRING.substring(START,END);}
function Replace(STRING,REPLACE_THIS,REPLACE_WITH){while(STRING.indexOf(REPLACE_THIS) > -1){STRING = STRING.replace(REPLACE_THIS,REPLACE_WITH);}return STRING;}
function Split(STRING,CHARACTER){return STRING.split(CHARACTER);}
function Sqr(NUMBER){return NUMBER * NUMBER}
function Trim(STRING){STRING = LTrim(STRING);return RTrim(STRING);}
function RTrim(STRING){while(STRING.charAt((STRING.length -1))==" "){STRING = STRING.substring(0,STRING.length-1);}return STRING;}
function LTrim(STRING){while(STRING.charAt(0)==" "){STRING = STRING.replace(STRING.charAt(0),"");}return STRING;}
function UBound(ARRAY){if(IsArray(ARRAY)){return ARRAY.length;}else{return;}}
function UCase(STRING){return STRING.toUpperCase();}
function UNESCAPE(U_VALUE){U_VALUE = unescape(U_VALUE);while(U_VALUE.indexOf("+") > -1){U_VALUE = U_VALUE.replace("+", " ");}return U_VALUE;}
// Cookies
function getCookie(NameOfCookie){if(document.cookie.length > 0){begin = document.cookie.indexOf(NameOfCookie+"=");if (begin != -1){begin += NameOfCookie.length+1;end = document.cookie.indexOf(";", begin);if (end == -1) end = document.cookie.length;return unescape(document.cookie.substring(begin, end));}}return null;}
function setCookie(NameOfCookie, value, expiredays){var ExpireDate = new Date ();ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));document.cookie = NameOfCookie + "=" + escape(value) + ((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString());}
function delCookie (NameOfCookie){if (getCookie(NameOfCookie)){document.cookie = NameOfCookie + "=" + "; expires=Thu, 01-Jan-70 00:00:01 GMT";}}

/* 
XHConn - Simple XMLHTTP Interface - bfults@gmail.com - 2005-04-08
Code licensed under Creative Commons Attribution-ShareAlike License
http://creativecommons.org/licenses/by-sa/2.0/
*/
function XHConn(){var xmlhttp, bComplete = false;try{xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); }catch(e){try{ xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); }catch(e){ try { xmlhttp = new XMLHttpRequest();}catch (e){xmlhttp = false;}}}if(!xmlhttp)return null;this.connect = function(sURL, sMethod, sVars, fnDone){if (!xmlhttp) return false;bComplete = false; sMethod = sMethod.toUpperCase();try{if(sMethod == "GET"){xmlhttp.open(sMethod, sURL+"?"+sVars, true);sVars = "";}else{xmlhttp.open(sMethod, sURL, true);xmlhttp.setRequestHeader("Method", "POST "+sURL+" HTTP/1.1");xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");}xmlhttp.onreadystatechange = function(){if (xmlhttp.readyState == 4 && !bComplete){bComplete = true;fnDone(xmlhttp);}};xmlhttp.send(sVars);}catch(z){return false;}return true;};return this;}
/*
Usage: (assuming you already have XHConn.js included in your HTML file)
var myConn = new XHConn();
if (!myConn) alert("XMLHTTP not available. Try a newer/better browser.");
var fnWhenDone = function (oXML) { alert(oXML.responseText); };
myConn.connect("mypage.php", "POST", "foo=bar&baz=qux", fnWhenDone);
*/
/*
Copyright 1999 by Mike Hall.
Visit http://www.dynamicdrive.com for full script
Last update: July 21st, '02 by Dynamic Drive for NS6 functionality. 
Provides basic functions for DHTML positioned elements which will work on 
both Netscape Communicator and Internet Explorer browsers (version 4.0 and  up).
*/
// Layer visibility.
function toggleLayer(layer){if(getVisibility(layer)=='hidden'){showLayer(layer);}else{hideLayer(layer);}}
function hideLayer(layer){if (isMinNS4){layer.visibility = "hide";}if (ie||dom){layer.style.visibility = "hidden";}}
function showLayer(layer){if(isMinNS4){layer.visibility = "show";}if (ie||dom){layer.style.visibility = "visible";}}
function inheritLayer(layer){if(isMinNS4){layer.visibility = "inherit";}if (ie||dom){layer.style.visibility = "inherit";}}
function getVisibility(layer){if(isMinNS4) {if (layer.visibility == "show"){return "visible";}if (layer.visibility == "hide"){return "hidden";}return layer.visibility;}if (ie||dom){return layer.style.visibility;}return "";}
function isVisible(layer){if(isMinNS4 && layer.visibility == "show"){return(true);}if (ie||dom && layer.style.visibility == "visible"){return(true);}return(false);}

function toggleDisplayLayer(layer){
if(isMinNS4){
layer.display = (layer.display != "none")? "none" : "";
}
if (ie||dom){
layer.style.display = (layer.style.display != "none")? "none" : "";
}
}
// Layer positioning.
function moveLayerTo(layer, x, y){if(isMinNS4){layer.moveTo(x, y);}if(ie||dom){layer.style.left = x;layer.style.top  = y;}}
function moveLayerBy(layer, dx, dy){if(isMinNS4){layer.moveBy(dx, dy);}if (ie||dom) {layer.style.left= parseInt(layer.style.left)+dx;layer.style.top= parseInt(layer.style.top)+dy;}}
function getLeft(layer){if(isMinNS4){return(layer.left);}if (ie||dom){return(parseInt(layer.style.left));}return(-1);}
function getTop(layer){if (isMinNS4){return(layer.top);}if (ie||dom){return(parseInt(layer.style.top));}return(-1);}
function getRight(layer){if (isMinNS4){return(layer.left + getWidth(layer));}if (ie||dom){return(parseInt(layer.style.left) + getWidth(layer));}return(-1);}
function getBottom(layer) {if (isMinNS4){return(layer.top + getHeight(layer));}else if (ie||dom){return(parseInt(layer.style.top) + getHeight(layer));}  return(-1);}
function getPageLeft(layer){if (isMinNS4){return(layer.pageX);}if (ie||dom){return(layer.offsetLeft);}return(-1);}
function getPageTop(layer){if(isMinNS4){return(layer.pageY);}if(ie||dom){return(layer.offsetTop);}return(-1);}
function getWidth(layer){if(isMinNS4){if(layer.document.width){return(layer.document.width);}else{return(layer.clip.right - layer.clip.left);}}if (ie||dom){if (layer.style.width){return(layer.style.width);}else{return(layer.offsetWidth);}}return(-1);}
function getHeight(layer){if (isMinNS4){if (layer.document.height){return(layer.document.height);}else{return(layer.clip.bottom - layer.clip.top);}}if (ie||dom) {if (false && layer.style.height){return(layer.style.height);}else{return(layer.offsetHeight);}}return(-1);}
function getzIndex(layer){if(isMinNS4){return(layer.zIndex);}if (ie||dom){return(layer.style.zIndex);}return(-1);}
function setzIndex(layer, z){if (isMinNS4){layer.zIndex = z;}if (ie||dom){layer.style.zIndex = z;}}
// Layer clipping.
function clipLayer(layer, clipleft, cliptop, clipright, clipbottom) {if (isMinNS4) {layer.clip.left = clipleft;layer.clip.top = cliptop;layer.clip.right = clipright;layer.clip.bottom = clipbottom;}if (ie||dom){layer.style.clip = 'rect(' + cliptop + ' ' +  clipright + ' ' + clipbottom + ' ' + clipleft +')';}}
function getClipLeft(layer) {if (isMinNS4){return(layer.clip.left);}if (ie||dom) {var str =  layer.style.clip;if (!str){return(0);}var clip = getIEClipValues(layer.style.clip);return(clip[3]);}return(-1);}
function getClipTop(layer) {if (isMinNS4){return(layer.clip.top);}if (ie||dom) {var str =  layer.style.clip;if (!str){return(0);}var clip = getIEClipValues(layer.style.clip);return(clip[0]);}return(-1);}
function getClipRight(layer) {if (isMinNS4){return(layer.clip.right);}if (ie||dom) {var str =  layer.style.clip;if (!str){return(layer.style.width);}var clip = getIEClipValues(layer.style.clip);return(clip[1]);}return(-1);}
function getClipBottom(layer) {if (isMinNS4){return(layer.clip.bottom);}if (ie||dom) {var str =  layer.style.clip;if (!str){return(layer.style.height);}var clip = getIEClipValues(layer.style.clip);return(clip[2]);}return(-1);}
function getClipWidth(layer) {if (isMinNS4){return(layer.clip.width);}if (ie||dom) {var str = layer.style.clip;if (!str){return(layer.style.width);}var clip = getIEClipValues(layer.style.clip);return(clip[1] - clip[3]);}return(-1);}
function getClipHeight(layer) {if (isMinNS4){return(layer.clip.height);}if (ie||dom) {var str =  layer.style.clip;if (!str){return(layer.style.height);}var clip = getIEClipValues(layer.style.clip);return(clip[2] - clip[0]);}return(-1);}
function getIEClipValues(str){var clip = new Array();var i;i = str.indexOf("(");clip[0] = parseInt(str.substring(i + 1, str.length), 10);i = str.indexOf(" ", i + 1);clip[1] = parseInt(str.substring(i + 1, str.length), 10);i = str.indexOf(" ", i + 1);clip[2] = parseInt(str.substring(i + 1, str.length), 10);i = str.indexOf(" ", i + 1);clip[3] = parseInt(str.substring(i + 1, str.length), 10);return(clip);}
// Layer scrolling.
function scrollLayerTo(layer, x, y, bound){var dx = getClipLeft(layer) - x;var dy = getClipTop(layer) - y;scrollLayerBy(layer, -dx, -dy, bound);}
function scrollLayerBy(layer, dx, dy, bound){var cl = getClipLeft(layer);var ct = getClipTop(layer);var cr = getClipRight(layer);var cb = getClipBottom(layer);if (bound){if (cl + dx < 0){dx = -cl;}else if (cr + dx > getWidth(layer)){dx = getWidth(layer) - cr;}if (ct + dy < 0){dy = -ct;}else if (cb + dy > getHeight(layer)){dy = getHeight(layer) - cb;}}clipLayer(layer, cl + dx, ct + dy, cr + dx, cb + dy);moveLayerBy(layer, -dx, -dy);}
// Layer background.
function setBgColor(layer, color){if(isMinNS4){layer.bgColor = color;}if (ie||dom){layer.style.backgroundColor = color;}}
function setBgImage(layer, src){if(isMinNS4){layer.background.src = src;}if (ie||dom){layer.style.backgroundImage = "url(" + src + ")";}}
// Layer utilities.
function getLayer(name){if(isMinNS4){return findLayer(name, document);}if(ie){return eval('document.all.' + name);}if(dom){return document.getElementById(name);}return null;}
function findLayer(name, doc){var i, layer;for (i = 0; i < doc.layers.length; i++){layer = doc.layers[i];if (layer.name == name){return layer;}if (layer.document.layers.length > 0) {layer = findLayer(name, layer.document);if (layer != null){return layer;}}}return null;}
// Window and page properties.
function getWindowWidth(){if(isMinNS4||dom){return(window.innerWidth);}if (ie){return(document.body.clientWidth);}return(-1);}
function getWindowHeight(){if(isMinNS4||dom){return(window.innerHeight);}if (ie){return(document.body.clientHeight);}return(-1);}
function getPageWidth(){if(isMinNS4||dom){return(document.width);}if (ie){return(document.body.scrollWidth);}return(-1);}
function getPageHeight(){if(isMinNS4||dom){return(document.height);}if(ie){return(document.body.scrollHeight);}return(-1);}
function getPageScrollX(){if(isMinNS4||dom){return(window.pageXOffset);}if(ie){return(document.body.scrollLeft);}return(-1);}
function getPageScrollY(){if(isMinNS4||dom){return(window.pageYOffset);}if (ie){return(document.body.scrollTop);}return(-1);}

