var nCtrlPressed = false;

function enableStart (){
//	get('btnStart100').disabled = "";
//	get('btnStart10').disabled = "";
}

function validateFlickrUsername (sTextbox, aTests) {

    //Get textbox
    var oTextbox = get('user');
    
    //Validate
    var sWarnings = ''
    if (textboxNotEmpty(oTextbox)==false) {
        sWarnings += '请输入合作网站帐户';
    }

    //Show warnings
    if (sWarnings != ''){
        setFocus('user');
        oTextbox.className = ' error';
        showWarning(sWarnings);
       }else{
        oTextbox.className = oTextbox.value.replace(' error','');
        postBackForm('frmStage1');
    }
}

function validateStage2 () {
    
    var oSelectedPhotoset = get('hidSelectedPhotoset').value;    

    
    if (oSelectedPhotoset == '') {
        showWarning("Please select a photoset");
    }else{
        postBackForm('frmStage2');
    }
}

function validateStage4 (){

    var aControlIDs = new Array("txtLine1","txtLine2","txtLine3","txtLine4","txtLine5","txtLine6")
	var sText = concatControlValues(aControlIDs);
    
    if (sText == '' ){
    	if (confirm("你肯定不在你的迷你酷卡上添加任何文字? ") == false) {
			return;
		}
    }
    
    postBackForm('frmStage4');
    
}

function validateStage5 (){

    var sWarnings = '';
    var bShippingAsBilling = false;

    if (get('chkShippingAsBilling').checked){
       bShippingAsBilling = true;
    }

    //validate controls
    if (textboxNotEmpty(get('txtPackCount'), true)==false) {
        sWarnings += '你想做多少套?\n';
    }
    if (textboxNotEmpty(get('txtBillingFullName'), true)==false) {
        sWarnings += '请输入姓名刷卡\n';
    }
	if (textboxNotEmpty(get('txtPurchaserFullName'), true)==false) {
        sWarnings += '请输入姓名\n';
    }

	if (textboxIsEmail(get('txtPurchaserEmail'), true)==false) {
        sWarnings += '请输入姓名Email\n';
    }

    if (textboxIsCreditCard(get('txtBillingCardNumber'), true)==false) {
        sWarnings += '请输入一个有效卡号码\n';
    }
    if (isExpiryDate(get('txtBillingExpiry').value) == false) {
        sWarnings += '请进入有效期限在您的卡片 \n';
    }
    if (textboxIsNumeric(get('txtBillingSecurityCode'), true)==false) {
        sWarnings += '请键入安全代码在您的卡片后面 \n';
    }
     if (textboxNotEmpty(get('txtBillingAddress1'), true)==false) {
        sWarnings += '请输入你的第一通信地址\n';
    }
    if (textboxNotEmpty(get('txtBillingTownCity'), true)==false) {
        sWarnings += '请输入你的现在住址\n';
    }
    if (get('ddlBillingCountry').value == 'United States') {
        if (textboxNotEmpty(get('txtBillingState'),true)==false){
            sWarnings += '请进入计费状态\n';
        }
    }
    if (dropdownNotEmpty(get('ddlBillingCountry'), true)==false) {
        sWarnings += '请输入您的运输国家\n';
    }
    if (textboxNotEmpty(get('txtBillingPostcode'), true)==false) {
        sWarnings += '请输入你所在城市的邮政编码 \n';
    }

    //Shipping
    if (bShippingAsBilling != true){
      if (textboxNotEmpty(get('txtShippingFullName'), true)==false) {
          sWarnings += '请输入你的名字\n';
      }
      if (textboxIsEmail(get('txtShippingEmail'), true)==false) {
          sWarnings += '请输入合法的电子邮件\n';
      }
      if (textboxNotEmpty(get('txtShippingAddress1'), true)==false) {
          sWarnings += '请输入你的第一邮寄地址\n';
      }
      if (textboxNotEmpty(get('txtShippingTownCity'), true)==false) {
          sWarnings += '请输入您的运输镇或城市\n';
      }
      if (get('ddlShippingCountry').value == 'United States') {
          if (textboxNotEmpty(get('txtShippingState'),true)==false){
              sWarnings += '请输入运输方式\n';
          }
      }
      if (dropdownNotEmpty(get('ddlShippingCountry'), true)==false) {
          sWarnings += '请输入您的运输国家 \n';
      }
      if (textboxNotEmpty(get('txtShippingPostcode'), true)==false) {
          sWarnings += '请输入你所在城市的邮政编码\n';
      }
    }
    
    
        
    //postback or show warnings
   if (sWarnings == ''){
        postBackForm('frmStage5');
   }else{
      showWarning(sWarnings);
   }


}

function enableDisableShipping(){

    var sDisabled = '';
    if (get('txtShippingFullName').disabled == ''){
       sDisabled = 'disabled';
    }

    get('txtShippingFullName').disabled = sDisabled;
    get('txtShippingFullName').disabled  = sDisabled;
    get('txtShippingEmail').disabled  = sDisabled;
    get('txtShippingPhone').disabled   = sDisabled;
    get('txtShippingAddress1').disabled  = sDisabled;
    get('txtShippingAddress2').disabled  = sDisabled;
    get('txtShippingTownCity').disabled   = sDisabled;
    get('txtShippingState').disabled   = sDisabled;
    get('ddlShippingCountry').disabled  = sDisabled;
    get('txtShippingState').disabled  = sDisabled;
    get('txtShippingPostcode').disabled = sDisabled;
}

function validateStage6 (){

	postBackForm('frmStage6');

}


