<!--
function MM_findObj(n, d) { //v3.0
  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); return x;
}

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_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];}
}

function MM_showHideLayers(){ //v3.0 modified by Eric
  var i,p,v,obj,args=MM_showHideLayers.arguments;  
  for (i=0; i<(args.length-2); i+=3)   	 
	//if ((obj=MM_findObj(args[i]))!=null){ v=args[i+2];		  	
	if ((obj=(document.getElementById)?document.getElementById(args[i]):MM_findObj(args[i]))!=null) { v=args[i+2];		
	    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
	   	obj.visibility=v; }
}

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_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

/*
 * check input character
 */
function checkFormat(e,strCheck){
	var whichCode = (window.Event) ? e.which : e.keyCode;
	if(window.Event && typeof(whichCode)=='undefined')
	{
		whichCode = e.keyCode;
	}
	//if (whichCode == 13) return true;  // Enter
	if (whichCode == 13 || whichCode == 8 || whichCode== 0) return true;  // Enter, Backspace or tab
	var key = String.fromCharCode(whichCode);  // Get key value from key code
	if (strCheck.indexOf(key) == -1) return false;  // Not a valid key
	return true;
}

function isAlphaNumeric(e){
	var strCheck = '0123456789_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
	return (checkFormat(e,strCheck) && disableEnterKey(e));	
}

function isInteger(e) {
	var strCheck = '0123456789';
	return checkFormat(e,strCheck);	
}

function isFloat(e){
	var strCheck = '0123456789.';
	return checkFormat(e,strCheck);
}

function zipCodeFormat(e){
	var strCheck = '0123456789-';
	return checkFormat(e,strCheck);	
}

function currencyFormat(e){
	return isFloat(e);
}

function phoneFormat(e){
	var strCheck = '0123456789-().';
	return checkFormat(e,strCheck);		
}

// returns true when enter is clicked
function isEnterClicked(e)
{
	var keycode;
	if (window.event)
		keycode = window.event.keyCode;
	else if (e)
		keycode = e.which;
	else
		return false;
	
	return (keycode == 13);
}

function disableEnterKey(e){
	return !isEnterClicked(e);
}


/*
 * end check input character
 */


function browser(n){ // check browser
	if(n=='ns')
		return (navigator.appName.indexOf("Netscape")!=-1)?1:0;
	else if(n=='ie')
		return (navigator.appName.indexOf("Microsoft")!=-1)?1:0;
	else if(n=='ns4')
		return ((navigator.appName.indexOf("Netscape")!=-1) && (parseInt(navigator.appVersion)==4))?1:0;
	else if(n=='ns6')
		return ((navigator.appName.indexOf("Netscape")!=-1) && (parseInt(navigator.appVersion)>=5))?1:0;
}

function openWin(url,width,height,scrollbar,resizable){
	self.name = "main";
	window.open(url,"msW","toolbar=no,width="+width+",height="+height+",directories=no,status=no,scrollbars="+scrollbar+",resizable="+resizable+",menubar=no");
	window.focus;
}

function openPopUp(url,width,height){	
	if(browser('ns')){
		var win_width  = paseInt(innerWidth);
		var win_height = paseInt(innerHeight);
	}else{
		var win_width  = document.body.clientWidth;
		var win_height =document.body.clientHeight;
	}
	var pos_left = win_width/2-150;
	var pos_top  = win_height/2 - 30;
	msg=window.open(url,"msg","height="+height+",width="+width+",left="+pos_left+",top="+pos_top);
}


function disableButtons(form){	
	for(i=0;i<form.elements.length;i++){
		if(form.elements[i].type == "submit" || form.elements[i].type=="reset" || form.elements[i].type == "button")
			form.elements[i].disabled = true;
	}	
}

function enableButtons(form){	
	for(i=0;i<form.elements.length;i++){
		if(form.elements[i].type == "submit" || form.elements[i].type=="reset" || form.elements[i].type == "button")
			form.elements[i].disabled = false;
	}	
}

function saveButtonValue(form,val){
	form._button.value=val;
}

function post(form,val){
	if(window.updateTextArea){
		updateTextArea(form);
	}
	autoSaveOff(form);
	disableButtons(form);
	saveButtonValue(form,val);
	form._goToURL.value='';
	form.submit();
}

function autoSaveOn(form){
	if(!form._autoSave) reutrn;
	form._autoSave.value = 'ON';	
}

function autoSaveOff(form){
	if(!form._autoSave) return;
	form._autoSave.value = 'OFF';	
	form._goToURL.value = '';
}

function isAutoSaveOn(form){
	if(!form._autoSave) return false;
	return (form._autoSave.value=='ON');
}

function autoSave(form){
	if(!form || document.goToURL!=undefined) return;

	if(window.updateTextArea){
		updateTextArea(form);
	}
	
	if(isAutoSaveOn(form)){		
		form.submit();
	}
}

function toURL(url){
	if(typeof confirmRedirect !='undefined'){
		if(!confirm("You will lose the content if you leave this page now.\nContinue?" )){
			return;
		}	
	}
	
	document.goToURL = url;
	var f = document.forms;
	if(f.length > 0){ // auto save
		for(i=0;i<f.length;i++){
			if(f[i]._autoSave && f[i]._autoSave.value=='ON') {
				f[i]._goToURL.value = url; 
				f[i]._autoSave.value=='OFF';							
			}	
		}
	}		
	window.location=url;		
}

function goToURL(url){
	if(typeof confirmRedirect !='undefined'){
		if(!confirm("You will lose the content if you leave this page now.\nContinue?" )){
			return;
		}	
	}
	
	document.goToURL = url;
	var f = document.forms;
	if(f.length > 0){ // auto save
		for(i=0;i<f.length;i++){
			if(f[i]._autoSave && f[i]._autoSave.value=='ON') {
				f[i]._goToURL.value = url; f[i].submit();				
			}else{
				window.location=url;
			}	
		}
	}else{
	
		window.location=url;		
	}
}

function convertPlainText(form,val,id){
	autoSaveOff(form);

	if(val==1){
		if(confirm('This will convert your message into plain text. All formatting will be lost. Continue?')){
			if(id!=''){
				var editor = eval('editor_'+id);
				editor.updateTextArea();
			}else if(window.updateTextArea){
				updateTextArea(form);
			}
			form.frmPlainText.value=1; 
			form.submit();
		}else{
			form.frmPlainText.value=0;
			return false;
		}		
	}else{
		form.frmPlainText.value=0;
		form.submit();
	}
}

// will check or clear all checkboxes in a form
function checkAll(form,checked){	
	for(i=0;i<form.elements.length;i++){
		if(form.elements[i].type=="checkbox"){
			form.elements[i].checked = checked;
		}
	}	
}

function checkAllInGroup(form,checked,name,groupID){
	var checkBox = false;
	for(i=0;i<form.elements.length;i++){
		if(form.elements[i].type=="checkbox" && form.elements[i].name.indexOf(name)>-1 && form.elements[i].value==groupID){
			checkBox = true;
		}else if(!checkBox){
			continue;
		}else if(form.elements[i].type=="checkbox" && form.elements[i].name.indexOf(name)>-1 && form.elements[i].value!=groupID){
			break;
		}else{
			form.elements[i].checked = checked;
		}	
	}	
}

function unCheckGroup(form,checked,groupName){
	if(!checked){
		form.elements[groupName].checked = false;
	}
}


function replaceChars(entry,oldString,newString) {
// replace oldString with newString		

	temp = "" + entry; // temporary holder
	while (temp.indexOf(oldString)>-1) {
		pos= temp.indexOf(oldString);
		temp = "" + (temp.substring(0, pos) + newString + 
		temp.substring((pos + oldString.length), temp.length));
	}
	return temp;
}	

/**
 * cross-browser event handling for IE5+, NS6 and Mozilla
 * By Scott Andrew
 */
function addEvent(elm, evType, fn, useCapture) {
	try{ // remove current event listener if it exists
		removeEvent(elm, evType, fn, useCapture);
	}catch(e){
		// no current event listener
	}
	
    if (elm.addEventListener) {
      elm.addEventListener(evType, fn, useCapture);    
    } else if (elm.attachEvent) {
      elm.attachEvent('on' + evType, fn);
    } else {
      elm['on' + evType] = fn;
    }
}
/**
 * remove event from an object
 */
function removeEvent(elm, evType, fn, useCapture) {
    if (elm.removeEventListener) {
      elm.removeEventListener(evType, fn, useCapture);
    } else if (elm.attachEvent) {
      elm.detachEvent('on' + evType, fn);      
    } else {
      elm['on' + evType] = null;
    }
}

/** 
 * Return height of current window
 * Shoule add a layer 'measure' in the body
 */
function getWindowHeight(){	
	return (document.getElementById("measure"))?(document.getElementById("measure").offsetHeight):document.body.offsetHeight;
}

/**
 * Return width of current window
 * Shoule add a layer 'measure' in the body
 */
function getWindowWidth(){
	return (document.getElementById("measure"))?(document.getElementById("measure").offsetWidth):document.body.offsetWidth;
} 


function getEvent(e){
	if(window.event){
		var e=window.event;
		var keyCode=e.keyCode;
		e.target=e.srcElement;
	}else{
		var keyCode=e.keyCode;
	}
	e.ENTER=(keyCode==13);
	e.ESC=(keyCode==27);
	return e;
} 
 
if(window.name=="msg")
	window.close();
	
var emailList = new Array();	



// inline popup window
function openPopUpLayer(url,x,y,width,height){
	var id = 'popUpLayer';
	closePopUpLayer(id);
	
	if(browser('ns')){
		var win_width  = parseInt(innerWidth);
		var win_height = parseInt(innerHeight);
	}else{
		var win_width  = document.body.clientWidth;
		var win_height =document.body.clientHeight;
	}
	var pos_x = (win_width-750)/2+130;
	var pos_y = 100;

	var div = document.createElement('div');
	div.setAttribute('id',id);
	div.style.position = 'absolute';
	div.style.left = pos_x+'px';
	//div.style.top  = pos_y+'px';
	div.style.top = y+'px';
	div.style.width = width+'px';
	div.style.height = height+'px';
	div.style.border = '1px;'
	div.style.zIndex = 1000;
	div.style.border = '1px solid #C5DAFA';
	div.style.backgroundColor = '#003366';
	
	div.innerHTML = '<p align="right" style="margin:5px"><a href="javascript:closePopUpLayer(\''+id+'\')" style="color:white;">Close</a>&nbsp;&nbsp;</p>';
	var iframe = document.createElement('iframe');
	iframe.style.position = 'absolute';
	iframe.style.top = '25px';
	iframe.style.width = width+'px';
	iframe.style.height = (height-30)+'px';
	iframe.style.border = 'none';
	iframe.backgroundColor = '#ffff00';	
	iframe.src = url;
	div.appendChild(iframe);
	document.body.appendChild(div);	
}

function closePopUpLayer(id){	
	if(document.getElementById(id)){
		document.body.removeChild(document.getElementById(id));
	}
}

function $(id)
{
	return document.getElementById(id);
}


var currentMenuId='';

function showHideMenu(id)
{
	var menuId = 'menu_'+id;
	if($(menuId)){
		if(currentMenuId!='' && currentMenuId!=menuId){
			$(currentMenuId).style.display = 'none';
		}
		$(menuId).style.display = ($(menuId).style.display=='none') ? 'block':'none';
		currentMenuId=menuId;
	}
}


//-->

