$(document).ready(function(){ 
	if(jQuery().datepicker) {
	   $(".datepick").datepicker({dateFormat: "yy-mm-dd"});
	}
	if(jQuery().clockpick) {
	  $(".clockpick").clockpick();
	}
	$(".round").corner();
	$("input:radio, input:checkbox").addClass('radio');
	$(".zebra tr:nth-child(odd)").css("background","#cccccc");
	
	$('.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(){
	$(this).closest('.window').fadeOut('fast');
});


///////////////////////////////////////////// form field default text from field title  
$(".def_text").bind("focus",function(){
	 if ($(this).val() == $(this).attr('title')){
            $(this).removeClass("defaultTextActive"); $(this).val("");
        }
}).bind("blur",function(){
	 if ($(this).val() == ""){
            $(this).addClass("defaultTextActive");
            $(this).val($(this).attr('title'));
        }
}); $(".def_text").blur();

$("form").bind("submit",function(){
	 if ($('.def_text', this).val() == $('.def_text', this).attr('title')){
            $('.def_text', this).val("");
        }
});
/////////////////////////////////////////////
  
$(".faderout").animate( { opacity:0 }, 5000 );



});

  
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();
	//var dcontrol = d.getMinutes();

//		$.getScript("http://localhost/server/webriye/core/js/jquery.js");
//		$.getScript("http://localhost/server/webriye/core/js/myfunc.js");
	$("#"+id).load("dinload.php"+get,{val: post, control: dcontrol });

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

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


/////// 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();
}


