$(document).ready(function(){ 

	$(".datepick").datepicker({dateFormat: "yy-mm-dd"});
	
	$(".round").corner();
	$("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(){
	$(this).closest('.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();
   /////////////////////////////////////////////
  
/*$("#mainpagecntnr img").each(function() {
	if ($(this).width() > 630) {
		$(this).css("width", "600px");
	}
}); */  
	  





});

  
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){
	var parid = $(id).parents('div.window').attr('id');
	$('#'+parid).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);
	
}


