function datetime() {
	var currentTime = new Date();
	var month = currentTime.getMonth() + 1;
	if (month < 10){ month = "0" + month; }
	var day = currentTime.getDate();
	if (day < 10){ day = "0" + day; }
	var year = currentTime.getFullYear();
	
	var tday = day + "." + month + "." + year;
	
	var hours = currentTime.getHours();
	var minutes = currentTime.getMinutes();
	if (minutes < 10){ minutes = "0" + minutes; }
	var seconds = currentTime.getSeconds();
	if (seconds < 10){ seconds = "0" + seconds; }
	
	var ttime = hours + ":" + minutes + ":" + seconds;
	$('#datetime').text(tday+ ' / '+ttime);
//		if(hours > 11){
//			document.write("PM")
//		} else {
//			document.write("AM")
//		}
}

function preloadImg(imgU) {
	var tmp = new Image();
		tmp.src = imgU;
}

function changeImage(e) {
	var $e = $(this);
	oA = $('.product_slide a.active');
	
	if (oA[0] == $e[0]) return;

	oA.stop().animate({opacity: '0.5'}, function(){
		$(this).removeClass('active');
	});
	$e.stop().animate({opacity: '1'}, function(){
		$(this).addClass('active');
	});
	
	$('.product_slide .img img').fadeOut('fast', function() {
		$(this).attr('src', $e.attr('href')).fadeIn();
	});

	return false;
}

$(document).ready(function() {

	$('.product_slide a').click(changeImage);

	/*
	Start: Product Slider
	*/
	var slideTDs = $('.product_slide .inner td');
	var slideWidth = slideTDs.length*95;

	var prevI = 285;
	$('.product_slide .prev').click(function() { 
		var tD = $('.product_slide a.active').parent().prev();
		if (tD.length == 1) {
			if (slideWidth%380 == 0) {
				$('.product_slide div.inner').animate({
					scrollLeft: '-=380px'
				});
			}
			tD.find('a').click();
			
			
			slideWidth += 95;
		}
	});

	$('.product_slide .next').click(function() { 
		var tD = $('.product_slide a.active').parent().next();
		if (tD.length == 1) {
			if (slideWidth%380 == 0) {
				$('.product_slide div.inner').animate({
					scrollLeft: '+=380px'
				});
			}
			tD.find('a').click();
			
			slideWidth -= 95;
		}
	});
	/*
	Stop: Product Slider
	*/

	$('#head_banner').wtRotator({
		width:1007,
		height:250,
		thumb_width:24,
		thumb_height:24,
		button_width:24,
		button_height:24,
		button_margin:5,
		auto_start:true,
		delay:6000,
		transition:"fade",
		transition_speed:1000,
		block_size:75,
		vert_size:55,
		horz_size:50,
		cpanel_align:"BR",
		timer_align:"bottom",
		display_thumbs:false,
		display_dbuttons:false,
		display_playbutton:false,
		display_thumbimg:false,			
		display_side_buttons:false,
		tooltip_type:"none",
		display_numbers:false,
		display_timer:false,
		mouseover_pause:true,
		cpanel_mouseover:false,
		text_mouseover:false,
		text_effect:"fade",
		text_sync:false,
		shuffle:false,
		block_delay:25,
		vstripe_delay:73,
		hstripe_delay:183
	});

	$('#service_banner').wtRotator({
		width: 210,
		height: 300,
		thumb_width:24,
		thumb_height:24,
		button_width:24,
		button_height:24,
		button_margin:5,
		auto_start:true,
		delay:5000,
		transition:"fade",
		transition_speed:1000,
		block_size:75,
		vert_size:55,
		horz_size:50,
		cpanel_align:"BR",
		timer_align:"top",
		display_thumbs:false,
		display_dbuttons:true,
		display_playbutton:false,
		display_thumbimg:false,			
		display_side_buttons:false,
		tooltip_type:"none",
		display_numbers:false,
		display_timer:false,
		mouseover_pause:true,
		cpanel_mouseover:true,
		text_mouseover:false,
		text_effect:"fade",
		text_sync:true,
		shuffle:false,
		block_delay:25,
		vstripe_delay:73,
		hstripe_delay:183
	});

	$('input.focuser').focus(function(){
		if (this.value == this.defaultValue) this.value = '';
	}).blur(function(){
		if (this.value == '') this.value = this.defaultValue;
	});

//	$('.print').click(function() {
//		$('link[media="print, handheld"]').attr('media', 'screen');
//		window.print();
//	})
});
