var main = {
    init: function() {
    	$('body').addClass($('#wrapper').attr('class'));
    	
    	$('input[placeholder], textarea[placeholder]').placeholder();
    	
		if($('body.page-index').length) {
			this.slider();
		}
		
		if(($.browser.msie && parseInt($.browser.version, 10) >= 9) || !$.browser.msie) {
			this.fancyHovers(); // ;)
		}
		
		$('.tiptip').tipTip({

		});
		
		this.linkOperations();
		
		
    },
    linkOperations: function(){
		if (t){
			this.switchWiz( t );
		}
		
		$('#wizard a').bind('click',function(e){
			e.preventDefault();
			
			main.switchWiz($(this).attr('rel'));
		});
	},
    fancyHovers: function() {
    	var $handler = $('h1 a, #wrapper > nav a, button, .btn-want-qr');
    	
    	$handler.bind('mouseover', function(){
			$(this).stop().animate({'opacity': .5});
		});
		$handler.bind('mouseout', function(){
			$(this).stop().animate({'opacity': 1});
		});
    },
    
    slider: function() {		
		$('aside > ul').cycle({
			delay:		2000,
			fx:			'fade',
			pause:		1,
			timeout:	4000
		});
	},
	switchWiz: function ( c )
	{
		$(".on").removeClass( "on" );
		$("."+c).addClass( "on" );	
		$(".check-site").removeClass( "on" );
		$(".lab").hide();
		$("."+c).show();	
		$('#freq').attr('disabled', c == 'url' );	
		if (c == 'url')
			$('#freq').hide().prev().hide();
		else 
			$('#freq').show().prev().show();
		$('#id_type').val( c );		
		
	}
}
$(document).ready(function() {
    main.init();
});
