
  jQuery(window).bind("load", function() {
    if (!($('.topPreview')[0]==undefined))
    {
      $('.topLoading').css('display', 'none');
      $('.topPreview').css('display', 'block');
      $('.slideshow').cycle({
    	  fx: 'fade',
        speed:    1000,
        timeout:  8000,
        pager:  '.pages',
        prev: '.prevTop',
        next: '.nextTop',
        activePagerClass: 'current'
    	});
    }
    

  });
  
  $(document).ready(function(){
  
	  $("#regCountry").change(function (){
		
		 var sell = $("#regState optgroup");
		 
		 for(var i=0, n=sell.length; i<n; i++){
			$(sell[i]).css('display','none');
			$("#id_" + $(this).val()).css('display','');
		 }
	  });
	  
	  
	  $('#answer_vote').click(function() {	
			
			var id = $("input[name=vote_main]").filter(":checked").val();
			
			if(id == undefined){
				alert('Choose to');
			}else{
			
				var url = "/ajax/vote.php";
				
				$.ajax({
					async : false,
					url: url,
					type: "POST",
					data:
						"id=" + id,
					dataType: "json",
					success: function(json){
						
						// добавляем id в куки
						var arr = new Array();
						if($.cookie("vote")){
							arr = eval('(' + $.cookie("vote") + ')');
						}
						arr[arr.length]=json.id;
						var jarr = $.toJSON(arr);
						$.cookie("vote",jarr,{expires: 360});
						//
					
						$("#block_vote").html(json.text)
					}
				});
			}
			
			return false;	
		});
  
  
  });
  
 
  
