// JavaScript Document
var GB_ANIMATION = true;
$(document).ready(function(){
	if(!$("#cartbox").hasClass("hide")){
	   $("#breadcrumb").width(955-$("#cartbox").width());
    }
	$(".faq").children("li").each(function() {
        //
        // hide content by default
        //
        $(this).children("div").css({ display: 'none' });
        $(this).children("ul").css({ display: 'none' });
        $(this).children("ul").children("li").children("div").css({ display: 'none' });
        //
        // open/close main items
        //
       $(this).children("h3").click(function() {
            $(this).parent().children("div").each(function() {
                if ($(this).css('display') == 'none')
                    $(this).css({ display: 'block' });
                else $(this).css({ display: 'none' });
            });
            $(this).parent().children("ul").each(function() {
                if ($(this).css('display') == 'none')
                    $(this).css({ display: 'block' });
                else $(this).css({ display: 'none' });
            });
        });
        //
        // open/close sub-items
        //
        $(this).children("ul").children("li").children("h4").click(function() {
            $(this).parent().children("div").each(function() {
                if ($(this).css('display') == 'none')
                    $(this).css({ display: 'block' });
                else $(this).css({ display: 'none' });
            });
        });
	});
  $("a.greybox").click(function(){
    var t = this.title || $(this).text() || this.href;
    GB_show(t,this.href,470,600);
    return false;
  });
  
  if(!$('#cdall_hint').hasClass('hide')){
      $("#cartbox").addClass("hlgt", 500);
	  $("#cartbox").effect("pulsate", { times:3 }, 1200, function(){
	      $("#cartbox").removeClass("hlgt", 500);
	  });
  }
  
  if($('#scrollpane').length){
	$('#scrollpane').jScrollPane({scrollbarOnLeft:true});
	if($('#scrollto').val() != ""){
		var $pane =  $('#scrollpane');
		var targetElementSelectorString = "#tmbid"+$('#scrollto').val();
		$pane[0].scrollTo(targetElementSelectorString);
		$pane[0].scrollBy(-130);
	}
  }

  if($('#homesidebar').length){
	  $('.boxgrid.slidedown').hover(function(){
					$(".cover", this).stop().animate({top:'-130px'},{queue:false,duration:300});
				}, function() {
					$(".cover", this).stop().animate({top:'0px'},{queue:false,duration:300});
				});
				//Horizontal Sliding
				$('.boxgrid.slideright').hover(function(){
					$(".cover", this).stop().animate({left:'195px'},{queue:false,duration:300});
				}, function() {
					$(".cover", this).stop().animate({left:'0px'},{queue:false,duration:300});
				});
				//Diagnal Sliding
				$('.boxgrid.thecombo').hover(function(){
					$(".cover", this).stop().animate({top:'130px', left:'195px'},{queue:false,duration:300});
				}, function() {
					$(".cover", this).stop().animate({top:'0px', left:'0px'},{queue:false,duration:300});
				});
				//Partial Sliding (Only show some of background)
				$('.boxgrid.peek').hover(function(){
					$(".cover", this).stop().animate({top:'90px'},{queue:false,duration:160});
				}, function() {
					$(".cover", this).stop().animate({top:'0px'},{queue:false,duration:160});
				});
				//Full Caption Sliding (Hidden to Visible)
				$('.boxgrid.captionfull').hover(function(){
					$(".cover", this).stop().animate({top:'45px'},{queue:false,duration:160});
				}, function() {
					$(".cover", this).stop().animate({top:'130px'},{queue:false,duration:160});
				});
				//Caption Sliding (Partially Hidden to Visible)
				$('.boxgrid.caption').hover(function(){
					$(".cover", this).stop().animate({top:'45px'},{queue:false,duration:160});
				}, function() {
					$(".cover", this).stop().animate({top:'110px'},{queue:false,duration:160});
				});
  }
});


function imageSlideShow(){
	var galNum = $.jqURL.get('alb');
	reqUrl = "/includes/functions/imagelist.php?alb=" + galNum;
	$.getJSON(reqUrl, function(data) {
		alert(data);
	});
}

$(function() {
 $('#navleft').hover(
   function () {
    $('#navleftbtn').fadeIn(200);
   },
   function () {
    $('#navleftbtn').fadeOut(200);
   }
 );
 $('#navright').hover(
   function () {
    $('#navrghtbtn').fadeIn(200);
   },
   function () {
    $('#navrghtbtn').fadeOut(200);
   }
 );
 /*$('#navright,#navleft').hover(
  function () {
   $(this).removeClass('transparent');
  },
  function () {
   $(this).addClass('transparent');
  }
 );*/
});

