//               JNMedia Skin Information            //
// ----------------------------------------------------
//	  Component: Main JavaScript File
//	    Created: 5/16/2010
//  Description: The main script file of the site skin. 
//               Configure the settings below.

var googleTrackingID = "";
var curvyCornersVerbose = false;

// ----------------------------------------------------
//        do not edit anything below this line       //

$(document).ready(function() {
  
	// temporary social feature setup
	$("#main-feature").click(function(){showSocialFeatures('afterglow');});
	
	// Product menu setup
	$("#products").mouseenter(function(){ showMenu();});
	$("#nav-products-menu").mouseleave(function(){hideMenu();});
	$(".nav-off").mouseenter(function(){hideMenu();});
	$("#products").click(function(){$("#products").mouseenter();});
	
	// Cross Platform Rounded Corners
	
  
});

function showSocialFeatures(feature){

	var v1 = $("#social1").is(":visible");
	var v2 = $("#social2").is(":visible");
	
	if(v1 && v2){
		
		$('#social2').hide('drop', { direction: 'down' }, 300, function(){
			$('#social2').css('opacity', '1.0');
			$('#social1').hide('drop', { direction: 'down' }, 300, function(){
				$('#social1').css('opacity', '1.0');
				int_showFeature(feature);
			});
		});
	} else if (v1){
		$('#social1').hide('drop', { direction: 'down' }, 300, function(){
			$('#social1').css('opacity', '1.0');
			int_showFeature(feature);
		});
	} else {
		int_showFeature(feature);
	}
}

function int_showFeature(feature){

	var sel   = "#social-content div[feature^="+feature+"]";
	var count = $(sel).length;
	var htmls = Array();

	$(sel).each(function(i,l){
		htmls[i] = $(l).html();
	});
	
	if(count == 2){
		$('#social1 .innercontent').html(htmls[0]);
		$('#social2 .innercontent').html(htmls[1]);
		
		$('#social1').show('drop', { direction: 'down' }, 500, function(){
			$('#social1').animate({opacity:0.9}, 700);
			$('#social2').show('drop', { direction: 'down' }, 500, function(){
				$('#social2').animate({opacity:0.9}, 700);
			});
		});
		
	} else if(count == 1){
		$('#social1 .innercontent').html(htmls[0]);
		$('#social1').show('drop', { direction: 'down' }, 500, function(){
			$('#social1').animate({opacity:0.9}, 700);
		});
	}
}

function showMenu(){
	$("#nav-products-menu").fadeIn('fast');
}

function hideMenu(){
	$("#nav-products-menu").fadeOut('fast');
}

function showCommentForm(){
    $("#blog-comment").hide();
    $("#comment-form").show('drop', { direction: 'down' }, 500, function(){});
}

function insertCommentFormHeader(){

    var ieHtml   = "<div id=\"comment-form\">";
    var realHtml = "<div id=\"blog-comment\"><a href=\"#\" onClick=\"javascript:showCommentForm();\">Click here to Comment</a></div><div id=\"comment-form\" style=\"display:none\">";
    
    if(isIE){
        document.writeln(ieHtml);
    } else {
        document.writeln(realHtml);
    }
}
