// JavaScript Document

function MM_swapImgRestore() 
{ //v3.0
 var i,x,a=document.MM_sr; for(var i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() 
{ //v3.0
// var thePageName = document.getElementById('thePageName');
// if(thePageName.value == "index.php") startTimer();

 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(var 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_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(var 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_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 (var i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(var 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_displayStatusMsg(msgStr)  { //v3.0
	status=msgStr; document.MM_returnValue = true;
} 
//**********************************************************************
function trim(stringToTrim) 
{
 return stringToTrim.replace(/^\s+|\s+$/g,"");
}
function ltrim(stringToTrim) 
{
 return stringToTrim.replace(/^\s+/,"");
}
function rtrim(stringToTrim) 
{
 return stringToTrim.replace(/\s+$/,"");
}
//**********************************************************************
<!-- ******************************************************************************************* -->
function imageResizePropByWidthAndHeight(actualWidth, actualHeight, target_width, target_height)
{ 
 // resizes image width & height to less than or equal to target width & height
 // (as close as possible)

 if (actualWidth > target_width) 
 {
  var widthPercentage = (target_width / actualWidth); 
 } 
 else 
 {
  var widthPercentage = 1; 
 } 
 
 var preScaledWidth = Math.round(actualWidth * widthPercentage); 
 var correspondingHeight = Math.round(actualHeight * widthPercentage);

 
 if (actualHeight > target_height) 
 {
  var heightPercentage = (target_height / actualHeight); 
 } 
 else 
 {
  var heightPercentage = 1; 
 } 
 
 var preScaledHeight = Math.round(actualHeight * heightPercentage); 
 var correspondingWidth = Math.round(actualWidth * heightPercentage);
 
 //--------------------------------------

 if( (correspondingHeight > target_height) && (correspondingWidth <= target_width) )
 {
  // corresponding height is out of bounds, but corresponding width is within bounds
  // height is therefore maximized 
  width = correspondingWidth; 
  height = preScaledHeight; 
 }
 else if( ( correspondingHeight <= target_height) && ( correspondingWidth > target_width) )
 { 
  // corresponding height is in bounds, but corresponding width is out of bounds
  // width is therefore maximized 
  width = preScaledWidth; 
  height = correspondingHeight; 
 }
 else if( ( correspondingHeight <= target_height) && ( correspondingWidth <= target_width) )
 {
  // corresponding height is in bounds, AND corresponding width is in bounds
  // either width or height may therefore be maximized -- we will choose to maximize width
  width = preScaledWidth; 
  height = correspondingHeight; 
 }
 else
 {
  width = actualWidth;
  height = actualHeight;
 }

 //--------------------------------------

 var returnString = 'width="' + width + '" height="' + height + '"';
 
//alert(returnString);

 //alert(actualWidth + ':' + actualHeight + '::' + width + ':' + height + '::' + target_width + ':' + target_height);
 
 return returnString; 
} 

<!-- ******************************************************************************************* -->
function updateClientLogStatusImage(logStatus,efxPath,efxpathSecure,sessionLogStatus)
{
 // alert(logStatus + ":" + sessionLogStatus);
 
 var theLoginStatus = document.getElementById('loginstatus'); // div

 var linkContent = "";
 //-----------------------------------

if(logStatus == 'logout')       // if user is logged in
 { 
  var logPath = efxpath + 'clientlogout.php?action=logout';
  var logImage = 'images/logout.jpg';
 }
 else                                     // no user is logged in
 {
  var logPath = efxpathSecure + 'clientlogin.php';
  var logImage = 'images/login.jpg';
 }
 
 //-----------------------------------

 linkContent += '<a class="catlinks3" href="' + logPath + '">';
 linkContent += '<img name="logButton" id="logButton" src="' + logImage + '" border="0"  onclick="updateClientLogStatusImage(' + "'" + logStatus + "'" + "," 
                                                                                                                     + "'" + efxPath + "'" + ","
																													 + "'" + efxpathSecure + "'" + ","
																													 + "'" + sessionLogStatus + "'"
																													 + ');" title="user ' + logStatus + '">';
 linkContent += '</a>';
 
 //-----------------------------------
/*
 // This is used IF the LOGOUT text is embedded in the background of the main image
 if(sessionLogStatus == 'logged in')
 {
  theLoginStatus.style.visibility = 'hidden';
 }
 else // sessionLogStatus == 'logged out'
 {
  theLoginStatus.style.visibility = 'visible';
 }
*/ 
}
<!-- ******************************************************************************************* -->

function getArrayFromCSVString(theCSVString)
{
 var CSVArray = new Array();

 if(theCSVString != "") CSVArray = theCSVString.split(",");
 return(CSVArray);
}

<!-- ******************************************************************************************* -->

function getArrayFromStringCustom(theCSVString,separator)
{
 var CSVArray = new Array();

 if(theCSVString != "") CSVArray = theCSVString.split(separator);
 return(CSVArray);
}

<!-- ******************************************************************************************* -->

function updateSearchAction()
{
 var theSearchText = document.getElementById('searchText');

 var theSearchTerm = "search.php" + "?searchTerm=" + theSearchText.value;
 
 document.searchForm.posted.value = "1";
 document.searchForm.act.value = theSearchTerm;
 //alert(document.searchForm.act.value);
 document.searchForm.submit();
}
<!-- ******************************************************************************************* -->

<!-- ******************************************************************************************* -->
<!-- ******************************************************************************************* -->
<!-- ******************************************************************************************* -->
<!-- ******************************************************************************************* -->




