
function Form_Validator(Form) {
	if (Form.orderid.value == "") {
    alert("Please enter the Order ID / Invoice No.");
    Form.orderid.focus();
    return (false);
  }
	if (Form.amount.value == "") {
    alert("Please enter the amount to be paid. Remember that VAT must be included.");
    Form.amount.focus();
    return (false);
  }
}

function PaymentSite(merchantno,amnt,orderid,sessionid,tunnelurl){
	//alert(merchantno);

	//action="https://pay.dandomain.dk/securetunnel.asp?merchantnumber=<? echo $HTTP_SESSION_VARS["merchantnumber"] ?>&SessionID=<? echo urlencode(getenv("HTTP_COOKIE")); ?>&tunnelurl=http://www.deres-domæne.dk/ex2php.php"

	var site="https://pay.dandomain.dk/securetunnel.asp?merchantnumber="+merchantno+"&amount="+amnt+"&orderid="+orderid+"&sessionid="+sessionid+"&tunnelurl="+tunnelurl;
	var width=650;
	var height=490;
	var left=(screen.width-width)/2;
	var top=(screen.height-height)/2;

	window.open(site,"popup","left="+left+",top="+top+",screenX="+left+",screenY="+top+",width="+width+",height="+height+",scrollbars=yes,resizable=no,status=yes");
}

function ValidateCCNumber(){
	var val=document.getElementById('CardNumber').value;
	if(val.match(/^\d+$/) && (val.length >= 13 && val.length <= 16)) {
		document.getElementById('CCNoChk').style.visibility = "visible";
	}
	else {
		document.getElementById('CCNoChk').style.visibility = "hidden";
	}
}

function ValidateCVC(){
	var val=document.getElementById('CardCVC').value;
	if(val.match(/^\d+$/) && val.length==3) {
		document.getElementById('CCCvCChk').style.visibility = "visible";
	}
	else {
		document.getElementById('CCCvCChk').style.visibility = "hidden";
	}
}

function ValidateExpiry(){
	vMonth=document.getElementById('ExpireMonth').value;
	vYear=document.getElementById('ExpireYear').value;

	if(vMonth!='0' && vYear!='0') {
		document.getElementById('CCExpiryChk').style.visibility = "visible";
	}
	else {
		document.getElementById('CCExpiryChk').style.visibility = "hidden";
	}
}

/*response.write "<!--" & VbCrLf

response.write "function PayMentSite() {" & VbCrLf

response.write "side = 'https://pay.dandomain.dk/securetunnel.asp?merchantnumber="&Session("merchantnumber")&"&amount="&Session("amount")&"&orderid="&Session("orderid")&"&sessionid="&Server.URLEncode(sessionIDStr)&"&tunnelurl=http://"&Request.ServerVariables("server_name")&"/admin/betaling2.asp?merchantnumber="&Session("merchantnumber")&"&amount="&Session("amount")&"&currencyid="&Session("currencyid")&"';" & VbCrLf

response.write "width = 500;" & VbCrLf

response.write "height= 450;" & VbCrLf

response.write "var left = (screen.width-width)/2;" & VbCrLf

response.write "var top = (screen.height-height)/2;" & VbCrLf

response.write "window.open(side,""popup"",""left=""+left+"",top=""+top+"",screenX=""+left+"",screenY=""+top+"",width=""+width+"",height=""+height+"",scrollbars=yes,resizable=no,status=yes"");" & VbCrLf

response.write "}" & VbCrLf

'response.write "PayMentSite();" & VbCrLf'

response.write "//-->" & VbCrLf*/
