function writeCurrDate() {
	var txt_weekdays = ["Sunday","Monday","Tuesday","Wednesday",
						"Thursday","Friday","Saturday"];
    var txt_months =  ["", "January", "February", "March", "April",
						"May", "June", "July", "August", "September", "October", "November",
						"December"];
	var currentTime = new Date();
	var month = currentTime.getMonth() + 1;
	var day = currentTime.getDate();
	var weekday = currentTime.getDay();
	var year = currentTime.getFullYear();
	document.write(txt_weekdays[weekday]+', '+txt_months[month] + " " + day + ", " + year);
}



if (typeof(jQuery) != 'undefined') {

	indeximgs = ['images/mainpage/01.jpg','images/mainpage/02.jpg','images/mainpage/03.jpg','images/mainpage/04.jpg','images/mainpage/05.jpg','images/mainpage/06.jpg'];

	jQuery(document).ready(function() {
		if (jQuery('#accordion').size() > 0){
			if (typeof(showcontactform) != 'undefined') {
					jQuery('#accordion').accordion({
							autoheight: false,
							event: 'click',
							header: 'h2',
							active: '#activeaccordeon',
							alwaysOpen: false
						});
			}
			else {
				jQuery('#accordion').accordion({
							autoheight: false,
							event: 'click',
							header: 'h2',
							alwaysOpen: false
						});
			}
		}

		
		if (jQuery('#indeximg').size() > 0) {
			//var randomnumber=Math.floor(Math.random()*indeximgs.length);
			//jQuery('#indeximg').attr('src', indeximgs[randomnumber]);		
			frontimagessrc = ['images/mainpage/01.jpg','images/mainpage/02.jpg','images/mainpage/03.jpg','images/mainpage/04.jpg','images/mainpage/05.jpg','images/mainpage/06.jpg'];
			frontimages = new Object();				
			imageObj = new Image();
			for(i=0; i<frontimagessrc.length; i++) 
			{
				var imageObj = new Image();
				imageObj.src=frontimagessrc[i];
				frontimages[i] = imageObj;
			}
			currfrontimage = 0;
			jQuery('#indeximg').attr('src',frontimages[currfrontimage].src);

			setInterval(function() {
				jQuery('#indeximg').css({opacity: 1.0}).animate({opacity: 0.1}, 800, function() {
					if (currfrontimage == frontimagessrc.length - 1) {
						currfrontimage = 0;
					}
					else {
						currfrontimage = currfrontimage + 1;
					}
						jQuery('#indeximg').css({opacity: 0.1}).attr('src',frontimages[currfrontimage].src).animate({opacity: 1.0}, 500);											
				});
			},3000);


		}
		
		/*
		var randomnumber = Math.floor(Math.random()*statements.length);
		randomnumbers = [randomnumber];
		while (randomnumbers.length != statements.length) {
			randomnumber=Math.floor(Math.random()*statements.length);
			if (randomnumbers.indexOf(randomnumber) == -1) {
				randomnumbers[randomnumbers.length] = randomnumber;
			}
		}
		*/
		
		
		
		/*JQuery Modal window for alloew access to download info-packs or advertisement*/
		$('#access-position').jqm();
		$('.not-allowed').click(function(){
			/*$('#positions td').each(function(){
				$(this).removeClass();
			});
			$(this).parents('td[align="center"]').addClass('clickedlink');*/
			var posname = $(this).parent().parent().find(".position-name").html();
			$('#access-position #position-name').html(posname);
			$('#access-position-infopack').val(posname);
			$('#access-position').jqmShow();
		});
		
		if($('.sidebar-entry').size() > 0) {
			$('.sidebar-entry').hover(
				function() {
					$(this).css('background-color','#ccb97f');
				}, function(){
					$(this).css('background-color','#dddddd');
			});
		}
	});
}
