//               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;
var globalTimer;

// ----------------------------------------------------
//        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();});
	//DZE 7/9/10 Changed effect to swirl
	//$('#coin-slider').coinslider({ width: 1400, height:420, navigation: true, delay: 7000, effect: 'swirl' });
	
});

function showSocialFeatures(feature, delay){

    clearTimeout(globalTimer);

    if(delay == undefined)
        delay = 0;

	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');
				globalTimer = setTimeout("int_showFeature('"+feature+"')",delay);
			});
		});
	} else if (v1){
		$('#social1').hide('drop', { direction: 'down' }, 300, function(){
			$('#social1').css('opacity', '1.0');
			globalTimer = setTimeout("int_showFeature('"+feature+"')",delay);
		});
	} else {
		globalTimer = setTimeout("int_showFeature('"+feature+"')",delay);
	}
}

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();
	});
	
	//DZE 7/27/10
	//if(count == 2){
	if(count > 1){
		$('#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(){


    if(!isIE){
        var formUrl = "commentform.html";
        
        $.get(formUrl, function(data) {
            $('#comment-form-holder').html(data);
        });
    }

}
function popUp(URL) {
    day = new Date();
    id = day.getTime();
    eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=1,scrollbars=1,location=0,statusbar=1,menubar=1,resizable=0,width=650,height=450,left = 340,top = 150');");
}
