/* Author:

*/


$(document).ready(function(){
	
	// Run Matt Kersley's jQuery Responsive menu plugin (see plugins.js)
	if ($.fn.mobileMenu) {
		$('ol#id').mobileMenu({
			switchWidth: 768,                   // width (in px to switch at)
			topOptionText: 'Choose a page',     // first option text
			indentString: '&nbsp;&nbsp;&nbsp;'  // string for indenting nested items
		});
	}

	// Run Mathias Bynens jQuery placeholder plugin (see plugins.js)
	if ($.fn.placeholder) {
		$('input, textarea').placeholder();		
	}
});

// Background script
 $(document).ready(function(){
 
 var imgArr = new Array( // relative paths of images
 'http://www.thebhaktishop.com/img/bg/bhakti-blue.png',
 'http://www.thebhaktishop.com/img/bg/bhakti-blue-green.png',
 'http://www.thebhaktishop.com/img/bg/bhakti-red.png',
 'http://www.thebhaktishop.com/img/bg/bhakti-green.png',
 'http://www.thebhaktishop.com/img/bg/bhakti-purple.png',
 'http://www.thebhaktishop.com/img/bg/bhakti-brown.png'
 );
 
 $('#container').animate({opacity: 1}, 100).css({'background': 'url(' + imgArr[Math.floor(Math.random() * imgArr.length)] + ') top left repeat'});

 var preloadArr = new Array();
 var i;
 
 /* preload images */
 for(i=0; i < imgArr.length; i++){
 preloadArr[i] = new Image();
 preloadArr[i].src = imgArr[i];
 }
 
 var currImg = +Math.floor(Math.random()*imgArr.length);
 var intID = setInterval(changeImg, 16000);
 /* image rotator */
 
 function changeImg(){	 
 $('#container').animate({opacity: 0}, 3000, function(){
 $(this).css('background','url(' + preloadArr[currImg++%preloadArr.length].src +') top left repeat');
 }).animate({opacity: 1}, 3000);
 
 $('html').css('background','url(' + preloadArr[currImg].src +') top left repeat');
 }
 
 });

// Main Navigation
			$(document).ready(function() {
                <!--$('#navigation li').stop().animate({'marginLeft':'10px'},1000);-->
				$('#nav1 li.snav1').stop().animate({'marginLeft':'30px'},700);
				$('#nav1 li.snav2').stop().animate({'marginLeft':'20px'},750);
				$('#nav1 li.snav3').stop().animate({'marginLeft':'15px'},800);
				$('#nav1 li.snav4').stop().animate({'marginLeft':'15px'},850);
				$('#nav1 li.snav5').stop().animate({'marginLeft':'20px'},900);
				$('#nav1 li.snav6').stop().animate({'marginLeft':'30px'},950);
				$('#nav1 li.snav7').stop().animate({'marginLeft':'20px'},1000);

                $('#nav1 > li').hover(
                    function () {
                        $('a',$(this)).stop().animate({'marginLeft':'20px','paddingLeft':'40px','paddingRight':'30px'},300);
                    },
                    function () {
                        $('a',$(this)).stop().animate({'marginLeft':'0px','paddingLeft':'6px','paddingRight':'15px'},400);
                    }
                );
				
				$('#nav2 li.snav8').stop().animate({'marginLeft':'10px'},1100);
				$('#nav2 li.snav8 a').stop().css({backgroundImage:"url(http://www.thebhaktishop.com/img/bg/trans-orange2.png)", color:"#FFF"});
				$('#nav2 li.snav9').stop().animate({'marginLeft':'15px'},1150);
				$('#nav2 li.snav9 a').stop().css({backgroundImage:"url(http://www.thebhaktishop.com/img/bg/trans-pink.png)", color:"#FFF"});
				$('#nav2 li.snav11').stop().animate({'marginLeft':'10px','marginTop':'5px'},1050);
				$('#nav2 li.snav10').stop().animate({'marginLeft':'25px','marginTop':'10px'},1000);
				
				
				$('#nav2 > li').hover(
                    function () {
                        $('a',$(this)).stop().animate({'marginLeft':'10px','paddingLeft':'20px','paddingRight':'20px'},300);
                    },
                    function () {
                        $('a',$(this)).stop().animate({'marginLeft':'0px','paddingLeft':'6px','paddingRight':'15px'},200);
                    }
                );
            });

// the411
$(document).ready(function()
{
	$("#firstpane h2.the411_head").hover(function()
    {
		$(this).css({color:"#FFF"});
		$(this).siblings("h2.the411_head").css({color:"#B4B81D"});
	});
	$("#firstpane h2.the411_head").click(function()
    {
		$(this).css({backgroundColor:"#B4B81D",color:"#FFF"}).next("div.the411_body").slideToggle(400).siblings("div.the411_body").slideUp("slow");
		$(this).siblings("h2.the411_head").css({background:"none",backgroundImage:"url(http://www.thebhaktishop.com/img/bg/trans-30.png)",color:"#B4B81D"});
	});
});
// contentpane
$(document).ready(function()
{
	$("#contentpane div.cmenu_head").hover(function()
    {
		$(this).css({backgroundColor:"#B4B81D"});
		$(this).siblings("div.cmenu_head").css({color:"#B4B81D",background:"none",backgroundImage:"url(http://www.thebhaktishop.com/img/bg/trans-30.png)"});
	});
	$("#contentpane div.cmenu_head").click(function()
    {
		$(this).css({backgroundColor:"#B4B81D",color:"#FFF"}).next("div.cmenu_body").slideToggle(400).siblings("div.cmenu_body").slideUp("slow");
		$(this).siblings("div.cmenu_head").css({background:"none",backgroundImage:"url(http://www.thebhaktishop.com/img/bg/trans-30.png)",color:"#B4B81D"});
	});
});

// cycles
$(document).ready(function() {	
$('.quotes')
.cycle({ 
    fx: 'fade', 
    speed: 3000,
	random: 1, 
	cleartypeNoBg: true,
    timeout: 10000   
});

$('.slideshow')
.cycle({ 
    fx:     'fade', 
    speed:  'slow', 
    timeout: 7000,
	fit: 1,
	width: '100%',
	height: 'auto',
	random: 1
});

/*$('.slideshow').after('<ul id="nav">').cycle({ 
    fx:     'fade', 
    speed:  'slow', 
    timeout: 7000,
	fit: 1,
	width: '100%',
	height: 'auto',
	random: 1,
	pager:  '#nav',
	
	pagerAnchorBuilder: function(idx, slide) { 
        return '<li><a href="#"><img src="' + slide.src + '" width="50" height="50" /></a></li>'; 
    } 
});*/


});




