function openWindowSize(sName, sURL, sOptions, iLeft, iTop,	iWidth,	iHeight)
{
	if (sURL.indexOf("?") <	0)
		sURL +=	"?";
	else
		sURL +=	"&";

	if (sName != "login")
		sURL +=	"MJ=" +	document.forms[0].MJ.value;

	if (sOptions != "")
		sOptions += ",";

	hWindow	= window.open(sURL,	sName, sOptions	+ 'top=' + iTop	+ ',left=' + iLeft + ',screenX=' + iLeft + ',screenY=' + iTop +	',width=' +	iWidth + ',height='	+ iHeight);
	hWindow.focus();
}

function openWindow(sName, sURL, sOptions)
{
var	iDefWidth  = 800;
var	iDefHeight = 600;

	openWindowSize(sName, sURL, sOptions ? sOptions : 'scrollbars,status,resizable', ((screen.availWidth - iDefWidth) / 2), ((screen.availHeight - iDefHeight) / 3), iDefWidth, iDefHeight);
}

function reloadWindow()
{
}

function gotoScreen(sScreen)
{
	document.forms[0].screen.value = sScreen;
	document.forms[0].submit();
	return;
}

function reloadWindow()
{
	performSearch(document.forms[0].screen.value, 'search');
}

function performSearch(sScreen, sAction)
{
	/*this part is to check if the lot search has suffix and cut the suffix - KL*/
	//works only on live as we are not using forms[0].isalelotnumber on dev.
//	var temp_char;
//	var check;
//	temp_char = document.forms[0].iSalelotnumber.value.charAt(document.forms[0].Crit20.value.length-1);
//	check=temp_char.match(/[a-zA-Z]/);
//	if (check != null)
//		document.forms[0].iSalelotnumber.value=document.forms[0].iSalelotnumber.value.slice(0,document.forms[0].iSalelotnumber.value.length-1);
	//end of update - KL
	document.forms[0].saction.value = sAction;
	if (document.forms[0].screen)
		document.forms[0].screen.value = sScreen;
	document.forms[0].submit();
	return;
}

function submitPage(sAction)
{
	document.forms[0].saction.value = sAction;
	document.forms[0].submit();
	return;
}

function checkKey(o, e)
{
	var charCode = (navigator.appName == "Netscape") ? e.which : e.keyCode;
	if ( charCode == 13 )
	{
		submitPage('search');
	}
	return true;
}

function lotFind(e)
{
var sLotFind;
var sURL;

	if (e)
	{
	var charCode = (navigator.appName == "Netscape") ? e.which : e.keyCode;
		if ( charCode != 13 )
			return true;
	}

	sLotFind = document.forms[0].LotFind.value;
	if (sLotFind == "")
		return true;

	sURL = "http://" + document.location.hostname + document.forms[0].SelfURL.value + "?screen=MySearchResults&saction=search&sFreeText=" + sLotFind;
	if (document.forms[0].MJ.value != "")
		sURL += "&MJ=document.forms[0].MJ.value";
	document.location.href = sURL;
	return false;
}

function SaleQuickLink(e)
{
	var Salenum;
	var sURL;

	if (e)
	{
	var charCode = (navigator.appName == "Netscape") ? e.which : e.keyCode;
		if ( charCode != 13 )
			return true;
	}

	Salenum=document.forms[0].SaleQLink.value;
	if (Salenum == "")
		return true;

	sURL = "http://" + document.location.hostname + document.forms[0].SelfURL.value + "?screen=catalogue&iSaleNo=" + Salenum;
	if (document.forms[0].MJ.value != "")
		sURL += "&MJ=document.forms[0].MJ.value";
	document.location.href = sURL;
	return false;
}


currentDate = new Date();
switch (currentDate.getMonth()) {
 case 0:
  currentMonth="January";
  break;
 case 1:
  currentMonth="February";
  break;
 case 2:
  currentMonth="March";
  break;
 case 3:
  currentMonth="April";
  break;
 case 4:
  currentMonth="May";
  break;
 case 5:
  currentMonth="June";
  break;
 case 6:
  currentMonth="July";
  break;
 case 7:
  currentMonth="August";
  break;
 case 8:
  currentMonth="September";
  break;
 case 9:
  currentMonth="October";
  break;
 case 10:
  currentMonth="November";
  break;
 case 11:
  currentMonth="December";
}
 
currentDateString = currentDate.getDate()+" "+currentMonth+" "+currentDate.getFullYear();
	var isMac = (navigator.userAgent.indexOf("Mac") != -1);
	var isSaf = (navigator.userAgent.indexOf("Safari") != -1);

	isIE=document.all; //for the next function of the image swapping
	img1= new Image();   //caching the images to be swapped
	img1.src="/images/salesb.gif";
	img2= new Image(); 
	img2.src="/images/departmentsb.gif";
	img3= new Image(); 
	img3.src="/images/servicesb.gif"; 
	img4= new Image(); 
	img4.src="/images/locationsb.gif"; 

function swap_img(which,to) //simple functions for swapping images -KL
{
	if (isIE) //for IE
		document.all[which].src = to;
	else //for NN
		document.getElementById(which).src = to;
}
function swap_back(which,to)
{
	if (isIE) //for IE
		document.all[which].src = to;
	else //for NN
		document.getElementById(which).src = to;
}

function LogOff() //website logoff
{
var ckyDate = new Date;

	ckyDate.setDate(ckyDate.getDate() -1);
	var path = document.location.pathname.substr(0,document.location.pathname.length-20);
	document.cookie = "MJ=; path=" + path + "; expires=" + ckyDate.toGMTString() + ';';
	window.location.href="http://" + window.location.host + window.location.pathname + "?screen=logoff";
}

function dispalayEmail(address,PosLeft,PosTop)
{
	trimRight=address.indexOf('.com');
    address=address.slice(7,trimRight+4);
	document.getElementById("EmailAddress").innerHTML = address;
    document.getElementById("EmailAddress").style.right=12;
    document.getElementById("EmailAddress").style.top=PosTop+16;
	document.getElementById("EmailAddress").style.visibility = "visible";
}
function hideEmail()
{
	document.getElementById("EmailAddress").style.visibility = "hidden";
}

function getTop(elemID) {
    var offsetTrail = document.getElementById(elemID);
    var offsetTop = 0;

    while (offsetTrail) {
		
        offsetTop += offsetTrail.offsetTop;
        offsetTrail = offsetTrail.offsetParent;
    }
    if (navigator.userAgent.indexOf("Mac") != -1 && 
        typeof document.body.leftMargin != "undefined") {
        offsetLeft += document.body.leftMargin;
        offsetTop += document.body.topMargin;
    }
    return offsetTop;
}

function getLeft(elemID) {
    var offsetTrail = document.getElementById(elemID);
    var offsetLeft = 0;
    while (offsetTrail) {
        offsetLeft += offsetTrail.offsetLeft;
        offsetTrail = offsetTrail.offsetParent;
    }
    if (navigator.userAgent.indexOf("Mac") != -1 && 
        typeof document.body.leftMargin != "undefined") {
        offsetLeft += document.body.leftMargin;
        offsetTop += document.body.topMargin;
    }
    return offsetLeft;
}

function goBack()
{
var vi = -1;

   if (document.forms[0].back)
      vi = parseInt(document.forms[0].back.value, 10);

   window.history.go(vi); 
}

//Now we're checking whether the browser has Flash for the banner, UK map and Erez images
	var MM_contentVersion = 5;
	var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
	if ( plugin ) 
	{
		var words = navigator.plugins["Shockwave Flash"].description.split(" ");
	    for (var i = 0; i < words.length; ++i)
		{
			if (isNaN(parseInt(words[i])))
				continue;
			var MM_PluginVersion = words[i]; 
	    }
		var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
	}
	else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 && (navigator.appVersion.indexOf("Win") != -1)) 
		{
			document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n'); //FS hide this from IE4.5 Mac by splitting the tag
			document.write('on error resume next \n');
			document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n');
			document.write('</SCR' + 'IPT\> \n');
		}
