function setandsubmitsearch(typeofsearch) {

	if (typeofsearch == 'searchtermgo') {
	  if (trim(document.frmimagesearch.txtsearchterm.value) == "") {
		  alert("You have not entered a Search Term")
			return;
		}	
	  document.location = "imageresults.asp?type=searchtermgo&image=" + trim(document.frmimagesearch.txtsearchterm.value)
  }
  
}

/* END OF SETANDSUBMITSEARCH - BEGINNING OF SETANDSUBMITSUPPLIERSEARCH  */


/*
==================================================================
ltrim(string) : Returns a copy of a string without leading spaces.
==================================================================
*/
function ltrim(str)
/*
   PURPOSE: Remove leading blanks from our string.
   IN: str - the string we want to ltrim
*/
{
   var whitespace = new String(" \t\n\r");

   var s = new String(str);

   if (whitespace.indexOf(s.charAt(0)) != -1) {
      // We have a string with leading blank(s)...

      var j=0, i = s.length;

      // Iterate from the far left of string until we
      // don't have any more whitespace...
      while (j < i && whitespace.indexOf(s.charAt(j)) != -1)
         j++;

      // Get the substring from the first non-whitespace
      // character to the end of the string...
      s = s.substring(j, i);
   }
   return s;
}

/*
==================================================================
rtrim(string) : Returns a copy of a string without trailing spaces.
==================================================================
*/
function rtrim(str)
/*
   PURPOSE: Remove trailing blanks from our string.
   IN: str - the string we want to rtrim

*/
{
   // We don't want to trip JUST spaces, but also tabs,
   // line feeds, etc.  Add anything else you want to
   // "trim" here in Whitespace
   var whitespace = new String(" \t\n\r");

   var s = new String(str);

   if (whitespace.indexOf(s.charAt(s.length-1)) != -1) {
      // We have a string with trailing blank(s)...

      var i = s.length - 1;       // Get length of string

      // Iterate from the far right of string until we
      // don't have any more whitespace...
      while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1)
         i--;


      // Get the substring from the front of the string to
      // where the last non-whitespace character is...
      s = s.substring(0, i+1);
   }

   return s;
}

/*
=============================================================
Trim(string) : Returns a copy of a string without leading or trailing spaces
=============================================================
*/
function trim(str)
/*
   PURPOSE: Remove trailing and leading blanks from our string.
   IN: str - the string we want to Trim

   RETVAL: A Trimmed string!
*/
{
   return rtrim(ltrim(str));
}

function checkmyworklength() {
/***************************************************************************/
/* Special Req's :- None                                                   */
/* Related Files :- None                                                   */
/* Purpose       :- To check that only the permitted number of characters  */
/*               :- are entered into the description                       */
/* Version       :- 1.00                                                   */
/* Author        :- Dennis McDermott                                       */
/* Date          :- 06/04/2004                                             */
/***************************************************************************/
/* Desc of Mod   :-                                                        */
/* Modified By   :-                                                        */
/* Date          :-                                                        */
/***************************************************************************/

var intmyworklength;
intmyworklength = 1500
  if (document.frmeditprofile.txtmywork.value.length > intmyworklength) {
    alert("Your About My Work text is too long, please enter no more than " + intmyworklength + " characters"); 
		document.frmeditprofile.txtmywork.value = 
		document.frmeditprofile.txtmywork.value.substr(0,intmyworklength);
		document.frmeditprofile.txtmywork.focus();
  } 
  if (document.frmeditprofile.txtmyworkcharsleft) {	  
		document.frmeditprofile.txtmyworkcharsleft.value = intmyworklength - document.frmeditprofile.txtmywork.value.length;	
		}
}
/***************************************************************************/
/*                End of function checkmyworklength()                 */
/***************************************************************************/


function checkexhibslength() {
/***************************************************************************/
/* Special Req's :- None                                                   */
/* Related Files :- None                                                   */
/* Purpose       :- To check that only the permitted number of characters  */
/*               :- are entered into the description                       */
/* Version       :- 1.00                                                   */
/* Author        :- Dennis McDermott                                       */
/* Date          :- 06/04/2004                                             */
/***************************************************************************/
/* Desc of Mod   :-                                                        */
/* Modified By   :-                                                        */
/* Date          :-                                                        */
/***************************************************************************/

var intexhibslength;
intexhibslength = 1500
  if (document.frmeditprofile.txtexhibs.value.length > intexhibslength) {
    alert("Your Upcoming Exhibitions text is too long, please enter no more than " + intexhibslength + " characters"); 
		document.frmeditprofile.txtexhibs.value = 
		document.frmeditprofile.txtexhibs.value.substr(0,intexhibslength);
		document.frmeditprofile.txtexhibs.focus();
  } 
  if (document.frmeditprofile.txtexhibscharsleft) {	  
		document.frmeditprofile.txtexhibscharsleft.value = intexhibslength - document.frmeditprofile.txtexhibs.value.length;	
		}
}
/***************************************************************************/
/*                End of function checkexhibslength()                 */
/***************************************************************************/


function checkaboutmelength() {
/***************************************************************************/
/* Special Req's :- None                                                   */
/* Related Files :- None                                                   */
/* Purpose       :- To check that only the permitted number of characters  */
/*               :- are entered into the description                       */
/* Version       :- 1.00                                                   */
/* Author        :- Dennis McDermott                                       */
/* Date          :- 06/04/2004                                             */
/***************************************************************************/
/* Desc of Mod   :-                                                        */
/* Modified By   :-                                                        */
/* Date          :-                                                        */
/***************************************************************************/

var intaboutmelength;
intaboutmelength = 1500
  if (document.frmeditprofile.txtaboutme.value.length > intaboutmelength) {
    alert("Your About Me text is too long, please enter no more than " + intaboutmelength + " characters"); 
		document.frmeditprofile.txtaboutme.value = 
		document.frmeditprofile.txtaboutme.value.substr(0,intaboutmelength);
		document.frmeditprofile.txtaboutme.focus();
  } 
  if (document.frmeditprofile.txtaboutmecharsleft) {	  
		document.frmeditprofile.txtaboutmecharsleft.value = intaboutmelength - document.frmeditprofile.txtaboutme.value.length;	
		}
}
/***************************************************************************/
/*                End of function checkaboutmelength()                 */
/***************************************************************************/
