// JavaScript Document
$(document).ready(function() {

// Begin  Custom script For StepWrapper (Like Button)	
$('.step2,.step3').animate({'opacity':'0.5'});// set the default opacity to 0.5 (and for ie)
$('.step2, a.download-btn').bind('click','false');// disable click handler on step2 and step3



$('div.like-btn').hide();// default hide like button facebook


$('a.nextStep').click(function(){ //changes the opacity and unbinds the click for step2
	$('div.like-btn').show();
	$('.step1').animate({'opacity':'0.5'});
	$('.step2').animate({'opacity':'1'}); 
	$('.step2').unbind('click','true');

});


	

// Begin Cufon replace 		
Cufon.replace('h2,h3,h4, .action-btns li, .tabFeatures li a, ul.tabs li, a.download-btn,.submit-button, a.buy-btn');
Cufon.replace('#header h2', {textShadow: '1px 1px 2px #fff;'});
Cufon.replace('.action-btns li a,a.download-btn ,a.buy-btn,.submit-button', { textShadow: '0px -1px 1px #cf7500;' });
// End Cufon Replace	

// initiates validation plugin
$("#subscribe-overlayForm").validate();
$("#subscribe-tabForm").validate();
// End validation plugin

// initialize scrollable
	$(".scrollable").scrollable({ circular: true, next:".sliderRight", prev:".sliderLeft" });
// End Scrollable	
			
// Begin Cloud Carousel Script 
$("#cloud-carousel").CloudCarousel(		
			{		
			
				xPos: 170,
				yPos: 30,
				minScale: 0.9,
				buttonLeft: $(".sliderLeft"),
				buttonRight: $(".sliderRight"),
				altBox: $("#alt-text"),
				titleBox: $("#title-text"),
				bringToFront: false
				
			});
//End Cloud Carousel
var triggers = $(".modal1").overlay({
 
	// some mask tweaks suitable for modal dialogs
	mask: {
		color: '#797979',
		loadSpeed: 200,
		opacity: 0.5
	},
 
	closeOnClick: false
});



// Begin Buttons Hover effect
 $('.actbtn2,  .actbtn1, a.buy-btn,  .submit-button, a.download-btn, a.like-btn, a.stepNext').hover(function(){
		$(this).animate({opacity: 0.8}, 200);
	}, function () {
		$(this).animate({opacity: 1}, 300);});
// End button hover effect
	
// Initiate hover effect on image gallery
    $('.tabGallery li a img').hover(function() {
		// Lower the opacity 0.2
        $(this).stop().animate({ 
		opacity: "0.2" 
	}, 200);// duration 
    },
			// restore the initial opacity
           function() {
               $(this).stop().animate({ opacity: "1.0" }, 200);

           });
// End hover effect over image gallery			

// Initiate Tabs 
$(".tab_content").hide(); //Hide all content
$("ul.tabNav li:first").addClass("active").show(); //Activate first tab
$(".tab_content:first").show(); //Show first tab content

//On Click Event
$("ul.tabNav li").click(function() {

	$("ul.tabNav li").removeClass("active"); //Remove any "active" class
	$(this).addClass("active"); //Add "active" class to selected tab
	$(".tab_content").hide(); //Hide all tab content

	var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
	$(activeTab).fadeIn(800); //Fade in the active ID content
	return false;
});
// End Tabs
	
// Fancybox script 
		$("a[class=gallery]").fancybox({
			'transitionIn'		: 'elastic',
			'transitionOut'		: 'elastic',
			'speeIn'			: 600,
			'speedOut'		:	200, 
			'titlePosition' 	: 'over',
			'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
				return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
			}
		});
// Endfancy box
			
//Iniatiate tipsy script
$('').tipsy({fade: true, gravity: 'n'});
$(' .facebook, .twitter, .rss, .actbtn1, .actbtn2, .submit-button,a.buy-btn,a.download-btn').tipsy({fade: true, gravity: 's'});
$('').tipsy({fade: true, gravity: 'n'});
$(' .submit-button').tipsy({fade: true, gravity: 'e'});
//End tipsy script

	  // Background change option
    
	$('li.pt1').click(function() {
	$('.patterns ul li').removeClass("active"); //Remove any "active" class
	$('li.pt1').addClass("active"); //Add "active" class to selected tab
	$('body').css('background','url(images/bg/pt1.png) repeat');
	$('.tabCorner').css('background','url(images/bg/tab-corner-pt1.png) no-repeat');
	$('.mainCorner').css('background','url(images/bg/main-corner-pt1.png) no-repeat');
	});
	$('.pt2').click(function() {
	$('.patterns ul li').removeClass("active"); //Remove any "active" class
	$('li.pt2').addClass("active"); //Add "active" class to selected tab
	$('body').css('background','url(images/bg/pt2.png) repeat');
	$('.tabCorner').css('background','url(images/bg/tab-corner-pt2.png) no-repeat');
	$('.mainCorner').css('background','url(images/bg/main-corner-pt2.png) no-repeat');
	});
	$('.pt3').click(function() {
	$('.patterns ul li').removeClass("active"); //Remove any "active" class
	$('li.pt3').addClass("active"); //Add "active" class to selected tab
	$('body').css('background','url(images/bg/pt3.png) repeat');
	$('.tabCorner').css('background','url(images/bg/tab-corner-pt3.png) no-repeat');
	$('.mainCorner').css('background','url(images/bg/main-corner-pt3.png) no-repeat');
	});
	$('.pt4').click(function() {
	$('.patterns ul li').removeClass("active"); //Remove any "active" class
	$('li.pt4').addClass("active"); //Add "active" class to selected tab
	$('body').css('background','url(images/bg/pt4.png) repeat');
	$('.tabCorner').css('background','url(images/bg/tab-corner-pt4.png) no-repeat');
	$('.mainCorner').css('background','url(images/bg/main-corner-pt4.png) no-repeat');
	});
	$('.pt5').click(function() {
	$('.patterns ul li').removeClass("active"); //Remove any "active" class
	$('li.pt5').addClass("active"); //Add "active" class to selected tab
	$('body').css('background','url(images/bg/pt5.png) repeat');
	$('.tabCorner').css('background','url(images/bg/tab-corner-pt5.png) no-repeat');
	$('.mainCorner').css('background','url(images/bg/main-corner-pt5.png) no-repeat');
	});
	$('.pt6').click(function() {
	$('.patterns ul li').removeClass("active"); //Remove any "active" class
	$('li.pt6').addClass("active"); //Add "active" class to selected tab
	$('body').css('background','url(images/bg/pt6.png) repeat');
	$('.tabCorner').css('background','url(images/bg/tab-corner-pt6.png) no-repeat');
	$('.mainCorner').css('background','url(images/bg/main-corner-pt6.png) no-repeat');
	});
	$('.pt7').click(function() {
		$('.patterns ul li').removeClass("active"); //Remove any "active" class
	$('li.pt7').addClass("active"); //Add "active" class to selected tab
	$('body').css('background','url(images/bg/pt7.png) repeat');
	$('.tabCorner').css('background','url(images/bg/tab-corner-pt7.png) no-repeat');
	$('.mainCorner').css('background','url(images/bg/main-corner-pt7.png) no-repeat');
	});
	$('.pt8').click(function() {
	$('.patterns ul li').removeClass("active"); //Remove any "active" class
	$('li.pt8').addClass("active"); //Add "active" class to selected tab
	$('body').css('background','url(images/bg/pt8.png) repeat');
	$('.tabCorner').css('background','url(images/bg/tab-corner-pt8.png) no-repeat');
	$('.mainCorner').css('background','url(images/bg/main-corner-pt8.png) no-repeat');
	});
	$('.pt9').click(function() {
	$('.patterns ul li').removeClass("active"); //Remove any "active" class
	$('li.pt9').addClass("active"); //Add "active" class to selected tab
	$('body').css('background','url(images/bg/pt9.png) repeat');
	$('.tabCorner').css('background','url(images/bg/tab-corner-pt9.png) no-repeat');
	$('.mainCorner').css('background','url(images/bg/main-corner-pt9.png) no-repeat');
	});
	$('.pt10').click(function() {
	$('.patterns ul li').removeClass("active"); //Remove any "active" class
	$('li.pt10').addClass("active"); //Add "active" class to selected tab
	$('body').css('background','url(images/bg/pt10.png) repeat');
	$('.tabCorner').css('background','url(images/bg/tab-corner-pt10.png) no-repeat');
	$('.mainCorner').css('background','url(images/bg/main-corner-pt10.png) no-repeat');
	});
	// end Bacground change option
	
	// Cufon shadow for theme skins 
    $('#orange').click(function() {
		Cufon.replace('.action-btns li a,a.download-btn ,a.buy-btn,.submit-button', { textShadow: '0px -1px 1px #cf7500;' });
		Cufon.refresh()
	});
	 $('#blue').click(function() {
		Cufon.replace('.action-btns li a,a.download-btn ,a.buy-btn,.submit-button',{textShadow: '0px -1px 1px #36589c;' });
		Cufon.refresh()
	});
	$('#green').click(function() {
		Cufon.replace('.action-btns li a,a.download-btn ,a.buy-btn,.submit-button',{textShadow: '0px -1px 3px #2eb127;' });
		Cufon.refresh()
	});
	$('#magenta').click(function() {
		Cufon.replace('.action-btns li a,a.download-btn ,a.buy-btn,.submit-button',{textShadow: '0px -1px 5px #ab34a2;' });
		Cufon.refresh()
	});
	$('#cyan').click(function() {
		Cufon.replace('.action-btns li a,a.download-btn ,a.buy-btn,.submit-button',{textShadow: '0px -1px 2px #2195a0;' });
		Cufon.refresh()
	});
	// End cufon shadow for theme skins 
	
	$('li.orange a').click(function() {
	$('.colors ul li').removeClass("active"); //Remove any "active" class
	$('li.orange').addClass("active"); //Add "active" class to selected tab
});
$('li.blue a').click(function() {
	$('.colors ul li').removeClass("active"); //Remove any "active" class
	$('li.blue').addClass("active"); //Add "active" class to selected tab
});
$('li.green a').click(function() {
	$('.colors ul li').removeClass("active"); //Remove any "active" class
	$('li.green').addClass("active"); //Add "active" class to selected tab
});
$('li.magenta a').click(function() {
	$('.colors ul li').removeClass("active"); //Remove any "active" class
	$('li.magenta').addClass("active"); //Add "active" class to selected tab
});
$('li.cyan a').click(function() {
	$('.colors ul li').removeClass("active"); //Remove any "active" class
	$('li.cyan').addClass("active"); //Add "active" class to selected tab
});


 $('li.like').toggle(function() {
	 $('#stepWrap').hide();
	 $('li.like').addClass('act');},function() {
		 $('#stepWrap').show();
	 $('li.like').removeClass('act');
 });
  $('li.tab').toggle(function() {
	 $('#tabWrap').hide();
	 $('li.tab').addClass('act');},function() {
	$('#tabWrap').show();
	 $('li.tab').removeClass('act');
 });
  $('li.com').toggle(function() {
	 $('#fbWrap').hide();
	 $('li.com').addClass('act');},function() {
		 $('#fbWrap').show();
	 $('li.com').removeClass('act');
 });
 $('li.buy').toggle(function() {

	 $('#buyWrap').hide();
	 $('li.buy').addClass('act');},function() {
		 $('#buyWrap').show();

	 $('li.buy').removeClass('act');
 });
 // themeswitcher
  $('.skins').hide();
 $('#options').hover(function() {
	
	 $('.skins').show();
	 $(this).animate({'width': '+=160px', 'height': '+=400px','right':'-=150px','opacity':'1'}, 100, 'linear');
	 $(this).css('background','#fff');
 },
 function() {
	 $('.skins').hide();
	 $(this).animate({'width': '-=160px','height': '-=400px','right':'+=150px','opacity':'0.5'}, 100, 'linear');
	 $(this).css('background','#09f');
 });	
//End themeswitcher
	
		
$(function()
		{
			// Call stylesheet init so that all stylesheet changing functions 
			// will work.
			$.stylesheetInit();
			
			// This code loops through the stylesheets when you click the link with 
			// an ID of "toggler" below.
			$('#toggler').bind(
				'click',
				function(e)
				{
					$.stylesheetToggle();
					return false;
				}
			);
			
			// When one of the styleswitch links is clicked then switch the stylesheet to
			// the one matching the value of that links rel attribute.
			$('.styleswitch').bind(
				'click',
				function(e)
				{
					$.stylesheetSwitch(this.getAttribute('rel'));
					return false;
					Cufon.refresh();
				}
			);
		}
	);
});






