﻿$(document).ready(function() {
	$("#tab1").css("display","block");	
});

function displayTab(tabNum)
{
	var i;
	
	// Hide tabs
	$("#tabs_zone .tab_content").css("display", "none");
	
	// Show one tab
	$("#tab" + tabNum).css("display", "block");
    
	// Remove selected class
	$("#tabs_zone #tabs li").removeClass("selected");
	
	// Add selected class to one tab
	$("#tabs_zone #tabs li:nth-child(" + tabNum + ")").addClass("selected");
	
	return false;
}

function displayUni() {

	return displayTab(1);
}

function displayBlog() {
	
	return displayTab(2);
}

function displayCase() {
	
	return displayTab(3);
}

function displayIntense() {
	
	return displayTab(4);
}

function displayTest() {
	
	return displayTab(5);
}

/*--------------------------------------------------------------------------*/

if (true) {
	// worked_with slides
	$(document).ready(function() {
	    var currentPosition = 0;
	    var slideWidth = 924;
	    var slides = $('#slidesContainer .slide');
	    var numberOfSlides = slides.length;
		
	    // Remove scrollbar in JS
	    $('#slidesContainer').css({
			"overflow": "hidden",
			"height": "100px"
		});
		
	    // Wrap all .slides with #slideInner div
	    slides
	    .wrapAll('<div id="slideInner"></div>')
	    // Float left to display horizontally, readjust .slides width
		.css({
		    'float': 'left',
		    'width': slideWidth + "px",
		    "overflow": "hidden"
		});
		
	    // Set #slideInner width equal to total width of all slides
	    $('#slideInner').css({
		    "width": (slideWidth * numberOfSlides + 10) + "px"
		});
	    
	    // Insert controls in the DOM
	    $('#slideshow')
	    .prepend('<span class="control" id="leftControl">Clicking moves left</span>')
	    .append('<span class="control" id="rightControl">Clicking moves right</span>');
	    
	    // Hide left arrow control on first load
	    manageControls(currentPosition);
	    
	    // Create event listeners for .controls clicks
	    $('#slideshow .control')
	    .bind('click', function() {
	        // Determine new position
	        currentPosition = ($(this).attr('id') == 'rightControl') ? currentPosition + 1 : currentPosition - 1;
	
	        // Hide / show controls
	        manageControls(currentPosition);
	        
	        // Move slideInner using margin-left
	        $('#slideInner').animate({
	            'marginLeft': slideWidth * (-currentPosition)
	        });
	    });
		
	    // manageControls: Hides and Shows controls depending on currentPosition
	    function manageControls(position) {
	        // Hide left arrow if position is first slide
	        if (position == 0) { $('#leftControl').hide() } else { $('#leftControl').show() }
	        // Hide right arrow if position is last slide
	        if (position == numberOfSlides - 1) { $('#rightControl').hide() } else { $('#rightControl').show() }
	    }
	});
}

/*The Pulse form post code

$(document).ready(function() {
     
    //if submit button is clicked
    $('#Submit').click(function () {    
         
        //Get the data from all the fields
        var name = $('#name').val();
        var email = $('#kykua-kykua').val();

		 
        //Simple validation to make sure user entered something
        //If error found, add hightlight class to the text field
        if (name=='') {
            alert("Please enter your name.");
            return false;
        }
		
		if (email=='') {
            alert("Please enter your email.");
            return false;
        }
                  
        //organize the data properly
        var data = 'name=' + name + '&kykua-kykua=' + email;
                  
        //start the ajax
        $.ajax({
            url: "http://eblasts.idealplatform.com/t/y/s/kykua/",
             
            type: "POST",
     
            data: data,    
             
            cache: false,
             
            //success
            success: function (html) {             
                //if mail success
                alert("Submission Received");             
            }      
        });

        return false;
    });
}); */
