var Time = 5;
var ProductCount = 4;
var CreateGameBaseUrl = '';

$(document).ready(function(){
	if ($('#warning') != null && $('#warning').html() != null && $('#warning').html().length > 0)
	{
    	$('#warning').modal();
    }
    
    if ($('#productcarousel')){
        $('#productcarousel').jcarousel({
          scroll: 1,
          auto: Time,
          visible: 1,
          itemVisibleInCallback: productVisibleInHandler
        });
    }
    
    $('#categoryList').change(function(){
        $('#createGameForm').attr('action', CreateGameBaseUrl + $('#categoryList').val() +  '/forum.htm');
    });
    
    $('#createGameForm').attr('action', CreateGameBaseUrl + $('#categoryList').val() +  '/forum.htm');
});

function productVisibleInHandler(carousel,item,pos) 
{ 
    if (pos == ProductCount) 
    {
        $(this).delay(Time * 1000,function(){
            carousel.scroll(1);   
        });                
    }            
}
