function goback() {
	history.back();
	return false;	
}
function setviewblog() {
	document.cookie = "set_view=blog; path=/";
}
function setviewblogreload() {
	document.cookie = "set_view=blog; path=/";
	window.location.reload();
}
function setviewnormal() {
	document.cookie = "set_view=normal; path=/";
}
function setviewnormalreload() {
	document.cookie = "set_view=normal; path=/";
	window.location.reload();
}



$(document).ready(function() {

$(".thumbnails li").click(function(){
	id = $(this).attr("id").replace("thumbnail-","");
	$(".previews li").removeClass("active");
	$("#preview-"+id).addClass("active");
});
$(".previews a").colorbox({
	photo: true,
	rel:'group',
	width: '80%',
	height: '80%',
	scalePhotos : true
});

/*
    $("a.shopp-zoom").colorbox({
        photo: true
    });
    $("a.shopp-zoom.gallery").each(function () {
        var b = a(this).attr("class").match(/product\_(\d+)/)[1];
        if (typeof (cbo) != "undefined") {
            a(this).attr("rel", "gallery-" + b).colorbox(cbo)
        } else {
            a(this).attr("rel", "gallery-" + b).colorbox({
                slideshow: true,
                slideshowSpeed: 3500
            })
        }
    })
*/
	
	
    $("select.shopp-orderby-menu").change(function () {
        this.form.submit()
    });
    $("select.shopp-categories-menu").change(function () {
        document.location.href = $(this).val()
    });


//console.log("Jquery Loaded");
	//$('input[name="st"]')[1].checked = true; 
	
		//$('.articleboxhighlight').fadeTo(0,0); 
		
	
/*
		
		img.src = img.src;
	
	$('.contentwrap img').hide().fadeIn(1000);
	$('.articlebox img').hide().fadeIn(1000);	
	$('.articlelongtext img').hide().fadeIn(1000);
		*/
	//$('#searchbox').hide();
	$('#backbutton').click( function() {
		goback();
	});
	$('#sitemapbutton').toggle(	function()	{
		$('#circlestickerblackhome').animate({top: "1640px"}, {duration: 500, easing: 'easeOutCubic'});
		$('#circlestickerblackbikes').animate({top: "670px"}, {duration: 500, easing: 'easeOutCubic'});
		$('#topbar').animate({top: "0px"}, {duration: 500, easing: 'easeOutCubic'});
		$('#contentwrap').animate({paddingTop: "442px"}, {duration: 500, easing: 'easeOutCubic'});
		$('#sitemapbutton').animate({paddingBottom: "12px"}, {duration: 500, easing: 'easeOutCubic'});
	}, function() {
		$('#circlestickerblackhome').animate({top: "1260px"}, {duration: 500, easing: 'easeOutCubic'});
		$('#circlestickerblackbikes').animate({top: "290px"}, {duration: 500, easing: 'easeOutCubic'});	
		$('#topbar').animate({top: "-380px"}, {duration: 500, easing: 'easeOutCubic'});
		$('#contentwrap').animate({paddingTop: "62px"}, {duration: 500, easing: 'easeOutCubic'});
		$('#sitemapbutton').animate({paddingBottom: "9px"}, {duration: 500, easing: 'easeOutCubic'});
	});
	/*$('#searchbutton').toggle(	function()	{
		$('#searchbox').fadeIn();
	}, function() {
		$('#searchbox').fadeOut();
	});*/
	$('#viewtextbutton').toggle(	function()	{
		
		$('.articleboxhighlight').animate({height: "564px"}, {duration: 500, easing: 'easeOutCubic'});
		$('.articleshorttext').css({overflow: "visible"});
	}, function() {
		$('.articleboxhighlight').animate({height: "332px"}, {duration: 500, easing: 'easeOutCubic'});
		$('.articleshorttext').css({overflow: "hidden"});
	});
	$('.slideshow').cycle({	fx: 'fade',	speed: 500, timeout: 2000 });
	$('.productlargeimage').cycle({	fx: 'fade',	speed: 500, timeout: 2000 });
	$('.articleboxhighlight').hover(	function()	{
		var color = $(this).children("div.bordertop").children("span.backcolor").css("background-color"); 
		$('.articlebox').css({backgroundColor: "#ffffff"});
		$(this).css({backgroundColor: color});
	}, function() {
		$(this).css({backgroundColor: "#ffffff"});
	});
	$(".aktt_tweets ul").marquee(); 
});




function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}



