jQuery.noConflict();
jQuery(document).ready(function(){

	/**
	*		Landing Page
	**/
	var url = location.search;
	if ( url == '?lp=1') {

		jQuery.fancybox(
			'/fileadmin/templates/popup.html',
			{
			'titlePosition'		: 'inside',
			'transitionIn'		: 'none',
			'transitionOut'		: 'none',
			'width'				: 840,
			'height'			: 535,
			'autoDimensions'	: false,
			'overlayOpacity'	: '0.5',
			'overlayColor'		: '#000',
			'titleShow'			: false,
			'showNavArrows' 	: false,
			'type'				: 'iframe'
			}
		);		
	} else if ( url == '?lp=2') {

		jQuery.fancybox(
			'/fileadmin/templates/popup2.html',
			{
			'titlePosition'		: 'inside',
			'transitionIn'		: 'none',
			'transitionOut'		: 'none',
			'width'				: 840,
			'height'			: 535,
			'autoDimensions'	: false,
			'overlayOpacity'	: '0.5',
			'overlayColor'		: '#000',
			'titleShow'			: false,
			'showNavArrows' 	: false,
			'type'				: 'iframe',
			'onClosed'			: function () {
										parent.location.href='http://www.wkgt.com/';
								  }
			}
		);		
	}
	
	jQuery(".download").fancybox({
		'titlePosition'		: 'inside',
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'width'				: 840,
		'height'			: 535,
		'autoDimensions'	: false,
		'overlayOpacity'	: '0.5',
		'overlayColor'		: '#000',
		'titleShow'			: false,
		'showNavArrows' 	: false,
		'type'				: 'iframe'
	});
	
	
	activateFPItem('header_0',5000);
	
	jQuery('.singleHeader').hover(function() {
		jQuery(this).toggleClass('singleHeaderhover');
	});
	
	jQuery('.singleHeader').mouseenter(function() {
		jQuery(this).addClass('singleHeaderhover');
	}).mouseleave(function() {
		jQuery(this).removeClass('singleHeaderhover');
	});

	jQuery('.singleHeader').click(function() {
		clearTimeout(t);
		activateFPItem(jQuery(this).attr('id'),20000);
	});
});


var t;
function activateFPItem(strover,ms) {
	var thisid = strover;
	var splitid = thisid.split('_');
	var activeid = splitid[1];
	var nextid = (splitid[1]*1)+1;
	if (nextid >= 4) { nextid = 0; } 
	var newbgimg = jQuery('#bgndimg_'+activeid).val();
	
	jQuery('.singleHeader').removeClass('singleHeaderhover');
	jQuery('#header_'+activeid).addClass('singleHeaderhover');
	jQuery('.singleBodytext').hide();
	jQuery('#text_'+activeid).show();
	
	bgElement = jQuery('.frommo_wkgtfrontpage_bgndimg');
	
	if (!bgElement.length) {
		bgElement = jQuery('.tx-frommowkgtfrontpage-pi1');
	}
	
	bgElement.css('background-image','url('+newbgimg+')');
	
	t = setTimeout("activateFPItem('header_"+nextid+"',5000)",ms);
}



