
$(document).ready(function(){
	
	//$('img._crs_img').load(function(){ //working alternative
	$('._crs_img').each(function(){
		if ($(this).height() > $(this).width()) {
			$(this).width("100%");
			//perhaps i will solve this someday, until then... the next 3 lines are commented.
			//imgm = ($(this).height()-$(this).width())/2;
			//imgm = "-"+imgm+"px"
			//$(this).css("margin-top", imgm);
		} else {
			$(this).height("100%");
			//imgm = ($(this).width()-$(this).height())/2;
			//imgm = "-"+imgm+"px"
			//$(this).css("margin-left", imgm);
		}
	});
	
	// jquery cycle
	$('#header').cycle({
		fx:    'fade', 
    	speed:  1000
	});
	
	$('#eventroll').cycle({
		fx:    'fade',
        speed:   1200,
        timeout: 7000,
        pause:	1,
        pager:	'#eventclick',
        pagerEvent:	'click',
        cleartype:     0
	});
	$('#newsroll').cycle({
		fx:    'scrollDown',
        speed:   600,
        timeout: 6000,
        pause:	1,
        cleartype:	0
	});
	$('#newsroll2').cycle({
		fx:    'scrollDown',
        speed:   600,
        timeout: 6000,
        pause:	1,
        cleartype:	0
	});
	$('#event1').click(function() { 
	    $('#eventroll').cycle(0); 
	    return false; 
	}); 
	 
	$('#event2').click(function() {  
	    $('#eventroll').cycle(1);  
	    return false;  
	});
	
	$('#event3').click(function() {  
	    $('#eventroll').cycle(2);  
	    return false;  
	});
	
	$(".searchfield").focus(function() {
		$(this).val("");
		}).blur(function() {
                if ($(this).val() == "") {
                        $(this).val($(this)[0].defaultValue);
                }
	});
	
	$('.azindex_show').click(function () {
		if ($('#azindex').is(":hidden")) {
			$('#azindex').slideDown("slow");
		} else {
			$('#azindex').slideUp("slow");
		}
	});
	
	
});