var d = new Date();
day=d.getDate();
month=d.getMonth();
year=d.getFullYear();
if(day<10){
day="0"+day;
}
month++;
if(month<10){
month="0"+month;
}
function checkStart(){


$('select#vepDay option[value='+day+']').attr({selected:'selected'});
$('select#vepMonth option[value='+month+']').attr({selected:'selected'});
$('#tx_vepevents_pi1\\[date_raum\\]').val($('#vepDay').val()+'.'+$('#vepMonth').val()+'.'+year);
$('#tx_vepevents_pi1\\[date_from\\]').val($('#vepDay').val()+'.'+$('#vepMonth').val()+'.'+year);
}
function checkActive(){
$('#t3mTabs > span').each(function(){
if($(this).attr('class')=='active'){
$(this).css('background-color','#e6eaee');
if($(this).attr('id')=='tabDate'){
$(this).css('border-width','0px 1px 0px 0px');
$('#tabCat').css('border-width','0px 0px 1px 0px');
$('#tabExtend').css('border-width','0px 0px 1px 0px');
$('#t3mTabs').css('background-color','#81B5F6');
}
if($(this).attr('id')=='tabCat'){
$(this).css('border-width','0px 1px 0px 1px');
$('#tabDate').css('border-width','0px 0px 1px 0px');
$('#tabExtend').css('border-width','0px 0px 1px 0px');
$('#t3mTabs').css('background-color','#81B5F6');
}
if($(this).attr('id')=='tabExtend'){
$(this).css('border-width','0px 0px 0px 1px');
$('#tabCat').css('border-width','0px 0px 1px 0px');
$('#tabDate').css('border-width','0px 0px 1px 0px');
$('#t3mTabs').css('background-color','#e6eaee');
}
} else {
$(this).css('background-color','#81B5F6');
}
});
}
function changeMonth(){
$('#tx_vepevents_pi1\\[date_raum\\]').val($('#vepDay').val()+'.'+$('#vepMonth').val()+'.'+year);
$('#tx_vepevents_pi1\\[date_from\\]').val($('#vepDay').val()+'.'+$('#vepMonth').val()+'.'+year);
}
function changeDay(){
$('#tx_vepevents_pi1\\[date_raum\\]').val($('#vepDay').val()+'.'+$('#vepMonth').val()+'.'+year);
$('#tx_vepevents_pi1\\[date_from\\]').val($('#vepDay').val()+'.'+$('#vepMonth').val()+'.'+year);
}
$(document).ready(function(){
///Tab Date am Start
$('#tabDate').attr('class','active');
$('#tabCat').attr('class','inactive');
$('#tabExtend').attr('class','inactive');
checkActive();
//$('#t3mSearchContent').hide('fast');
$('#divCat').hide('fast');
$('#evt_extended_search').hide('fast');
$('#divDate').slideDown('fast');
checkStart();
//MouseOver Effekt für Tabs
$('#t3mTabs > SPAN').mouseover( function(){
if($(this).attr('class')!='active'){
$(this).attr('class','hover inactive');
}
});
$('#t3mTabs > SPAN').mouseout( function(){
if($(this).attr('class')!='active'){
$(this).attr('class','inactive');
}
});
//Tab Date geklickt
$('#tabDate').click( function(){
$(this).attr('class','active');
$('#tabCat').attr('class','inactive');
$('#tabExtend').attr('class','inactive');
checkActive();
$('#divCat').hide('fast');
$('#evt_extended_search').hide('fast');
$('#divDate').slideDown('fast');
checkStart();
});
//Tab Cat geklickt
$('#tabCat').click( function(){
$('#tabDate').attr('class','inactive');
$(this).attr('class','active');
$('#tabExtend').attr('class','inactive');
checkActive();
$('#divDate').hide('fast');
$('#evt_extended_search').hide('fast');
$('#divCat').slideDown('fast');

checkStart();
});
//Tab Extend geklickt
$('#tabExtend').click( function(){
$('#tabDate').attr('class','inactive');
$('#tabCat').attr('class','inactive');
$(this).attr('class','active');
checkActive();
$('#divDate').slideDown('fast');
$('#divCat').slideDown('fast');
$('#evt_extended_search').slideDown('fast');
checkStart();
});
//Monats Select geändert --> in Datum-Feld eintragen
$('#vepMonth').change(changeMonth());
//Tages Select geändert --> in Datum-Feld eintragen
$('#vepDay').change(changeDay());
});