$(document).ready(function(){ 
		
		$('.dateRange').calendar({ dateFormat: 'YMD-',firstDay: 1,yearRange: '2000:2024' });
		
		
		$(".zebra tr:nth-child(odd)").css("background","#cccccc");
  
      $('.hovertable tr').hover(function() {
        $(this).addClass('hover');
      }, function() {
        $(this).removeClass('hover');
      });
	  
	 $(".sup").hover(function(){
		$('.sub').hide();
		$('.sub', this).show();
	},function(){
		$('.sub').hide();
	});
	  
	$("#loading").bind("ajaxSend", function(){
	   $(this).show();
	 }).bind("ajaxComplete", function(){
	   $(this).hide();
	});
	  
});

function tabbar( id ){
	
	$("#tabhead div").click( function() { 
		$("#tabhead div").css({ backgroundColor:"#f2f2f2"})
		$(this).css({ backgroundColor:"#cccccc"})
	//alert($(this).text()); 
	});
	
	$('#tabbs div').hide();
	$('#'+id).show();
	
  }
  
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){
		///
		if(id==''){return false;}
		var d = new Date();
		//var dcontrol = d.getHours();
		var dcontrol = d.getMinutes();
		$("#"+id).load("dinload.php"+get,{val: post, control: dcontrol });
	}
	
	

function winclose(id){
	var parid = $(id).parents('div.window').attr('id');
	$('#'+parid).fadeOut();
}

function acordion( id ){
	var et = $("#"+id).css("display");
	if(et=='none'){
		$('.accontainer').slideUp('fast');
		$('#'+id).slideDown('fast');
	}else{$('#'+id).slideUp('fast');}
}

function checkForm(obj, elems) {
var element, pattern;
    for (var i = 0; i < obj.elements.length; i++) {
        element = obj.elements[i];
        // field
        if (elems != undefined)
            if (elems.join().indexOf(element.type) < 0) continue;
        // messg
        if (!element.getAttribute("check_message")) continue;
        if (pattern = element.getAttribute("check_pattern")) {  // check by reg
            pattern = new RegExp(pattern, "g");
            if (!pattern.test(element.value)) {
                alert(element.getAttribute("check_message"));
                element.focus();
                return false;
            }
        } else if(/^s*$/.test(element.value)) {  // check empty
            alert(element.getAttribute("check_message"));
            element.focus();
            return false;
        }
    }
return true;
}
