$(document).ready(function(){ 

	$(".datepick").datepicker({dateFormat: "yy-mm-dd"});

	$("input:radio, input:checkbox").addClass('radio');
	$(".zebra tr:nth-child(odd)").css("background","#cccccc");
	$(".clockpick").clockpick();
	
	$('.hovertable tr').hover(function() {
		$(this).addClass('hover');
	}, function() {
		$(this).removeClass('hover');
	});
	
	$('.contentbody table tr').hover(function() {
		$(this).addClass('hover');
	}, function() {
		$(this).removeClass('hover');
	});
	
	$(".sup").hover(function(){
		$('.sub', this).show();
	},function(){
		$('.sub', this).hide('fast');
	});
  

$("#loading").bind("ajaxSend", function(){
   $(this).show();
 }).bind("ajaxComplete", function(){
   $(this).hide();
});
  
  
$(".button").click(function () { 
	$(".button").removeClass("selected"); 
	$(this).addClass("selected"); 
});

$(".confirm, .delete").click(function () { 
	return confirm(' \n Before you click OK be sure you do right action! \n\n\n Note: This may take a some troubles \n\n\n');
});

  
$(".onhover").bind("mouseenter",function(){
	$(".onhover").removeClass('hover');
	$(this).addClass('hover');
}).bind("mouseleave",function(){
	$(".onhover").removeClass('hover');});


$(".closewin, .winclose").bind("click",function(){
	winclose(this);
	//$(this).parents('div.window').fadeOut('fast');
});


///////////////////////////////////////////// form field default text from field title  
   $(".def_text").focus(function(srcc)
    {
        if ($(this).val() == $(this)[0].title)
        {
            $(this).removeClass("defaultTextActive");
            $(this).val("");
        }
    }).blur(function()
    {
        if ($(this).val() == "")
        {
            $(this).addClass("defaultTextActive");
            $(this).val($(this)[0].title);
        }
    });
   $(".def_text").blur();



});

  
function tabber( id, clas ){
	$('.'+clas).hide();
	$('#'+id).show();
  }
  

  function togling( id ){
    
	var et = $("#"+id).css("display");
	if(et=='none'){
		$('#'+id).slideDown('fast');
	}else{
		$('#'+id).slideUp('fast');
	}
  }
  
  function sliding( id ){
  	$('#'+id).toggle(400);
	/*var et = $("#"+id).css("display");
	if(et=='none'){$('#'+id).show('slow');
	}else{$('#'+id).hide('fast');}*/
  }
  
function dinload( id, get, post){
	///id - loading container id
	if(id==''){return false;}
	var d = new Date();
	var dcontrol = d.getHours();
	$("#"+id).load("dinload.php"+get,{val: post, control: dcontrol });

}
	
function show_first(id){
	$("#"+id).show();
}

/////////
function winclose(thiss){
	$(thiss).parents('div.window').fadeOut('fast');
}


/////// calendar selector
function calendar_selector(get, post){
	var year = $('#phpcalendary').val();
	var month = $('#phpcalendarm').val();
	var post = year+'-'+month;
	dinload('phpcalendarcontainer', get, post);
//	alert(get);
	
}

function fast_load(from, to){
	$("#"+to).html('').hide();
	var tt = $('#'+from).html();
	//alert(tt);
	$("#"+to).html(tt).show();
//	$("#"+to).show();
}



