$(window).load(function() {
	$('.flexslider').flexslider({
		slideshowSpeed: 10000,
		directionNav: false,
		controlNav: false,
		start: function(slider){
			jQuery("#previous-home-tile").bind("click", function() {
				slider.flexAnimate(slider.getTarget("prev"));
		        return false;
		    });

		    jQuery("#next-home-tile").bind("click", function() {
		        slider.flexAnimate(slider.getTarget("next"));
		        return false;
		    });
		}
	});
 });

/*
$(document).ready(function(){
	var idx = $("#homebanner li").index($("#homebanner li.active-tile")) + 1;
	//alert(idx);
	jQuery("#homebanner ul").jcarousel({
		start: idx,
		wrap : "both",
		scroll: 1,
		auto: 100,
        initCallback: mycarousel_initCallback,
        buttonNextHTML: null,
        buttonPrevHTML: null
	});
});

function mycarousel_initCallback(carousel) {
    jQuery("#previous-home-tile").bind("click", function() {
        carousel.prev();
        return false;
    });

    jQuery("#next-home-tile").bind("click", function() {
        carousel.next();
        return false;
    });
};
*/


/*
$(document).ready(function(){
	

	all_images = new Array();
	$('li.home-slide-tile > img').each(function(){
		all_images.push($(this).attr('src'));
	});

	if(all_images.length > 0)
	{
		// Preload
		pl_images = new Array();
		for(m=0;m<all_images.length;m=m+1)
		{
			pl_images.push(new Image());
			pl_images[m].src=all_images[m];
		}
	}
});


$('#homebanner').ready(function(){
	createSIFR();
});

function home_slide_next()
{
	$('div#homebanner ul li.active-tile').hide('fast',function(){

		cur_item = $('div#homebanner ul li.active-tile');

		curr_pos = $('div#homebanner ul li').index(cur_item);
		next = 0;

		if(curr_pos != $('div#homebanner ul li').length-1) next=curr_pos+1;

		next_li = $('div#homebanner ul li:eq('+next+')')

		$(this).removeClass('active-tile');
		$(this).css('display','none');
		
		$(next_li).show('fast',function(){
			$(this).addClass('active-tile');
			if(!$(this).find('object').length) createSIFR();
		});
	});
}

function home_slide_prev()
{
	$('div#homebanner ul li.active-tile').hide('fast',function(){
		cur_item = $('div#homebanner ul li.active-tile');
		curr_pos = $('div#homebanner ul li').index(cur_item);
		next = $('div#homebanner ul li').length-1;
		if(curr_pos != 0) next=curr_pos-1;
		next_li = $('div#homebanner ul li:eq('+next+')');
		$(this).removeClass('active-tile');
		$(this).css('display','none');
		$(next_li).show('fast',function(){
			$(this).addClass('active-tile');
			if(!$(this).find('object').length) createSIFR();
		});
	});
}

function createSIFR()
{
	sIFR.replace(din_medium, {
		selector: '.hst-overlay-title',
		css: ['.sIFR-root { color: #FFFFFF; font-size:25px; }'],
		wmode: 'transparent',
		transparent: true
	});
	

	sIFR.replace(din_light, {
		selector: '.hst-overlay-descr',
		css: ['.sIFR-root { color: #FFFFFF; font-size:12px; }'],
		wmode: 'transparent',
		transparent: true
	});
	
	
	sIFR.replace(din_medium, {
		selector: 'span.hst-content-title',
		css: ['.sIFR-root { display:inline; color: #C0CC00; font-size:10px;  }'],
		wmode: 'transparent',
		transparent: true
	});
	
	sIFR.replace(din_light, {
		selector: 'span.hst-content-value',
		css: ['.sIFR-root { display:inline; color: #FFFFFF; font-size:10px; }'],
		wmode: 'transparent',
		transparent: true
	});
	
	sIFR.replace(din_medium, {
		selector: 'h2.maintitle',
		css: ['.sIFR-root { display: inline; color: #FAA71B; font-size: 24px; text-transform: uppercase; }'],
		wmode: 'transparent',
		transparent: true
	});
}

*/
