function submitFormByName(formName) {
	var form = document.getElementById(formName);
	form.submit();
	
}
function openLargeImageWindow(imageUrl){
	url = "/Store/catalog/popupLargeImage.jsp";
	windowUrl = url+"?imageUrl="+imageUrl;
	window.open(windowUrl,'LargeImage','width=400,height=400,scrollbars=no,resizable=no,toolbar=no,status=no,menubar=no,location=no,directories=no,copyhistory=no');
}

function openLargeImageWindowLicensed(imageUrl){
	url = "/Store/catalog/popupLargeImage.jsp";
	windowUrl = url+"?imageUrl="+imageUrl;
	window.open(windowUrl,'LargeImage','width=705,height=584,scrollbars=no,resizable=no,toolbar=no,status=no,menubar=no,location=no,directories=no,copyhistory=no');
}

function openLargeImageWindowLicensedFramed(imageUrl){
	url = "/Store/catalog/popupLargeImageFramed.jsp";
	windowUrl = url+"?imageUrl="+imageUrl;
	window.open(windowUrl,'LargeImage','width=511,height=584,scrollbars=no,resizable=no,toolbar=no,status=no,menubar=no,location=no,directories=no,copyhistory=no');
}

function openLargeImageWindowThemed(imageUrl){
	url = "/Store/catalog/popupLargeImageThemed.jsp";
	windowUrl = url+"?imageUrl="+imageUrl;
	popupImg = new Image();
	popupImg.src = imageUrl;
	popupImg.onload = function() {
		if (this.width == 600) { // for 600 x 600 images
			if (screen.height < 769) {
				window.open(windowUrl,'LargeImage','width=650,height=590,scrollbars=yes,toolbar=no,status=no,menubar=no,location=no,directories=no,copyhistory=no');
			} else {
				window.open(windowUrl,'LargeImage','width=650,height=690,scrollbars=no,toolbar=no,status=no,menubar=no,location=no,directories=no,copyhistory=no');
			}
		}
		else {  // for 510 x 660 images
			if (screen.height < 769) {
				window.open(windowUrl,'LargeImage','width=560,height=590,scrollbars=yes,toolbar=no,status=no,menubar=no,location=no,directories=no,copyhistory=no');
			} else {
				window.open(windowUrl,'LargeImage','width=560,height=765,scrollbars=no,toolbar=no,status=no,menubar=no,location=no,directories=no,copyhistory=no');
			}
		}
	}
}

function winOpen(type){
	var url;
	if (type=='restriction') {
		url = "/Store/conditions/crPopup.jsp";
	}
	else if (type=="TandC") {
		url = "/Store/conditions/popup.jsp";
	}
	else if (type="freeShipping") {
		url="/Store/support/faq/shipping/";
	}
	pop = window.open(url,'Information','screenX=0,left=0,screenY=0,top=0,width=650,height=500,scrollbars=yes');
	pop.focus();
}

function fillBox(arg,line) {
	if (document.getElementById(line).value == null || document.getElementById(line).value < 1   ) {
		document.getElementById(line).value=1;
		
		return;
	}
	switch (arg) {
		case -1:
		if (document.getElementById(line).value > 1 && document.getElementById(line).value <= 499) {
			i= parseInt (document.getElementById(line).value) + arg;
			document.getElementById(line).value=i;
		}
		break;
		case 1:
		if (document.getElementById(line).value >= 0 && document.getElementById(line).value < 499) {
			i= parseInt (document.getElementById(line).value) + arg;
			document.getElementById(line).value=i;
		}
		break;
		default:
		if ( document.getElementById(line).value < 1 || document.getElementById(line).value == null ) {
			document.getElementById(line).value=1;
		}
	}
}


function checkIt() {
	var success=true;
	if (isNaN(document.order.value)) {
		alert("The value must be a number between 0 and 10");
		document.order[line].focus();
		success=false;
	}
	if ( success ) {
		document.order.submit();
		display();
	}
}


function editImage(pEditImageSuccessURL) {
	document.getElementById('editImageSuccessURL').value=pEditImageSuccessURL;
	return true;
}
