function theRotator() 
{
	//Set the opacity of all images to 0
	$('div#rotator ul li').css({opacity: 0.0});
	//Get the first image and display it (gets set to full opacity)
	$('div#rotator ul li:first').css({opacity: 1.0});
	//Call the rotator function to run the slideshow, 6000 = change to next image after 6 seconds
	//Set the opacity of all images to 0
	$('div#rotator1 ul li').css({opacity: 0.0});
	//Get the first image and display it (gets set to full opacity)
	$('div#rotator1 ul li:first').css({opacity: 1.0});
	//Call the rotator function to run the slideshow, 6000 = change to next image after 6 seconds
	setInterval('rotate()',6000);
	setInterval('rotate1()',4000);
}
function rotate() 
{	
	//Get the first image
	var current = ($('div#rotator ul li.show')?  $('div#rotator ul li.show') : $('div#rotator ul li:first'));
	//Get next image, when it reaches the end, rotate it back to the first image
	var next = ((current.next().length) ? ((current.next().hasClass('show')) ? $('div#rotator ul li:first') :current.next()) : $('div#rotator ul li:first'));	
	//Set the fade in effect for the next image, the show class has higher z-index
	next.css({opacity: 0.0})
	.addClass('show')
	.animate({opacity: 1.0}, 1000);
	//Hide the current image
	current.animate({opacity: 0.0}, 1000)
	.removeClass('show');
	
}
function rotate1() 
{	
	//Get the first image
	var current = ($('div#rotator1 ul li.show1')?  $('div#rotator1 ul li.show1') : $('div#rotator1 ul li:first'));
	//Get next image, when it reaches the end, rotate it back to the first image
	var next = ((current.next().length) ? ((current.next().hasClass('show1')) ? $('div#rotator1 ul li:first') :current.next()) : $('div#rotator1 ul li:first'));	
	//Set the fade in effect for the next image, the show class has higher z-index
	next.css({opacity: 0.0})
	.addClass('show1')
	.animate({opacity: 1.0}, 1000);
	//Hide the current image
	current.animate({opacity: 0.0}, 1000)
	.removeClass('show1');
}
function onSelectDate()
{
	//var selected_date = $('#changeDate :selected').text();
	var date_value = $('#changeDate :selected').val();
	$(".movie_time_showing_div").html('<div align="center" class="schedule_image_div"><img src="images/ajax-loading.gif" /></div>');
	//alert(""+selected_date+date_value);
	$.ajax({
          		type: "GET",
		        url: "getScheduleDataFromBookMyShow.php",
       			data: "date=" + date_value ,
	        	success: function(msg)
				{
					$(".movie_time_showing_div").html(msg);
				}
	   		});
}
function onclickPopUp()
{
	//alert(""+getFrom);
	$('.basic-modal-content').modal();
}
function onclickPopUp1()
{
	//alert(""+getFrom);
	$('.basic-modal-content1').modal();
}
function triviaClick()
{
	onclickPopUp();
}
function triviaClick1()
{
	var type = "Trivia";
	var val = $('input:radio[name=trivia]:checked').val();
	var phone_num = $('#mobile_trivia').val();
	var username = $('#name_trivia').val();
	var email = $('#email_trivia').val();
	$.ajax({
          		type: "GET",
		        url: "getQuizResults.php",
       			data: "answer=" + val + "&username=" + username + "&email=" + email + "&phone_num=" + phone_num + "&type=" + type ,
	        	success: function(msg)
				{
					alert(""+msg);
				}
	   		});
}
//validating mobile number
function checkform()
{
if ($('#mobile_number').val().length < 1) 
{
    alert('Please enter your mobile number');
    $('#mobile_number').focus();
    return false;
}
if ((!is_mobile($('#mobile_number').val())) || ($('#mobile_number').val().length < 10) || ($('#mobile_number').val().length > 10)) 
{
    alert('Please enter valid mobile number');
    $('#mobile_number').focus();
    return false;
}
function is_mobile(mobile) 
{
    var pattern = new RegExp(/^[0-9]+$/);
    return pattern.test(mobile);
}
}
$(document).ready(function() 
{
	//Load the slideshow
	theRotator();
	//Load Function Ends Here
	onSelectDate();
	onclickPopUp1();
	
	//Book Ticket Module Get Disable here
	$('#select_movie').attr("disabled", true); 
	$('#select_date').attr("disabled", true); 
	$('#select_time').attr("disabled", true);
	$('#book_ticket_button').attr("disabled", true);
	
	//Book Ticket Modules Ends here
	
	//Menu Gets Loaded Here
	$('#navigationMenu li .normalMenu').each(function()
	{
		$(this).before($(this).clone().removeClass().addClass('hoverMenu'));
	});
	$('#navigationMenu li').hover(function()
	{
		$(this).find('.hoverMenu').stop().animate({marginTop:'0px'},200);
	},function()
	{
		$(this).find('.hoverMenu').stop().animate({marginTop:'-25px'},200);
	});
	//Menus Ends Here
		
	//Coming Soon,Now Showing and Schedule gets Loaded here
	$("a.tab").click(function ()
	{
		$(".active").removeClass("active");  
		$(this).addClass("active");  
		$(".content").slideUp();  
		var content_show = $(this).attr("title");  
		$("#"+content_show).slideDown();  
	});  
	//Module Ends Here
	
	
	$(".goleft").click( function(e) 
	{
        var $active1 = $(".active1");
        var $next = $active1.prev().length ? $active1.prev() : $(".focusitem:last");
 
        $active1.removeClass('active1');
        $active1.addClass('notactive1');
        $next.addClass('active1');
        $next.removeClass('notactive1');
    });
 	
	$(".goright").click( function(e) 
	{
        var $active1 = $(".active1");
		var $next = $active1.next().length ? $active1.next() : $(".focusitem:first");
 	    $active1.removeClass('active1');
        $active1.addClass('notactive1');
        $next.addClass('active1');
        $next.removeClass('notactive1');
    });

	$(".goleft1").click( function(e) 
	{
        var $active1 = $(".active2");
        var $next = $active1.prev().length ? $active1.prev() : $(".focusitem1:last");
 
        $active1.removeClass('active2');
        $active1.addClass('notactive2');
        $next.addClass('active2');
        $next.removeClass('notactive2');
    });
 	
	$(".goright1").click( function(e) 
	{
        var $active1 = $(".active2");
		var $next = $active1.next().length ? $active1.next() : $(".focusitem1:first");
 	    $active1.removeClass('active2');
        $active1.addClass('notactive2');
        $next.addClass('active2');
        $next.removeClass('notactive2');
    });
	
	$(".goleft3").click( function(e) 
	{
        var $active1 = $(".active3");
        var $next = $active1.prev().length ? $active1.prev() : $(".focusitem3:last");
 
        $active1.removeClass('active3');
        $active1.addClass('notactive3');
        $next.addClass('active3');
        $next.removeClass('notactive3');
    });
 	
	$(".goright3").click( function(e) 
	{
        var $active1 = $(".active3");
		var $next = $active1.next().length ? $active1.next() : $(".focusitem3:first");
 	    $active1.removeClass('active3');
        $active1.addClass('notactive3');
        $next.addClass('active3');
        $next.removeClass('notactive3');
    });
	
	
		$('#slider').nivoSlider({
		effect:'fold', //Specify sets like: 'random,fold,fade,sliceDown'
		slices:15,
		animSpeed:500,
		pauseTime:3000,
		startSlide:0, //Set starting Slide (0 index)
		directionNav:false, //Next & Prev
		directionNavHide:false, //Only show on hover
		controlNav:true, //1,2,3...
		controlNavThumbs:true, //Use thumbnails for Control Nav
      	controlNavThumbsFromRel:false, //Use image rel for thumbs
		controlNavThumbsSearch: '.jpg', //Replace this with...
		controlNavThumbsReplace: '_thumb.jpg', //...this in thumb Image src
		keyboardNav:true, //Use left & right arrows
		pauseOnHover:true, //Stop animation while hovering
		manualAdvance:false, //Force manual transitions
		captionOpacity:0.8, //Universal caption opacity
		beforeChange: function(){},
		afterChange: function(){},
		slideshowEnd: function(){} //Triggers after all slides have been shown
	});
		//$.colorbox({href:"#inline_example1", innerWidth:519, innerHeight:430, inline:true});
});
function show_selected_tab()
{
	$(this).addClass("active"); 
	var content_show = $(this).attr("title"); 
}
function changeUrl()
{
	window.location = 'http://www.srsparivar.com/srs%20limted/index.htm';
}
