

jQuery(function() {
	jQuery(window).scroll(function() {
		if(jQuery(this).scrollTop() != 0) {
			jQuery('#backtoTop').fadeIn();	
		} else {
			jQuery('#backtoTop').fadeOut();
		}
	});
 
	jQuery('#backtoTop').click(function() {
		jQuery('body,html').animate({scrollTop:0},800);
	});
		jQuery('.footerTxt').click(function() {
		jQuery('body,html').animate({scrollTop:0},800);
		return false;
	});
		jQuery('#global_icon').click(function() {
		jQuery('body,html').animate({scrollTop:0},800);
		return false;
	});
		jQuery('#show-panel').click(function() {
		jQuery('body,html').animate({scrollTop:840},800);
		return false;
	});
	
		jQuery('#close-panel').click(function() {
		jQuery('body,html').animate({scrollTop:840},800);
		return false;
	});
	
		jQuery('#show-panel01').click(function() {
		jQuery('body,html').animate({scrollTop:840},800);
		return false;
	});
	
		jQuery('#close-panel01').click(function() {
		jQuery('body,html').animate({scrollTop:840},800);
		return false;
	});
	
		jQuery('#show-panel02').click(function() {
		jQuery('body,html').animate({scrollTop:840},800);
		return false;
	});
	
		jQuery('#close-panel02').click(function() {
		jQuery('body,html').animate({scrollTop:840},800);
		return false;
	});
	
		jQuery('#show-panel03').click(function() {
		jQuery('body,html').animate({scrollTop:840},800);
		return false;
	});
	
		jQuery('#close-panel03').click(function() {
		jQuery('body,html').animate({scrollTop:840},800);
		return false;
	});
	
		jQuery('#show-panel04').click(function() {
		jQuery('body,html').animate({scrollTop:840},800);
		return false;
	});
	
		jQuery('#close-panel04').click(function() {
		jQuery('body,html').animate({scrollTop:840},800);
		return false;
	});
	
		jQuery('#show-panel05').click(function() {
		jQuery('body,html').animate({scrollTop:840},800);
		return false;
	});
	
		jQuery('#close-panel05').click(function() {
		jQuery('body,html').animate({scrollTop:840},800);
		return false;
	});


	jQuery('#close-panel-top1').click(function() {
	jQuery('body,html').animate({scrollTop:840},800);
		return false;
	});
	jQuery('#close-panel-top2').click(function() {
	jQuery('body,html').animate({scrollTop:840},800);
		return false;
	});
	jQuery('#close-panel-top3').click(function() {
	jQuery('body,html').animate({scrollTop:840},800);
		return false;
	});
	jQuery('#close-panel-top4').click(function() {
	jQuery('body,html').animate({scrollTop:840},800);
		return false;
	});
	jQuery('#close-panel-top5').click(function() {
	jQuery('body,html').animate({scrollTop:840},800);
		return false;
	});
		jQuery('#close-panel-top6').click(function() {
		jQuery('body,html').animate({scrollTop:840},800);
		return false;
	});


});


 jQuery(document).ready(function() {
         jQuery("#popUpPrint-spec").click(function() {
             printElem({ leaveOpen: true, printMode: 'popup'  });
			 return false;
         });
     });
 function printElem(options){
     jQuery('#price-spec-moludes').printElement(options);
 }
 



jQuery(document).ready(function() {
	
	jQuery("ul.makeabook-panel li, ul.makeabook-panel1 li").hover(function() {
		
		var thumbOver = jQuery(this).find("img").attr("src");
		jQuery(this).find("a.thumb").css({'background' : 'url(' + thumbOver + ') no-repeat center bottom'});
		jQuery(this).find("span").stop().fadeTo('normal', 0 , function() {
			jQuery(this).hide()
		}); 
	} , function() {
		jQuery(this).find("span").stop().fadeTo('normal', 1).show();
	});

});


//jQuery(function(){
//jQuery('#navigation li a').append('<span class="hover"></span>')
//jQuery('#navigation li a').hover(function() {
//	jQuery('.hover', this).stop().animate({
//		'opacity': 1
//	}, 500,'easeOutSine')
	
//},function() {
//	jQuery('.hover', this).stop().animate({
//		'opacity': 0
//		}, 700, 'easeOutQuad')
//	})
//});

jQuery(document).ready(function(){
		jQuery("#featured > ul").tabs({fx:{opacity: "toggle"}}).tabs("fade", 0, true);
		jQuery("#tips > ul").tabs({fx:{opacity: "toggle"}}).tabs("fade", 0, true);
		jQuery("#open_tab > ul").tabs({fx:{opacity: "toggle"}}).tabs("rotate", 0, true);
		jQuery("#paper-styles > ul").tabs({fx:{opacity: "toggle"}}).tabs("rotate", 0, true);
	});
	
		jQuery(document).ready(function() {
		jQuery('#navigation li a,.get_started').append('<span class="hover"></span>').each(function () {
	  		var jQueryspan = jQuery('> span.hover', this).css('opacity', 0);
	  		jQuery(this).hover(function () {
	    		jQueryspan.stop().fadeTo(500, 1);
	 		}, function () {
	   	jQueryspan.stop().fadeTo(700, 0);
	  		});
		});
	});
		
jQuery(document).ready(function() {
		jQuery(".topMenuAction").click( function() {
			if (jQuery("#openCloseIdentifier").is(":hidden")) {
				jQuery("#slider").animate({ 
					marginTop: "-300px"
					}, 800 );
				//jQuery("#topMenuImage").html('<img src="/templates/PhotoBook_WorldWide/images/close.png" alt="open" />');
				jQuery("#openCloseIdentifier").show();
			} else {
				jQuery("#slider").animate({ 
					marginTop: "0px"
					}, 800 );
				jQuery("#topMenuImage").html('<img src="/images/close.png" alt="close" />');
				jQuery("#openCloseIdentifier").hide();
			}
		});  
	});



(function(jQuery) {
	jQuery.fn.loopedSlider = function(options) {
		
	var defaults = {			
		container: '.container,.Review-container,.gs-container,.tutorial_container,.gstart_container',
		slides: '.slides,.Review-slides,.gs-slides,.tutorial_slides,.gstart_slides',
		pagination: '.pagination',
		containerClick: true, 
		autoStart: 5000, 
		slidespeed: 1000, 
		fadespeed: 500, 
		autoHeight: false 
		

	};
	

		
	
		
	this.each(function() {
		
		var obj = jQuery(this);
		var o = jQuery.extend(defaults, options);
		var pagination = jQuery(o.pagination+' li a',obj);
		var m = 0;
		var t = 1;
		var s = jQuery(o.slides,obj).children().size();
		var w = jQuery(o.slides,obj).children().outerWidth();
		var p = 0;
		var u = false;
		var n = 0;
		
		jQuery(o.slides,obj).css({width:(s*w)});
		
		jQuery(o.slides,obj).children().each(function(){
			jQuery(this).css({position:'absolute',left:p,display:'block'});
			p=p+w;
		});
		
		jQuery(pagination,obj).each(function(){
			n=n+1;
			jQuery(this).attr('rel',n);
			jQuery(pagination.eq(0),obj).parent().addClass('active');
		});
		
		jQuery(o.slides,obj).children(':eq('+(s-1)+')').css({position:'absolute',left:-w});
		
		if(o.autoHeight){autoHeight(t);}
		
		jQuery('.next',obj).click(function(){
			if(u===false) {
				animate('next',true);
				if(o.autoStart){clearInterval(sliderIntervalID);}
			} return false;
		});
		
		jQuery('.previous',obj).click(function(){
			if(u===false) {	
				animate('prev',true);
				if(o.autoStart){clearInterval(sliderIntervalID);}
			} return false;
		});
		
		if (o.containerClick) {
			jQuery(o.container ,obj).click(function(){
				if(u===false) {
					animate('next',true);
					if(o.autoStart){clearInterval(sliderIntervalID);}
				} return false;
			});
		}
		
		jQuery(pagination,obj).click(function(){
			if (jQuery(this).parent().hasClass('active')) {return false;}
			else {
				t = jQuery(this).attr('rel');
				jQuery(pagination,obj).parent().siblings().removeClass('active');
				jQuery(this).parent().addClass('active');
				animate('fade',t);
				if(o.autoStart){clearInterval(sliderIntervalID);}
			} return false;
		});
		
		if (o.autoStart) {
			sliderIntervalID = setInterval(function(){
				if(u===false) {animate('next',true);}
			}, o.autoStart);
		}
		
		function current(t) {
			if(t===s+1){t=1;}
			if(t===0){t=s;}
			jQuery(pagination,obj).parent().siblings().removeClass('active');
			jQuery(pagination+'[rel="' + (t) + '"]',obj).parent().addClass('active');
		};
		
		function autoHeight(t) {
			if(t===s+1){t=1;}
			if(t===0){t=s;}	
			var getHeight = jQuery(o.slides,obj).children(':eq('+(t-1)+')',obj).outerHeight();
			jQuery(o.container,obj).animate({height: getHeight},o.autoHeight);					
		};		
		
		function animate(dir,clicked){	
			u = true;	
			switch(dir){
				case 'next':
					t = t+1;
					m = (-(t*w-w));
					current(t);
					if(o.autoHeight){autoHeight(t);}
					jQuery(o.slides,obj).animate({left: m}, o.slidespeed,function(){
						if (t===s+1) {
							t = 1;
							jQuery(o.slides,obj).css({left:0},function(){jQuery(o.slides,obj).animate({left:m})});							
							jQuery(o.slides,obj).children(':eq(0)').css({left: 0});
							jQuery(o.slides,obj).children(':eq('+(s-1)+')').css({ position:'absolute',left:-w});				
						}
						if (t===s) jQuery(o.slides,obj).children(':eq(0)').css({left:(s*w)});
						if (t===s-1) jQuery(o.slides,obj).children(':eq('+(s-1)+')').css({left:s*w-w});
						u = false;
					});					
					break; 
				case 'prev':
					t = t-1;
					m = (-(t*w-w));
					current(t);
					if(o.autoHeight){autoHeight(t);}
					jQuery(o.slides,obj).animate({left: m}, o.slidespeed,function(){
						if (t===0) {
							t = s;
							jQuery(o.slides,obj).children(':eq('+(s-1)+')').css({position:'absolute',left:(s*w-w)});
							jQuery(o.slides,obj).css({left: -(s*w-w)});
							jQuery(o.slides,obj).children(':eq(0)').css({left:(s*w)});
						}
						if (t===2 ) jQuery(o.slides,obj).children(':eq(0)').css({position:'absolute',left:0});
						if (t===1) jQuery(o.slides,obj).children(':eq('+ (s-1) +')').css({position:'absolute',left:-w});
						u = false;
					});
					break;
				case 'fade':
					t = [t]*1;
					m = (-(t*w-w));
					current(t);
					if(o.autoHeight){autoHeight(t);}
					jQuery(o.slides,obj).children().fadeOut(o.fadespeed, function(){
						jQuery(o.slides,obj).css({left: m});
						jQuery(o.slides,obj).children(':eq('+(s-1)+')').css({left:s*w-w});
						jQuery(o.slides,obj).children(':eq(0)').css({left:0});
						if(t===s){jQuery(o.slides,obj).children(':eq(0)').css({left:(s*w)});}
						if(t===1){jQuery(o.slides,obj).children(':eq('+(s-1)+')').css({ position:'absolute',left:-w});}
						jQuery(o.slides,obj).children().fadeIn(o.fadespeed);
						u = false;
					});
					break; 
				default:
					break;
				}					
			};
		});
	};
})(jQuery);

var profiles =
	{

		windowCenter:
		{
			height:680,
			width:550,
			center:1
		},

	};

	function unloadcallback(){
		alert("unloaded");
	};


   	jQuery(document).ready(function()
	{
   		jQuery(".popupwindow").popupwindow(profiles);
   	});

jQuery(document).ready(function(){
		jQuery('#tips_panel1').loopedSlider();
		jQuery('#tips_panel2').loopedSlider();
		jQuery('#tips_panel3').loopedSlider();
		jQuery('#tips_panel4').loopedSlider();
		jQuery('#Review_panel').loopedSlider();
		jQuery('#gs_panel').loopedSlider();
		jQuery('#tutorial_panel').loopedSlider();
		jQuery('#gstart_panel').loopedSlider();
	});

jQuery(document).ready(function(){
jQuery('#bookTypes-tabs div').hide();
jQuery('#bookTypes-tabs div:first').show();
jQuery('#bookTypes-tabs ul li:first').addClass('active');
jQuery('#bookTypes-tabs ul li a').mouseover(function(){ 
jQuery('#bookTypes-tabs ul li').removeClass('active');
jQuery(this).parent().addClass('active'); 
var currentTab = jQuery(this).attr('href'); 
jQuery('#bookTypes-tabs div').hide();
jQuery(currentTab).show();
return false;
});
});


(function(a){
    a.fn.previousnext_slideshow=function(p){
        var p=p||{};

        var m=p&&p.slideshow_time_interval?p.slideshow_time_interval:"2000";
        var n=p&&p.slideshow_window_background_color?p.slideshow_window_background_color:"#e0e0e0";
        var o=p&&p.slideshow_window_padding?p.slideshow_window_padding:"5";
        var q=p&&p.slideshow_window_width?p.slideshow_window_width:"0";
        var r=p&&p.slideshow_window_height?p.slideshow_window_height:"0";
        var s=p&&p.slideshow_window_border_size?p.slideshow_window_border_size:"1";
        var t=p&&p.slideshow_window_border_color?p.slideshow_window_border_color:"black";
        var u=p&&p.slideshow_button_style?p.slideshow_button_style:"1";
        var d=p&&p.directory?p.directory:"images";
        o += "px";
        q += "px";
        r += "px";
        s += "px";
        var v;
        var w=0;
        var x=a(this);
        var y=x.find("ul:first").children("li").length;
        if(x.find("ul").length==0||x.find("li").length==0){
            x.append("Require content");
            return null
            }
            x.find("ul:first").children("li").children("a").children("img").css("width",q).css("height",r);
        s_s_ul(x.find("ul:first"),o,q,r,s,t,n);
        s_s_n(x.find(".slideshow_nav"),u,d);
        x.find("ul:first").children("li").hide();
        play();
        x.find(".slideshow_nav").children("li").click(function(){
            if(jQuery(this).attr("class")=="slideshow_nav_previous"){
                previous()
                }else if(jQuery(this).attr("class")=="slideshow_nav_next"){
                next()
                }
            });
    function previous(){
        if(w==0){
            w=y-2
            }else{
            if(w==1){
                w=y-1
                }else{
                w-=2
                }
            }
        play()
    }
    function next(){
    play()
    }
    function play(){
    clearTimeout(v);
    x.find("ul:first").children("li").fadeOut();
    x.find("ul:first").children("li").eq(w).fadeIn();
    w++;
    if(w>=y){
        w=0
        }
        v=setTimeout(play,m)
    }
    function s_s_ul(a,b,c,d,e,f,g){
    b=parseInt(b);
    c=parseInt(c);
    d=parseInt(d);
    e=parseInt(e);
    var h=c+e*2+b*2;
    var i=d+e*2+b*2;
    x.css("width",h);
    x.css("height",i);
    var j=d+"px";
    var k=c+"px";
    var l="border: "+f+" solid "+" "+e+"px; height:"+j+"; width:"+k+"; padding:"+b+"px; background-color:"+g;
    a.attr("style",l)
    }
    function s_s_n(a,b,d){
    var c=a.children(".slideshow_nav_previous");
    var e=a.children(".slideshow_nav_next");
    switch(b){
        case'1':
            c.css("width","15px");
            c.css("height","15px");
            c.css('background-image','url("'+d+'/style1.png")');
            e.css("width","15px");
            e.css("height","15px");
            e.css('background-image','url("'+d+'/style1.png")');
            e.css('background-position','right top');
            e.css('background-repeat','no-repeat');
            break;
        default:
            break
            }
        }
}
})(jQuery);




            jQuery(function() {
                jQuery("#previousnext_slideshow").previousnext_slideshow({
                    slideshow_time_interval: '4000',
                    slideshow_window_padding: '0',
                    slideshow_window_width: '550',
                    slideshow_window_height: '25',
                    slideshow_window_border_size: '0',
   
                    directory: 'images'
                });

            });
            
jQuery(document).ready(function(){
	
jQuery('.acc_container').hide(); 
jQuery('.acc_trigger:first').addClass('active').next().hide(); 
jQuery('.acc_trigger.active').hide(); 

jQuery('.acc_trigger').click(function(){
	if( jQuery(this).next().is(':hidden') ) { 
		jQuery('.acc_trigger').removeClass('active').next().slideUp();
		jQuery(this).toggleClass('active').next().slideDown(); 
	}
	return false;
});

}); 



