//==========================javascript collections BEGIN=======================================

var bValidOrder;
var f;

function input_clear(page) {	
var f = document.form1;
	if (page == 'logon') {	
		f.editusername.value='';
		f.editpassword.value='';
		/*change username to editusername/editpassword*/
		f.editusername.focus();
	}
	if (page == 'password') {
		f.poldpwd.value='';
		f.pnewpwd1.value='';
		f.pnewpwd2.value='';
		f.poldpwd.focus();
	}
}

function ChangeDep() {
    var url = "product_sizechart.asp?seldep="+document.all('seldep').value;
    document.form1.action = url;
    document.form1.target="_top";
    document.form1.submit();
}

function ChangeCid() {
    var url = "system_store_edit.asp?selcid="+document.all('selcid').value;
    document.frmcid.action = url;
    document.frmcid.target="_top";
    document.frmcid.submit();
}

function window_onload(page) {
	if (page == 'logon') {
		document.form1.editusername.focus();
		/*change username to editusername*/
	}
	if (page == 'password') {
		document.form1.poldpwd.focus();
	}
}

function txtoid_focus() {
	document.form1.txtoid.focus();
}

//=================== 数据输入有效性检验 =================================
function FromOrderBrief(url) {

	bValidOrder = true;
	f = document.form1;
	
	CheckSpecified(f.txtoid,f.txtoid.value,"Please specify a P.O. No.");
	CheckSpecified(f.selcid,f.selcid.value,"Please specify a store ID.");	
	CheckSpecified(f.seldmode,f.seldmode.value,"Please specify a Delivery Mode.");
	
	if (bValidOrder)
		{
			f.action= url;
			f.target="_parent";
			f.submit();
			// TODO:  Actually send the order.
		}
    return;	
}

function RevOrderBrief(url) {

	bValidOrder = true;
	f = document.form1;
		
	CheckSpecified(f.selcid,f.selcid.value,"Please specify a store ID.");	
	CheckSpecified(f.seldmode,f.seldmode.value,"Please specify a Delivery Mode.");
	
	if (bValidOrder)
		{
			f.action= url;
			f.target="_parent";
			f.submit();
			// TODO:  Actually send the order.
		}
    return;	
}


function FromXSize(url) {	
	
	bValidOrder = true;
	f = document.form1;
	
	CheckSpecified(f.seldep,f.seldep.value,"Please specify a department.");
	CheckSpecified(f.txtempname,f.txtempname.value,"Please specify an employee name.");
	CheckSpecified(f.txtquan,f.txtquan.value,"Please specify a valid quantity.");
	CheckSpecified(f.txtbodylen,f.txtbodylen.value,"Please specify a body length.");
	CheckSpecified(f.txtneck,f.txtneck.value,"Please specify a neck size.");
	CheckSpecified(f.txtshoulder,f.txtshoulder.value,"Please specify a shoulder size.");
	CheckSpecified(f.txtwaist,f.txtwaist.value,"Please specify a waist size.");
	CheckSpecified(f.txtsleeve,f.txtsleeve.value,"Please specify a sleeve size.");
	CheckSpecified(f.txthip,f.txthip.value,"Please specify a hip size.");
	CheckSpecified(f.txtpantlen,f.txtpantlen.value,"Please specify a pants length.");
	CheckSpecified(f.txtbust,f.txtbust.value,"Please specify a bust size.");
	CheckSpecified(f.txtheight,f.txtheight.value,"Please specify a height size.");
	
	if (bValidOrder)
		{
			f.action= url;
			f.target="_parent";
			f.submit();
			// TODO:  Actually send the order.
		}
    return;	
}

function NewUser(url) {	
	
	bValidOrder = true;
	f = document.form1;
		
	CheckSpecified(f.txtuid,f.txtuid.value,"Please specify a User ID.");
	CheckSpecified(f.selcid,f.selcid.value,"Please specify a Store ID.");
	CheckSpecified(f.selregion,f.selregion.value,"Please specify a Region.");
	CheckSpecified(f.pwdnew1,f.pwdnew1.value,"Please specify new user password.");
	CheckSpecified(f.pwdnew2,f.pwdnew2.value,"Please confirm new user password.");
	CheckSpecified(f.seltitle,f.seltitle.value,"Please specify a title.");
	CheckSpecified(f.seltype,f.seltype.value,"Please specify user type.");
	
	if (bValidOrder)
		{
			f.action= url;
			f.target="_parent";
			f.submit();
			// TODO:  Actually send the order.
		}
    return;	
}

function NewStore(url) {	
	
	bValidOrder = true;
	f = document.form1;

	CheckSpecified(f.txtcid,f.txtcid.value,"Please specify a store ID.");	
	CheckSpecified(f.txtsname,f.txtsname.value,"Please specify a store name.");
	CheckSpecified(f.txtaddr,f.txtaddr.value,"Please specify a store address.");
	CheckSpecified(f.txttel,f.txttel.value,"Please specify a telphone No.");
	CheckSpecified(f.txtlinkman,f.txtlinkman.value,"Please specify a linkman.");
	CheckSpecified(f.txtfax,f.txtfax.value,"Please specify a fax No.");
	CheckSpecified(f.txtcity,f.txtcity.value,"Please specify a city.");	

	if (bValidOrder)
		{
			f.action= url;
			f.target="_parent";
			f.submit();
			// TODO:  Actually send the order.
		}
    return;	
}

function CheckSpecified(strObjName,strFieldValue, strMsg){
	if (strFieldValue == "" | strFieldValue == 0){
		if (bValidOrder)
			{
				alert(strMsg);
				strObjName.focus();
				bValidOrder = false;
			}
	}
}

//====================== 有效性检验代码结束 ===============================

function goform(url)
{
	document.form1.action= url ;	
	document.form1.target="_parent";
	document.form1.submit();
}


//==========================javascript collections END===================================