$(function()
{
	$("#footer p span").html(showYear());
});

function showYear()
{
	now = new Date();
	return now.getFullYear();
}

function setCurrency(c)
{
	//document.cookie = "currency=" + c;
	url = document.URL;
	pos=url.indexOf('?_$ja=');
	if (pos>-1)
	{
		pos2=url.indexOf('&');
		if (pos2>-1) url=url.substring(0,pos)+"?"+url.substring(pos2+1);
		else url=url.substring(0,pos);
	}
	if (url.indexOf('?')>-1)
	{
		pos=url.indexOf('currency=');
		if (pos>-1)
		{
			url=url.replace('currency=','currency2=');
			document.location = url + "&currency=" + c;
		}
		else document.location = url + "&currency=" + c;
	}
	else if (url.indexOf('?')==-1 && url.indexOf('HDFront')>-1)
	{
		document.newform.currency.value=c;
		document.newform.submit();
	}
	else if (url.indexOf('?')==-1 && url.indexOf('HDSearchDate')>-1)
	{
		document.form.currency.value=c;
		document.form.submit.click();
	}
	else
	{
		if (url.indexOf('currency=')>-1)
			document.location = url.substring(0, url.indexOf('currency=')) + "currency=" + c;
		else
		{
		  if (c=='usdollar') c='usd';
		  lastchar=url.length;
		  if (url.indexOf('.htm')==-1 && url.indexOf('servlet')==-1)
			document.location = url + "index_" + c+".htm";
		  else
		  {
		    if (url.indexOf('index_')>-1)
		    {
			if (c=='gbp')
			{
			   pos=url.indexOf('index_');
			   document.location = url.substring(0,pos);		  	   
			}
			else
		  	{
			   pos=url.indexOf('index_');
	  	  	   document.location = url.substring(0,pos)+ "index_" + c+".htm";  
			}
		    }
		    else if (url.indexOf('.htm')>-1)
		    {
			pos=url.indexOf(".htm");
			if (c=='gbp')
			{
			   pos2=url.indexOf('_usd.htm');
			   if (pos2>-1) document.location = url.substring(0,pos2)+".htm";  		  	   
			   else 
			   {	
				pos2=url.indexOf('_euro.htm');
				if (pos2>-1) document.location = url.substring(0,pos2)+".htm";  		  	   
			   }
			}
			else
			{
			   pos2=url.indexOf('_usd.htm');
			   if (pos2>-1) document.location = url.substring(0,pos2)+"_"+c+".htm";  		  	   
			   else 
			   {	
				pos2=url.indexOf('_euro.htm');
				if (pos2>-1) document.location = url.substring(0,pos2)+"_"+c+".htm";  		  	   
				else document.location = url.substring(0,pos)+"_"+c+".htm";
			   }
			}
		    }
		    else
			document.location = url + "?currency=" + c;
		  }
		}
	}
}

function createDropdown(t, b, e, s)
{
	f=document.form;
	for (i=b; i<=e; i++)
	{
		len = f[t].length++;
		f[t].options[len].value = i;
		f[t].options[len].text = i;
		if (i==s)
		{
			f[t].options[len].selected = true;
		}
	}
}

function createDropdownID(t, b, e)
{
	var option = '';
	for (i=b; i<=e; i++)
	{
		option += '<option value="' + i + '">' + i + '</option>';
	}
	$("#" + t).html(option);
}

function openCalendar(url)
{
	var params="menubar=no,toolbar=no,location=no,directories=no,status=yes,scrollbars=no,resizable=no,dependent,top=0,left=0,width=680,height=210";
	popupWin = window.open(url, 'calendar',params);
	popupWin.focus();
}

function sameAddress()
{
	f = document.form;
	$("#ccaddress").val($("#address").val());
	$("#cccity").val($("#custcity").val());
	$("#ccstate").val($("#county").val());
	$("#ccpostcode").val($("#postcode").val());
	f.cccountry.selectedIndex = f.country.selectedIndex;
}

function clearAddress()
{
	$("#ccaddress").val("");
	$("#cccity").val("");
	$("#ccstate").val("");
	$("#ccpostcode").val("");
}

function openWindow(url, w, h, s)
{
	var params="menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars="+s+",resizable=yes,dependent,top=0,left=0,width="+w+",height="+h;
	popupWin = window.open(url, 'popup',params);
	popupWin.focus();
}

function printPage()
{
	if (window.print)
	{
		window.print();
	}
	else
	{
		alert("Sorry, your browser doesn't support this feature.");
	}
}