function shippingshowhide(value){
	var block = document.getElementById('shippingshowhide');
	if(value == 'yes'){
		block.style.display='block';
	}else{
		block.style.display='hidden';
	}
}
function shippingshowhide2(){
	var block = document.getElementById('shippingshowhide');
		block.style.display='block';
}

function giftshowhide(value){
	var block = document.getElementById('giftshowhide');
	if(value == 'yes'){
		block.style.display='block';
	}else{
		block.style.display='hidden';
	}
}
function giftshowhide2(){
	var block = document.getElementById('giftshowhide');
		block.style.display='block';
}

function showInterstitial(){
	document.getElementById('interstitial').style.display = 'block';
	selects = document.getElementsByTagName('select');
	for(i=0;i<selects.length;i++){
		selects[i].style.visibility = 'hidden';
	}
	setTimeout('document.images["pbar"].src = "/images/loading.gif"', 200);
	scroll(0,0);
}

function hideInterstitial(){
	document.getElementById('interstitial').style.display = 'none';
	selects = document.getElementsByTagName('select');
	for(i=0;i<selects.length;i++){
		selects[i].visibility = 'visible';
	}
}

function printreceipt(orderid){
	var nlocation = '/wineshop/cartreceipt.cfm' + "?orderid=" + orderid;
	window.open(nlocation + "&printable", 'printable', 'width=615,height=600,scrollbars=yes,menubar=yes');
	return false;
}

function printThis(){
	if ( document.location.toString().indexOf('#') != -1 ){
		location = document.location.toString();
		location = substr(0, location.length - 1);
	}else{
		location = document.location.toString();
	}
	if(window.location.search.substring(1)){
		window.open(location + "&printable", 'printable', 'width=615,height=600,scrollbars=yes,menubar=yes');
	}else{
		window.open(document.location.toString() + "?printable", 'printable', 'width=615,height=600,scrollbars=yes,menubar=yes');
	}
}

function checkTextArea(maxsize,element,iderror){
  var supportString = element.value.toString();
  if (supportString.length > (maxsize - 1)) {
  	element.value=element.value.toString().substring(0, maxsize);
	supportString = element.value.toString();
 	document.getElementById(iderror).style.color = 'red';
   	document.getElementById(iderror).innerHTML = ' You have reached the maximum allowable '+maxsize+' characters';
	document.getElementById(iderror).style.color = 'red';
	
	}
	else {
	document.getElementById(iderror).style.color = 'black';
   	document.getElementById(iderror).innerHTML = '';
	document.getElementById(iderror).style.color = 'black';
	}
	
	document.getElementById(iderror).innerHTML = supportString.length + ' ('+maxsize+' characters maximum).';
	
}

function doPopUp(url)
{
	window.open(url, 'WAPopUp', 'toolbar=no,directories=no,status=no,menubar=no,resizable=no,scrollbars=yes,width=560,height=485');
}
