function validateCheckoutData(current_form)
{
	var Msg="";
	var reg_exp;
	var error=false;

	var Name
	var CardNumber
	

	// ---------------------------------------------------------//
	// ---- Ship Address field validation ----------------------//
	var adddress=current_form.ship_Address1.value;
	if (adddress==null || adddress=="") 
	{ 
		error=true;
		Msg=Msg+"Shipping Address"+"\n\n";
	}
	// ---------------------------------------------------------//

	// ---------------------------------------------------------//
	// ---- Ship City validation -------------------------------//
	var city=current_form.ship_City.value;
	reg_exp=/^[a-z][a-z]*((( *- *)|(\. *)| +)[a-z][a-z]*((\. *)| *)?)*$/i;
	if (!reg_exp.test(city)) 
	{ 
		error=true;
		Msg=Msg+"Shipping City"+"\n\n";
	}
	// ---------------------------------------------------------//

	// ---------------------------------------------------------//
	// ---- Ship State validation ------------------------------//
	var state=current_form.ship_State.value;
	reg_exp=/^[a-z][a-z]$/i;
	if (!reg_exp.test(state)) 
	{ 
		error=true;
		Msg=Msg+"Shipping State"+"\n\n";
	}
	// ---------------------------------------------------------//

	// ---------------------------------------------------------//
	// ---- Ship ZIP validation --------------------------------//
	var zip=current_form.ship_Zip.value;
	reg_exp=/^[0-9]{5}$/i;
	if (!reg_exp.test(zip)) 
	{ 
		error=true;
		Msg=Msg+"Shipping Zip"+"\n\n";
	}
	// ---------------------------------------------------------//

//------------------------------------------------------------------------//
// Payment / Billing validation

	// ---------------------------------------------------------//
	// ---- Card Name field validation -------------------------//
	Name=current_form.card_HolderName.value;
	if (Name==null || Name=="") 
	{ 
		error=true;
		Msg=Msg+"Cardholder Name"+"\n\n";
	}
	// ---------------------------------------------------------//


	// ---------------------------------------------------------//
	// ---- Card Number field validation -----------------------//
	CardNumber=current_form.card_CardNumber.value;
	reg_exp=/^[0-9]{15}/i;
	if ( !reg_exp.test(CardNumber) ) 
	{ 
		error=true;
		Msg=Msg+"Card Number"+"\n\n";
	}
	// ---------------------------------------------------------//
	

	// ---------------------------------------------------------//
	// ---- Card Address field validation ----------------------//
	adddress=current_form.card_Address.value;
	if (adddress==null || adddress=="") 
	{ 
		error=true;
		Msg=Msg+"Payment Address"+"\n\n";
	}
	// ---------------------------------------------------------//

	// ---------------------------------------------------------//
	// ---- Card City validation -------------------------------//
	city=current_form.card_City.value;
	reg_exp=/^[a-z][a-z]*((( *- *)|(\. *)| +)[a-z][a-z]*((\. *)| *)?)*$/i;
	if (!reg_exp.test(city)) 
	{ 
		error=true;
		Msg=Msg+"Payment City"+"\n\n";
	}
	// ---------------------------------------------------------//

	// ---------------------------------------------------------//
	// ---- Card State validation ------------------------------//
	state=current_form.card_State.value;
	reg_exp=/^[a-z][a-z]$/i;
	if (!reg_exp.test(state)) 
	{ 
		error=true;
		Msg=Msg+"Payment State"+"\n\n";
	}
	// ---------------------------------------------------------//

	// ---------------------------------------------------------//
	// ---- Ship ZIP validation --------------------------------//
	zip=current_form.card_Zip.value;
	reg_exp=/^[0-9]{5}$/i;
	if (!reg_exp.test(zip)) 
	{ 
		error=true;
		Msg=Msg+"Payment Zip"+"\n\n";
	}
	// ---------------------------------------------------------//



	// ---------------------------------------------------------//
	if ( error )
	{
		alert("Please correct following information:\n\n"+Msg);
		return false;
	} else {
		current_form.submit();
	}
	// ---------------------------------------------------------//

}



function Show(link, width, height, scrollchoice)
{
		var aWin;
		var win_dims;
		
		var win_left=(screen.availWidth/2)-(width/2);
		var win_top=(screen.availHeight/2)-(height/2);

		if ( width>0 && height>0 )
		{		
			win_dims="width="+width+",height="+height+",scrollbars="+scrollchoice+",resizable=no"+",left="+win_left+",top="+win_top
		}
		
		aWin = window.open(link,"view",win_dims);
		aWin.focus ();
}



function Close()
{
	self.close();
}

