<!-- hide
// JAVASCRIPT INCLUDE FILE - FOR ALL AUCTION PAGES
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];}
}

function toggleDisplay(DOM_Item) {
	if (document.getElementById) {
		thisItem = document.getElementById(DOM_Item).style
		if (thisItem.display == "block") {
			thisItem.display = "none";
		} else {
			thisItem.display = "block";
		}
	}
}

function show(DOM_Item)
{
	if (document.getElementById) // netscape 6+   IE 5+  - make IE 4 compatible
	{
		thisItem = document.getElementById(DOM_Item).style;
		thisItem.display = "block";
	}
}

function hide(DOM_Item)
{
	if (document.getElementById) 
	{
		thisItem = document.getElementById(DOM_Item).style;
		thisItem.display = "none";
	}
}

function viewPhoto(iAuctionID)
{
	sPageURL = "auction_photo.asp?id=" + iAuctionID;
	photoWindow=window.open(sPageURL,"photoWindow","toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=1,top=20,left=20,width=500,height=400");
}

function popupHelp(iHelpItemID)
{
	sPageURL = "help_popup.asp?id=" + iHelpItemID;
	helpWindow=window.open(sPageURL,"helpWindow","toolbar=0,location=0,status=1,menubar=0,scrollbars=1,resizable=1,top=10,left=10,width=500,height=350");
}

function openTerms()
{
	sPageURL = "terms_print.asp";
	termsWindow=window.open(sPageURL,"termsWindow","toolbar=0,location=0,status=1,menubar=0,scrollbars=1,resizable=1,top=10,left=10,width=600,height=500");
}
function creditCardDetails(iMemberID)
{
	sPageURL = "my_account_credit_card.asp?id=" + iMemberID;
	photoWindow=window.open(sPageURL,"creditCardWindow","toolbar=0,location=0,status=1,menubar=0,scrollbars=0,resizable=0,top=200,left=150,width=600,height=250");
}

function trim(strText) 
{
    // get rid of leading spaces
    while (strText.substring(0,1) == ' ')
        strText = strText.substring(1, strText.length);

    // get rid of trailing spaces
    while (strText.substring(strText.length-1,strText.length) == ' ')
        strText = strText.substring(0, strText.length-1);

    return strText;
}

// jumps to a category page, based on the user selection in header
function jumpToCategory()
{
	if ( document.formSearch.category.value == "Select" )
	{
		return false;
	}
	else	//get value of browse drop-down and jump to new page
	{
		window.location="category_view.asp?id=" + document.formSearch.category.options[document.formSearch.category.selectedIndex].value;

	}
}

function stripSpaces(x) {
    while (x.substring(0,1) == ' ') x = x.substring(1);
    return x;
}

function empty(x) { if (x.length > 0) return false; else return true; }


/*
 * Functions added by GG 06/04/2004
 */

function checkStringLength(str,minLen)
{
	if (trim(str).length < minLen) {
		return (false);
	} else {
		return (true);
	}
}

function checkEmail(emailAddress,mailType)
{
	var atIndex  = emailAddress.indexOf('@')
	var dotIndex = emailAddress.indexOf('.',atIndex)
	
	// check 0 < atIndex < dotindex < length
	if( (0 < atIndex) && (atIndex < dotIndex) && (dotIndex < emailAddress.length-1) )
	{
	// first character is a letter and all other are not whitespace
		var firstChar = emailAddress.charAt(0);
	
		if( (firstChar>='a' && firstChar<='z') || (firstChar>='A' && firstChar<='Z') || (firstChar>='0' && firstChar<='9') )
		{
			for(var i=1; i<emailAddress.length; ++i)
			{
				if(emailAddress.charCodeAt(i) <= 0x20)
				{
					if(emailAddress.charAt(i) == ' ') {
						return("  " + mailType + "Email address must not contain spaces.\n");
					} else {
						return("  " + mailType + "Email address must not contain the character \"" + emailAddress.charAt(i) + "\".\n")
					}
				}
			}
			return ("");
		}
		return("  " + mailType + "Email address cannot start with the character \"" + firstChar + "\".\n")
	}
	return("  " + mailType + "Email address invalid.\n")
}

/*
 * Function to write HTML options for a time selection box in the format:-
 *
 *       <option value="8">08:00</option>
 *
 * Parameter passed in is used to specify the selected value, range is from 0 to 23
 */
function writeTimes(selIndex)
{
	var i         = 0;
	var maxCount  = 23;
	var addZero   = "";
	var txtSelect = "";
	
	for (i=0; i <= maxCount; i++)
	{
		if (i < 10) {
			addZero = "0";
		} else {
			addZero = "";
		}

		if (i == selIndex && i != -1) {
			txtSelect = " selected";
		} else {
			txtSelect = "";
		}		
		document.write("<option value=\"" + i + "\"" + txtSelect + ">" + addZero + i + ":00</option>\n");
	}
}

function chkNumericField(formField,numberType,messPrefix)
{
	var formElement = trim(formField.value);

	if (formElement.length == 0) {
		return ("  " + messPrefix + " value is empty.\n");
	} else {					
		if (isANumber(formField.value)) {
			if (numberType == "int") {
				if (Number(formField.value) != parseInt(formField.value,10)) {
					return("  " + messPrefix + " must be a whole number.\n");
				}						
			}
		} else {
			return("  " + messPrefix + " value is not a number.\n");
		}

		if (formElement <= 0) {
			return ("  " + messPrefix + " must be greater than zero.\n");
		}
	}
	return ("");
}

function validatedNumber(string) {
    for (var i=0, output='', valid="0123456789.'"; i<string.length; i++)
       if (valid.indexOf(string.charAt(i)) != -1)
          output += string.charAt(i)
    return output;
}

function isANumber(theElement)
{
  s = theElement;
  if ( (s == "") || (isNaN(Math.abs(s)) && (s.charAt(0) != '#')))
  {
    return false;
  }
  return true;
}

function plural(noun,nounPlural,numberUnits)
{
	var retStr = "";

	switch (noun)
	{
		case "day":
			if (numberUnits > 1) {
				retStr = nounPlural;
			}
		break;
		case "week":
			if (numberUnits > 1) {
				retStr = nounPlural;
			}
		break;
	}

	return (retStr);
}

function browserDetect()
{
	var agt = navigator.userAgent.toLowerCase();

	if ((agt.indexOf('mozilla')!=-1) && ((agt.indexOf('spoofer')==-1) && (agt.indexOf('compatible')==-1))) {
		ns  = true;
		ie  = false;
		ver = parseFloat(navigator.appVersion,10);
	} else if (agt.indexOf("msie") != -1) {
		ie  = true;
		ns  = false;
		s   = navigator.appVersion;
		s   = s.substr(s.indexOf("MSIE")).substr(5);
		ver = parseFloat(s,10)
	}
}
// This function requires three parameters date1 & date2 are in dd/mm/yyyy format
// comparison is evaluation and can be ==, <, <=, >, >=
// returns true or false depending on the comparison required

function compareDates(strdate1,strdate2,comparison)
{
	// Must include the radix of 10 in the parseInt function otherwise can cause
	// erroneous results if string preceeds with a zero eg '08'
	var day1    = parseInt(strdate1.substr(0,2),10);
	var month1  = parseInt(strdate1.substr(3,2),10);
	var year1   = parseInt(strdate1.substr(6,4),10);
	var day2    = parseInt(strdate2.substr(0,2),10);
	var month2  = parseInt(strdate2.substr(3,2),10);
	var year2   = parseInt(strdate2.substr(6,4),10);
	var retStat;

	month1--; // i.e. January is 0
	month2--;

	var date1   = new Date(year1,month1,day1);
	var date2   = new Date(year2,month2,day2);

	eval ("if (date1 " + comparison + " date2) { retStat=true; } else { retStat=false; }");
	return (retStat);
}



//**************************************************************************************

function setCountry(sourceForm, countryCode, sPostCode, sPostCodeLabel, sPostalZIPCode, sPostalZIPCodeLabel, sLookupButton, 
		    sTownCitySelect, sTownCity, sTownCityUKLabel, sTownCityALLLabel, sCountyRegion, sCountryRegionUKLabel, 
		    sCountryRegionALLLabel) 
{
	var theForm	= MM_findObj(sourceForm);
	
	if (countryCode == 'GB')	//default setting
	{
		show(sPostCode);
		show(sPostCodeLabel);
		show(sLookupButton);
		hide(sPostalZIPCode);
		hide(sPostalZIPCodeLabel);

		show(sTownCitySelect);
		hide(sTownCity);
		show(sTownCityUKLabel);
		hide(sTownCityALLLabel);
		
		show(sCountryRegionUKLabel);
		hide(sCountryRegionALLLabel);

		eval('theForm.'+sCountyRegion+'.readOnly=1;');
		eval('theForm.'+sCountyRegion+'.value="";');
	}
	else
	{
		hide(sPostCode);
		hide(sPostCodeLabel);
		hide(sLookupButton);
		show(sPostalZIPCode);
		show(sPostalZIPCodeLabel);

		hide(sTownCitySelect);
		show(sTownCity);
		
		hide(sTownCityUKLabel);
		show(sTownCityALLLabel);

		hide(sCountryRegionUKLabel);
		show(sCountryRegionALLLabel);
		
		eval('theForm.'+sCountyRegion+'.readOnly=0;');
		eval('theForm.'+sCountyRegion+'.value="";');
	}
}




//**************************************************************************************

function js_SetValue(theForm, theElement, newValue)
{
	document.forms[theForm].elements[theElement].value=newValue;
}

function js_EnableSelect(theForm, theSelect)
{
	// Enable target drop down
	document.forms[theForm].elements[theSelect].disabled=false;
}

function js_AddSelectOption(theForm, theSelect, selText, selValue)
{
	var opt = new Option(selText, selValue);
	var sel = document.forms[theForm].elements[theSelect];
	sel.options[sel.options.length] = opt;
}

function js_DeleteSelectOptions(theForm,theSelect)
{
	// Clear drop down contents
	document.forms[theForm].elements[theSelect].length = 0;
}

function js_JumpToSelectOption(theForm, theSelect, theOptionValue)
{

	for(var i = 0; i < document.forms[theForm].elements[theSelect].length; i++)
	{
	        
	    if (document.forms[theForm].elements[theSelect].options[i].value == theOptionValue)
	    	document.forms[theForm].elements[theSelect].options[i].selected = true;
	    		     
	}


}

function writeSelectFieldValues(maxValue)
{
	
	// zero to maxValue
	var i         = 0;
	
	var addZero   = "";
	var txtSelect = "";
	
	for (i=0; i <= maxValue; i++)
	{
		if (i < 10) {
			addZero = "0";
		} else {
			addZero = "";
		}

		//if (i == selIndex && i != -1) {
		//	txtSelect = " selected";
		//} else {
		//	txtSelect = "";
		//}		
		document.write("<option value=\"" + i + "\"" + txtSelect + ">" + addZero + i + "</option>\n");
	}
}



//**************************************************************************************

// IMAGE ROLLOVER ROUTINES

function swapTabImage(imgNameID,imgNewImageFilenameX)
{
	if(document.images)document.images[imgNameID].src=imgNewImageFilenameX;
}


function preloadImages()
{
	var toW='<layer top="-100" left="0" visibility="hide"><div style="position:absolute; top:-100px; left:0px; visibility:hidden">';
	for(ii=0;ii<arguments.length;ii++)toW+='<img src="'+arguments[ii]+'" height="10" width="10">';
	toW+='</div></layer>';
	document.write(toW);
}


function changeChildTDs(eTR, sNewTDClassName)
{
// take a TR element and change the className of it's children TDs to new className

	childrenTDs = eTR.childNodes;		
	 for(var i = 0; i < childrenTDs.length; i++)
	 {
		//if (childrenTDs[i].tagName == "TD")
			childrenTDs[i].className = sNewTDClassName;
	 }	
}

//-- END -->