﻿// JScript File

 var Value;
    var keyValue="";
    var _DropDownObject = null;
    var _DropDownObjectt = null;
     var DropDownCity=null;
    var DropDownTheater=null;
    var DropDownMovie=null;
    var DropDownShowDate=null;
    var  drpLocation=null;
    var  drpDate=null;  
    var drpCity=null;
    function SearchTheater(DropDownCity1,DropDownTheater1)
    {
      
          DropDownCity=DropDownCity1;
           DropDownTheater=DropDownTheater1;  
         Value=0;
         if(Value==0)
            {
            if(document.getElementById('DropDownCity').value!='0')
            {
	            keyValue=document.getElementById('DropDownCity').value;	           
	        }	
	      
	         if(keyValue!="")
	          {            
	            var listt = document.getElementById('DropDownTheater'); 
	            listt.options.length = 0 ; 	            
	            listt.options[listt.options.length] = new Option("Loading....","0");	            
	            MovieHome.CityWiseTheaterDetails(keyValue,SearchTheater_CallBack);	          
	            document.getElementById('txtCityid').value=document.getElementById('DropDownCity').value;	            
	          }
	         
	
	       }
	
	
	
     }


function SearchTheater_CallBack(response) 
{
 
    Value=1;
   var objTable = response.value;
	var count=0;
	var NoOfRows="";
	if(objTable !=null)
	{	
	if(objTable.Rows==null)
	{
	count=1;
	
	NoOfRows=objTable.length;
	}
	else
	{
	count=2;
	
	NoOfRows=objTable.Rows.length;
	//alert(NoOfRows)
	}
	if(NoOfRows==0 && keyValue!=0)
	{
	
	//alert("Sorry! There are no Location available for the selected city.");
	}
	 if(objTable == null || typeof(objTable) != "object") 
	 { 
	 return; 
	 } 
	 var list = document.getElementById('DropDownTheater');
	  list.options.length = 0 ; 
	  list.options[list.options.length] = new Option("Select Your Location","0");
	for(var i = 0 ; i < NoOfRows; i++) 
		{	
			
			if(count==1)
			{
			list.options[list.options.length] = new Option(trim(objTable[i].TM_Name),objTable[i].TM_Id);
			}
			else
			{
					
			list.options[list.options.length] = new Option(trim(objTable.Rows[i].TM_Name),objTable.Rows[i].TM_Id);
			}
		}
    }
    else
    {
        //alert("Sorry! There are no Location available for the selected city.");
    }
}

function trim(str) {
 if (str == null)
  return "";
 if (str.length <1)
    return "";
    
 var i =0;
 while (str.charAt(i) == ' ')
        i++;
 str = str.substr(i);
 i = str.length;
 while (str.charAt(--i) == ' ')
        ;
 str = str.substr(0, (str.length + 1 + (i - str.length)));
 return str;
}


function SearchDateofShows(DropDownMovie1,DropDownShowDate1)
{
      DropDownMovie=DropDownMovie1;
          DropDownShowDate=DropDownShowDate1;
          
   var Keymovie=0
   var keycenter=document.getElementById('txtCityid').value;
      var keyTheater=document.getElementById('txtTheaterid').value;
      if(document.getElementById('DropDownMovie').value!='0')
        {
	     Keymovie = document.getElementById('DropDownMovie').value;	           
	    }	
	         
	var list1 = document.getElementById('DropDownShowDate'); list1.options.length = 0 ; 
	 list1.options[list1.options.length] = new Option("Loading....","0");
	
	MovieHome.GetShowDate_Details(keycenter,keyTheater,Keymovie,SearchDate_CallBack);
	
	document.getElementById('txtMovieid').value=document.getElementById('DropDownMovie').value;	
}
function SearchDate_CallBack(response) 
{
   var objTable = response.value;
	var count=0;
	
	var NoOfRows;
	if(objTable !=null)
	{
	if(objTable.Rows==null)
	{
	count=1;
	NoOfRows=objTable.length;
	}
	else
	{
	count=2;
	NoOfRows=objTable.Rows.length;
	}

	 if(objTable == null || typeof(objTable) != "object") { return; } 
	 var list = document.getElementById('DropDownShowDate'); list.options.length = 0 ; 
	 list.options[list.options.length] = new Option("Select Your Date","0");
	  for(var i = 0 ; i < NoOfRows; i++) 
		{	
			if(count==1)
			{
			list.options[list.options.length] = new Option(objTable[i].SD_ShowDate,objTable[i].SD_ShowDate);
			}
			else
			{
			list.options[list.options.length] = new Option(objTable.Rows[i].SD_ShowDate,objTable.Rows[i].SD_ShowDate);
			}
		}
	}

}



function SearchMovies(DropDownTheater1,DropDownMovie1)
{
//    var keycenter=0
//	var keycenter=document.getElementById('txtCityid').value;
//	//var KeyVal =document.getElementById('SearchMovie1_drpmovie').value;
//	var keyTheater =0;
//    _DropDownObjectt=drpShowDate1;
//	
//	var list1 = document.getElementById(_DropDownObjectt); list1.options.length = 0 ; 
//	 list1.options[list1.options.length] = new Option("Loading....","0");
//	MoviesHome.GetShowDate_Details(keyValue,KeyVal,KeyTheater,Keynext,SearchDate_CallBack1);
//	document.getElementById('SearchMovie1_txtmovieid').value=document.getElementById('SearchMovie1_drpmovie').value;



       var keyTheater=0;
       DropDownTheater=DropDownTheater1;
       DropDownMovie=DropDownMovie1;
       var keycenter=document.getElementById('txtCityid').value;
       if(document.getElementById('DropDownTheater').value!='0')
        {
           keyTheater=document.getElementById('DropDownTheater').value;	           
        }	
          
            var listt = document.getElementById('DropDownMovie'); 
            
        listt.options.length = 0 ; 
        listt.options[listt.options.length] = new Option("Loading....","0");
        MovieHome.CityTheaterWiseMoviesDetails(keycenter,keyTheater,SearchMovie_CallBack);
        document.getElementById('txtTheaterid').value=document.getElementById('DropDownTheater').value;
          

 }
	
	
	



function SearchMovie_CallBack(response) 
{
    Value=1;
   var objTable = response.value;
	var count=0;
	var NoOfRows="";
	if(objTable !=null)
	{	
	if(objTable.Rows==null)
	{
	count=1;
	
	NoOfRows=objTable.length;
	}
	else
	{
	count=2;
	
	NoOfRows=objTable.Rows.length;
	//alert(NoOfRows)
	}
	if(NoOfRows==0 && keyValue!=0)
	{
	
	//alert("Sorry! There are no movies available for the selected Location.");
	}
	 if(objTable == null || typeof(objTable) != "object") 
	 { 
	 return; 
	 } 
	 var list = document.getElementById('DropDownMovie');
	  list.options.length = 0 ; 
	  list.options[list.options.length] = new Option("Select Your Movie","0");
	for(var i = 0 ; i < NoOfRows; i++) 
		{	
			
			if(count==1)
			{
			list.options[list.options.length] = new Option(trim(objTable[i].MovieName),objTable[i].mm_id);
			}
			else
			{
					
			list.options[list.options.length] = new Option(trim(objTable.Rows[i].MovieName),objTable.Rows[i].mm_id);
			}
		}
    }
    else
    {
        alert("Sorry! There are no movies available for the selected Location.");
    }
}

function testDate1()
{

document.getElementById('txtdate').value=document.getElementById('DropDownShowDate').value;

 return;
}


function FillCardType(IsCreditOrDebit)
{    
var listt = document.getElementById("DrpCardType");	
listt.options.length = 0 ; 
listt.options[listt.options.length] = new Option("Loading....","0");
buy_step_02.fillCardType(IsCreditOrDebit,FillCard_CallBack);		
}

function FillCard_CallBack(response) 
{
    Value=1;
    var objTable = response.value;
	var count=0;
	var NoOfRows="";
	if(objTable !=null)
	{	
	if(objTable.Rows==null)
	{
	count=1;
	
	NoOfRows=objTable.length;
	}
	else
	{
	count=2;
	
	NoOfRows=objTable.Rows.length;
	}
	if(NoOfRows==0 && keyValue!=0)
	{
	
	alert("Sorry!We are facing some problem .please try after some time.");
	}
	 if(objTable == null || typeof(objTable) != "object") 
	 { 
	 return; 
	 } 
	 var list = document.getElementById("DrpCardType");
	  list.options.length = 0 ; 
	  list.options[list.options.length] = new Option("Card Type","0");
	for(var i = 0 ; i < NoOfRows; i++) 
		{	
			
			if(count==1)
			{
			list.options[list.options.length] = new Option(trim(objTable[i].CT_Type),objTable[i].CT_Id);
			}
			else
			{
					
			list.options[list.options.length] = new Option(trim(objTable.Rows[i].CT_Type),objTable.Rows[i].CT_Id);
			}
		}
    }   
}


//document.write("<script type='text/javascript' src='src/adapter/shadowbox-base.js'></script>");
//document.write("<script type='text/javascript' src='src/shadowbox.js'></script>");



//Shadowbox.loadSkin('classic', 'src/skin');
//Shadowbox.loadLanguage('en', 'src/lang');
//Shadowbox.loadPlayer(['flv', 'html', 'iframe', 'img', 'qt', 'swf', 'wmp'], 'src/player');
//window.onload = function(){};
//   
//        function ShowConfirmation()
//        {         
//                        try {
//                        var strflag = '<%=ConfigurationManager.AppSettings["flagPopup"].ToString() %>';

//                        if(strflag==1)
//                        {
//                            Shadowbox.init();
//                            Shadowbox.open({
//                                player: 'iframe',
//                                title: '',
//                                content: 'card.htm',
//                                height: 360,
//                                width: 520
//                                 });
//                        }

//                     
//                            } catch (e) { } 
//                     
//        }

 
