﻿var xmlHttpLogin;
var xmlHttpCRM;
var LocationPath = "Default.aspx";
var IsLogin =1;
var LoginType = 0;
var IsRedirect = 0;
var IsDivDown = 0;
var CenterCodeCRM = 0;
var LightenPage = 0;
var tempCRM_LoginID, tempCRM_OldUserID, tempNewUserID
var iscookies = 0;
function GetXmlHttpObject()
{ 
    var objXMLHttp=null
    if (window.XMLHttpRequest)
    {
        objXMLHttp=new XMLHttpRequest()
    }
    else if (window.ActiveXObject)
    {
        objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
    }
    return objXMLHttp
}


function LoadLoginDialog(Type,Path)
{
    LoginType = Type;
    LocationPath = Path;
 //   alert(LocationPath);
    //document.getElementById("divLoginInfo").innerHTML = "";
    document.getElementById("txtUID").value = "";
    document.getElementById("txtPass").value = "";
    
    document.getElementById("tblLgnBtn").style.display = "none";
    
    document.getElementById("divLoginInfo").style.display = "none";
    document.getElementById("divLogin").style.display = "";
    document.getElementById("divLoginStatus").innerHTML = "";
    if(IsDivDown == 1)
    {
        BookingUnderDivDown();
    }
    
    
}

function createCookie(name,value,expiredays) {
    var exdate=new Date();
    exdate.setDate(exdate.getDate()+expiredays);
    document.cookie = "fid="+name+"|fpass="+value+((expiredays==null) ? "" : ";expires="+exdate.toUTCString())+"; path=/";
}


function readCookie() {
    var nameEQ = "fid=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
        if (c.indexOf(nameEQ) == 0) 
        {
            //alert("1");
            var d = c.substring(nameEQ.length,c.length);
            var e = d.split("|");
            var f = e[1].split("=");
            //alert(e[0] + "----" + f[1]);
                if(document.getElementById("txtUID").value == "" && document.getElementById("txtPass").value == "")
                {
                    document.getElementById("txtUID").value = e[0];
                    document.getElementById("txtPass").value = f[1];
                }
                if(IsLogin == 1)
                {
                    CheckLogin();
                }
        }
  	}
}

function GetGuestLoggin()
{
        LoginType = 2;
        var currentTime = new Date()       
        var temp = (currentTime.getMonth() + 1) + "-" + currentTime.getDate() + "-" + currentTime.getFullYear() + "-" + currentTime.getHours() + "-" +  currentTime.getMinutes() + "-" + currentTime.getSeconds();  
        
        xmlHttpLogin=GetXmlHttpObject()
        if (xmlHttpLogin==null)
        {
            alert ("Browser does not support HTTP Request")
            return
        }
       
        var loginid = "guest";
        var pass = "guest";

        document.getElementById("divLoginStatus").innerHTML = "Loading.....";
        var url="Service/LoginService.asmx/CheckForLogin?UserID="+loginid+"&Password="+pass+"&temp="+temp;
        xmlHttpLogin.onreadystatechange=CheckLoginGuest_CallBack
        xmlHttpLogin.open("GET",url,true)
        xmlHttpLogin.send(null)         
}


function CheckLoginGuest_CallBack()
{
    if (xmlHttpLogin.readyState==4 || xmlHttpLogin.readyState=="complete")
    {	
        if (xmlHttpLogin.status == 200)      
        { 
            switch(xmlHttpLogin.responseXML.getElementsByTagName("string")[0].childNodes[0].nodeValue)
            {
            
                case "0" :  
                            document.getElementById("divLoginInfo").style.display = "";
                            document.getElementById("divLogin").style.display = "none";
                            GetLoginStatus();
                            break;
                case "1": 
                            document.getElementById("divLoginStatus").innerHTML = "Invalid UserID/Password.";
                            break;
                case "2": 
                            document.getElementById("divLoginStatus").innerHTML = "Server Busy!!! Please try after some time."
                            break;       
            }
            
        }
    }    
}



function CheckLogin()
{
        var currentTime = new Date()       
        var temp = (currentTime.getMonth() + 1) + "-" + currentTime.getDate() + "-" + currentTime.getFullYear() + "-" + currentTime.getHours() + "-" +  currentTime.getMinutes() + "-" + currentTime.getSeconds();  
        
        xmlHttpLogin=GetXmlHttpObject()
        if (xmlHttpLogin==null)
        {
            alert ("Browser does not support HTTP Request")
            return
        }
       
        var loginid = document.getElementById("txtUID").value;
        var pass = document.getElementById("txtPass").value;
        if(document.getElementById("chkRemember") != null)
        {
            if(document.getElementById("chkRemember").checked)
            {
                createCookie(loginid,pass,15);
            }
        }
        document.getElementById("divLoginStatus").innerHTML = "Loading.....";
        var url="Service/LoginService.asmx/CheckForLogin?UserID="+loginid+"&Password="+pass+"&temp="+temp;
        xmlHttpLogin.onreadystatechange=CheckLogin_CallBack
        xmlHttpLogin.open("GET",url,true)
        xmlHttpLogin.send(null)         
}

function CheckLogin_CallBack()
{
    if (xmlHttpLogin.readyState==4 || xmlHttpLogin.readyState=="complete")
    {	
        if (xmlHttpLogin.status == 200)      
        { 
            switch(xmlHttpLogin.responseXML.getElementsByTagName("string")[0].childNodes[0].nodeValue)
            {
            
                case "0" :  
                            document.getElementById("divLoginInfo").style.display = "";
                            document.getElementById("divLogin").style.display = "none";
                            if(LoginType == 2)
                            {
                                GetLoginStatus();
                            }
                            else
                            {
                                location.href = LocationPath;
                            }
                            break;
                case "1": 
                            document.getElementById("divLoginStatus").innerHTML = "Invalid UserID/Password.";
                            break;
                case "2": 
                            document.getElementById("divLoginStatus").innerHTML = "Server Busy!!! Please try after some time."
                            break;       
            }
            
        }
    }    
}


function CancelLoginDialog()
{
    document.getElementById("tblLgnBtn").style.display = "";
    document.getElementById("divLoginInfo").style.display = "";
    document.getElementById("divLogin").style.display = "none";
    if(IsDivDown == 1)
    {
        BookingUnderDivDown();
    }
    if(LightenPage == 1)
    {
         ImageLightenPage();
    }
    
}



function GetLoginStatus()
{
    var currentTime = new Date()       
    var temp = (currentTime.getMonth() + 1) + "-" + currentTime.getDate() + "-" + currentTime.getFullYear() + "-" + currentTime.getHours() + "-" +  currentTime.getMinutes() + "-" + currentTime.getSeconds();  
   
    xmlHttpLogin=GetXmlHttpObject()
    if (xmlHttpLogin==null)
    {
        alert ("Browser does not support HTTP Request")
        return
    }
     document.getElementById("divLoginInfo").innerHTML = "Loading.....";
    var url="Service/LoginService.asmx/GetLoginStatus?CenterID=" + CenterCodeCRM +"&temp=" + temp;
    xmlHttpLogin.onreadystatechange=GetLoginStatus_CallBack
    xmlHttpLogin.open("GET",url,true)
    xmlHttpLogin.send(null) 
}

function GetLoginStatus_CallBack()
{
    if (xmlHttpLogin.readyState==4 || xmlHttpLogin.readyState=="complete")
    {	
        if (xmlHttpLogin.status == 200)      
        { 
            var str = new String(xmlHttpLogin.responseText);
            str= str.replace(/&gt;/g,'>');
            str= str.replace(/&lt;/g,'<');
            str= str.replace(/&amp;/g,'&');
            document.getElementById("divLoginInfo").innerHTML = str;
            document.getElementById("tblLgnBtn").style.display="";
            IsLogin = document.getElementById("hiddIsLogin").value; 
            if(iscookies == 0)
            {
                readCookie();
            }
            if(IsDivDown == 1)
            {
               BookingUnderDivDown();
            }
            
        }
    }    
}


function LogOutNew()
{
    HideContent();
    var currentTime = new Date()       
    var temp = (currentTime.getMonth() + 1) + "-" + currentTime.getDate() + "-" + currentTime.getFullYear() + "-" + currentTime.getHours() + "-" +  currentTime.getMinutes() + "-" + currentTime.getSeconds();  
   
    xmlHttpLogin=GetXmlHttpObject()
    if (xmlHttpLogin==null)
    {
        alert ("Browser does not support HTTP Request")
        return
    }
     document.getElementById("divLoginInfo").innerHTML = "Loading.....";
    var url="Service/LoginService.asmx/LogOut?temp="+temp;
    xmlHttpLogin.onreadystatechange=LogOut_CallBackNew
    xmlHttpLogin.open("GET",url,true)
    xmlHttpLogin.send(null) 
}

function LogOut_CallBackNew()
{
    if (xmlHttpLogin.readyState==4 || xmlHttpLogin.readyState=="complete")
    {	
        if (xmlHttpLogin.status == 200)      
        { 
            var url = window.location.href;
            var nohttp = url.split('//')[1];    
            var hostPort = nohttp.split('/')[1];
            var page =  hostPort.split('?')[0].toLowerCase();
            
            if (page == "ticketbooking.aspx")
            {
                location.href = "Default.aspx";      
            }
            else
            {
                LoadLoginDialog(1,hostPort);
            }
        }
    }
}


function LogOut()
{
    HideContent();
    var currentTime = new Date()       
    var temp = (currentTime.getMonth() + 1) + "-" + currentTime.getDate() + "-" + currentTime.getFullYear() + "-" + currentTime.getHours() + "-" +  currentTime.getMinutes() + "-" + currentTime.getSeconds();  
   
    xmlHttpLogin=GetXmlHttpObject()
    if (xmlHttpLogin==null)
    {
        alert ("Browser does not support HTTP Request")
        return
    }
     document.getElementById("divLoginInfo").innerHTML = "Loading.....";
    var url="Service/LoginService.asmx/LogOut?temp="+temp;
    xmlHttpLogin.onreadystatechange=LogOut_CallBack
    xmlHttpLogin.open("GET",url,true)
    xmlHttpLogin.send(null) 
}

function LogOut_CallBack()
{
    if (xmlHttpLogin.readyState==4 || xmlHttpLogin.readyState=="complete")
    {	
        if (xmlHttpLogin.status == 200)      
        { 
            switch(xmlHttpLogin.responseXML.getElementsByTagName("string")[0].childNodes[0].nodeValue)
            {
            
                case "0" :  
                            if(IsRedirect == 1)
                            {
                                location.href = "Default.aspx";
                            }
                            else
                            {
                                var url = window.location.href;
                                var nohttp = url.split('//')[1];    
                                var hostPort = nohttp.split('/')[1];
                                var page =  hostPort.split('?')[0].toLowerCase();  
                                if (page == "funrewardshistory.aspx" || page == "userbookinghistory.aspx" || page == "bookinghistory.aspx")
                                { 
                                    location.href = "Default.aspx";
                                }
                                else
                                {
                                    iscookies = 1;
                                    GetLoginStatus();
                                }
                            }
                            break;
                  
            }
            
        }
    }    
}


function BookingUnderDivDown()
{
    document.getElementById("divBookingBoxDown").top = "";
    
    
    
    var h1 = document.getElementById("divBookingBox").offsetHeight;
    var scrollHeight;
    if(h1 < 340)
    {
           scrollHeight =  0;
    }
    else
    {    
       scrollHeight = h1-340;
    }
    document.getElementById("divBookingBoxDown").style.height = scrollHeight+"px";
}




//////////////////////////Functions for CRM//////////////////

//////////////////////////Functions for CRM//////////////////

function LoadBengCRMReg()
{
    document.getElementById("txtCRMUserID").value = "";
    document.getElementById("txtCRMPass").value = "";
    
    document.getElementById("tblLgnBtn").style.display = "none";
    
    document.getElementById("divLoginInfo").style.display = "none";
    document.getElementById("divBengCRM").style.display = "";
    document.getElementById("divBengCRMStatus").innerHTML = "";
    
    if(IsDivDown == 1)
    {
        BookingUnderDivDown();
    }
}


function CancelBengCRMReg()
{
    document.getElementById("tblLgnBtn").style.display = "";
    document.getElementById("divLoginInfo").style.display = "";
    document.getElementById("divBengCRM").style.display = "none";
    if(IsDivDown == 1)
    {
        BookingUnderDivDown();
    }
}


function BangCRMCheckAuth(UserID,Password)
{ 
        
        var UserID = document.getElementById("txtCRMUserID").value;
        var Password = document.getElementById("txtCRMPass").value;
        
        var currentTime = new Date()
        var month = currentTime.getMonth() + 1
        var day = currentTime.getDate()
        var year = currentTime.getFullYear()
        var hours = currentTime.getHours()
        var minutes = currentTime.getMinutes()
        var seconds = currentTime.getSeconds()        
        var temp = month + "-" + day + "-" + year + "-" + hours + "-" + minutes + "-" + seconds;  
        
        xmlHttpCRM=GetXmlHttpObject()
        if (xmlHttpCRM==null)
        {
            alert ("Browser does not support HTTP Request")
            return
        }
        document.getElementById("divBengCRMStatus").innerHTML = "Loading..";
        var url="AjaxRequests/AJAXCRMAuth.aspx?temp="+temp+"&Username="+UserID+"&Password="+Password; 
        xmlHttpCRM.onreadystatechange=BangCRMCheckAuth_CallBack
        xmlHttpCRM.open("GET",url,true)
        xmlHttpCRM.send(null)        
      
}


function BangCRMCheckAuth_CallBack()
{
    var value;
	if (xmlHttpCRM.readyState==4 || xmlHttpCRM.readyState=="complete")
    	{	
		    if (xmlHttpCRM.status == 200)      
		    { 
		        value = xmlHttpCRM.responseText;
		        if(value == 1)
		        {
		            document.getElementById("divLoginInfo").style.display = "";
                    document.getElementById("divBengCRM").style.display = "none";
		            GetLoginStatus();
		        }
		        else if(value == 2)
		        {
		            document.getElementById("divBengCRMStatus").innerHTML = "<font color='red'>CRM Number Alredy Registerd.</font>";
		        }
		        else if(value == 3)
		        {
		            document.getElementById("divBengCRMStatus").innerHTML = "<font color='red'>Invalid UserName/Password.</font>";    
		        }
		        else
		        {
		            document.getElementById("divBengCRMStatus").innerHTML = "<font color='red'>Server Busy!!! Please try after some time.</font>";
		        }
		    }
	    }
}

function UpdateCRMUserID(LoginID,OldUserID)
{
        HideContent();
        tempCRM_LoginID = LoginID;
        tempCRM_OldUserID = OldUserID;
        var NewUserID = document.getElementById("txtNewUserID").value;
        if(NewUserID == "")
        {
            alert("Please enter mobile number.");
            return false;
        }
        if(NewUserID.length < 10)
        {
            alert("Please enter your valid mobile number.");
            document.getElementById("txtNewUserID").select();
            return false;
        }        
        if(isNaN(NewUserID))
        {
            alert("Mobile number should be numeric");
            document.getElementById("txtNewUserID").select();            
            return false;
        }
        var currentTime = new Date()
        var month = currentTime.getMonth() + 1
        var day = currentTime.getDate()
        var year = currentTime.getFullYear()
        var hours = currentTime.getHours()
        var minutes = currentTime.getMinutes()
        var seconds = currentTime.getSeconds()        
        var temp = month + "-" + day + "-" + year + "-" + hours + "-" + minutes + "-" + seconds;  
        
        xmlHttpCRM=GetXmlHttpObject()
        if (xmlHttpCRM==null)
        {
            alert ("Browser does not support HTTP Request")
            return
        }
        tempNewUserID= NewUserID;
        document.getElementById("divUpdateCRMUserID").innerHTML = "Processing....";
        var url="AjaxRequests/AJAXCRMUser.aspx?NewUserID="+NewUserID+"&LoginID="+LoginID+"&OldUserID="+OldUserID+"&temp="+temp;
        xmlHttpCRM.onreadystatechange=UpdateCRMUserID_CallBack
        xmlHttpCRM.open("GET",url,true)
        xmlHttpCRM.send(null)            
}
function UpdateCRMUserID_CallBack()
{
 var value;
	if (xmlHttpCRM.readyState==4 || xmlHttpCRM.readyState=="complete")
    	{	
		    if (xmlHttpCRM.status == 200)      
		    { 
		        value = xmlHttpCRM.responseText;
		        var temp = value.split('|');
		        if(temp[0] == "0")
		        {
		          document.getElementById("divCRMResult").innerHTML = temp[1];
		        }		        
		        else if(temp[0] == "2")
		        {
		                document.getElementById("divUpdateCRMUserID").innerHTML = temp[1];
		                document.getElementById("txtNewUserID").select();
		        }
		        else if(temp[0] == "5")
		        {
		                document.getElementById("divUpdateCRMUserID").innerHTML = temp[1];
	                	var strDisplayUP = "<table cellpadding=\"0\" cellspacing=\"0\"  border=\"0\"><tr><td><table cellpadding=\"0\" cellspacing=\"0\"  border=\"0\"><tr><td style=\"width:1px;\"><img src=\"image/siteimages/CommHdLeft.gif\" alt=\"\"/></td><td class=\"AllPagesHeaderBgStrip\" width=\"250px\">Update Your Details:</td><td class=\"AllPagesHeaderBgStrip\" align=\"right\" ><a href=\"javascript:void(0);\" onclick='javascript:HideReplaceTip("+tempCRM_LoginID+","+tempCRM_OldUserID+","+tempNewUserID+");' class=\"AllPagesHeaderBgStrip\"><img src=\"image/siteimages/Help_close.gif\" alt=\"\"/  style=\"border:0;\" ></a></td><td align='right'><img src=\"image/siteimages/CommHdRight.gif\" alt=\"\"/></td></tr><tr><td colspan=\"4\" style=\"background-color:#AF251C;\" align='center' valign='middle'><b>";
                        var strDisplayDOWN = "</b></td></tr><tr><td colspan=\"4\" style=\"background-color:#AF251C;\" align='center' valign='middle' height=\"3px\" ></td></tr></table></td><td><div id='divHelpArrow' style=\"position:absolute;top:110px;\"><img src=\"image/siteimages/Help-arrow.gif\" alt=\"\"/></div></td></tr></table>";
                        var div_dropContent = window.parent.document.getElementById('HelpTip');
                        var w = 380;
                        var h = 244;
                        var xc = Math.round((document.body.clientWidth/2)-(w/8))
                        var yc = 340//380;//Math.round((550/2)-(h/10))
                        div_dropContent.style.left = xc + "px";
                        div_dropContent.style.top  = yc + "px";
                        div_dropContent.style.visibility="visible";
                        div_dropContent.innerHTML = strDisplayUP+temp[2]+strDisplayDOWN;
                        div_dropContent.style.display = 'block';
		        }		        
		        else
		        {
		            document.getElementById("divUpdateCRMUserID").innerHTML = temp[1];
		        }
		        
		    }
	    }
}
function HideReplaceTip(LoginID,OldUSerID,NewUserID)
{
    var div_dropContent = window.parent.document.getElementById('HelpTip');
    div_dropContent.style.display = 'none';
    
    var ShowUpdateBox = "<table border='0' cellPadding ='2' cellSpacing='0'>";
    ShowUpdateBox += "<tr><td><span class='UserName'><b>Please update your Mobile number to earn/redeem points.</b><a href='javascript:void(0);' onclick='showCRMTip();'><img src='image/siteimages/Help-questionmark.gif' alt=''  style='border:0;' /></a></span>";
    ShowUpdateBox += "</td></tr>";
    ShowUpdateBox += "<tr><td>";
    ShowUpdateBox += "<input type='text' id='txtNewUserID' maxlength='10' style='width:80px;' class='menuList' value=\"" + NewUserID + "\" />&nbsp;&nbsp;";
    ShowUpdateBox += "<input type='button' value='Update' class='SubmitButtons' onclick='javascript:UpdateCRMUserID(\"" + LoginID + "\",\"" + OldUSerID + "\");' />";
    ShowUpdateBox += "</td></tr>";
    ShowUpdateBox += "</table>";
    document.getElementById("divUpdateCRMUserID").innerHTML = ShowUpdateBox;
    
}
function showCRMTip()
{
    HideContent();
	var strDisplayUP = "<table cellpadding=\"0\" cellspacing=\"0\"  border=\"0\"><tr><td><table cellpadding=\"0\" cellspacing=\"0\"  border=\"0\"><tr><td style=\"width:1px;\"><img src=\"image/siteimages/CommHdLeft.gif\" alt=\"\"/></td><td class=\"AllPagesHeaderBgStrip\" width=\"250px\">NOTE :</td><td class=\"AllPagesHeaderBgStrip\" align=\"right\" ><a href=\"javascript:void(0);\" onclick='javascript:HideContent();' class=\"AllPagesHeaderBgStrip\"><img src=\"image/siteimages/Help_close.gif\" alt=\"\"/  style=\"border:0;\" ></a></td><td align='right'><img src=\"image/siteimages/CommHdRight.gif\" alt=\"\"/></td></tr><tr><td colspan=\"4\" style=\"background-color:#AF251C;\" align='center' valign='middle'><b>";
    var strDisplayDOWN = "</b></td></tr><tr><td colspan=\"4\" style=\"background-color:#AF251C;\" align='center' valign='middle' height=\"3px\" ></td></tr></table></td><td><div id='divHelpArrow'><img src=\"image/siteimages/Help-arrow.gif\" alt=\"\"/></div></td></tr></table>";
    var strText = "<table  style=\"background-color:#FFFFFF;\" width=\"270px\" cellpadding=\"2\" cellspacing=\"2\">";
        strText +="<tr><td align='left'>Henceforth, your Fun Rewards User ID will be your mobile number.</td></tr>";
        strText +="<tr><td align='left'>The points collected/redeemed by you so far, remain as before.</td></tr>";
        strText +="<tr><td align='left'>Please visit you booking history to view the same.</td></tr>";
        strText += "</table>";
    var div_dropContent = window.parent.document.getElementById('HelpTip');
    var w = 380;
    var h = 244;
    var xc = Math.round((document.body.clientWidth/2)-(w/8))
    var yc = 410;//Math.round((550/2)-(h/10))
    div_dropContent.style.left = xc + "px";
    div_dropContent.style.top  = yc + "px";
    div_dropContent.style.visibility="visible";
    div_dropContent.innerHTML = strDisplayUP+strText+strDisplayDOWN;
    div_dropContent.style.display = 'block';
}
function CheckCRMMandatoryDetails(LoginID,OldUSerID,NewUserID)
{
    if(document.getElementById("txtMname").value == "")
    {
        alert("Please enter mother maiden name.");
        document.getElementById("txtMname").focus();
        return false;
    }
    if(!isNaN(document.getElementById("txtMname").value))
    {
        alert("Mother maiden name should be text.");
        document.getElementById("txtMname").select();
        return false;
    }    
    if(document.getElementById("txtdd").value == "")
    {
        alert("Please enter Date of Birth.");
        document.getElementById("txtdd").focus();    
        return false;        
    }
    if(isNaN(document.getElementById("txtdd").value))
    {
        alert("Date should be numeric.");
        document.getElementById("txtdd").select();    
        return false;        
    }    
    if(document.getElementById("txtmm").value == "")
    {
        alert("Please enter month of the Date of Birth.");
        document.getElementById("txtmm").focus();    
        return false;        
    }
    if(isNaN(document.getElementById("txtmm").value))
    {
        alert("Month of the Date of Birth should be numeric.");
        document.getElementById("txtmm").select();    
        return false;        
    }    
    if(document.getElementById("txtyyyy").value == "")
    {
        alert("Please enter year of the Date of Birth.");
        document.getElementById("txtyyyy").focus();    
        return false;        
    }   
    if(isNaN(document.getElementById("txtyyyy").value))
    {
        alert("Year of the Date of Birth should be numeric.");
        document.getElementById("txtyyyy").select();    
        return false;        
    }          
    if(document.getElementById("txtStreet").value == "")
    {
        alert("Please enter Street.");
        document.getElementById("txtStreet").focus();    
        return false;        
    }
    if(document.getElementById("txtLocality").value == "")
    {
        alert("Please enter Locality/Area/Sector.");
        document.getElementById("txtLocality").focus();    
        return false;        
    }
    if(document.getElementById("txtPinCode").value == "")
    {
        alert("Please enter Pin Code.");
        document.getElementById("txtPinCode").focus();    
        return false;        
    }   
    if(isNaN(document.getElementById("txtPinCode").value))
    {
        alert("Pin Code should be numeric.");
        document.getElementById("txtPinCode").select();    
        return false;        
    }        
    var DOB = document.getElementById("txtmm").value + "/" + document.getElementById("txtdd").value + "/" + document.getElementById("txtyyyy").value;
    if(ValidateDate(DOB) == false)
    {
        return false;
    }  
    var DateOfBirth = document.getElementById("txtdd").value + "-" + document.getElementById("txtmm").value + "-" + document.getElementById("txtyyyy").value;
    var MotherName = document.getElementById("txtMname").value;
    var Street = document.getElementById("txtStreet").value;
    var Locality = document.getElementById("txtLocality").value;
    var PinCode = document.getElementById("txtPinCode").value;
    UpdateCRMMandatoryDetails(LoginID,OldUSerID,NewUserID,MotherName,DateOfBirth,Street,Locality,PinCode);
}
function UpdateCRMMandatoryDetails(LoginID,OldUSerID,NewUserID,MotherName,DateOfBirth,Street,Locality,PinCode)
{
        var currentTime = new Date()
        var month = currentTime.getMonth() + 1
        var day = currentTime.getDate()
        var year = currentTime.getFullYear()
        var hours = currentTime.getHours()
        var minutes = currentTime.getMinutes()
        var seconds = currentTime.getSeconds()        
        var temp = month + "-" + day + "-" + year + "-" + hours + "-" + minutes + "-" + seconds;  
        
        xmlHttpCRM=GetXmlHttpObject()
        if (xmlHttpCRM==null)
        {
            alert ("Browser does not support HTTP Request")
            return
        }
        tempNewUserID= NewUserID;
        document.getElementById("divUpdateCRMUserID").innerHTML = "Processing....";
        HideContent();
        var url="AjaxRequests/AJAXCRMUser.aspx?Update=1";
        url += "&NewUserID="+NewUserID+"&LoginID="+LoginID+"&OldUserID="+OldUSerID;
        url += "&MotherName="+MotherName+"&DateOfBirth="+DateOfBirth+"&Street="+Street;
        url += "&Locality="+Locality+"&PinCode="+PinCode+"&temp="+temp;
        xmlHttpCRM.onreadystatechange=UpdateCRMMandatory_callBack
        xmlHttpCRM.open("GET",url,true)
        xmlHttpCRM.send(null)
}
function UpdateCRMMandatory_callBack()
{
 var value;
	if (xmlHttpCRM.readyState==4 || xmlHttpCRM.readyState=="complete")
    	{	
		    if (xmlHttpCRM.status == 200)      
		    { 
		        value = xmlHttpCRM.responseText;
 		        var temp = value.split('|');
    	        document.getElementById("divUpdateCRMUserID").innerHTML = temp[1];
		    }
		}
}
function ResetCRMDetails()
{
    document.getElementById("txtMname").value = "";
    document.getElementById("txtdd").value = "";
    document.getElementById("txtmm").value = "";
    document.getElementById("txtyyyy").value = "";
    document.getElementById("txtState").value = "";
    document.getElementById("txtLocality").value = "";
    document.getElementById("txtPinCode").value = "";
}
function CancelUpdateCRMUserID()
{
    document.getElementById("divUpdateCRMUserID").style.display = "none";
}

///////////////////End for function for CRM////////////////////



function PaidBookingCallFromSchedule(StringPath)
{
        xmlHttpLogin=GetXmlHttpObject()
        if (xmlHttpLogin==null)
        {
            alert ("Browser does not support HTTP Request")
            return
        }
       
       LocationPath =StringPath;
        var currentTime = new Date()     
        var temp = (currentTime.getMonth() + 1) + "-" + currentTime.getDate() + "-" + currentTime.getFullYear() + "-" + currentTime.getHours() + "-" + currentTime.getMinutes() + "-" + currentTime.getSeconds();    
        var url="Service/WebService.asmx/CancelTransaction?&temp="+temp;
     
        //document.getElementById('divSuccess').innerHTML = 'Loading....';

        xmlHttpLogin.onreadystatechange=PaidBookingCallFromSchedule_CallBack
        xmlHttpLogin.open("GET",url,true)
        xmlHttpLogin.send(null)
}

function PaidBookingCallFromSchedule_CallBack()
{
    if (xmlHttpLogin.readyState==4 || xmlHttpLogin.readyState=="complete")
    {	
        if (xmlHttpLogin.status == 200)      
        { 

            GetLoginStatus();
            if(window.parent.IsLogin == 0)
            {
                location.href = LocationPath;
            }
            else
            {
                LoadLoginDialog(1,LocationPath);
            }
        }
    }
}



function GiftMovieCall(StringPath)
{
        xmlHttpLogin=GetXmlHttpObject()
        if (xmlHttpLogin==null)
        {
            alert ("Browser does not support HTTP Request")
            return
        }
       
       LocationPath =StringPath;
        var currentTime = new Date()     
        var temp = (currentTime.getMonth() + 1) + "-" + currentTime.getDate() + "-" + currentTime.getFullYear() + "-" + currentTime.getHours() + "-" + currentTime.getMinutes() + "-" + currentTime.getSeconds();    
        var url="Service/ServiceForGAM.asmx/SessionExpire?&temp="+temp;
     
        //document.getElementById('divSuccess').innerHTML = 'Loading....';

        xmlHttpLogin.onreadystatechange=GiftMovieCall_CallBack
        xmlHttpLogin.open("GET",url,true)
        xmlHttpLogin.send(null)
}

function GiftMovieCall_CallBack()
{
    if (xmlHttpLogin.readyState==4 || xmlHttpLogin.readyState=="complete")
    {	
        if (xmlHttpLogin.status == 200)      
        { 

            GetLoginStatus();
            if(window.parent.IsLogin == 0)
            {
                location.href = LocationPath;
            }
            else
            {
                LoadLoginDialog(1,LocationPath);
            }
        }
    }
}

