/*================================
 STYLMARK
 
 Last Updated By: Ryan Perry
 Last Updated: 04/20/2010
================================*/
//alert("floogy");
$(document).ready(function(){

/*================================================
 Main Navigation Drop-Down Menu
================================================*/
$(".header-container ul.nav").superfish({
	hoverClass: 'hover',
	autoArrows: false,
	animation: {opacity:'show',height:'show'},
	delay: 200, 
	dropShadows: true,
	speed: 'fast'
	
});


/*================================================
 Add Asterisk  for Required Fields 
================================================*/
/*---- Input Textboxes/Textarea ----*/
$(".form-container .form-row .form-textbox[required $= True]").prev(".form-label").append("<span class='form-required'> *</span>");

/*---- Selectboxes ----*/
$(".form-container .form-row .form-selectbox[required $= True]").prev(".form-label").append("<span class='form-required'> *</span>");

/*---- Checkboxes ----*/
$(".form-container .form-row .form-checkbox[required $= True]").prev(".form-label").append("<span class='form-required'> *</span>");

/*---- Radio Buttons ----*/
$(".form-container .form-row .form-radio[required $= True]").prev(".form-label").append("<span class='form-required'> *</span>");


/*================================================
 Resource Link Listings 
================================================*/
$(".product-landing .product-downloads .links li:nth-child(3n)").addClass("last-set");
$(".portfolio-detail .portfolio-solutions .links li:nth-child(3n)").addClass("last-set");



//$(".portfolio-detail .portfolio-coverflow .portfolio-images").jcoverflip();

/*================================================
 Home Feature Showcase
================================================*/
/*$(".feature-container .feature-image").cycle({
        fx: 'fade',
        timeout: 0,
		cleartypeNoBg: true
});*/

/*$(".feature-container .feature-nav .nav li img").each(function( homeFeatureIndex ){
	$(this).css("opacity", "0.5");
	$(this).hover(function() {
		$(this).stop().animate({opacity: 1.0}, "slow");},
		function(){$(this).stop().animate({opacity: 0.5}, "slow");
	});

	$( this ).bind ("click",function(){							 
		$(".feature-container .feature-image").cycle(homeFeatureIndex);		
		return false;
 	});
});*/


var numHomeFeatures = 0;
$(".feature-container .feature-nav .nav li img").each(function( homeFeatureIndex ){
	var homeFeatureImage = homeFeatureIndex + 1;
	numHomeFeatures++;
	/*
	$(this).css("opacity", "0.5");
	$(this).hover(function() {
						   
		$(this).stop().animate({opacity: 1.0}, "slow");},
		function(){$(this).stop().animate({opacity: 0.5}, "slow");
	});
	*/
	$( this ).bind ("click",function(){			
									 
		//alert("Showcase Image Clicked: " + homeFeatureImage);
		
		$(".feature-image").removeClass("selected-image").fadeOut('slow');
		$(".feature-image-" + homeFeatureImage).addClass("selected-image").animate({opacity: 1.0}, 200).fadeIn('slow');
		return false;
 	});
});

var randomFeature = Math.floor(Math.random()*numHomeFeatures) + 1;
//alert("randomFeature="+randomFeature);
$(".feature-image").removeClass("selected-image");
$(".feature-image-" + randomFeature).addClass("selected-image").show();
					

/*================================================
 Product Landing Slideshow
================================================*/
$('.product-landing .product-slideshow .product-categories ul').jcarousel({
		animation: 'fast'
});

/*$(".product-landing .product-slideshow .product-image").cycle({
        fx: 'fade',
        timeout: 0,
		cleartypeNoBg: true		
});
$(".product-landing .product-slideshow .product-categories ul li img").each(function( productSolutionIndex ){

	$( this ).bind ("click",function(){
		
					 
		$(".product-landing .product-slideshow .product-image ").cycle(productSolutionIndex);		
		return false;
 	});
});*/

$(".product-landing .product-slideshow .product-categories ul li img").each(function( productSolutionIndex ){
	var productSolutionImage = productSolutionIndex + 1;
	$( this ).bind ("click",function(){
		
		//alert("Product Solution Image: " + productSolutionImage);
		$(".product-landing .product-image").removeClass("selected-image").fadeOut('slow');
		$(".product-landing .product-image-" + productSolutionImage).addClass("selected-image").animate({opacity: 1.0}, 200).fadeIn('slow');					 
		return false;
 	});
});


/*================================================
 Portfolio Landing CSS Class Insert
================================================*/
$(".portfolio-landing .portfolio-feature:first").addClass("first-feature");
$(".portfolio-landing .portfolio-feature:last").addClass("last-feature");

$('.portfolio-detail .portfolio-coverflow ul').jcarousel({
		animation: 'slow',
		scroll: 1
});



});
