var imagerotation = {
		
		imgArray : new Array(),
		selector : "headpic", 
		fadeTime : 500, 
		showTime : 5000, 
		
		init: function(){
			var arr = new Array();
			/* defined in headpic template */
			arr = headImageArray;
			urlArr = headImageUrlArray;
			
			jQuery("#defaultHeadpic").hide();
			
			// add the container
			var str = '<div id="container_startimages" style="display:none;">';
			for (i = 0; i < arr.length; i++) {
				if (urlArr[i].length > 0) {
					str += '<a href="' + urlArr[i] +'">';
				}	
				str += '<img src="' + arr[i] +'" border="0" alt="zwittag.at" width="830" height="180" />';
				if (urlArr[i].length > 0) {
					str += '</a>';
				}	
			}
			str += '</div>';
			jQuery(str).insertAfter("#" + imagerotation.selector);
		},
			
	    /**
	     * fadeImages using plugin cycle
	     */
 		fadeImages : function() {
			jQuery('#container_startimages').show();
			jQuery('#container_startimages').cycle({ 
			    fx:    'fade', 
			    speed:    500, 
			    timeout:  3000 
			}); 
		}
}


jQuery.noConflict(); 
jQuery(document).ready(function(){
	 // hack to exclude IE 6
	/*
	if (jQuery.browser.msie && jQuery.browser.version == 6) {
		return; 
	}
	*/
	imagerotation.init();
	imagerotation.fadeImages();

});