function sendreprint(send) {
	if (send == 0) {
		closerr();
		return;}
		//check to see if the option is available
		var opchoice = $('rselect').value;
		if (!(slook[sk+";"+opchoice])){
			//requesting reprint of a shirt in stock
			if ($('buymsg')) {var m = $('buymsg'); while (m.childNodes.length >=1) {m.removeChild(m.firstChild);}} else {var m = document.createElement('div');
			m.setAttribute('id','buymsg');
			m.setAttribute('class','buymessage');
			}
			m.appendChild(document.createTextNode(opchoice+" is presently available.  Please "));
			for (var i=0, il=ssel.length; i<il; i++){
			if (sk == ssel[i].form.action.substring(ssel[i].form.action.lastIndexOf('+')+1)) {var ops = ssel[i].options;for (var o=0, ol=ops.length; o<ol; o++){
				if (ops[o].value == opchoice) {ssel[i].selectedIndex =ops[o].index;
				var l=document.createElement('a');
				l.setAttribute('href','javascript:submitfromrestock();');
				l.appendChild(document.createTextNode('add to cart'));
				m.appendChild(l);
				m.appendChild(document.createTextNode('.  If you are still having trouble, please contact '));
				var l2=document.createElement('a');
				l2.setAttribute('href','http://store.glennz.com/service.html');
				l2.appendChild(document.createTextNode('customer service'));
				m.appendChild(l2);
				m.appendChild(document.createTextNode('.'));
				$('reprintrequest').appendChild(m);		
				}
			}
			
			}
			}
			return;}
	var posturl="http://www.whatabeets.com/glennz/reprint.php";
	var errortext = '';
	var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	var address = $('reprintrequest').email.value;
	if (reg.test(address) == false) {
		if ($('emailerror')) {var msg = $('emailerror'); while (msg.childNodes.length >=1) {msg.removeChild(msg.firstChild);}} else {
		var msg = document.createElement('div');
		msg.setAttribute('id','emailerror');
		msg.setAttribute('class','alertmsg');};
		msg.appendChild(document.createTextNode("Please enter a valid email address to request a reprint."));
		$('reprintrequest').appendChild(msg);
		return;}	$('reprintrequest').setAttribute('action',posturl+'?url='+window.location.href);
	$('rdesign').setAttribute('value',sk);
	$('reprintrequest').submit();
}

function closerr(){
	if ($('emailerror')) {var msg = $('emailerror'); while (msg.childNodes.length >=1) {msg.removeChild(msg.firstChild);}};
	if ($('buymsg')) {var m = $('buymsg'); while (m.childNodes.length >=1) {m.removeChild(m.firstChild);}};	
	if ($('oos')) {var n= $('oos'); while (n.childNodes.length >=1) {n.removeChild(n.firstChild);}};
	var rr = $('reprint');
	Element.hide(rr);
}

function checkitem(){
	var f = $(sk+'form').Size;
	var i = f.selectedIndex;
	if (f.options[i].text.search("out of stock")>0) {
		if ($('oos')) {var n= $('oos'); while (n.childNodes.length >=1) {n.removeChild(n.firstChild);}} else {
		var n = document.createElement('div');
		n.setAttribute('id','oos');
		$('reprintrequest').insertBefore(n,$('reprintrequest').firstChild);	
		}
		var rs = $('rselect');
		for (var o=0, ol=rs.length; o<ol; o++){
			if (f.value == rs[o].value) {
			rs.selectedIndex = rs[o].index;
			}
		}
		n.appendChild(document.createTextNode(rs.value+" is not available - fill out the form below to request a reprint"));
		repr('reprint','imgdsp');
		return false;
	} else {
	return true;}

}

function submitfromrestock(){
	$(sk+'form').submit();
}

var ssel = document.getElementsByTagName('select');for (i=0, il=ssel.length; i <il; i++){repsel = ssel[i].cloneNode(true);repsel.setAttribute('id','rselect');repsel.setAttribute('name','rselect');var rslabel = document.createElement('label'); rslabel.setAttribute('for','rselect');rslabel.appendChild(document.createTextNode('Reprint Size'));$('rsel').appendChild(rslabel);$('rsel').appendChild(repsel);sk = ssel[i].form.action.substring(ssel[i].form.action.lastIndexOf('+')+1);
var skform = ssel[i].form; 
skform.setAttribute('id',sk+'form'); 
skform.setAttribute('onsubmit','return checkitem();'); 
for (var s=0, sl=skform.childNodes.length; s<sl; s++) {
if (skform.childNodes[s].textContent == "\nSize "){
skform.removeChild(skform.childNodes[s]);
break;
}
}
var ops = ssel[i].options;for (o=0, ol=ops.length; o <ol; o++){if (slook[sk+";"+ops[o].value]) {ops[o].text = ops[o].text.replace(ops[o].value,ops[o].value+"-out of stock");}}for (o=0, ol=ops.length; o <ol; o++){if (ops[o].text.search("out of stock")>0){var rn = ops[o];rn.parentNode.appendChild(rn);o=o-1;ol=ol-1;}ssel[i].selectedIndex = 0;}}