function swapper (img) {
	document.getElementById("large").src = "/products/0607fw/" + img;
}
function joinFields() {
	wcBuy.custom.value = "Size: " + wcBuy.custom1.value ;
	//+ "\nQty: " + wcBuy.custom2.value;
}
function drawQty(num) {
	var d = '';
	d = '<option value="Quantity">Qty.</option>';
	for (i=1;i<num;i++) {
		//if (i < 10) { i = "0" + i; }
		d += '<option value="' + i + '">' + i + '</option>';
	}
	return d;
}

function resizer() {
//function called in firefox only, look down for IE version
//left, middle, right column, and second flash module ids
	var elmL = document.getElementById('nav');
	var elmM = document.getElementById('midCol');
//find the height of the middle div (usually the longest) and set vars
	var x = elmM.offsetHeight;
	mainColH = x;
//give left and right columns height equal to the middle column
//place the second flash module
	elmL.style.height = mainColH + "px";
}

function checkWholeForm(theForm) {
//alert(theForm);
	var why = "";
	why += checkVisitor(theForm.visitor.value);
	why += checkEmail(theForm.email.value);
	why += checkSubject(theForm.subject.value);    
	why += checkComments(theForm.comments.value);
	if (why != "") {
		 alert(why);
		 return false;
	}
return true;
}
function checkEmail (str) {
	var error="";
	if (str == "") {
	   error = "No email address? We promise, we won't stalk you.\n";
	}
    var emailFilter=/^.+@.+\..{2,3}$/;
    if (!(emailFilter.test(str))) { 
       error = "Remember, only 1 @ and one . are allowed in your email.\n";
    } else {
	//test email for illegal characters
    var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]\%\$\#\!\^\*]/
 		if (str.match(illegalChars)) {
    		error = "Remember, only 1 @ and one . are allowed in your email\n";
    	}
    }
return error;    
}

function checkVisitor (str) {
	var error = "";	
	if (str == "") {
	   error = "You didn't enter a name. Please do, we're looking for that special someone...\n";
	}
    var illegalChars = /\W/; // allow letters, numbers, and underscores
	if (illegalChars.test(str)) {
    error = "Your name contains illegal characters. Here come the cops!\n";
    } 
return error;
}     

function checkSubject (str) {
	var error = "";
	if (str == "") {
		error = "No subject, eh? Why do you want to contact us?\n";
	}
/*
	var illegalChars = /\\/
	if (illegalChars.test(str)) {
		error = "You have entered something that doesn't make us happy: '\'\n";
	}
*/
return error;
}
function checkComments (str) {
	var error = "";
	if (str == "") {
		error = "You're not going to fill out a message? But that's what we live for.\n"
	}
	return error;
}

