function submitForm(form) {
	$(form).submit();
	return false;
}
function submitCheckout(action) {
	var frm1 = $('checkoutform');
	var frm2 = $('mainform');
	var anum = parseInt(action);
	if (anum == 0) {
		if (!changechecker(frm1)) {
			frm1.mode.value = 'update';
			frm1.submit();
		} else {
			frm2.mode.value = 'checkout';
			frm2.submit();
		}
	} else if (anum == 1) {
		frm1.mode.value = 'update';
		frm1.submit();
	} else if (anum == 2) {
		if (checkform(frm2)) {
			frm2.mode.value = 'go';
			frm2.submit();
		}
	} else if (anum == 3) {
		if (isvalidcard(frm2)) frm2.submit();
	}
	return false;
}
function submitProduct(form, func) {
	var frm = $(form);
	if (func(frm)) frm.submit();
	return false;
}
function submitButtonEvent(form, func, event) {
	var k = (window.event) ? window.event.keyCode : ((event) ? event.which : true);
	return (k == 13) ? submitProduct(form, func) : true;
}
function submitSearch() {
	return ($F('s0') == 'ENTER KEYWORDS' || $F('s0') == '') ? false : true;
}
function submitEmail() {
	return ($F('n0') == 'ENTER EMAIL' || $F('n0') == '') ? false : true;
}
function clickSearch(blur) {
	if (blur == true) {
		if ($F('s0') == '') $('s0').value = 'ENTER KEYWORDS';
	} else {
		if ($F('s0') == 'ENTER KEYWORDS') $('s0').value = '';
	}
}
function clickEmail(blur) {
	if (blur == true) {
		if ($F('n0') == '') $('n0').value = 'ENTER EMAIL';
	} else {
		if ($F('n0') == 'ENTER EMAIL') $('n0').value = '';
	}
}

function openImageWindow(title, image, width, height) {
	var html = '<html>\n<head>\n';
	html += '<title>Hangers Direct - '+title+'</title>\n';
	html += '<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\n';
	html += '<style type="text/css">\n';
	html += 'body { margin:0px; padding:0px; }\n';
	html += '</style>\n';
	html += '</HE' + 'AD>\n';
	html += '</BO' + 'DY onunload="self.close();">\n';
	html += '<div align="center"><img src="'+image+'" width="'+width+'" height="'+height+'" alt="'+title+'" /></div>\n';
	html += '</BO' + 'DY>\n';
	html += '</HT' + 'ML>';
	var windowWidth = width+30;
	var windowHeight = height+30;
	var leftPos = ((screen.availWidth/2)-(windowWidth/2));
	var topPos = ((screen.availHeight/2)-(windowHeight/2));
	var params = "width=" + windowWidth + ",height=" + windowHeight + ",location=no,toolbar=no,menubar=yes,scrollbars=yes,status=no,resizable=yes,left=" + leftPos + ",top=" + topPos + ",screenX=" + leftPos + ",screenY=" + topPos;
	var imageWin = window.open('','imageContent',params);
	if (imageWin) {
		imageWin.document.open();
		imageWin.document.write(html);
		imageWin.document.close();
	} else {
		alert("You have popups disabled. Please enable this function and try again.");
	}
}
function openPrintWindow(title, url) {
	if (document.getElementById != null) {
		var html = '<html>\n<head>\n';
		html += '<title>Hangers Direct - '+title+'</title>\n';
		html += '<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\n';
		html += '<base href="'+unescape(url)+'"/>\n';
		html += '<style type="text/css">\n';
		html += '<!--\n';
		html += '@import url(\"common/css/global.css\");\n';
		html += '@import url(\"common/css/window.css\");\n';
		html += '-->\n';
		html += '</style>\n';
		html += '</HE' + 'AD>\n';
		html += '</BO' + 'DY onunload="self.close();">\n';
		html += '<table width="100%"  border="0" cellspacing="0" cellpadding="0" style="margin-bottom:20px">\n';
		html += ' <tr>\n';
		html += '  <td width="267"><img src="/images/new/logo_small.gif" alt="Hangers Direct" width="267" height="55"></td>\n';
		html += '  <td valign="top"><div style="border-bottom:1px solid #B2B2B2;"><img src="/images/1x1.gif" width="1" height="24"></div></td>\n';
		html += '  <td width="75" valign="top"><a href="javascript:window.print();"><img src="/images/printPage_print.gif" width="75" height="25" border="0"></a></td>\n';
		html += '  <td width="65" valign="top"><a href="javascript:self.close();"><img src="/images/printPage_close.gif" width="65" height="25" border="0"></a></td>\n';
		html += ' </tr>\n';
		html += '</table>\n';
		var printReadyElem = $("print_area");
		if (printReadyElem) {
				html += printReadyElem.innerHTML;
		} else {
			alert("The page could not be rendered properly.");
			return;
		}
		html += '</BO' + 'DY>\n';
		html += '</HT' + 'ML>';
		var windowWidth = 640;
		var windowHeight = 420;
		var leftPos = ((screen.availWidth/2)-(windowWidth/2));
		var topPos = ((screen.availHeight/2)-(windowHeight/2));
		var params = "width=" + windowWidth + ",height=" + windowHeight + ",location=no,toolbar=no,menubar=yes,scrollbars=yes,status=no,resizable=yes,left=" + leftPos + ",top=" + topPos + ",screenX=" + leftPos + ",screenY=" + topPos;
		var printWin = window.open('','printContent',params);
		if (printWin) {
			printWin.document.open();
			printWin.document.write(html);
			printWin.document.close();
		} else {
			alert("You have popups disabled. Please enable this function and try again.");
		}
	} else {
		alert("Your browser does not support this function.");
	}
}
function addBookmark(title, url) {
	url = url || location.href;
	title = title || document.title;
	// firefox
	if (window.sidebar) {
		window.sidebar.addPanel(title, url, "");
	// opera
	} else if(window.opera && window.print) {
		var elem = document.createElement('a');
		elem.setAttribute('href',url);
		elem.setAttribute('title',title);
		elem.setAttribute('rel','sidebar');
		elem.click();
	// ie
	} else if(document.all) {
		window.external.AddFavorite(url, title);
	} else {
		alert("Your browser does not support this function.");
	}
}
function sendEmail(url) {
	url = url || location.href;
	mail_str = "mailto:?subject=This is a great resource for all types of clothes Hangers Direct";
	mail_str += "&body=Save to Favorites. Over 150 styles to choose from in inventory or customize and logo your hangers. Click here: "+url;
	location.href = mail_str;
}
function openSelectLink(string) {
	if (string !== "#") {
		location.href = string;
	}
}