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 MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
/**
* <p>Title: Initializer.</p>
* <p>Description: Common Onload initialisation interface.</p>
* <p>Copyright: Richard Cornford 2004</p>
* @author Richard Cornford
* @version 1.0
*/
/**
* A global function named - initializeMe - is created that can be used
* to arrange the execution of an arbitrary number (but probably
* implementation limited to the order of about 1500) of functions from
* the - onload - handler of a web page. The intention being to allow an
* indefinite number of other scripts to use a common interface for
* triggering their onload initialisation functions.
*
* NOTE: This function must be included before any code that attempts
* to use it.
*
* The - initializeMe - function is called with a reference to a
* function object as its first argument, and up to 4 optional
* additional arguments:-
*
* initializeMe(functRef, "idOfElement", "nameOfForm");
*
* - The function reference and any additional arguments are stored in a
* function stack, the base of which is assigned as to window.onload
* handler (or using W3C DOM addEventListener or IE attachEven, if
* available) and when the onload event is triggered the execution of
* the base of the function stack results in the execution of the
* function passed as the first argument, followed by the next function
* in the stack (which executes its function argument, And so on until
* the stack is excused. The execution of functions passed to the -
* initializeMe - function is in the order in which they are passed to
* the - initializeMe - function (first in, first executed).
*
* The function object passed as - funcRef - is called with its first
* argument being the (onload) - event - object and the values
* originally passed to the call to - initializeMe - as the optional 2nd
* to 5th arguments as its 2nd to 5th arguments (in the same order). So,
* in the example call to - initializeMe - above, the function object
* passed by reference as the first argument would have the pattern:-
*
* function(event, idString, nameString){
*    ...
* }
*
* - and the two string arguments passed to - initializeMe - would be
* passed on when it was called during the onload event.
*
* Note: The - event - object passed to the calls to the - funcRef -
* functions is browser normalised with - (ev?ev:global.event) - prior
* to the call to the function, so these function do not have to
* normalise the event objects themselves, but they also cannot make
* decisions about the DOM in use from inferences about their - event -
* argument.
*/
var initializeMe = (function(){
    var global = this;
    var base = null;
    var safe = false;
          var listenerType = (global.addEventListener && 2)||
                            (global.attachEvent && 3)|| 0;
    function getStackFunc(funcRef, arg1,arg2,arg3,arg4){
        var next = null;
        function l(ev){
            funcRef((ev?ev:global.event), arg1,arg2,arg3,arg4);
            if(next)next = next(ev);
            return (arg1 = arg2 = arg3 = arg4 = funcRef = null);
        };
        l.addItem = function(d){
            if(next){
                next.addItem(d);
            }else{
                next = d;
            }
        };
        return l;
    };
    return (function(funcRef, arg1,arg2,arg3,arg4){
        if(base){
            base.addItem(
                       getStackFunc(funcRef, arg1,arg2,arg3,arg4)
                        );
        }else{
            base = getStackFunc(funcRef, arg1,arg2,arg3,arg4);
        }
        if(!safe){
            switch(listenerType){
                case 2:
                    global.addEventListener("load", base, false);
                    safe = true;
                    break;
                case 3:
                    global.attachEvent("onload", base);
                    safe = true;
                    break;
                default:
                    if(global.onload != base){
                        if(global.onload){
                            base.addItem(getStackFunc(global.onload));
                        }
                        global.onload = base;
                    }
                    break;
            }
        }
    });
})();
//^^ : The inline execution of the outermost function expression.

/**
 * <p>Title: Body Initializer.</p>
 * <p>Description: Common Onload initialisation interface.</p>
 * <p>Copyright: Tamás F. Demeter</p>
 * @author Tamás F. Demeter
 * @version 1.0
 *
 *usage example:
 *
 * addEvent(window, 'load', bodyInitFunction);
 *
 * Inspired by:
 *	http://www.digital-web.com/articles/separating_behavior_and_structure_2/
 *	http://www.sitepoint.com/article/structural-markup-javascript
 *	http://simon.incutio.com/archive/2004/05/26/addLoadEvent
 * 	http://www.quirksmode.org/js/introevents.html
 *	http://www.sitepoint.com/blogs/2004/05/26/closures-and-executing-javascript-on-page-load/
 */
function addEvent(obj, evType, fn){
 if (obj.addEventListener){
   obj.addEventListener(evType, fn, false);
   return true;
 } else if (obj.attachEvent){
   var r = obj.attachEvent("on"+evType, fn);
   return r;
 } else {
   var oOldEvent = obj[evType];
   if (typeof oOldEvent != "function") {
     obj[evType] = fn;
   } else {
     obj[evType] = function(e) {
       oOldEvent(e);
       fn(e);
     }
   }
   return false;
 }
}

var W3CDOM = (document.createElement && document.getElementsByTagName);

var mouseOvers = new Array();
var mouseOuts = new Array();

//addEvent( window, 'load', initImgMouseOvers);
//addEvent( window, 'load', initItabPanelMouseOvers);

//initializeMe(setTabPanelMouseOvers, "tabControl", "tab");
//initializeMe(setImgMouseOvers, "mouseovers");

/**
 * <p>Title: Body Initializer.</p>
 * <p>Description: Common Onload initialisation interface.</p>
 * <p>Copyright: Tamás F. Demeter</p>
 * @author Tamás F. Demeter
 * @version 1.0
 *
 *usage example:
 *
 * setImgMouseOvers('mouseovers');
 *
 * Inspired by:
 *	http://www.digital-web.com/articles/separating_behavior_and_structure_2/
 *	http://www.sitepoint.com/article/structural-markup-javascript
 *	http://simon.incutio.com/archive/2004/05/26/addLoadEvent
 * 	http://www.quirksmode.org/js/introevents.html
 *	http://www.sitepoint.com/blogs/2004/05/26/closures-and-executing-javascript-on-page-load/
 *
 */
function setImgMouseOvers(event, elementId) {
    if (!W3CDOM) return;
    var nav = document.getElementById(elementId);
    var imgs = nav.getElementsByTagName('img');
    for (var i=0;i<imgs.length;i++)
    {
        imgs[i].onmouseover = mouseGoesOver;
        imgs[i].onmouseout = mouseGoesOut;
        var suffix = imgs[i].src.substring(imgs[i].src.lastIndexOf('.'));
        mouseOuts[i] = new Image();
        mouseOuts[i].src = imgs[i].src;
        mouseOvers[i] = new Image();
        mouseOvers[i].src = imgs[i].src.substring(0,imgs[i].src.lastIndexOf('.')) + "_omo" + suffix;
        imgs[i].number = i;
    }
}
			    
function mouseGoesOver() {
    this.src = mouseOvers[this.number].src;
}
				
function mouseGoesOut()	{
    this.src = mouseOuts[this.number].src;
}
				    

/**
 * <p>Title: Tab Control.</p>
 * <p>Description: JavaScript Tab Control widget.</p>
 * <p>Copyright: Tamás F. Demeter</p>
 * @author Tamás F. Demeter
 * @version 1.0
 *
 *usage example:
 *
 * setTabPanelMouseOvers('tabControl','tab');
 *
 <div id="tabPanel"  style="width: 762px; height: 120px; position: absolute; border: 2px black dotted;">
    <div id="tabControl" style="width: 100%; height: 20px; color: black; background: green;">
        <div id="tabControl_1" style="background: gray; width: 50px; height: 20px; top: 3px; border: 1px red solid; float: left;">TAB 1...</div>
        <div id="tabControl_2" style="width: 50px; height: 20px; top: 3px; border: 1px red solid; float: left;">TAB 2...</div>
        <div id="tabControl_3" style="width: 50px; height: 20px; top: 3px; border: 1px red solid; float: left;">TAB 3...</div>
        <div id="tabControl_4" style="width: 50px; height: 20px; top: 3px; border: 1px red solid; float: left;">TAB 4...</div>
    </div>
    <div id="tab_1" style="position: absolute; width: 100%; color: white; height: 100px; background: gray;">			
	TAB 1 content ....
    </div>
    <div id="tab_2" style="position: absolute; width: 100%; color: green; height: 100px; background: gray; visibility: hidden;">			
	TAB 2 content ....
    </div>
    <div id="tab_3" style="position: absolute; width: 100%; color: blue; height: 100px; background: gray; visibility: hidden;">			
	TAB 3 content ....
    </div>
    <div id="tab_4" style="position: absolute; width: 100%; color: yellow; height: 100px; background: gray; visibility: hidden;">			
	TAB 4 content ....
    </div>
 </div>
 *
 */
function setTabPanelMouseOvers(event, tabControl, tabElements, tabOnStyle, tabOffStyle) {
    if (!W3CDOM) return;
    var tabContainer = document.getElementById(tabControl);
    var tabs = tabContainer.childNodes;
    var tabCount = 0;
    for (var i=0;i<tabs.length;i++)
    {
	if (tabs.item(i).id && tabs.item(i).id.toString().indexOf(tabControl+"_",0) == 0) {
	    var tabC = document.getElementById(tabs.item(i).id);
	    tabCount++;
    	    tabC.onmouseover = mouseGoesOverTab;
    	    tabC.tabId = tabElements+"_"+tabCount;
	    tabC.tabControl=tabControl;
	    tabC.onStyle=tabOnStyle;
	    tabC.offStyle=tabOffStyle;
	}
    }
}
			    
function mouseGoesOverTab() {
    if (!W3CDOM) return;
    var id = this.tabId;
    var tabContainer = document.getElementById(this.tabControl);
    var tabs = tabContainer.childNodes;
    for (var i=0;i<tabs.length;i++)
    {
	if (tabs.item(i).id && tabs.item(i).id.toString().indexOf(this.tabControl+"_",0) == 0) {
	    var tab = document.getElementById(tabs.item(i).tabId);
	    var tabC = document.getElementById(tabs.item(i).id);
            if( tab.id != id ) {
		    if (tabC.offStyle) {
			swapClass(tabC,tabC.offStyle);
		    } else {
			setFontWeight(tabC.id,"normal");
			setBgColor(tabC.id,getBgColor(tabContainer.id));
		    }
		    setHidden(tab.id);
	    }
	}
    }
    if (this.offStyle) {
	swapClass(this,tabC.onStyle);
    } else {
        setFontWeight(this.id,"bold");
	setBgColor(this.id,getBgColor(id));
    }
    setVisible(id);
}

/* This function is used to change the style class of an element */
function swapClass(obj, newStyle) {
    obj.className = newStyle;
}

function isUndefined(value) {   
    var undef;   
    return value == undef; 
}

function getLeftPosition(id) {
	var retVal;

	ie  = document.all ? 1 : 0;
	dom = document.getElementById ? 1 : 0;
	
	if (dom) {

		element = document.getElementById(id);
//alert("DOM::element="+element+" \nelement.x="+getObjX(element));
		retVal = getObjX(element);

	} else if (ie) {

		element = document.all[id];
//alert("IE::element="+element+" \nelement.x="+getObjX(element));
		retVal = getObjX(element);
	}
	return retVal;
}

function getWidth(id) {
	var retVal;

	ie  = document.all ? 1 : 0;
	dom = document.getElementById ? 1 : 0;
	
	if (dom) {

		element = document.getElementById(id);
//alert("DOM::element="+element+" \nelement.x="+getObjWidth(element));
		retVal = getObjWidth(element);

	} else if (ie) {

		element = document.all[id];
//alert("IE::element="+element+" \nelement.x="+getObjWidth(element));
		retVal = getObjWidth(element);
	}
	return retVal;
}

function getObjX(obj) {
	var retVal;
	var currPos = 0;
	if (obj.offsetParent){
//	    while (obj.offsetParent){
		currPos += obj.offsetLeft;
//		obj = obj.offsetParent;
//	    }
	    retVal = currPos;
	} else if(obj.x) {
	    currPos += obj.x;
	    retVal = currPos;
	}
	return retVal;
}

function getObjWidth(obj) {
	var retVal;
	if (obj.offsetWidth){
	    retVal = obj.offsetWidth;
	}
	return retVal;
}

function setDivFontSize(id, size) {

	ie  = document.all ? 1 : 0;
	dom = document.getElementById ? 1 : 0;
	
	if (dom) {

		element = document.getElementById(id);
		element.style.fontSize=size;

	} else if (ie) {

		element = document.all[id];
		element.style.fontSize=size;
	}
}

function setFontSize(id, size) {
	setDivFontSize(id,size);
}

function getFontSize(id) {

	ie  = document.all ? 1 : 0;
	dom = document.getElementById ? 1 : 0;
	
	var size = null;
	
	if (dom) {

		element = document.getElementById(id);
		size = element.style.fontSize;

	} else if (ie) {

		element = document.all[id];
		size = element.style.fontSize;
	}
	return size;
}

function setFontWeight(id, weight) {

	ie  = document.all ? 1 : 0;
	dom = document.getElementById ? 1 : 0;
	
	if (dom) {

		element = document.getElementById(id);
		element.style.fontWeight=weight;

	} else if (ie) {

		element = document.all[id];
		element.style.fontWeight=weight;
	}
}

function getFontWeight(id) {

	ie  = document.all ? 1 : 0;
	dom = document.getElementById ? 1 : 0;
	var weight = null;
	if (dom) {

		element = document.getElementById(id);
		weight = element.style.fontWeight;

	} else if (ie) {

		element = document.all[id];
		weight = element.style.fontWeight;
	}
	return weight;
}

function setBgColor(id, color) {

	ie  = document.all ? 1 : 0;
	dom = document.getElementById ? 1 : 0;
	
	if (dom) {

		element = document.getElementById(id);
		element.style.backgroundColor=color;

	} else if (ie) {

		element = document.all[id];
		element.style.backgroundColor=color;
	}
}

function getBgColor(id) {

	ie  = document.all ? 1 : 0;
	dom = document.getElementById ? 1 : 0;
	var color = null;
	if (dom) {

		element = document.getElementById(id);
		color = element.style.backgroundColor;

	} else if (ie) {

		element = document.all[id];
		color = element.style.backgroundColor;
	}
	return color;
}

function setVisible(id) {

	ie  = document.all ? 1 : 0;
	ns4 = document.layers ? 1 : 0;
	dom = document.getElementById ? 1 : 0;
	
	if (dom) {

		element = document.getElementById(id);
		element.style.visibility="visible";

	} else if (ie) {

		element = document.all[id];
		element.style.visibility="visible";

	} else if (ns4) {

		element = document.layers[id];
		element.visibility="show";
	}
}

function setHidden(id) {
	
	ie  = document.all ? 1 : 0;
	ns4 = document.layers ? 1 : 0;
	dom = document.getElementById ? 1 : 0;
	
	if (dom) {

		element = document.getElementById(id);
		element.style.visibility="hidden";

	} else if (ie) {

		element = document.all[id];
		element.style.visibility="hidden";

	} else if (ns4) {

		element = document.layers[id];
		element.visibility="hide";
	}
}

function toggleVisibility(id) {
	
	ie  = document.all ? 1 : 0;
	ns4 = document.layers ? 1 : 0;
	dom = document.getElementById ? 1 : 0;
	
	if (dom) {

		element = document.getElementById(id);
		element.style.visibility = element.style.visibility=="hidden" ? "visible" : "hidden";

	} else if (ie){

		element = document.all[id];
		element.style.visibility = element.style.visibility=="hidden" ? "visible" : "hidden";

	} else if (ns4) {

		element = document.layers[id];
		element.visibility= element.visibility=="hide" ? "show" : "hide";
	}
}
								
function loadMenu ( thisMenu, newMenu ) {
//    alert(parent.menu.location.href);
    parent.menu.location.href = location.href.substring(0,location.href.indexOf(thisMenu)) + newMenu;
}

//
function getValue(id) {

	ie  = document.all ? 1 : 0;
	ns4 = document.layers ? 1 : 0;
	dom = document.getElementById ? 1 : 0;
	
	value = "";
	if (dom) {

		element = document.getElementById(id);
		value = element.value;

	} else if (ie) {

		element = document.all[id];
		value = element.value;
	}
	return value;
}

//
function gotoThisUrl(url, id) {

	ie  = document.all ? 1 : 0;
	ns4 = document.layers ? 1 : 0;
	dom = document.getElementById ? 1 : 0;
	
	value = "";
	if (dom) {

		element = document.getElementById(id);
		value = element.value;

	} else if (ie) {

		element = document.all[id];
		value = element.value;
	}
	window.location.href = url+value;
	return true;
}

//
function gotoThisNumUrl(defUrl, urlId, parameterId) {

	ie  = document.all ? 1 : 0;
	ns4 = document.layers ? 1 : 0;
	dom = document.getElementById ? 1 : 0;

	value = "";
	if (dom) {

		url = document.getElementById(urlId);
		parameter = document.getElementById(parameterId);
		value = "0"+parameter.value;

	} else if (ie) {

		url = document.all[urlId];
		parameter = document.all[parameterId];
		value = "0"+parameter.value;
	}

	if (parseInt(value,10)>0) {
		url.href = defUrl + "" + parseInt(value,10);
	} else {
		url.href = "#";
	}

	return true;
}

//
function gotoThisOptNumUrl(defUrl, urlId, parameterId) {

	ie  = document.all ? 1 : 0;
	ns4 = document.layers ? 1 : 0;
	dom = document.getElementById ? 1 : 0;

	value = "";
	if (dom) {

		url = document.getElementById(urlId);
		parameter = document.getElementById(parameterId);
		value = "0"+parameter.value;

	} else if (ie) {

		url = document.all[urlId];
		parameter = document.all[parameterId];
		value = "0"+parameter.value;
	}

	if (parseInt(value,10)>0) {
		url.href = defUrl + "" + parseInt(value,10);
	} else {
		url.href = defUrl;
	}

	return true;
}

//
function gotoThisAltNumUrl(defUrl, altUrl, urlId, parameterId) {

	ie  = document.all ? 1 : 0;
	ns4 = document.layers ? 1 : 0;
	dom = document.getElementById ? 1 : 0;

	value = "";
	if (dom) {

		url = document.getElementById(urlId);
		parameter = document.getElementById(parameterId);
		value = "0"+parameter.value;

	} else if (ie) {

		url = document.all[urlId];
		parameter = document.all[parameterId];
		value = "0"+parameter.value;
	}

	if (parseInt(value,10)>0) {
		url.href = defUrl + "" + parseInt(value,10);
	} else {
		url.href = altUrl;
	}

	return true;
}


/* Function for showing and hiding elements that use 'display:none' to hide */
function toggleDisplay(targetId)
{
    if (document.getElementById) {
        target = document.getElementById(targetId);
    	if (target.style.display == "none"){
    		target.style.display = "";
    	} else {
    		target.style.display = "none";
    	}
    }
}

// toggle visibility 
function toggleVisibility(targetId) {
    if (document.getElementById) {
        target = document.getElementById(targetId);
    	if (target.style.visibility == "hidden"){
    		target.style.visibility = "visible";
    	} else {
    		target.style.visibility = "hidden";
    	}
    }
}

function checkAll(theForm) { // check all the checkboxes in the list
  for (var i=0;i<theForm.elements.length;i++) {
    var e = theForm.elements[i];
		var eName = e.name;
    	if (eName != 'allbox' && 
            (e.type.indexOf("checkbox") == 0)) {
        	e.checked = theForm.allbox.checked;		
		}
	} 
}

/* Function to clear a form of all it's values */
function clearForm(frmObj) {
	for (var i = 0; i < frmObj.length; i++) {
        var element = frmObj.elements[i];
		if(element.type.indexOf("text") == 0 || 
				element.type.indexOf("password") == 0) {
					element.value="";
		} else if (element.type.indexOf("radio") == 0) {
			element.checked=false;
		} else if (element.type.indexOf("checkbox") == 0) {
			element.checked = false;
		} else if (element.type.indexOf("select") == 0) {
			for(var j = 0; j < element.length ; j++) {
				element.options[j].selected=false;
			}
            element.options[0].selected=true;
		}
	} 
}

/* Function to get a form's values in a string */
function getFormAsString(frmObj) {
    var query = "";
	for (var i = 0; i < frmObj.length; i++) {
        var element = frmObj.elements[i];
        if (element.type.indexOf("checkbox") == 0 || 
            element.type.indexOf("radio") == 0) { 
            if (element.checked) {
                query += element.name + '=' + escape(element.value) + "&";
            }
		} else if (element.type.indexOf("select") == 0) {
			for (var j = 0; j < element.length ; j++) {
				if (element.options[j].selected) {
                    query += element.name + '=' + escape(element.value) + "&";
                }
			}
        } else {
            query += element.name + '=' 
                  + escape(element.value) + "&"; 
        }
    } 
    return query;
}

/* Function to hide form elements that show through
   the search form when it is visible */
function toggleForm(frmObj, iState) // 1 visible, 0 hidden 
{
	for(var i = 0; i < frmObj.length; i++) {
		if (frmObj.elements[i].type.indexOf("select") == 0 || frmObj.elements[i].type.indexOf("checkbox") == 0) {
            frmObj.elements[i].style.visibility = iState ? "visible" : "hidden";
		}
	} 
}

/* Helper function for re-ordering options in a select */
function opt(txt,val,sel) {
    this.txt=txt;
    this.val=val;
    this.sel=sel;
}

/* Function for re-ordering <option>'s in a <select> */
function move(list,to) {     
    var total=list.options.length;
    index = list.selectedIndex;
    if (index == -1) return false;
    if (to == +1 && index == total-1) return false;
    if (to == -1 && index == 0) return false;
    to = index+to;
    var opts = new Array();
    for (i=0; i<total; i++) {
        opts[i]=new opt(list.options[i].text,list.options[i].value,list.options[i].selected);
    }
    tempOpt = opts[to];
    opts[to] = opts[index];
    opts[index] = tempOpt
    list.options.length=0; // clear
    
    for (i=0;i<opts.length;i++) {
        list.options[i] = new Option(opts[i].txt,opts[i].val);
        list.options[i].selected = opts[i].sel;
    }
    
    list.focus();
} 

/*  This function is to select all options in a multi-valued <select> */
function selectAll(elementId) {
    var element = document.getElementById(elementId);
	len = element.length;
	if (len != 0) {
		for (i = 0; i < len; i++) {
			element.options[i].selected = true;
		}
	}
}

/* This function is used to select a checkbox by passing
 * in the checkbox id
 */
function toggleChoice(elementId) {
    var element = document.getElementById(elementId);
    if (element.checked) {
        element.checked = false;
    } else {
        element.checked = true;
    }
}

/* This function is used to select a radio button by passing
 * in the radio button id and index you want to select
 */
function toggleRadio(elementId, index) {
    var element = document.getElementsByName(elementId)[index];
    element.checked = true;
}


/* This function is used to open a pop-up window */
function openWindow(url, winTitle, winParams) {
	winName = window.open(url, winTitle, winParams);
    winName.focus();
}


/* This function is to open search results in a pop-up window */
function openSearch(url, winTitle) {
    var screenWidth = parseInt(screen.availWidth);
    var screenHeight = parseInt(screen.availHeight);

    var winParams = "width=" + screenWidth + ",height=" + screenHeight;
        winParams += ",left=0,top=0,toolbar,scrollbars,resizable,status=yes";

    openWindow(url, winTitle, winParams);
}

/* This function is used to set cookies */
function setCookie(name,value,expires,path,domain,secure) {
  document.cookie = name + "=" + escape (value) +
    ((expires) ? "; expires=" + expires.toGMTString() : "") +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : "");
}

/* This function is used to get cookies */
function getCookie(name) {
	var prefix = name + "=" 
	var start = document.cookie.indexOf(prefix) 

	if (start==-1) {
		return null;
	}
	
	var end = document.cookie.indexOf(";", start+prefix.length) 
	if (end==-1) {
		end=document.cookie.length;
	}

	var value=document.cookie.substring(start+prefix.length, end) 
	return unescape(value);
}

/* This function is used to delete cookies */
function deleteCookie(name,path,domain) {
  if (getCookie(name)) {
    document.cookie = name + "=" +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}

// This function is for stripping leading and trailing spaces
function trim(str) { 
    if (str != null) {
        var i; 
        for (i=0; i<str.length; i++) {
            if (str.charAt(i)!=" ") {
                str=str.substring(i,str.length); 
                break;
            } 
        } 
    
        for (i=str.length-1; i>=0; i--) {
            if (str.charAt(i)!=" ") {
                str=str.substring(0,i+1); 
                break;
            } 
        } 
        
        if (str.charAt(0)==" ") {
            return ""; 
        } else {
            return str; 
        }
    }
} 

// This function is used by the login screen to validate user/pass
// are entered. 
function validateRequired(form) {                                    
    var bValid = true;
    var focusField = null;
    var i = 0;                                                                                          
    var fields = new Array();                                                                           
    oRequired = new required();                                                                         
                                                                                                        
    for (x in oRequired) {                                                                              
        if ((form[oRequired[x][0]].type == 'text' || form[oRequired[x][0]].type == 'textarea' || form[oRequired[x][0]].type == 'select-one' || form[oRequired[x][0]].type == 'radio' || form[oRequired[x][0]].type == 'password') && form[oRequired[x][0]].value == '') {
           if (i == 0)
              focusField = form[oRequired[x][0]]; 
              
           fields[i++] = oRequired[x][1];
            
           bValid = false;                                                                             
        }                                                                                               
    }                                                                                                   
                                                                                                       
    if (fields.length > 0) {
       focusField.focus();
       alert(fields.join('\n'));                                                                      
    }                                                                                                   
                                                                                                       
    return bValid;                                                                                      
}

function confirmDelete(formId, obj) {   
    var form = document.getElementById(formId);
    var msg = "Are you sure you want to delete this " + obj + "?";
	ans = confirm(msg);
	if (ans) {
        return true;
	} else {
        return false;
    }
}

// Show the document's title on the status bar
window.defaultStatus=document.title;


function viewImage(imgWhat, cTitle, cClose)
{
	if ( window.windImgView && !windImgView.closed ) { windImgView.close(); } 
	windImgView=window.open("","", "scrollbars=yes,left=75,top=10,width=650, height=700");
//	windImgView=window.open("blank.html",cTitle, "scrollbars=yes, width=screen.width, height=screen.height, left="+((screen.width-(screen.width%2))/2-250)+",top=1");
//	windImgView=window.open("","", "scrollbars=yes, width=screen.width, height=screen.height, left="+((screen.width-(screen.width%2))/2-250)+",top=1");
	if ( !windImgView.opener) { windImgView.opener = self; }
	windImgView.document.open();
	windImgView.document.write("<html><head><title>"+cTitle+"</title></head>");
	windImgView.document.write("<body><center>");
	windImgView.document.write("<h2><strong>"+cTitle+"</strong></h2>");
	windImgView.document.write("<p><img src="+imgWhat+" border='0' name='image'></p>");
	windImgView.document.write("<p><a href='#' onClick='self.close();'>"+cClose+"</a></p>");
	windImgView.document.write("</center></body></html>");
	windImgView.document.close();
//	windImgView.document.width= windImgView.document['image'].width+20;
	windImgView.focus();
}
function FlashCodeFinanc()
{
    document.write('<object width="580" height="58" align="middle" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" id="Untitled-2">');
    document.write('<param name="allowScriptAccess" value="sameDomain" />');
    document.write('<param name="movie" value="loadBinaryContent.do?binaryId=7333" />');
    document.write('<param name="quality" value="high" />');
    document.write('<param name="bgcolor" value="#ffffff" />');
    document.write('<embed width="580" height="58" align="middle" src="loadBinaryContent.do?binaryId=7333" quality="high" bgcolor="#ffffff" name="Untitled-2" allowscriptaccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
    document.write('</object>');
}

