
featuredcontentglider.init({
	gliderid: "splashpics", //ID of main glider container
	contentclass: "glidecontent", //Shared CSS class name of each glider content
	togglerid: "p-select", //ID of toggler container
	remotecontent: "", //Get gliding contents from external file on server? "filename" or "" to disable
	selected: 0, //Default selected content index (0=1st)
	persiststate: false, //Remember last content shown within browser session (true/false)?
	speed: 500, //Glide animation duration (in milliseconds)
	direction: "rightleft", //set direction of glide: "updown", "downup", "leftright", or "rightleft"
	autorotate: true, //Auto rotate contents (true/false)?
	autorotateconfig: [4000, 20] //if auto rotate enabled, set [milliseconds_btw_rotations, cycles_before_stopping]
})

function pause(ms)
{
	var now = new Date();
	var exitTime = now.getTime() + ms;
	while (true)
	{
		now = new Date();
		if (now.getTime() > exitTime) return;
	}
} 

function chgimg(i, d, b, m, s, c)
{
	$("#"+i).attr('src', m);
	$("#"+d).text(s);
	$("#"+b).attr('href', c);
}

function add_sth_done(loc)
{
	pause(1000);
	$.prettyPhoto.close();
	if ( loc ) document.location = loc;
}

function checkAddProductSubmit(ppp)
{
	var els = document.forms.addform[ppp];
	var sel = false;

	if ( els.length == undefined ) {
		if ( els.checked ) sel = true;
	}
	else {
		for ( var i=0; i<els.length; i++ ) {
			if ( els[i].checked ) sel = true;
		}
	}

	if ( sel ) {
		return true;
	}
	else {
		alert("Please select variant");
		return false;
	}
}

function deliveryChanged(el)
{
	var da = $(el).find('option:selected').val();

	$('#baskettotal').load('?do=basket&a=getTotal&da=' + da);

	if ( da == -1 ) {
		$('#order_a').val('email');
		$('#order_info').show();
		$('#order_submit_paypal').hide();
		$('#order_submit_email').show();
	}
	else {
		$('#order_a').val('wps');
		$('#order_info').hide();
		$('#order_submit_paypal').show();
		$('#order_submit_email').hide();
	}
}

$(document).ready(function() {

	$('#text-slides').cycle({ 
		fx:'fade',
		cleartype:  true,
		cleartypeNoBg:  true
	});

	$("a[rel^='prettyPhoto']").prettyPhoto({theme:'light_rounded'});

	$('.mycarousel').jcarousel();
	//$('.news-container').vTicker();

	if ( $('#paypalform').length > 0 ) {
		$('#paypalform').submit();
	}


		$('.slideshowServices').cycle({ 
			fx:      	'scrollHorz',
		    speed:    	1000,
			timeout:  	0,
			sync:   	1,
		    prev:   '#nextSer', 
		    next:   '#prevSer',
			pause:  	1
		});
		
		
		$('.slideshowTop, .slideshowTopB').cycle({ 
			fx:      	'fade',
		    speed:    	1000,
			timeout:  	4000,
			sync:   	0,
		    next:   '#nextSlide', 
		    prev:   '#prevSlide',
			pause:  	1,
			pager:  '#navNew',

			// callback fn that creates a thumbnail to use as pager anchor 
				pagerAnchorBuilder: function(idx, slide) { 
				return '<a href="#"></a>'; 
			} 
		});


		$(".fadeFx, .jqueryslidemenu ul li a").fadeTo("slow", 1.0); // This sets the opacity of the thumbs to 100% when the page loads
		$(".fadeFx, .jqueryslidemenu ul li a").hover(function(){
			$(this).fadeTo("fast", 0.4); // This should set the opacity to 60% on hover
			},function(){
			$(this).fadeTo("slow", 1.0); // This should set the opacity back to 1000% on mouseout
			});


/*Since all the tabs are hidden with css we are displaying the tab with class .active_tab using fadeIn()
function. If you just want it to show with no effect, just put show() instead of fadeIn() */
  $('.active_tab').fadeIn();
  
  //when a tab link is clicked...
  $('.tab_link').live('click', function(event){
		/*...prevent the default behaviour...*/
		event.preventDefault();
		/* ...remove the tab_link_selected class from current active link... */
		$('.tab_link_selected').removeClass('tab_link_selected');
		/* ...and add it to the new active link */
		$(this).addClass('tab_link_selected');
		/*...get the title attribute (which corensponds to the id of the needed text container),
		but you can use any attribute you want*/
		var container_id = $(this).attr('title');
		//...animate the current active_tab by changing it's height and opacity ...'
		$('.active_tab').animate({ 
			height : 'toggle' , opacity : 'toggle' 
		//...and when that animation ends...
		},function(){
			//...remove the active_tab class from the current active tab...
			$(this).removeClass('active_tab');
			//...and add that class to the tab that corensponds the clicked link...
			$(container_id).addClass('active_tab');
			//...and animate the new active_tab by using toggle on height and opacity again...
			$('.active_tab').animate({
				height : 'toggle' , opacity : 'toggle'
			});
		});
	});


}); 

