$(document).ready(function() {
	var sectionOpen = 'intro_content';	
    var url = window.location.href;

url = url.split('#');
url = url[1];

    $('#merchant_content').hide();
    $('#affiliate_content').hide();
    $('#intro_content').hide();
    
if (url == 'merchant') {

    $('#merchant_content').show();
    sectionOpen = 'merchant_content';

} else if (url == 'affiliate') {

    $('#affiliate_content').show();
    sectionOpen = 'affiliate_content';

} else {

    $('#intro_content').show();
    sectionOpen = 'intro_content';

}
        
     $('.anchor').attr('name', 'void');		  

    //$('#nav a').attr('href', 'javascript:void(0);');	
    $('h1').attr('href', '#').css('cursor', 'pointer');	   


    $('.content dl dt a').each(function() {
										  
	   $(this).parent().next().hide();

	});

    $('.content dl dt a').click(function() {
									 
    	$(this).attr('title', (!$(this).parent().next().is(':hidden')) ? 'Click for more info' : 'Close').parent().css('background-image', (!$(this).parent().next().is(':hidden')) ? 'url(images/plus.gif)' : 'url(images/minus.gif)');
		$(this).parent().next().slideToggle('fast'); 
					
	});

    $('#nav').hide();
    $('img.merchant').css('right', '110%');
    $('img.affiliate').css('left', '110%');

    $('#nav').fadeTo(1000,1).slideDown(1100,'easeOutBounce');
    $('img.merchant').fadeTo(2100,1).animate({right: '50%'},600, 'easeOutCirc');
    $('img.affiliate').fadeTo(2100,1).animate({left: '50%'},600, 'easeOutCirc');
    $('#which').fadeTo(3500,1).animate({bottom: '8px'},600, 'easeOutElastic');



    //$.cookie('intro', 'watched', { expires: 7 });

    //$('#nav').mouseover(function() {
		
    //    if ($('#nav').height() <= 61){
        							
    //        $('#nav').animate({height: '300px'},600, 'easeOutCirc');
									
    //    }
        
//	});
	
//	$('.content').mouseover(function() {
	
  //      if ($('#nav').height() >= 61){
        								
   //         $('#nav').animate({height: '60px'},600, 'easeOutCirc');
            
   // 	}
    	
//	});


    $('#nav').hover(function() {
  
        							
           $('#nav').stop().animate({height: '300px'},600, 'easeOutCirc');
									
        
    }, function() {
           $('#nav').stop().animate({height: '60px'},600, 'easeOutCirc');
    });

    $('img.merchant').click(function() {
    
        if(sectionOpen!= 'merchant_content'){
	       $('#merchant_content').fadeTo(600,1).slideDown(1400, 'easeInOutCirc');
           $('#'+sectionOpen).slideUp(600, 'easeOutCirc');
	       $('#nav').animate({height: '60px'},600, 'easeOutCirc');
	       sectionOpen = 'merchant_content';
	   }
	
	});

    $('img.affiliate').click(function() {
    
		if(sectionOpen!= 'affiliate_content'){
		  $('#affiliate_content').fadeTo(600,1).slideDown(1400, 'easeInOutCirc');
		  $('#'+sectionOpen).slideUp(600, 'easeOutCirc');
		  $('#nav').animate({height: '60px'},600, 'easeOutCirc');
		  sectionOpen = 'affiliate_content';
		
        }
								 
    });
    
    $('h1').click(function() {
    
		if(sectionOpen!= 'intro_content'){
		  $('#intro_content').fadeTo(600,1).slideDown(1400, 'easeInOutCirc');
		  $('#'+sectionOpen).slideUp(600, 'easeOutCirc');
		  $('#nav').animate({height: '60px'},600, 'easeOutCirc');
		  sectionOpen = 'intro_content';
		
        }
								 
    });


    var year = new Date();
    year = year.getFullYear();
    $('#footer p').html('&copy; 2006 - '+year+' whyaffiliatemarketing.com, All Rights Reserved.'); 

});

$(function tooltips () {

$('#nav a').tooltip({ 
    track: true, 
    delay: 0, 
    showURL: false, 
    showBody: " - ", 
    opacity: 0.85 
});

$('.content dl dt a').tooltip({ 
    track: true, 
    delay: 0, 
    showURL: false, 
    showBody: " - ", 
    opacity: 0.85 
});

});
