﻿$(document).ready(function() {

	$('ul.tabs li').css('cursor', 'pointer');

	$('ul.tabs.tabs1 li').click(function(){
		var thisClass = this.className.slice(0,2);
		$('div.t1').hide();
		$('div.t2').hide();
		$('div.' + thisClass).show();
		$('ul.tabs.tabs1 li').removeClass('tab-current');
		$(this).addClass('tab-current');
	});

	$('ul.tabs.tabs2 li').click(function(){
		var thisClass = this.className.slice(0,2);
		$('div.t3').hide();
		$('div.t4').hide();
		$('div.' + thisClass).show();
		$('ul.tabs.tabs2 li').removeClass('tab-current');
		$(this).addClass('tab-current');
	});

	$('ul.tabs.tabs3 li').click(function(){
		var thisClass = this.className.slice(0,2);
		$('div.t5').hide();
		$('div.t6').hide();
		$('div.' + thisClass).show();
		$('ul.tabs.tabs3 li').removeClass('tab-current');
		$(this).addClass('tab-current');
	});

	$('div.t3 li:even').addClass('border');
	$('div.t5 li:even').addClass('border');
	$('div.t6 li:even').addClass('border');
	
	// Smile			
	$('#smile_dialog').dialog({
		bgiframe: true,
		width: 800,
		height: 500,
		autoOpen: false,
		modal: true,
		resizable: true,
		draggable: true,
		closeOnEscape: true,
		buttons: {
			'Закрыть': function(){
				$(this).dialog('close');
			}
		},
		open: function(){
			
			$('#smile_dialog_content').load( $('#smile_date').val() );
		}
	});
	
	// Dialog
	var mode = 'ref';
	$('#remote_html').dialog({
		bgiframe: true,
		width: 600,
		height: 400,
		autoOpen: false,
		modal: true,
		resizable: true,
		draggable: true,
		closeOnEscape: true,
		buttons: {
			'Закрыть': function(){
				$(this).dialog('close');
			}
		},
		open: function(){
			
			if (mode == 'ref') {
				$('#remote_html_content').load('/ref.html');
			}
			else{
				$('#remote_html_content').load('/invite.html');
			}
		}
	});
		
	
	$('#smile').click(function(){
		
    	$('#smile_dialog').dialog('open'); 		
	});
	
	$('#invites').click(function(){
		
		mode = 'invites';
    	$('#remote_html').dialog('open'); 		
	});
	
	$('#ref').click(function(){
		
		mode = 'ref';
    	$('#remote_html').dialog('open'); 		
	});

});

