
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:      	'fade',
		    speed:    	1000,
			timeout:  	0,
			sync:   	1,
		    prev:   '#nextSer', 
		    next:   '#prevSer',
			pause:  	1
		});

		$('.slideshowHome2').cycle({ 
			fx:      	'fade',
		    speed:    	1000,
			timeout:  	6000,
			sync:   	1,
		    prev:   '#nextSlide', 
		    next:   '#prevSlide',
			pause:  	1
		});

		
		$('.slideshowHome, .slideshowTopB').cycle({ 
			fx:      	'scrollHorz',
		    speed:    	1000,
			timeout:  	4000,
			sync:   	1,
		    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, .maincolumnW a").fadeTo("slow", 1.0); // This sets the opacity of the thumbs to 100% when the page loads
		$(".fadeFx, .jqueryslidemenu ul li a, .maincolumnW 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
			});


	$("#wraper1").hover(function(){
		$("#panel1").toggle("fast");
		$(this).toggleClass("active");
		return false;
	});
	$("#wraper2").hover(function(){
		$("#panel2").toggle("fast");
		$(this).toggleClass("active");
		return false;
	});
	$("#wraper3").hover(function(){
		$("#panel3").toggle("fast");
		$(this).toggleClass("active");
		return false;
	});
	$("#wraper4").hover(function(){
		$("#panel4").toggle("fast");
		$(this).toggleClass("active");
		return false;
	});
	$("#wraper5").hover(function(){
		$("#panel5").toggle("fast");
		$(this).toggleClass("active");
		return false;
	});
	$("#wraper6").hover(function(){
		$("#panel6").toggle("fast");
		$(this).toggleClass("active");
		return false;
	});
	$("#wraper7").hover(function(){
		$("#panel7").toggle("fast");
		$(this).toggleClass("active");
		return false;
	});
	$("#wraper8").hover(function(){
		$("#panel8").toggle("fast");
		$(this).toggleClass("active");
		return false;
	});
	$("#wraper9").hover(function(){
		$("#panel9").toggle("fast");
		$(this).toggleClass("active");
		return false;
	});
	$("#wraper10").hover(function(){
		$("#panel10").toggle("fast");
		$(this).toggleClass("active");
		return false;
	});




/*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'
			});
		});
	});


}); 
		$(function () {
			$('.preload').hide();//hide all the images on the page
		});
		
		var i = 0;//initialize
		var int=0;//Internet Explorer Fix
		$(window).bind("load", function() {//The load event will only fire if the entire page or document is fully loaded
			var int = setInterval("doThis(i)",200);//500 is the fade in speed in milliseconds
		});
 
		function doThis() {
			var imgs = $('.preload').length;//count the number of images on the page
			if (i >= imgs) {// Loop the images
				clearInterval(int);//When it reaches the last image the loop ends
			}
			$('.preload:hidden').eq(0).fadeIn(200);//fades in the hidden images one by one
			i++;//add 1 to the count
		}




/**
 * @author Alexander Farkas
 * v. 1.02
 */
(function($) {
	$.extend($.fx.step,{
	    backgroundPosition: function(fx) {
            if (fx.state === 0 && typeof fx.end == 'string') {
                var start = $.curCSS(fx.elem,'backgroundPosition');
                start = toArray(start);
                fx.start = [start[0],start[2]];
                var end = toArray(fx.end);
                fx.end = [end[0],end[2]];
                fx.unit = [end[1],end[3]];
			}
            var nowPosX = [];
            nowPosX[0] = ((fx.end[0] - fx.start[0]) * fx.pos) + fx.start[0] + fx.unit[0];
            nowPosX[1] = ((fx.end[1] - fx.start[1]) * fx.pos) + fx.start[1] + fx.unit[1];
            fx.elem.style.backgroundPosition = nowPosX[0]+' '+nowPosX[1];

           function toArray(strg){
               strg = strg.replace(/left|top/g,'0px');
               strg = strg.replace(/right|bottom/g,'100%');
               strg = strg.replace(/([0-9\.]+)(\s|\)|$)/g,"$1px$2");
               var res = strg.match(/(-?[0-9\.]+)(px|\%|em|pt)\s(-?[0-9\.]+)(px|\%|em|pt)/);
               return [parseFloat(res[1],10),res[2],parseFloat(res[3],10),res[4]];
           }
        }
	});
})(jQuery);

$(function(){
	$('.leftmenu a')
		.css( {backgroundPosition: "0 8px"} )
		.mouseover(function(){
			$(this).stop().animate({backgroundPosition:"(12px 8px)"}, {duration:100})
		})
		.mouseout(function(){
			$(this).stop().animate({backgroundPosition:"(0 8px)"}, {duration:500})
		})
});

/*
$(document).ready(function(){
			//Start the snow default options you can also make it snow in certain elements, etc.
			$(document).snowfall({round : true, minSize: 2, maxSize:8})
		});
*/
