// from ADSC:
function DoNothing(){}
function SelPG(iObj){
  iObj.className = "ProductTableBorderOrange";
}
function UnselPG(iObj){
  iObj.className = "ProductTableBorderGray";
}
//---------------------------------------------------------------

function SaveExchange(){
	var frm = document.frmExchangeLink;
	var iExch = frm.txtExchangeLink.value;
	iExch = iExch.Trim();
	if (iExch == ""){
		alert("Please fill Link Page URL");
		frm.txtExchangeLink.value = "";
		frm.txtExchangeLink.focus();
	}else{
		frm.submit();
	}
}

function ShowTotalAmount(kNum){
	document.getElementById("layerTotalDue3").style.display = "none";
	document.getElementById("layerTotalDue12").style.display = "none";
	document.getElementById("layerTotalDue"+kNum).style.display = "";
}

function SaveSuscriptionPayment(){
	var frm = document.frmPayment;
	var objRad = frm.radStorePlanPayment;
	var iLen = objRad.length;
	var sw = false;
	for (i=0; i<iLen; i++){
		if (objRad[i].checked) sw = true;
	}
	if (sw){
		//alert("Please select Payment Method");
		var xMsg = "";
		var xPayment = document.frmPayment.PaymentActive.value;
		if (xPayment != "disabled"){
			var iCards = document.frmPayment.PaymentCounter.value;
			var xSW1 = false;
			for (i=1; i<=iCards; i++){
				xSW1 = xSW1 || (document.frmPayment.CCard[i].checked);
			}
			if (!xSW1) xMsg += "\n- Payment method (unselected)";
			if (!document.frmPayment.CardType.disabled){
				if (document.frmPayment.CardType.selectedIndex == 0) xMsg += "\n- Card Type (unselected)";
				if (!isCCardValid(document.frmPayment.CardNumber.value)) xMsg += "\n- Card Number (invalid)";
				if (document.frmPayment.NameOnCard.value=="") xMsg += "\n- Name On Card (empty)";
				if (!isCardExpires(document.frmPayment.CardExpires.value)) xMsg += "\n- Card Expiration (invalid)";
				if (!isCVV2Valid(document.frmPayment.CardCVV2.value)) xMsg += "\n- Card CVV2 (invalid)";
				if (document.frmPayment.BillName.value=="") xMsg += "\n- Billing Client Name (empty)";
				if (document.frmPayment.BillAddress.value=="") xMsg += "\n- Billing Address (empty)";
				if (document.frmPayment.BillCity.value=="") xMsg += "\n- Billing City (empty)";
				if (document.frmPayment.Val_State.value == "true"){
					if (document.frmPayment.BillState.value=="") xMsg += "\n- Billing State (empty)";
				}
				if (document.frmPayment.Val_ZipCode.value == "true"){
					if (document.frmPayment.BillZipCode.value=="") xMsg += "\n- Billing ZipCode (empty)";
				}
				if (document.frmPayment.BillCountry.value=="") xMsg += "\n- Billing Country (empty)";
				if (document.frmPayment.BillPhone.value=="") xMsg += "\n- Billing Phone (empty)";
			}
		}
		if (xMsg == ""){
			document.frmPayment.CCard[0].disabled = true;
			//document.frmPayment.SusPlan[0].disabled = true;
			/*if (xSW_DOM == "true"){document.frmSubscribe.DOM[0].disabled = true;}*/
			document.frmPayment.tg.value = "SAVE_PAYMENT_SUMMARY";
			document.frmPayment.submit();
		}else{
			alert("To continue please review the following information:\n" + xMsg);
		}
	}else{
		alert("Please select Plan Amount");
	}
}

function SaveSuscriptionPayment_fromDotFront(){
	var frm = document.frmPayments;
	var objRad = frm.radStorePlanPayment;
	var iLen = objRad.length;
	var sw = false;
	for (i=0; i<iLen; i++){
		if (objRad[i].checked) sw = true;
	}
	if (sw){
		//alert("Please select Payment Method");
		var index = document.frmPayments.sPayMethod.selectedIndex;
		var index2 = document.frmPayments.sPayMethod.options[index].text;
		var CadError = "";
		if ((index2=="Credit Card")){
			if (isCardNumValid(document.frmPayments.sCardNumber.value)){
				CadError = "Credit Card invalid!";
				document.frmPayments.sCardNumber.value = "";
			}else{
				if (document.frmPayments.sCardNumber.value=="") CadError += "\nCard Number";
				if (document.frmPayments.sCardName.value=="") CadError += "\nCard Name Holder";
				if (document.frmPayments.sCardType.selectedIndex == 0) CadError += "\nCard Type";
				if (document.frmPayments.sCardMonth.selectedIndex == 0) CadError += "\nCard Month Expitarion";
				if (document.frmPayments.sCardYear.selectedIndex == 0) CadError += "\nCard Year Expitarion";
				if (document.frmPayments.sCardCode.value=="") CadError += "\nCard Code";
				//if (document.frmPayments.Terms.status!=true) CadError += "\nAccept the terms and conditions";
			}
		}
		if (index2 == "PhoneFax"){
			var c = false;
			var iII = 0;
			for (var i=0; i<document.frmPayments.elements.length;i++){
				var e = document.frmPayments.elements[i];
				if (e.type == 'radio'){
					iII++;
					if (e.checked){
						c = true;
					}
				}
			}
			if (!c){
				if (iII != 0){
					CadError += "\nPayment Method";
				}
			}
		}
		if (index2 == "eCheck"){
			if (document.frmPayments.sBankName.value == "") CadError += "\nBank Name";
			if (document.frmPayments.sAccountNumber.value == "") CadError += "\nAccount Number";
			if (document.frmPayments.sRoutingNumber.value == "") CadError += "\nRouting Number";
			if (document.frmPayments.sCheckNumber.value == "") CadError += "\nCheck Number";
		}
		if (index2 == "Value Partner"){
			if (document.frmPayments.sPartnerLogin.value == "") CadError += "\nPartner Login";
			if (document.frmPayments.sPartnerPassword.value == "") CadError += "\nPartner Password";
		}
		if (CadError == ""){
			//document.frmPayments.Target.value = "PLACE";
			//document.frmPayments.submit();
			alert("submit");
		}else{
			if (CadError  == "Credit Card invalid!"){
				alert(CadError);
			}else{
				var sError = "";
				sError += "SORRY\nWe cannot process this form. You must fill in the follow fields first:\n";
				sError += "---------------------------------------------------------------------------------\n";
				alert(sError + CadError);
			}
		}
	}else{
		alert("Please select Plan Amount");
	}
}










function DoNotAgree(){
  if (confirm("Are you sure you want to decline the Terms of Service? Click Cancel to continue with registration.")){
    window.location.href="/SignIn.asp";
  }
}

function SubmitAccount(){
  var xMsg="";
  if (document.frmCreateAccount.FirstName.value.Trim()=="") xMsg += "\n\t- First Name (required)";
  if (document.frmCreateAccount.LastName.value.Trim()=="") xMsg += "\n\t- Last Name (required)";
  if (!isEmail(document.frmCreateAccount.Email.value.Trim())) xMsg += "\n\t- Email Address (invalid)";
  if (document.frmCreateAccount.Pass1.value != document.frmCreateAccount.Pass2.value){
    xMsg += "\n\t- Password (does not match)";
  }else{
    if (document.frmCreateAccount.Pass1.value.Trim().length < 6){
      xMsg += "\n\t- Password (too short)";
    }
  }
  if (document.frmCreateAccount.SecQuestion.selectedIndex == 0) xMsg += "\n\t- Security Question (not selected)";
  if (document.frmCreateAccount.SecAnswer.value.Trim() == "")  xMsg += "\n\t- Secret Answer (required)";
  if (document.frmCreateAccount.BMonth.selectedIndex == 0) xMsg += "\n\t- Birthday Month (not selected)";
  if (!isInteger(document.frmCreateAccount.BDay.value.Trim(),false)) xMsg += "\n\t- Birthday Day (invalid)";
  if (!isInteger(document.frmCreateAccount.BYear.value.Trim(),false)){xMsg += "\n\t- Birthday Year (invalid)";
  }else{
	var iDate = new Date();
	if ((document.frmCreateAccount.BYear.value < 1901) || (document.frmCreateAccount.BYear.value > iDate.getFullYear())){
		xMsg += "\n\t- Birthday Year (not allowed)";
	}
  }
  if (document.frmCreateAccount.ZipCode.value.Trim() == "") xMsg += "\n\t- Zip Code (required)";
  if (xMsg == ""){
    document.frmCreateAccount.tg.value = "RECORDACCOUNT";
    document.frmCreateAccount.submit();
  }else{
    alert("To continue please fill correctly the following fields:\n" + xMsg);
  }
}

function ValidateAccount(){
  var xMsg="";
  if (!isEmail(document.frmValidateAccount.Email.value.Trim())) xMsg += "\n\t- Email Address (invalid)";
  if (document.frmValidateAccount.CRCCode.value.length != 20) xMsg += "\n\t- 20-digits Secret Code (invalid)";
  if (xMsg == ""){
    document.frmValidateAccount.tg.value = "VALIDATEACCOUNT";
    document.frmValidateAccount.submit();
  }else{
    alert("To continue please fill correctly the following fields:\n" + xMsg);
  }
}

function ReSendValidateEmail(iCode){
  window.open("/USRINT/ResendValidation.asp?UID=" + iCode, "RESEND","menubar=0,resizable=0,scroll=0,width=450,height=150");
}

function SignIn(){
  var xMsg = "";
  if (!isEmail(document.frmSignInAccount.Email.value)) xMsg += "\n\t- Email Address (invalid)";
  if (document.frmSignInAccount.Password.value=="") xMsg += "\n\t- Password";
  if (xMsg == ""){
    document.frmSignInAccount.tg.value="SIGNINACCOUNT";
    document.frmSignInAccount.submit();
  }else{
    alert("To continue please fill correctly the following fields:\n" + xMsg);
  }
}

function SignOut(){
  window.location.href='/USRINT/SignOut.asp';
}

function ChangeCountry(iCode){
  switch(iCode){
    case 0:
      document.frmAddStore.tg.value = "ADDSTORE";
      document.frmAddStore.submit();
      break;
  }
}

function ChangeSTRUpload(){
  var xFF = document.frmAddStore.CH_LOGO.checked;
  if (xFF){
    document.frmAddStore.btnUpload.disabled = false;
  }else{
    document.frmAddStore.btnUpload.disabled = true;
  }
}

function SaveStore(){
  var xMsg = "";
  if (document.frmAddStore.StoreName.value.Trim()=="") xMsg += "\nStore Name";
  if (document.frmAddStore.StoreDomain.value.Trim()=="") xMsg += "\nDomain";
  if (xMsg == ""){
    document.frmAddStore.tg.value = "SAVESTORE";
    document.frmAddStore.submit();
  }else{
    alert("To continue please fill correctly the following fields:\n" + xMsg);
  }
}

function ResetPassword(){
  window.open ("ResetPassword.asp","","width=410, height=170");
}

function StoreContinue(iType){
  switch(iType){
    case 0:
      if (document.frmStep1.nop.selectedIndex == 0){
        alert("To continue, please select at least one product");
      }else{
        document.frmStep1.submit();
      }
      break;
    case 1:
      var xSW = false;
      var iC = document.frmStep2.counter.value;
      for (i=1; i<=iC; i++){
        xSW = (xSW || document.all("CH_"+i).checked);
      }
      if (xSW){
        document.frmStep2.submit();
      }else{
        alert("To continue please select at lease one Line of business (LOB).");
      }
      break;
    case 2:
      var xSW = false;
      var iC = document.frmStep3.Counter.value;
      for (i=1; i<=iC; i++){
        xSW = (xSW || document.all("CH_"+i).checked);
      }
      if (xSW){
        document.frmStep3.submit();
      }else{
        alert("To continue, please select one publising web site.");
      }
      break;
    case 3:
      break;
  }
}

function ConfigStore(iStoreID){
  window.location.href = "MyStores.asp?tg=configstore&sid=" + iStoreID;
}

function EditStore(iStoreID){
  window.location.href = "MyStores.asp?tg=editstore&sid=" + iStoreID;
}

function ViewPayments(iStoreID){
  window.location.href = "Payments.asp?tg=paymentlog&sid=" + iStoreID;
}

function ViewPayments2(iStoreID, iDTFSource){
  window.location.href = "Payments.asp?tg=paymentlog&sid=" + iStoreID + "&DTFSource=" + iDTFSource;
}
function ViewPayments3(iStoreID, iDTFSource){
  window.location.href = "Payments.asp?tg=PAYMENT_LOG_SV&sid=" + iStoreID + "&DTFSource=" + iDTFSource;
}

function DeleteStore(iStoreID, iStoreURL){
  if (confirm("Are you sure you want to delete store '" + iStoreURL + "' ?")){
    window.location.href = "MyStores.asp?tg=remstore&sid=" + iStoreID;
  }
}

function DeleteStoreWPag(iStoreID, iStoreURL, iLetter, iPage){
  if (confirm("Are you sure to remove '" + iStoreURL + "' store?")){
    var xStr = "MyStores.asp?tg=remstore&sid=" + iStoreID;
    if (iLetter != ''){xStr += "&q=" + iLetter;}
    if (iPage != ''){xStr += "&page=" + iPage;}
    window.location.href = xStr;
  }
}

function ManageProducts(iStoreID, iSW){
  if (iSW){
    window.location.href = "Products.asp?tg=products&sid=" + iStoreID + "&src=multi";
  }else{
    window.location.href = "Products.asp?tg=products&sid=" + iStoreID;
  }
}

function ChangePList(){
  document.frmP.submit();
}

function ImportProducts(iStoreID){
  window.location.href = "Products.asp?tg=import&sid=" + iStoreID;
}

function SendImport(){
  if (document.frmUpload.FileName1.value == ""){
    alert("To continue, please enter a valid file name.");
  }else{
    document.frmUpload.submit();
  }
}
function SendImportStores(){
	var sw = true;
	var obj = "";
	if (document.frmUploadStores.FileName1.value == ""){sw = false; obj = "FileName1"; msg = "enter a valid file name"}
	if (sw){
		var iCounter = document.frmUploadStores.counter.value;
		if (iCounter > 0){
			sw = false;
			for (ii=1; ii<=iCounter; ii++){
				if (eval('document.frmUploadStores.CH_' + ii + '.checked')){sw = true;}
			}
			if (!sw){obj = "CH_1"; msg = "select a Line Of Businness";}
		}
	}
	if (sw){
		document.frmUploadStores.submit();
	}else{
	    alert("Please " +msg+ " to continue.");
	    eval("document.frmUploadStores." + obj + ".focus()");
	}
}
function SendImportStores2(){
	var sw = true;
	var obj = "";
	if (document.frmUploadStores.LOBID.value == ""){sw = false; obj = "LOBID"; msg = "select a Line Of Businness";}
	if (document.frmUploadStores.FileName1.value == ""){sw = false; obj = "FileName1"; msg = "enter a valid file name"}
	if (sw){
		document.frmUploadStores.submit();
	}else{
	    alert("Please " +msg+ " to continue.");
	    eval("document.frmUploadStores." + obj + ".focus()");
	}
}
function GoUploadServiceStores(frm){
	var iCID = frm.selCID.value;
	var ifile = frm.FileName1.value;
	if (ifile == ""){
		alert("Please select file");
		frm.FileName1.click();
	}else{
		var xExt = new Array(".csv");
		var sw = false;
		var iext = (ifile.substring(ifile.lastIndexOf("."))).toLowerCase();
		for (var i=0; i<xExt.length; i++){
			if (xExt[i] == iext){
				sw = true;
				break;
			}
		}
		if (sw){
			if (iCID == 0){
				alert("Please select Category");
				frm.selCID.focus();
			}else{
				frm.submit();
			}
		}else{
			alert("Error.\nFile type must be: " + xExt.join());
			frm.FileName1.value="";
		}
	}
}


function CreateProduct(iStoreID){
  window.location.href = "Products.asp?tg=newproduct&sid=" + iStoreID;
}


function OpenWindow3(xPage){
	window.open(xPage,'','width=500,height=450,resizable=no');
	return false;
}
function OpenMyWindow(URL){
	window.open(URL,'','width=500,height=500,scrollbars=NO')
}

function CreateServiceAd(){
	var frm = document.frmCreateServiceAd;
	var xMsg = "";
	if (frm.StoreName.value.Trim()=="") xMsg += "\n\t- Store Name";
//	if (frm.StoreDomain.value.Trim()=="") xMsg += "\n\t- Domain";
	if (frm.StoreDescription.value.Trim()=="") xMsg += "\n\t- Store Description";
	if (frm.StoreCtcName.value.Trim()=="") xMsg += "\n\t- Contact Name";
	if (frm.StoreAddress.value.Trim()=="") xMsg += "\n\t- Address";
	if (frm.StoreCity.value.Trim()=="") xMsg += "\n\t- City";
	if (frm.StoreState.selectedIndex == 0) xMsg += "\n\t- State";
	if (frm.StoreZipCode.value.Trim()=="") xMsg += "\n\t- Zip Code";
	if (frm.StoreCountry.selectedIndex == 0) xMsg += "\n\t- Country";
	if (frm.StorePhone.value.Trim()=="") xMsg += "\n\t- Phone";
	if (xMsg == ""){
		frm.tg.value = "SAVE_SERVICE_AD";
		frm.submit();
	}else{ alert("To continue please fill correctly the following fields:\n" + xMsg); }
}

function GoConfigStoreSAd(iStoreID){
	window.location.href = "MyStores.asp?tg=CONFIG_STORE_AD&SID=" + iStoreID;
}

function ConfigStoreSAdContinue(iType){
	switch(iType){
		case 0:
			var frm = document.frmSAdStep1;
			var sw = true;
			var iSAP = frm.sap.value;
			if (iSAP == 0){
				if (frm.nop.selectedIndex == 0){
					sw = false;
					alert("To continue, please select plan");
					frm.nop.focus();
				}
			}else{
				if (frm.strAboutUs.value == ""){
					sw = false;
					alert("To continue, please fill Store About Us field");
					frm.strAboutUs.focus();
				}else{
					if (frm.StoreShowLogo.checked){
						if (frm.StoreLogo.value == ""){
							sw = false;
							alert("To continue, please fill Store Logo Path field");
							frm.StoreLogo.focus();
						}
					}
				}
			}
			if (sw){frm.submit();}
			break;
		case 1:
			var frm = document.frmSAdStep2;
			var xStep = frm.step.value;
			var xSW = false;
			if (xStep == ""){
				var iC = frm.Counter.value;
				if (iC > 0){
					for (i=1; i<=iC; i++){
						xSW = (xSW || document.getElementById("chk_"+i).checked);
					}
				}
			}else{
				var iMC = frm.TotalMainCats.value;
				if (iMC > 0){
					for (i=1; i<=iMC; i++){
						var iFC = eval("frm.TotalSubCats_" +i+ ".value");
						for (k=1; k<=iFC; k++){
							xSW = (xSW || document.getElementById("chkFC_" +i+ "_" +k).checked);
						}
					}
				}
			}
			if (xSW){
				frm.submit();
			}else{
				if (xStep == ""){
					alert("To continue please select at least one Line of business (LOB).");
				}else{
					alert("To continue please select at least one Sub-category.");
				}
			}
			break;
		case 2:
			var frm = document.frmSAdStep3;
			var xStep = frm.step.value;
			var xSW = false;
			if (xStep == ""){
				var iC = frm.TotalStates.value;
				for (i=1; i<=iC; i++){
					xSW = (xSW || document.getElementById("chkST_"+i).checked);
				}
			}else{
				var iST = frm.TotalStates.value;
				if (iST > 0){
					for (i=1; i<=iST; i++){
						var iCT = eval("frm.TotalCounties_" +i+ ".value");
						for (k=1; k<=iCT; k++){
							xSW = (xSW || document.getElementById("chkCT_" +i+ "_" +k).checked);
						}
					}
				}
			}
			if (xSW){frm.submit();
			}else{alert("To continue, please select serving area.");}
			break;
		case 3:
			break;
	}
}

function CheckAllCounties(){ //disabl
	var frm = document.frmSAdStep3;
	var iTotal = frm.Counter.value;
	if (iTotal > 0){
		var sw = frm.chk_0.checked;
		for(i=1; i<=iTotal; i++){
			document.getElementById("chk_" + i).checked = sw;
		}
	}
}
function CheckAll(frm, obj, objTotal, objChk){
	var iTotal = eval("frm." +objTotal+ ".value");
	if (iTotal > 0){
		var sw = eval("frm." +obj+ ".checked");
		for(i=1; i<=iTotal; i++){
			document.getElementById(objChk + i).checked = sw;
		}
	}
}
function CheckCountiesLimit(iCont){
	var frm = document.frmSAdStep3;
	var iTotal = frm.Counter.value;
	var iLimit = frm.Counties.value;
	var iOn = 0;
	if (iTotal > 0){
		for (i=1; i<=iTotal; i++){
			if (document.getElementById("chk_" + i).checked){iOn++}
		}
	}
	if (iOn > iLimit){document.getElementById("chk_" + iCont).checked = false;}
}

function CheckPlanLimit(frm,objLimit,objTotal,iCont,objChk){//disabled
	var iLimit = eval("frm." +objLimit+ ".value");
	var iTotal = eval("frm." +objTotal+ ".value");
	var iOn = 0;
	if (iTotal > 0){
		for (i=1; i<=iTotal; i++){
			if (document.getElementById(objChk + i).checked){iOn++}
		}
	}
	if (iOn > iLimit){
		document.getElementById(objChk + iCont).checked = false;
		alert("You can only select " +iLimit);
	}
}
function CheckPlanLimit2(frm,objLimit,objCounter,iCont){//disabled
	var iLimit = eval("frm." +objLimit+ ".value");
	var iTotal = eval("frm." +objCounter+ ".value");
	var iOn = 0;
	if (iTotal > 0){
		for (i=1; i<=iTotal; i++){
			if (document.getElementById("chk_" + i).checked){iOn++}
		}
	}
	if (iOn > iLimit){
		document.getElementById("chk_" + iCont).checked = false;
		alert("You can only select " +iLimit+ " options with this Plan\nIf you wish to add more you need to UPGRADE THIS PLAN.");
	}
}

function CheckMCLimit(frm,iMCCont){
	var iLimit = frm.CatsLimit.value;
	var iTotal = frm.TotalMainCats.value;
	var iSubTotal = eval("frm.TotalSubCats_" +iMCCont+ ".value");
	var iOn = 0;
	if (iTotal > 0){
		for (i=1; i<=iTotal; i++){
			if (document.getElementById("chkMC_" + i).checked){iOn++}
		}
	}
	if (iOn > iLimit){
		document.getElementById("chkMC_" + iMCCont).checked = false;
		alert("You can only select " +iLimit+ " Category");
	}
	//descheckear subs
	if (iSubTotal > 0){
		for (i=1; i<=iSubTotal; i++){
			document.getElementById("chkFC_" +iMCCont+ "_" + i).checked = false;
		}
	}
}
function CheckFCLimit(frm,iMCCont,iFCCont){
	var iLimit = frm.SubCatsLimit.value;
	var iTotal = eval("frm.TotalSubCats_" +iMCCont+ ".value");
	var iOn = 0;
	if (iTotal > 0){
		if (document.getElementById("chkMC_" + iMCCont).checked){
			for (i=1; i<=iTotal; i++){
				if (document.getElementById("chkFC_" +iMCCont+ "_" + i).checked){iOn++}
			}
			if (iOn > iLimit){
				document.getElementById("chkFC_" +iMCCont+ "_" + iFCCont).checked = false;
				alert("You can only select " +iLimit+ " Sub-category");
			}
		}else{
			document.getElementById("chkFC_" +iMCCont+ "_" + iFCCont).checked = false;
		}
	}
}
function CheckMainCat(frm, iMC){
	var iSubCatsLimit = frm.SubCatsLimit.value;
	var iTotalMainCats = frm.TotalMainCats.value;
	if (iMC <= iTotalMainCats){
		var iTotalSubCats = eval("frm.TotalSubCats_" +iMC+ ".value");
		if (iTotalSubCats > 0){
			var sw = document.getElementById("chkMC_" + iMC).checked;
			if (iSubCatsLimit == -1){
				for (iFCCont=1; iFCCont<=iTotalSubCats; iFCCont++){
					document.getElementById("chkFC_" + iMC + "_" + iFCCont).checked = sw;
				}
			}
		}
	}
}
function CheckStateLimit(frm,iSTCont){
	var iLimit = frm.StatesLimit.value;
	var iTotal = frm.TotalStates.value;
	var iOn = 0;
	if (iTotal > 0){
		for (i=1; i<=iTotal; i++){
			if (document.getElementById("chkST_" + i).checked){iOn++}
		}
	}
	if (iOn > iLimit){
		document.getElementById("chkST_" + iSTCont).checked = false;
		alert("You can only select " +iLimit+ " State");
	}
}

function GoServiceAdsManager(iStoreID, iSW){ //ManageProducts(iStoreID, iSW)
	if (iSW){
		window.location.href = "ServiceAds.asp?tg=&sid=" + iStoreID + "&src=multi";
	}else{
		window.location.href = "ServiceAds.asp?tg=&sid=" + iStoreID;
	}
}

function GoCreateServiceAd(iStoreID){	//CreateProduct(iStoreID)
  window.location.href = "ServiceAds.asp?tg=NEW_SERVICEAD&SID=" + iStoreID;
}

function CancelCreateServiceAd(iStoreID){	//CancelProduct(iStoreID)
	window.location.href = "ServiceAds.asp?tg=&sid=" + iStoreID;
}

function GoSaveCreateServiceAd(){	//SaveProduct(){
	var xMsg = "";
	var frm = document.frmCreateServiceAd;
	if (frm.selAdCat.selectedIndex == 0) xMsg += "\nSelect Category";
	if (frm.txtAdTitle.value.Trim() == "") xMsg += "\nFill Ad Title";
	if (frm.txtAdDesc.value.Trim() == "") xMsg += "\nFill Ad Text";
	if (frm.txtAdAddress.value.Trim() == "") xMsg += "\nFill Address";
	if (frm.txtAdPhone.value.Trim() == "") xMsg += "\nFill Phone";
	if (xMsg == ""){
		frm.tg.value = "SAVE_CREATE_SERVICEAD";
		frm.submit();
	}else{
		alert("To continue, please fill the following fields:\n" + xMsg);
	}
}




var xAboutUsText = "";
function CheckAboutUsLength(){
	var frm = document.frmSAdStep1;
	var objTA = frm.strAboutUs;
	var objC = frm.txtAboutUsCounter;
	var iLimit = 1500;
	iLen = objTA.value.length;
	if (iLen <= iLimit){
		xAboutUsText = objTA.value;
	}else{
		objTA.value = xAboutUsText;
	}
	if (iLen >= iLimit){
		objC.style.color="#ff0000";
	}else{
		objC.style.color="#000000";
	}
	objC.value = objTA.value.length;
}

var xAboutUsTextE = "";
function CheckAboutUsLengthE(){
	var frm = document.frmEditProfile;
	var objTA = frm.strAboutUs;
	var objC = frm.txtAboutUsCounter;
	var iLimit = 1500;
	iLen = objTA.value.length;
	if (iLen <= iLimit){
		xAboutUsTextE = objTA.value;
	}else{
		objTA.value = xAboutUsTextE;
	}
	if (iLen >= iLimit){
		objC.style.color="#ff0000";
	}else{
		objC.style.color="#000000";
	}
	objC.value = objTA.value.length;
}

function ValidateTextareaLimit(objTA, iMaxLen, objMsg){
	var xValue = objTA.value.toString();
	var iLen = xValue.length;
	var iCont = iMaxLen - iLen;
	if (iCont >= 0){
		if (document.getElementById(objMsg)) document.getElementById(objMsg).innerText=iCont
	}else{
		xValue = xValue.substring(0,iMaxLen);
		objTA.value = xValue;
	}
}



function EnableStoreLogo(frm){
	if (frm.StoreShowLogo.checked){
		frm.StoreLogo.disabled = false;
	}else{
		frm.StoreLogo.disabled = true;
	}
}

function GoUpgradePlan(iSID, iType){
	window.location.href = "MyStores.asp?tg=SERVICE_PLAN_UPGRADE&SID=" + iSID + "&SrcType=" + iType;
}

function GoSaveServicePlanUpgrade(frm){
	frm.submit();
}

function DisplayUpgradePlans(frm){
	var iTotalUPs = frm.TotalUPs.value;
	var iPos = frm.selUPID.selectedIndex;
	if (iTotalUPs > 0){
		for(i=1; i<=iTotalUPs; i++){
			document.getElementById("trUP_" + i).style.display = "none";
			document.getElementById("trTitle_" + i).style.display = "none";
			document.getElementById("trData_" + i).style.display = "none";
		}
		if (iPos > 0){
			document.getElementById("trUP_" + iPos).style.display = "";
			document.getElementById("trTitle_" + iPos).style.display = "";
			document.getElementById("trData_" + iPos).style.display = "";
		}
	}
}

function SaveUpgradeServicePlan(){
	var frm = document.frmUpgradeServicePlan;
	if (frm.selUPID.value != 0){
		if (confirm('Are you sure you want to UPGRADE to this publishing plan?')){
			frm.submit();
		}
	}else{
		alert('Please, select a Upgrade Plan.');
		frm.selUPID.focus();
	}
}

function cliqui(){
	alert("cecx d2edc e2");
}
