﻿// JScript File
var thisfromId="";
function validateAll(formId,url)
{
 
  var theForm = document.getElementById(formId);
  var txtName = theForm.elements["txtName"];
  thisfromId = formId;
   document.getElementById('divFailedSave').style.display = "none";
    if(validateALLStuff(txtName))
    {
       
        document.getElementById('loadingItem').style.display = "block";
        var type = "AddToSavedSearches";
        //CreateXmlHttpRequest();
        var mydate = new Date();
        url+="&cacheId="+mydate.getTime();
        url+="&txtName="+txtName.value;
        //request.onreadystatechange = CheckPrevious;
        //request.open("GET", url, true);
            
        jQuery.post(url, function(data) {
                document.getElementById('loadingItem').style.display = "none";
                var targetElement = document.getElementById("savesearch");
                var response = data;
                if(response == "1")
                {
                    var theForm = document.getElementById(thisfromId);
                    var statusDiv = document.getElementById('divFailedSave');
                    statusDiv.style.display = "block";
                }
                else if(response == "0")
                {
                    var theForm = document.getElementById(thisfromId);
                    theForm.setAttribute("method","GET");
                    theForm.setAttribute("action","/MyAccount/formPost.aspx?act="+theForm.elements["act"].value);
                    theForm.attributes["action"].value = "/MyAccount/formPost.aspx?act="+theForm.elements["act"].value;
                    theForm.attributes["onsubmit"].value = "return true;";
                    theForm.submit()                            
                }
        });

     }
    
}

function validateALLStuff(txtEmail,txtPassword)
{

    if(txtEmail.value == "")
    {
        alert("Please provide valid name");
        return false;
    }
 
    return true;
}
function doDisable(boo)
{
    
}


