﻿// JScript File

var xmlHttp1
var ttoltiploading="<table cellspacing='0' cellpadding='5' border='0' width='200' bgcolor='#D17869'><tr><td align='center' class='buytickettxt'><b>Please wait.. while the information is being loaded. </b></td></tr></table>";
var tooltipup="<table cellspacing='0' cellpadding='0' border='0' width='400' bgcolor='#D17869'>";
var tooltipdown="</table></td></tr></table>";
var isLogin = 1;
var errCounter =0;
var tempEvent;
var AudiMultiplexCode;
var tempClientX,tempClientY;
var tempShowDate;
var xmlHttpToolTip,xmlHttpToolTip1,xmlHttpToolTip2,xmlHttpToolTip3,xmlHttpToolTip4,xmlHttpToolTip5,xmlHttpToolTip6,xmlHttpPayment,width=1000;
var height=200;
var timer;
var tooltip="";
var tempX,tempY,tempX1,tempY1;
var xmlHttpBookStatus;
var tempPG;
var tempMoiveSessionID = "",tempMultiplexCode = "",tempCenterCode = "",tempITZMovieCode = "",tempCityID = "";
var tempHOMovieCode = "",tempMovieShowTime = "",tempMovieTitle = "",tempMovieShowDate ="", tempe = "";
var errStatus=0;
var isDome = 0;
// Set Netscape up to run the "captureMousePosition" function whenever
// the mouse is moved. For Internet Explorer and Netscape 6, you can capture
// the movement a little easier.
if (document.layers) { // Netscape
    document.captureEvents(Event.MOUSEMOVE);
    document.onmousemove = captureMousePosition;
} else if (document.all) { // Internet Explorer
    document.onmousemove = captureMousePosition;
} else if (document.getElementById) { // Netcsape 6
    document.onmousemove = captureMousePosition;
}
// Global variables
xMousePos = 0; // Horizontal position of the mouse on the screen
yMousePos = 0; // Vertical position of the mouse on the screen
xMousePosMax = 0; // Width of the page
yMousePosMax = 0; // Height of the page

function captureMousePosition(e) {
    if (document.layers) {
        // When the page scrolls in Netscape, the event's mouse position
        // reflects the absolute position on the screen. innerHight/Width
        // is the position from the top/left of the screen that the user is
        // looking at. pageX/YOffset is the amount that the user has 
        // scrolled into the page. So the values will be in relation to
        // each other as the total offsets into the page, no matter if
        // the user has scrolled or not.
        xMousePos = e.pageX;
        yMousePos = e.pageY;
        xMousePosMax = window.innerWidth+window.pageXOffset;
        yMousePosMax = window.innerHeight+window.pageYOffset;
    } else if (document.all) {
        // When the page scrolls in IE, the event's mouse position 
        // reflects the position from the top/left of the screen the 
        // user is looking at. scrollLeft/Top is the amount the user
        // has scrolled into the page. clientWidth/Height is the height/
        // width of the current page the user is looking at. So, to be
        // consistent with Netscape (above), add the scroll offsets to
        // both so we end up with an absolute value on the page, no 
        // matter if the user has scrolled or not.
        xMousePos = window.event.x+document.documentElement.scrollLeft;
        yMousePos = window.event.y+document.documentElement.scrollTop;
        xMousePosMax = document.documentElement.clientWidth+document.documentElement.scrollLeft;
        yMousePosMax = document.documentElement.clientHeight+document.documentElement.scrollTop;             
        /*xMousePosMax = document.body.clientWidth+document.documentElement.scrollLeft;
        yMousePosMax = document.body.clientHeight+document.documentElement.scrollTop;*/
    } else if (document.getElementById) {
        // Netscape 6 behaves the same as Netscape 4 in this regard 
        xMousePos = e.pageX;
        yMousePos = e.pageY;
        xMousePosMax = window.innerWidth+window.pageXOffset;
        yMousePosMax = window.innerHeight+window.pageYOffset;
    }
}

function GetXmlHttpObject()
{ 
    var objXMLHttp=null
    if (window.XMLHttpRequest)
    {
        objXMLHttp=new XMLHttpRequest()
    }
    else if (window.ActiveXObject)
    {
        objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
    }
    return objXMLHttp
} 
    var xmlDoc12;
    
    function loadXMLString(txt) 
    {
        var parser;
        var xmlDoc;
        try //Internet Explorer
          {
              xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
              xmlDoc.async="false";
              xmlDoc.loadXML(txt);
              return(xmlDoc); 
          }
        catch(e)
          {
          try //Firefox, Mozilla, Opera, etc.
            {
                parser=new DOMParser();
                xmlDoc=parser.parseFromString(txt,"text/xml");
                return(xmlDoc);
            }
          catch(e) 
            {
            alert(e.message)
                }
          }
        return(null);
    }

function hideTip() {

if(xmlHttp1 != null)
    {
        /*if(xmlHttp1 != '' || xmlHttp1 != null)
        {*/
            xmlHttp1.abort();
            errStatus = 1;
        //}
    }
    if(xmlHttpToolTip3 != null)
    {
        /*if(xmlHttpToolTip3 != '' || xmlHttpToolTip3 != null)
        {*/
            xmlHttpToolTip3.abort();
            errStatus = 1;            
        //}
    }
    if(xmlHttpToolTip2 != null)
    {
        /*if(xmlHttpToolTip2 != '' || xmlHttpToolTip2 != null)
        {*/
            xmlHttpToolTip2.abort();
            errStatus = 1;            
        //}
    }
	
	
    var url = window.location.href;
    var nohttp = url.split('//')[1];    
    var page = nohttp.split('/')[1].toLowerCase();
    if(page == "bookinghistory.aspx")
    {
        CancelAgentTrans();
    }
    else if (page != "buyticket.aspx")
    {          
	    ntipobj = document.getElementById( "ntooltip" );
	    ntipobj.style.visibility="hidden";
    	ClearGenCRMPopUp();
        showErrorTip();
	}
	else
	{
		ClearGenCRMPopUp();
        showErrorTip();
	    //document.getElementById("ctl00_ContentPlaceHolder1_DivSynTooltip").className="displaynone";
	}

	//clearTimeout(timer);
}
 function showErrorTip()
 {
   if(errStatus == 1 && errCounter == 0)
    {
        errStatus = 0;
        errCounter = 1;
        ntipobj = document.getElementById( "ntooltip" );  
        var errortip="<table cellspacing='0' cellpadding='5' border='0' width='200' bgcolor='#D17869'><tr><td align='right' height='2'><font size='1px'><a href='javascript:void(0);' onclick='javascript:hideTip();' class='closeText'>x</a></font></td></tr><tr><td align='center' class='buytickettxt'><b>Server Busy! Please try again after sometime </b></td></tr></table>";
        ntipobj.innerHTML=errortip;
        ntipobj.style.visibility="visible";
        ShowGenCRMPopUp();
    }
 }
 function showTip(CityID,MoiveSessionID,MultiplexCode,CenterCode,ITZMovieCode,HOMovieCode,MovieShowTime,MovieTitle,MovieShowDate,flag,e)
 {
            var url;
              errCounter = 0;
              tempMoiveSessionID = MoiveSessionID;
              tempMultiplexCode = MultiplexCode;
              tempCenterCode = CenterCode;
              tempITZMovieCode = ITZMovieCode;
              tempHOMovieCode = HOMovieCode;
              tempMovieShowTime = MovieShowTime;
              tempMovieTitle = MovieTitle;
              tempMovieShowDate =MovieShowDate;
              tempCityID = CityID;
                 var XoffSet = 0;
                 if(flag == 0)
                 {
                    if (!e) 
                    {
                        var e = window.event;
                        XoffSet = 145;
                    }
                    else
                    {
                        XoffSet = 133;
                    }
                    tempX = e.clientX + document.documentElement.scrollLeft;
                    tempY = e.clientY + document.documentElement.scrollTop;
                    tempY1 = tempY;
                    tempX1 = tempX - XoffSet;
                }
                tempEvent = e;
                 xmlHttp1=GetXmlHttpObject()
                if (xmlHttp1==null)
                {
                    alert ("Browser does not support HTTP Request")
                    return
                } 
                ntipobj = document.getElementById( "ntooltip" );    
                var url = window.location.href;
                var nohttp = url.split('//')[1];    
                var hostPort = nohttp.split('/')[1];
                var page =  hostPort.split('?')[0];  
                if (page != "buyTicket.aspx")
                {      
                    /*ntipobj.style.width= width;
                    ntipobj.style.height= height;*/
                    if(isLogin != 1)
                    {

	                    ntipobj.innerHTML=ttoltiploading;
	                    ntipobj.style.visibility="visible";
	                }
	                else
	                {
	                       ntipobj.innerHTML="";
	                       ntipobj.style.visibility="";
	                }
                }
                else
                {
                	  
                  // document.getElementById("ctl00_ContentPlaceHolder1_DivSynTooltip").className="";
                   //document.getElementById("ctl00_ContentPlaceHolder1_DivSynTooltip").innerHTML = ttoltiploading;
                }   
                var w = screen.width; // Get the width of the screen
                var h = screen.height; // Get the height of the screen

                // The size of the Window
                var win_width = w/2; //- 700;
                var win_height = h/2 ;//- 450;

                // Where to place the Window
                var left = width/6;
                var top = height + 40;


                /* ntipobj.style.left = (tempX-XoffSet) + "px";
                ntipobj.style.top = tempY + "px" ;
                tempClientX = (tempX-XoffSet) + "px";;
                tempClientY = (tempY+10) + "px" ;*/
                if(window.navigator.appName == "Microsoft Internet Explorer")
                {
                top = height + 40;
                ntipobj.style.posLeft = (win_width + parseInt(document.documentElement.scrollLeft)) - left;
                ntipobj.style.posTop = win_height + parseInt(document.documentElement.scrollTop) - top;
                ntipobj.style.left = (win_width + parseInt(document.documentElement.scrollLeft)) - left;
                ntipobj.style.top = (win_height + parseInt(document.documentElement.scrollTop)) - top;
                }
                else
                {
                top = height + 40;
                ntipobj.style.posLeft = ((win_width + parseInt(document.documentElement.scrollLeft)) - left)+"px";
                ntipobj.style.posTop = ((win_height + parseInt(document.documentElement.scrollTop)) - top)+"px";
                ntipobj.style.left = ((win_width + parseInt(document.documentElement.scrollLeft)) - left)+ "px";
                ntipobj.style.top = ((win_height+ parseInt(document.documentElement.scrollTop)) - top)+"px" ;
                }
             
                /*Generate Date & time */
                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;    
                /*End of Date Time*/
                
                if(MultiplexCode == "0001" || MultiplexCode == "0003") //For Funcinemas
                {              
                    url ="Services/ITZService.asmx/GetBookingToolTip?MovieSessionID="+MoiveSessionID;
                    url +="&MultiplexCode="+MultiplexCode;
                    url +="&CenterCode="+CenterCode;
                    url +="&ITZMovieCode="+ITZMovieCode;
                    url +="&HOMovieCode="+HOMovieCode; 
                    url +="&MovieTime="+MovieShowTime;
                    url +="&MovieTitle="+MovieTitle;
                    url +="&MovieDate="+MovieShowDate;
                    url += "&rand="+temp;
                }
                else if(MultiplexCode == "0002") // For adlabs
                {    
                    url ="Services/ITZAdlabsService.asmx/GetBookingToolTip?MovieSessionID="+MoiveSessionID;
                    url +="&MultiplexCode="+MultiplexCode;
                    url +="&CenterCode="+CenterCode;
                    url +="&ITZMovieCode="+ITZMovieCode;
                    url +="&HOMovieCode="+HOMovieCode; 
                    url +="&MovieTime="+MovieShowTime;
                    url +="&MovieTitle="+MovieTitle;
                    url +="&MovieDate="+MovieShowDate;
                    url += "&rand="+temp;                
                }
                xmlHttp1.onreadystatechange=GetToolTip
                xmlHttp1.open("GET",url,true)
                xmlHttp1.send(null)  
                timer = setTimeout("hideTip();",4000);
                return false; 
 }
 
function GetToolTip() 
{
    if (xmlHttp1.readyState==4 || xmlHttp1.readyState=="complete")
    {
         if (xmlHttp1.status == 200)      
         {
            errCounter = 1;
            clearTimeout(timer);
            var str = new String(xmlHttp1.responseText);
            str= str.replace(/&gt;/g,'>');
            str= str.replace(/&lt;/g,'<');
            str= str.replace(/&amp;/g,'&');
           switch(xmlHttp1.responseXML.getElementsByTagName("string")[0].childNodes[0].nodeValue)
                        {
                            case "0001": 
                                    hideTip();
                                    ntipobj.innerHTML="";
                                    CheckLogin(tempEvent); // to check allow login
                                    break;
                            case "0002": 
                                    alert("Ticket details not found! Please try again later!!!");
                                    hideTip();
                                    break;
                            case "0003": 
                                    alert("Communication failed. Please try again later!");
                                    hideTip();
                                    break;                                    
                            case "0004": 
                                    alert("Not Allowed to Book the tickets as you have booked 50 tickets in current week.\nTry to book in next week.");
                                    hideTip();
                                    break;  
                            case "0005": 
                                    alert("Not Allowed to Book the tickets as you have booked 500 tickets in current week.\nTry to book in next week.");
                                    hideTip();
                                    break;                                                                                                                                                                                    
                            default: 
                                        var url = window.location.href;
                                        var nohttp = url.split('//')[1];    
                                        var hostPort = nohttp.split('/')[1];
                                        var page =  hostPort.split('?')[0];    
                                        if (page != "searchByMovie.aspx" )
                                        {      
                                            ntipobj.innerHTML="";                          
                                            tooltip=tooltipup+str+tooltipdown
                                            ntipobj = document.getElementById( "ntooltip" );
                                            ntipobj.innerHTML = tooltip;
                                            //ntipobj.innerHTML = xmlHttp1.responseText;
                                            if(document.getElementById("hdnOrderIdState").value == 1)
                                            {
                                                GetShortOrderSummary(tempCityID,tempITZMovieCode,tempMovieShowDate);
                                            }
                                            
                                        }
                                        else
                                        {   
                                            //document.getElementById("ctl00_ContentPlaceHolder1_DivSynTooltip").className="";
                                            //document.getElementById("ctl00_ContentPlaceHolder1_DivSynTooltip").innerHTML = tooltipup+xmlHttp1.responseText+tooltipdown;
                                        }
                                        ShowGenCRMPopUp();
                                    break;
                                   
                        }
         } 
         
    }
}


function ShowGenCRMPopUp()
{

    GenCRMDarkenPage();
    ShowGenCRMPopUpPanel();
    
   
}

function ClearGenCRMPopUp()
{
    var div_temp = document.getElementById('ntooltip');
    //div_temp.style.display = 'none';
    GenCRMLightenPage();
}


function ShowGenCRMPopUpPanel()
{
    var div_temp = document.getElementById('ntooltip');
    
    // w is a width of the newsletter panel
    w = 480;
    // h is a height of the newsletter panel
    h = 279;
    
    // get the x and y coordinates to center the newsletter panel
    xc = Math.round((document.body.clientWidth/2)-(w/2))
    //yc = Math.round((document.body.clientHeight/2)-(h/2))
	yc = Math.round((650/2)-(h/2))
    
    // show the newsletter panel
    //div_temp.style.left = xc + "px";
    //div_temp.style.top  = yc + "px";
    div_temp.style.display = 'block';
    
}


function GenCRMDarkenPage()
{
   var div_temp = document.getElementById('div_screen');
   div_temp.style.width = (parseInt(document.body.scrollWidth)) + 'px';
   //div_temp.style.height = (parseInt(document.body.scrollHeight))+ (parseInt(document.body.parentNode.scrollHeight)) + 'px';
   div_temp.style.height = (parseInt(document.body.parentNode.scrollHeight) + 80) + 'px';
   div_temp.style.display = 'block';
}

// this function removes the dark screen and the page is light again
function GenCRMLightenPage()
{
    var div_temp = document.getElementById('div_screen');
    div_temp.style.display = 'none';
}

function SetTipPostion()
{

   var objtip = document.getElementById( "ntooltip" );
   var w = screen.width; // Get the width of the screen
	var h = screen.height; // Get the height of the screen

	// The size of the Window
	var win_width = w/2; //- 700;
	var win_height = h/2 ;//- 450;

	// Where to place the Window
	var left = width /4;
	var top = height;
    objtip.style.left = (win_width + document.documentElement.scrollLeft) - left;
    objtip.style.top = (win_height + document.documentElement.scrollTop) - top;
  
    timer = setTimeout("SetTipPostion();",500);
}

function GetPrice()
{
                var ServiceFee = document.getElementById("hdnServieFee").value;
                if(ServiceFee == "" || ServiceFee == null)
                {
                   ServiceFee = "10.00";
                }
                if(document.getElementById("ttype").value == -1 && document.getElementById("ddlseats").value == -1)
                {
                    document.getElementById("tdTotalPrice").innerHTML = "<font size='3'>Ticket Amount: 0.00</font><font size ='2'>&nbsp;INR</font>"
                    if(document.getElementById("tdTktPrice") != null)
                    {
                        document.getElementById("tdTktPrice").innerHTML = "0.00";
                        document.getElementById("tdServiceFee").innerHTML = "0.00";
                        document.getElementById("tdTAmt").innerHTML = "0.00";
                    }
                }
                else if(document.getElementById("ttype").value != -1 && document.getElementById("ddlseats").value == -1)
                {
                    var seatAvl=GetSeatAvl(document.getElementById("ttype").value);
                    document.getElementById("tdTotalPrice").innerHTML = "<font size='3'>Ticket Amount: 0.00</font><font size ='2'>&nbsp;INR</font>"
                    if(document.getElementById("tdTktPrice") != null)
                    {
                        document.getElementById("tdTktPrice").innerHTML = "0.00";
                        document.getElementById("tdServiceFee").innerHTML = "0.00";
                        document.getElementById("tdTAmt").innerHTML = "0.00";                    
                    }
                }
                else if(document.getElementById("ttype").value == -1 && document.getElementById("ddlseats").value != -1)
                {
                    document.getElementById("tdTotalPrice").innerHTML = "<font size='3'>Ticket Amount: 0.00</font><font size ='2'>&nbsp;INR</font>"
                    if(document.getElementById("tdTktPrice") != null)
                    {
                        document.getElementById("tdTktPrice").innerHTML = "0.00";
                        document.getElementById("tdServiceFee").innerHTML = "0.00";
                        document.getElementById("tdTAmt").innerHTML = "0.00";                    
                    }                
                }
                else if(document.getElementById("ttype").value != -1 && document.getElementById("ddlseats").value != -1)
                {
                    var SelectedPrice = GetSelectedPriceValue(document.getElementById("ttype").value);  
                    var seatAvl=GetSeatAvl(document.getElementById("ttype").value);
                    var TotalSeats = document.getElementById("ddlseats").value;        
                    if(seatAvl!="N.A")
                    {
                       var TotalServiceFee = ServiceFee * TotalSeats;
                       var ticketprice = (SelectedPrice * TotalSeats) + TotalServiceFee; 
                       var PriceWithoutServiceFee = (SelectedPrice * TotalSeats);
                        if(document.getElementById("tdTktPrice") != null)
                        {                       
                            document.getElementById("tdTktPrice").innerHTML = (SelectedPrice * TotalSeats).toFixed(2);
                            document.getElementById("tdServiceFee").innerHTML = TotalServiceFee.toFixed(2);                       
                            document.getElementById("tdTAmt").innerHTML = ticketprice.toFixed(2);                                                   
                        }
                       document.getElementById("hdnNetAmount").value = ticketprice.toFixed(2);
                       document.getElementById("tdTotalPrice").innerHTML = "<font size='3'>Ticket Amount: "+ PriceWithoutServiceFee.toFixed(2) +"</font><font size ='2'>&nbsp;INR</font>";
                    }
                }
                if(document.getElementById("ttype").value != -1)
                {
                    var seatText = (document.getElementById("ttype").options[document.getElementById("ttype").selectedIndex].text).toLowerCase();;
                    if(seatText == "dome")
                    {
                        isDome = 1;
                        document.getElementById("tdDomeMsg").style.height = "25";
                        document.getElementById("tdDomeMsg").innerHTML = "<font size='2' color='#FF0000'><b>For SeatType 'Dome', AudiLayout will not be visible.</b></font>";
                    }
                    else
                    {
                        isDome = 0;
                        document.getElementById("tdDomeMsg").style.height = "";                        
                        document.getElementById("tdDomeMsg").innerHTML = "";
                    }
                }
                else
                {
                        isDome = 0;
                        document.getElementById("tdDomeMsg").style.height = "";                       
                        document.getElementById("tdDomeMsg").innerHTML = "";                    
                }
}
function GetSelectedPriceValue(str)
{
    var mytool = str.split("-");
    return mytool[1];
}
function GetSeatAvl(str)
{
    var mytool = str.split("-");
    return mytool[2];
}

 function showAudiToolTip(MoiveSessionID,MultiplexCode,CenterCode, HOMovieCode)
 {
    var UserID = "0";
    AudiMultiplexCode = MultiplexCode;
    errCounter = 0;
    var NetPrice = document.getElementById("hdnNetAmount").value;

    var XoffSet = 0;
    if (!e) 
    {
        var e = window.event;
        XoffSet = 145;
    }
    else
    {
        XoffSet = 133;
    }
    if(document.getElementById("ttype").value == -1)
    {
        errCounter = 1;
        alert("Please Select Ticket type");
        return false;
    }
    if(document.getElementById("ddlseats").value == -1)
    {
         errCounter = 1;
        alert("Please Select Quantity of Tickets");
        return false;
    }
    if(document.getElementById("tdTotalPrice").innerHTML == "<font size='3'>Net Amount: 0.00</font><font size ='2'>&nbsp;INR</font>" || NetPrice == '' || NetPrice == null)
    {
         errCounter = 1;
        alert("Please Select Ticket type");
        return false;
    }
    
        var No_of_Ticket= document.getElementById("ddlseats").value
        var className = document.getElementById("ttype").options[document.getElementById("ttype").selectedIndex].text;
        var mytool = className.split("-");
        className = mytool[0];
        var classCode = document.getElementById("ttype").value;
        var selClassCode = classCode.split("-");
        classCode = selClassCode[0];
        var TicketPrice = GetSelectedPriceValue(document.getElementById("ttype").value); 
        /*var TotalPrice = document.getElementById("tdTotalPrice").innerHTML;
        var selTotalPrice = TotalPrice.split(":");
        var NetPrice = selTotalPrice[1];*/
        var ServiceFee = document.getElementById("hdnServieFee").value;
        if(ServiceFee == "" || ServiceFee == null)
         {
            ServiceFee = "10.00";
         }
        xmlHttp1=GetXmlHttpObject()
        if (xmlHttp1==null)
        {
            alert ("Browser does not support HTTP Request")
            return
        } 
//Loading funtion
    Loading();
      
    /*Generate Date & time */
    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;    
    /*End of Date Time*/
 
        xmlHttpToolTip3=GetXmlHttpObject()
        if (xmlHttpToolTip3==null)
        {
            alert ("Browser does not support HTTP Request")
            return
        }
        var url;
        if(MultiplexCode == "0001" || MultiplexCode == "0003")
        {
            url="Services/ITZService.asmx/GenrateOrderID?IsGift=0&UserId="+UserID;
        }
        else if(MultiplexCode == "0002")
        {
             url="Services/ITZAdlabsService.asmx/GenrateOrderID?IsGift=0&UserId="+UserID;
        }
            url+="&MovieSessionId="+MoiveSessionID+"&CenterCode="+CenterCode;
            url+="&MultiplexCode="+MultiplexCode+"&SeatType="+className+"&NOS="+No_of_Ticket;
            url+="&ClassCode="+classCode+"&TicketPrice="+TicketPrice+"&Discount=0";
            url+="&ServiceTax="+ServiceFee+"&NetPayable="+NetPrice+"&temp="+temp; 
        xmlHttpToolTip3.onreadystatechange=GenerateOrderID
        xmlHttpToolTip3.open("GET",url,true)
        xmlHttpToolTip3.send(null)
        ShowGenCRMPopUp();
        //timer = setTimeout("hideTip();",9000);
        return false; 
    
 }
 function GenerateOrderID()
 {
	 if (xmlHttpToolTip3.readyState==4 || xmlHttpToolTip3.readyState=="complete")
    	    {	
		        if (xmlHttpToolTip3.status == 200)      
		        { 
		            errCounter = 1;
		            clearTimeout(timer);
			        var str = new String(xmlHttpToolTip3.responseText);
                    str= str.replace(/&gt;/g,'>');
                    str= str.replace(/&lt;/g,'<');
                    str= str.replace(/&amp;/g,'&');

                    switch(xmlHttpToolTip3.responseXML.getElementsByTagName("string")[0].childNodes[0].nodeValue)
                        {
                            case "0000" : 
                                        OrderSummary();
                                        //alert("inserted");
                                        /*if(AudiMultiplexCode == "0001" || AudiMultiplexCode == "0003")
                                        {
                                            AudiTip();
                                        }
                                        else if(AudiMultiplexCode == "0002" && isDome == 0)
                                            {
                                                AdlabsAudiTip();
                                            }
                                        else if(AudiMultiplexCode == "0002" && isDome == 1)
                                            {
                                                isDome = 0;
                                                OrderSummary();
                                            } */                                           
                                        break;
                            case "0001": 
                                    alert("Server Busy : Please try again after sometime");//Transction id generation
                                    hideTip();
                                    break;
                            case "0002": 
                                    alert("Server Busy : Please try again after sometime"); //Error generating while Engaging Seat ErrCode:003
                                    hideTip();
                                    break;
                                    
                            case "0003": 
                                    alert("Session Expired.Please Login again");
                                    location.href="home.aspx";                                    
                                    break;
                            case "0004": 
                                    alert("Server Busy : Please try again after sometime");//Invalid orderid
                                    hideTip();
                                    break;
                            case "0005": 
                                    alert("Server Busy : Please try again after sometime");//Err occured while inserting the data.
                                    hideTip();
                                    break;
                                  
                        }
		        }
	    	}
 }
function AudiTip()
{
    errCounter = 0;
     var XoffSet = 0;
    if (!e) 
    {
        var e = window.event;
        XoffSet = 145;
    }
    else
    {
        XoffSet = 133;
    }

        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;  
        xmlHttpToolTip2=GetXmlHttpObject()
        if (xmlHttpToolTip2==null)
        {
            alert ("Browser does not support HTTP Request")
            return
        }
        //Loading funtion
        Loading();

            var url="Services/ITZService.asmx/GetAudiLayoutForOrderID?temp="+temp; 
            xmlHttpToolTip2.onreadystatechange=ShowAudi_CallBack
            xmlHttpToolTip2.open("GET",url,true)
            xmlHttpToolTip2.send(null);
            ShowGenCRMPopUp();
         // timer = setTimeout("hideTip();",9000);
}    
function ShowAudi_CallBack()
    {
	    if (xmlHttpToolTip2.readyState==4 || xmlHttpToolTip2.readyState=="complete")
    	    {	
		        if (xmlHttpToolTip2.status == 200)      
		        { 
		            errCounter = 1;
		            clearTimeout(timer);
                    var str = new String(xmlHttpToolTip2.responseText);
                    str= str.replace(/&gt;/g,'>');
                    str= str.replace(/&lt;/g,'<');
                    str= str.replace(/&amp;/g,'&');
                     switch(xmlHttpToolTip2.responseXML.getElementsByTagName("string")[0].childNodes[0].nodeValue)
                        {
                            case "0001" : 
                                    alert("Server Busy : Please try again after sometime");//Session orderid lost
                                    hideTip();
                                    break;
                                     break;
                            case "0002": 
                                    alert("Server Busy : Please try again after sometime");//ifo cnt generate using orderid
                                    hideTip();
                                    break;
                            case "0003": 
                                    alert("Server Busy : Please try again after sometime");//blnGetSeatLayout error
                                    hideTip();
                                    break;
                            default:
                                    ntipobj = document.getElementById( "ntooltip" );  
                                    ntipobj.innerHTML = "";
                                    var w = screen.width; // Get the width of the screen
                                    var h = screen.height; // Get the height of the screen
                                    // The size of the Window
                                    var win_width = w/2; //- 700;
                                    var win_height = h/2 ;//- 450;
                                    var tableWidth=400;
                                    ntipobj.style.left = (win_width - tableWidth) + "px";
                                    ntipobj.style.top = 110 + "px";                                    
                                    tooltip=tooltipup+str+tooltipdown
                                    ntipobj = document.getElementById( "ntooltip" );
                                    ntipobj.innerHTML = tooltip;
                                    ntipobj.style.visibility="";
                                    break;                                    
                         }
   		        }
	        }
    }    

function AdlabsAudiTip()
{
    errCounter = 0;
     var XoffSet = 0;
    if (!e) 
    {
        var e = window.event;
        XoffSet = 145;
    }
    else
    {
        XoffSet = 133;
    }

        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;  
        xmlHttpToolTip2=GetXmlHttpObject()
        if (xmlHttpToolTip2==null)
        {
            alert ("Browser does not support HTTP Request")
            return
        }
        //Loading funtion
        Loading();

            var url="Services/ITZAdlabsService.asmx/GetAudiLayoutForOrderID?temp="+temp; 
            xmlHttpToolTip2.onreadystatechange=ShowAdlabsAudi_CallBack
            xmlHttpToolTip2.open("GET",url,true)
            xmlHttpToolTip2.send(null);
            ShowGenCRMPopUp();      
          //timer = setTimeout("hideTip();",7000);
}    
function ShowAdlabsAudi_CallBack()
    {
	    if (xmlHttpToolTip2.readyState==4 || xmlHttpToolTip2.readyState=="complete")
    	    {	
		        if (xmlHttpToolTip2.status == 200)      
		        { 
		            errCounter = 1;
		            clearTimeout(timer);
                    var str = new String(xmlHttpToolTip2.responseText);
                    str= str.replace(/&gt;/g,'>');
                    str= str.replace(/&lt;/g,'<');
                    str= str.replace(/&amp;/g,'&');
                     switch(xmlHttpToolTip2.responseXML.getElementsByTagName("string")[0].childNodes[0].nodeValue)
                        {
                            case "0001" : 
                                    alert("Server Busy : Please try again after sometime");//Session orderid lost
                                    hideTip();
                                    break;
                                     break;
                            case "0002": 
                                    alert("Server Busy : Please try again after sometime");//ifo cnt generate using orderid
                                    hideTip();
                                    break;
                            case "0003": 
                                    alert("Server Busy : Please try again after sometime");//blnGetSeatLayout error
                                    hideTip();
                                    break;
                            default:
                                    ntipobj = document.getElementById( "ntooltip" );  
                                    ntipobj.innerHTML = "";
                                    var w = screen.width; // Get the width of the screen
                                    var h = screen.height; // Get the height of the screen
                                    // The size of the Window
                                    var win_width = w/2; //- 700;
                                    var win_height = h/2 ;//- 450;
                                    var tableWidth=400;
                                    ntipobj.style.left = (win_width - tableWidth) + "px";
                                    ntipobj.style.top = 110 + "px";                            
                                    tooltip=tooltipup+str+tooltipdown
                                    ntipobj = document.getElementById( "ntooltip" );
                                    ntipobj.innerHTML = tooltip;
                                    ntipobj.style.visibility="";
                                    break;                                    
                         }
   		        }
	        }
    }   
function Proceed(AreaCode,Rows,Cols,TotalSeats,MultiplexCode)
{
            var i,j,k;
            var count = 0;
            var strSeatSelect = "";
            SeatCount = 0;
            var rowCont;
           if(MultiplexCode == "0001" || MultiplexCode == "0003")
           {
                rowCont = 1;
           }
           else if(MultiplexCode == "0002")
           {
               rowCont = 0;
           }
            loop1:for(i=rowCont;i<=Rows;i++)
            {
               loop2:for(j=rowCont;j<=Cols;j++) 
               {  
                    
                    if(document.getElementById("chAudi_"+AreaCode+"_"+i+"_"+j)!=null)
                    {
                        if(document.getElementById("chAudi_"+AreaCode+"_"+i+"_"+j).checked == true)
                        {
                            count++;
                            if(count > TotalSeats)
                            {
                                alert("You can select only " + TotalSeats + " seats");
                                return false;
                            }
                            strSeatSelect +=  document.getElementById("chAudi_"+AreaCode+"_"+i+"_"+j).value;
                            SeatCount++;
                        }
                    }
               }
              
            }
            
            strSeatSelect = "|" + TotalSeats + "|" + strSeatSelect;
            
                       
            if(count < TotalSeats)
            {
                alert("Please select " + TotalSeats + " seats");
                return false;
            } 
            if(count == TotalSeats)
            {
                   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;  
                    xmlHttp14=GetXmlHttpObject()
                    if (xmlHttp14==null)
                    {
                        alert ("Browser does not support HTTP Request")
                        return
                    }

                    var url;
                    if(MultiplexCode == "0001" || MultiplexCode == "0003")
                    {
                        url="Services/ITZService.asmx/SetSeatsForOrderID?StrSelectedSeats="+strSeatSelect+"&temp="+temp;
                    }
                    else if(MultiplexCode == "0002")
                    {
                        url="Services/ITZAdlabsService.asmx/SetSeatsForOrderID?StrSelectedSeats="+strSeatSelect+"&temp="+temp; 
                    }
                    
                    xmlHttp14.onreadystatechange=Proceed_CallBack
                    xmlHttp14.open("GET",url,true)
                    xmlHttp14.send(null)   
            }
}  
function Proceed_CallBack()
{
	    if (xmlHttp14.readyState==4 || xmlHttp14.readyState=="complete")
    	    {	
		        if (xmlHttp14.status == 200)      
		        { 
		        	    var str = new String(xmlHttp14.responseText);
                        str= str.replace(/&gt;/g,'>');
                        str= str.replace(/&lt;/g,'<');
                        str= str.replace(/&amp;/g,'&');
		                switch(xmlHttp14.responseXML.getElementsByTagName("string")[0].childNodes[0].nodeValue)
                            {
                                case "0000" : 
                                           OrderSummary();
                                            break;
                                case "0001": 
                                        alert("Server Busy : Please try again after sometime"); //session orderid lost
                                        break;
                                case "0002": 
                                        alert("Server Busy : Please try again after sometime"); // Error while genartaing ifo using orderid
                                        break;
                                        
                                case "0003": 
                                        alert("Server Busy : Please try again after sometime");// error in blnSetSeats 
                                        break;
                                case "0004": 
                                        alert("Server Busy : Please try again after sometime");//Cant update seat info
                                        break;
                                          
                            }
		        }
	        }
}

function OrderSummary()
{
                    var isAgentSummary = 0;
                    var url = window.location.href;
                    var nohttp = url.split('//')[1];    
                    var page = nohttp.split('/')[1].toLowerCase();
                    if(page == "bookinghistory.aspx")
                    {
                        isAgentSummary = 1;
                    }
                    else
                    {
                        isAgentSummary = 0;
                    }
                    
                    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;  
                    xmlHttp14=GetXmlHttpObject()
                    if (xmlHttp14==null)
                    {
                        alert ("Browser does not support HTTP Request")
                        return
                    }
                    var w = screen.width; // Get the width of the screen
                    var h = screen.height; // Get the height of the screen

                    // The size of the Window
                    var win_width = w/2; //- 700;
                    var win_height = h/2 ;//- 450;
                    if(isAgentSummary == 0)
                    {
                        var tableWidth=400;
                        //ntipobj = document.getElementById( "ntooltip" );
                        //ntipobj.style.left = (win_width - tableWidth) + "px";
                        //ntipobj.style.top = 110 + "px";                            
                        //ntipobj.innerHTML=ttoltiploading;
                        //ntipobj.style.visibility="visible";    
                        ShowGenCRMPopUp();  
                    }            
                    else if(isAgentSummary == 1)
                    {
                        document.getElementById("TransactionTip").innerHTML = "";
                        document.getElementById("TransactionTip").style.visibility="visible";
                        document.getElementById("TransactionTip").innerHTML = ttoltiploading;                    
                    }
                    var url="Services/ITZService.asmx/OrderSummary?&temp="+temp; 
                    xmlHttp14.onreadystatechange=OrderSummary_CallBack
                    xmlHttp14.open("GET",url,true)
                    xmlHttp14.send(null)  
                    if(isAgentSummary == 0)
                    {
                        timer = setTimeout("hideTip();",7000);     
                    }
                  
}
function OrderSummary_CallBack()
{              
if (xmlHttp14.readyState==4 || xmlHttp14.readyState=="complete")
    	    {	
		        if (xmlHttp14.status == 200)      
		        {       
                    var str = new String(xmlHttp14.responseText);
                    str= str.replace(/&gt;/g,'>');
                    str= str.replace(/&lt;/g,'<');
                    str= str.replace(/&amp;/g,'&');
                    
                    var isAgentSummary = 0;
                    var url = window.location.href;
                    var nohttp = url.split('//')[1];    
                    var page = nohttp.split('/')[1].toLowerCase();
                    if(page == "bookinghistory.aspx")
                    {
                        isAgentSummary = 1;
                    }
                    else
                    {
                        isAgentSummary = 0;
                    }

                        switch(xmlHttp14.responseXML.getElementsByTagName("string")[0].childNodes[0].nodeValue)
                            {
                                case "0001": 
                                        if(isAgentSummary == 0)
                                        {
                                            document.getElementById("divOrderSum").innerHTML ="Please try after sometime";//session Orderid lost
                                        }
                                        else if(isAgentSummary == 1)
                                        {
                                            alert("Please try after sometime");//session Orderid lost
                                            hideTransTip();
                                        }
                                        break;
                                case "0002": 
                                        if(isAgentSummary == 0)
                                        {
                                            document.getElementById("divOrderSum").innerHTML ="Please try after sometime";//error while gen info using orderid
                                        }
                                        else if(isAgentSummary == 1)
                                        {
                                            alert("Please try after sometime");
                                            hideTransTip();
                                        }                                        
                                        break;
                                default:
                                        if(isAgentSummary == 0)
                                        {                                
                                            document.getElementById("divOrderSum").innerHTML =str;
                                            hideTip();
                                        }
                                        else if(isAgentSummary == 1)
                                        {
         	                                var str = xmlHttpHistory.responseText;
                                            var w = screen.width; // Get the width of the screen
                                            var h = screen.height; // Get the height of the screen

                                            var win_width = w/2; 
                                            var win_height = h/2 ;
                                        
         	                                document.getElementById("TransactionTip").style.left = (win_width-50) + "px";
         	                                document.getElementById("TransactionTip").style.top = 180 + "px";
                                                 	
         	                                document.getElementById("TransactionTip").style.visibility="visible";
                                            document.getElementById("TransactionTip").innerHTML = tooltipAgentOrderup+xmlHttp14.responseXML.getElementsByTagName("string")[0].childNodes[0].nodeValue+tooltipAgentdown;
                                        }                                        
                                       
                                break;
                             }
                    }
            }
}
function CheckSeatCount(AreaCode,Rows,Cols,TotalSeats,MultiplexCode)
{
    var i,j,k;
    var count = 0;
    strSeatSelect = "";
    SeatCount = 0;
    var rowCont;
   if(MultiplexCode == "0001")
   {
        rowCont = 1;
   }
   else if(MultiplexCode == "0002")
   {
       rowCont = 0;
   }    
    loop1:for(i=rowCont;i<=Rows;i++)
    {
       loop2:for(j=rowCont;j<=Cols;j++) 
       {  
            
            if(document.getElementById("chAudi_"+AreaCode+"_"+i+"_"+j)!=null)
            {
                if(document.getElementById("chAudi_"+AreaCode+"_"+i+"_"+j).checked == true)
                {
                    count++;
                    if(count > TotalSeats)
                    {
                        alert("You can select only " + TotalSeats + "seats");
                        //break loop1;
                        return false;
                    }
                    strSeatSelect +=  document.getElementById("chAudi_"+AreaCode+"_"+i+"_"+j).value;
                    SeatCount++;
                }
            }
       }
      
    }
    strSeatSelect = "|" + TotalSeats + "|" + strSeatSelect;
    return true;
            
}

function CancelTransaction(MultiplexCode)
{
        
            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;  

            xmlHttpToolTip6=GetXmlHttpObject()
            if (xmlHttpToolTip6==null)
            {
                alert ("Browser does not support HTTP Request")
                return
            }
            var url;
            if(MultiplexCode == "0001" || MultiplexCode == "0003")
            {
                url="Services/ITZService.asmx/CancelTransaction?temp="+temp; 
            }
            else if(MultiplexCode == "0002")
            {
              url="Services/ITZAdlabsService.asmx/CancelTransaction?temp="+temp; 
            }
            xmlHttpToolTip6.onreadystatechange=CancelTransaction_CallBack
            xmlHttpToolTip6.open("GET",url,true)
            xmlHttpToolTip6.send(null)   
}
        
function CancelTransaction_CallBack()
         {
	        if (xmlHttpToolTip6.readyState==4 || xmlHttpToolTip6.readyState=="complete")
	        {	
	            if (xmlHttpToolTip6.status == 200)      
	            { 
                        var isAgentSummary = 0;
                        var url = window.location.href;
                        var nohttp = url.split('//')[1];    
                        var page = nohttp.split('/')[1].toLowerCase();
                        if(page == "bookinghistory.aspx")
                        {
                            isAgentSummary = 1;
                        }
                        else
                        {
                            isAgentSummary = 0;
                        }
                            var str = new String(xmlHttpToolTip6.responseText);
                            str= str.replace(/&gt;/g,'>');
                            str= str.replace(/&lt;/g,'<');
                            str= str.replace(/&amp;/g,'&');

		                    switch(xmlHttpToolTip6.responseXML.getElementsByTagName("string")[0].childNodes[0].nodeValue)
                            {
                                case "0001" : 
                                            if(isAgentSummary == 0)
                                            {                                
                                                document.getElementById("divOrderSum").innerHTML = "Session Expired";//Session orderid lost
                                                hideTip();
                                            }
                                            else if(isAgentSummary == 1)
                                            {
                                                alert("Session Expired");//session Orderid lost
                                                hideTransTip();
                                            }                                            
                                            break;
                                case "0002":
                                            if(isAgentSummary == 0)
                                            {
                                                  document.getElementById("divOrderSum").innerHTML = "Server Busy"; //err gen ifo using orderid
                                                  hideTip();
                                            }
                                            else if(isAgentSummary == 1)
                                            {
                                                alert("Server Busy");//session Orderid lost
                                                hideTransTip();
                                            }                                             
                                        break;
                                case "0003": 
                                            if(isAgentSummary == 0)
                                            {                                
                                                document.getElementById("divOrderSum").innerHTML = "Server Busy"; //blnCancelTrans
                                                hideTip();                                                
                                            }
                                            else if(isAgentSummary == 1)
                                            {
                                                alert("Server Busy");//session Orderid lost
                                                hideTransTip();
                                            }                                             
                                        break;
                                default:
                                            if(isAgentSummary == 0)
                                            {                                   
                                                document.getElementById("divOrderSum").innerHTML = str;
                                                hideTip();
                                            }
                                            else if(isAgentSummary == 1)
                                            {
                                                hideTransTip();
                                            }                                                  
                                            
                                break;                                      
                            }                        
	                        
	                    
	            }
	        }
	        
}               
        
function GetShowDetails(CityID,ITZMovieID,showDate)
{
            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;  
            tempShowDate=showDate;
            xmlHttpToolTip5=GetXmlHttpObject()
            if (xmlHttpToolTip5==null)
            {
                alert ("Browser does not support HTTP Request")
                return
            }
            var url="Services/ITZService.asmx/GetShowDetails?CityID="+CityID+"&ITZMovieCode="+ITZMovieID+"&showDate="+showDate+"&temp="+temp; 
            xmlHttpToolTip5.onreadystatechange=GetShowDetails_CallBack
            xmlHttpToolTip5.open("GET",url,true)
            xmlHttpToolTip5.send(null)   
           
}
function GetShowDetails_CallBack()
        {
	        if (xmlHttpToolTip5.readyState==4 || xmlHttpToolTip5.readyState=="complete")
    	        {	
		            if (xmlHttpToolTip5.status == 200)      
		            { 
                        //var str = new String(xmlHttpToolTip5.responseXML.getElementsByTagName("string")[0].childNodes[0].nodeValue);
                        var str = xmlHttpToolTip5.responseText;
                        str= str.replace(/&gt;/g,'>');
                        str= str.replace(/&lt;/g,'<');
                        str= str.replace(/&amp;/g,'&');
                        document.getElementById("divResult").innerHTML = str;
                        document.getElementById("aboutMovie").innerHTML = document.getElementById("hdnshortDesc").value;
                        document.getElementById("imgSyn").src = document.getElementById("hdnimgURL").value; 
                        document.getElementById("divMovieName").innerHTML = document.getElementById("hdnMovieName").value;
                        
                        //To add view more button in synopsis
                        if(document.getElementById("isMoreSyn").value == "1")
                        {
                                var ITZMovID=document.getElementById("hdnITZMovieCode").value;
                                var strViewMore="<table><tr><td>";
                                strViewMore+="<a href='javascript:void(0);' onclick='javascript:showLongDesc(\""+ITZMovID+"\");' ><img src='images/nowshowing/viewmore.gif' width='81' height='18' border='0px'></a>";
                                strViewMore+="</td></tr></table>";
                                document.getElementById("tdshowbutton").innerHTML = strViewMore;
                                document.getElementById("tdshowbutton").style.display = '';
                        }
		            }
	            }
}
function PaymentGateway()
{
            var mobileNo = "0";
            if(document.getElementById("chkSMS").checked == true)
            {
                mobileNo = document.getElementById("txtcno").value;
                if(mobileNo.length == 0)
                {
                    alert("Please enter 10 digit mobile number to get SMS");
                    document.getElementById("txtcno").focus();
                    return false;
                }
                if (isNaN(document.getElementById("txtcno").value))
                    {
                        alert("No characters!!!Please enter Mobile number in Number") 
                        document.getElementById("txtcno").select(); 
                        document.getElementById("txtcno").focus(); 
                        return false; 
                    }                
            }
                        var PG = "0";
             
                        var isAgentSummary = 0;
                        var url = window.location.href;
                        var nohttp = url.split('//')[1];    
                        var page = nohttp.split('/')[1].toLowerCase();
                        if(page == "bookinghistory.aspx")
                        {
                            PG = "2";
                        }
                        else
                        {
                            PG = document.getElementById("selPayment").value;
                            if(document.getElementById("selPayment").value == "-1")
                            {
                                alert("Please Select payment mechanisam");
                                return false;
                            }  
                        }
                        tempPG = PG;
            if(document.getElementById("chkTermCon").checked == false)
            {
                alert("Please read the terms and Conditions");
                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;  
            xmlHttpPayment=GetXmlHttpObject()
            if (xmlHttpPayment==null)
            {
                alert ("Browser does not support HTTP Request")
                return
            }    
            var url="Services/ITZService.asmx/UpdatePaymentGatewayType?MobileNo="+mobileNo+"&PG="+PG+"&temp="+temp; 
            xmlHttpPayment.onreadystatechange=PaymentGateway_CallBack
            xmlHttpPayment.open("GET",url,true)
            xmlHttpPayment.send(null)      

}     
function PaymentGateway_CallBack()
{
	        if (xmlHttpPayment.readyState==4 || xmlHttpPayment.readyState=="complete")
	        {	
	            if (xmlHttpPayment.status == 200)      
	            { 
                        var isAgentSummary = 0;
                        var url = window.location.href;
                        var nohttp = url.split('//')[1];    
                        var page = nohttp.split('/')[1].toLowerCase();
                        if(page == "bookinghistory.aspx")
                        {
                            isAgentSummary = 1;
                        }
                        else
                        {
                            isAgentSummary = 0;
                        }
                        
                        var str = new String(xmlHttpPayment.responseText);
                        str= str.replace(/&gt;/g,'>');
                        str= str.replace(/&lt;/g,'<');
                        str= str.replace(/&amp;/g,'&');
		                switch(xmlHttpPayment.responseXML.getElementsByTagName("string")[0].childNodes[0].nodeValue)
                        {
                            case "0001" : 
                                            if(isAgentSummary == 0)
                                            {
                                                document.getElementById("divOrderSum").innerHTML = "Session Expired";//session orderid
                                                return;
                                            }
                                            if(isAgentSummary == 1)
                                            {                     
                                                alert("Session Expired");
                                                hideTransTip();
                                            }                       
                                        break;
                            case "0002":
                                        if(isAgentSummary == 0)
                                            {
                                                document.getElementById("divOrderSum").innerHTML = "Server Busy"; //err gen ifo using orderid
                                                return;
                                            }
                                            if(isAgentSummary == 1)
                                            {                     
                                                alert("Server Busy");
                                                hideTransTip();
                                            }                                                  
                                        break;
                            case "0000":
                                        if(isAgentSummary == 0)
                                            {
                                                var url;
                                                if(tempPG == "1")
                                                {
                                                    url="ITZRequest.aspx";
                                                }
                                                if(tempPG == "3")
                                                {
                                                    url="CCAVenueRequest.aspx";
                                                }         
                                                    location.href = url;
                                            }
                                           /* else if(isAgentSummary == 1)
                                            {
                                                var url="ITZResponse.aspx";
                                                location.href = url;                                                
                                            }*/
                            break;                                      
                        }                        
	            }
	        }
}

function GetSelDateShowDetails()
{
    var CityID=0;
    var ITZMovieID=0;
    if(document.getElementById("City").checked==true)
    {
        CityID=document.getElementById("ctl00_ddlCity").value;
        ITZMovieID=document.getElementById("ctl00_ddlMovie").value;
    }
    if(document.getElementById("Movie").checked==true)
    {
        ITZMovieID=document.getElementById("ctl00_ddlCity").value;
        CityID=document.getElementById("ctl00_ddlMovie").value;
    } 
    var showDate=document.getElementById("ddlDate").options[document.getElementById("ddlDate").selectedIndex].value;
    GetShowDetails(CityID,ITZMovieID,showDate);
    GetShortOrderSummary(CityID,ITZMovieID,showDate);
}
function GetShowDateList(CityID,ITZMovieID,showDate)
{
        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;  
        xmlHttpToolTip1=GetXmlHttpObject()
        if (xmlHttpToolTip1==null)
        {
            alert ("Browser does not support HTTP Request")
            return
        }
        var url="Services/ITZService.asmx/GetShowDateList?CityID="+CityID+"&ITZMovieCode="+ITZMovieID+"&showDate="+showDate+"&temp="+temp; 
        xmlHttpToolTip1.onreadystatechange=GetShowDateList_CallBack
        xmlHttpToolTip1.open("GET",url,true)
        xmlHttpToolTip1.send(null)   
           
}
function GetShowDateList_CallBack()
{
	        if (xmlHttpToolTip1.readyState==4 || xmlHttpToolTip1.readyState=="complete")
    	        {	
		            if (xmlHttpToolTip1.status == 200)      
		            { 
                       var str = new String(xmlHttpToolTip1.responseText);
                        str= str.replace(/&gt;/g,'>');
                        str= str.replace(/&lt;/g,'<');
                        str= str.replace(/&amp;/g,'&');  
                        document.getElementById("divDateList").innerHTML =str;
		            }
	            }
}
function GetShortOrderSummary(CityID,ITZMovieID,showDate)
{
          
        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;  
        tempShowDate=showDate;
        xmlHttpToolTip=GetXmlHttpObject()
        if (xmlHttpToolTip==null)
        {
            alert ("Browser does not support HTTP Request")
            return
        }
        var url="Services/ITZService.asmx/GetShortOrderSummary?CityID="+CityID+"&ITZMovieCode="+ITZMovieID+"&showDate="+showDate+"&temp="+temp; 
        xmlHttpToolTip.onreadystatechange=GetShortOrderSummary_CallBack
        xmlHttpToolTip.open("GET",url,true)
        xmlHttpToolTip.send(null)   
           
}
function GetShortOrderSummary_CallBack()
{
    if (xmlHttpToolTip.readyState==4 || xmlHttpToolTip.readyState=="complete")
        {	
            if (xmlHttpToolTip.status == 200)      
            { 
               var str = new String(xmlHttpToolTip.responseText);
                str= str.replace(/&gt;/g,'>');
                str= str.replace(/&lt;/g,'<');
                str= str.replace(/&amp;/g,'&');
               document.getElementById("divOrderSum").innerHTML = str;
            }
        }
}
        
function showLongDesc(ITZMovID)                
{
            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;  
            xmlHttpToolTip=GetXmlHttpObject()
            if (xmlHttpToolTip==null)
            {
                alert ("Browser does not support HTTP Request")
                return
            }
            var url="Services/ITZService.asmx/showLongDesc?ITZMovieCode="+ITZMovID+"&temp="+temp; 
            
            xmlHttpToolTip.onreadystatechange=showLongDesc_CallBack
            xmlHttpToolTip.open("GET",url,true)
            xmlHttpToolTip.send(null)   
           
}
function showLongDesc_CallBack()
{
	        if (xmlHttpToolTip.readyState==4 || xmlHttpToolTip.readyState=="complete")
    	        {	
		            if (xmlHttpToolTip.status == 200)      
		            { 
		                document.getElementById("divSyn").style.display = '';
                        var str = new String(xmlHttpToolTip.responseText);
                        str= str.replace(/&gt;/g,'>');
                        str= str.replace(/&lt;/g,'<');
                        str= str.replace(/&amp;/g,'&');
		                switch(xmlHttpToolTip.responseXML.getElementsByTagName("string")[0].childNodes[0].nodeValue)
                        {
                            case "0000":
                                alert("Server Busy : Please try again after sometime"); 
                            //No record found
                            break;
                            case "0001":
                                alert("Server Busy : Please try again after sometime"); 
                            //Error while genearating description
                            break;                            
                            default:
                                  document.getElementById("divSynopsis").innerHTML = str;
                            break;
                        }		            

		            }
	            }
}    
        
function DivCollaspe(DivID)
{
    if(document.getElementById(DivID).style.display == '')
    {
        document.getElementById(DivID).style.display = 'none';
        document.getElementById("img_"+DivID).src = 'images/bollet_down.gif';
    }
    else
    {
        document.getElementById(DivID).style.display = '';
        document.getElementById("img_"+DivID).src = 'images/bollet_up.gif';
    }
     
}

function closeSynopsis()
{
    document.getElementById("divSyn").style.display = 'none';
}

/*function showTermsCondn()
{
    url = "ShortTermC.aspx";
    window.open(url,"",'left=20,top=20,width=500,height=500,toolbar=1,resizable=0,status=1,scrollbars=1');
}*/
function showTermsCondn()
{
    errCounter = 0;
     var XoffSet = 0;
    if (!e) 
    {
        var e = window.event;
        XoffSet = 145;
    }
    else
    {
        XoffSet = 133;
    }
        ntipobj = document.getElementById( "ntooltip" );  
        ntipobj.innerHTML = "";
        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;  
        xmlHttpToolTip2=GetXmlHttpObject()
        if (xmlHttpToolTip2==null)
        {
            alert ("Browser does not support HTTP Request")
            return
        }
        var w = screen.width; // Get the width of the screen
        var h = screen.height; // Get the height of the screen

        // The size of the Window
        var win_width = w/2; //- 700;
        var win_height = h/2 ;//- 450;

        var tableWidth=400;
        // Where to place the Window
    
        ntipobj.style.left = (win_width - tableWidth) + "px";
        ntipobj.style.top = 110 + "px";
            var url="Services/ITZService.asmx/TermsCondition?temp="+temp; 
            xmlHttpToolTip2.onreadystatechange=showTermsCondn_CallBack
            xmlHttpToolTip2.open("GET",url,true)
            xmlHttpToolTip2.send(null);
            ShowGenCRMPopUp();      
          timer = setTimeout("hideTip();",7000);
}    
function showTermsCondn_CallBack()
    {
	    if (xmlHttpToolTip2.readyState==4 || xmlHttpToolTip2.readyState=="complete")
    	    {	
		        if (xmlHttpToolTip2.status == 200)      
		        { 
		            errCounter = 1;
		            clearTimeout(timer);
                    var str = new String(xmlHttpToolTip2.responseText);
                    str= str.replace(/&gt;/g,'>');
                    str= str.replace(/&lt;/g,'<');
                    str= str.replace(/&amp;/g,'&');
                     switch(xmlHttpToolTip2.responseXML.getElementsByTagName("string")[0].childNodes[0].nodeValue)
                        {
                            case "0001" : 
                                    alert("Server Busy : Please try again after sometime");//Session orderid lost
                                    hideTip();
                                    break;
                                     break;
                            default:
                                      tooltip=tooltipup+str+tooltipdown
                                      ntipobj = document.getElementById( "ntooltip" );
                                      ntipobj.innerHTML = tooltip;
                                      ntipobj.style.visibility="";
                                    break;                                    
                         }
   		        }
	        }
    }   
    
function Loading()
{
    var ntipobj = document.getElementById( "ntooltip" );
    var url = window.location.href;
    var nohttp = url.split('//')[1];    
    var hostPort = nohttp.split('/')[1];
    var page =  hostPort.split('?')[0];  
    if (page != "buyTicket.aspx")
    {          
        ntipobj.innerHTML=ttoltiploading;
        ntipobj.style.visibility="visible";
    }
    else
    {
          // document.getElementById("ctl00_ContentPlaceHolder1_DivSynTooltip").className="";
       //document.getElementById("ctl00_ContentPlaceHolder1_DivSynTooltip").innerHTML = ttoltiploading;
    }   
    var objtip = document.getElementById( "ntooltip" );
    var w = screen.width; // Get the width of the screen
    var h = screen.height; // Get the height of the screen

    // The size of the Window
    var win_width = w/2; //- 700;
    var win_height = h/2 ;//- 450;

    // Where to place the Window
    var left = width /4;
    var top = height;
    ntipobj.style.left = (win_width + document.documentElement.scrollLeft) - left + "px";
    ntipobj.style.top = (win_height + document.documentElement.scrollTop) - top + "px";
}
