// JavaScript Document

// jQuery
$(function() {
	    
	    var num;
	     
   	    if(window.location.href.indexOf('?Sector=Retail%20And%20Leisure') >= 0) {
	    	$('body').addClass('pg_green');
	    	num = 1;
	    }
	    if(window.location.href.indexOf('/case-studies/retail-and-leisure/') >= 0) {
	    	$('body').addClass('pg_green');
	    	num = 1;
	    }
	    if(window.location.href.indexOf('/case-studies/retail-and-leisure.aspx') >= 0) {
	    	$('body').addClass('pg_green');
	    	num = 1;
	    }
	    if(window.location.href.indexOf('?Sector=Healthcare') >= 0) {
	    	$('body').addClass('pg_blue');
	    	num = 1;
	    }
	    if(window.location.href.indexOf('/case-studies/healthcare/') >= 0) {
	    	$('body').addClass('pg_blue');
	    	num = 1;
	    }
	    if(window.location.href.indexOf('/case-studies/healthcare.aspx') >= 0) {
	    	$('body').addClass('pg_blue');
	    	num = 1;
	    }
	    if(window.location.href.indexOf('?Sector=Public%20sector') >= 0) {
	    	$('body').addClass('pg_grey');
	    	num = 1;
	    }
	    if(window.location.href.indexOf('/case-studies/public-sector/') >= 0) {
	    	$('body').addClass('pg_grey');
	    	num = 1;
	    } 
	    if(window.location.href.indexOf('/case-studies/public-sector.aspx') >= 0) {
	    	$('body').addClass('pg_grey');
	    	num = 1;
	    }  
    
	   switch (num)
	   {
	   case 1:
	   		break
	   default:
	   		$('body').addClass('pg_green');
	   }
     
  	// External Links
	$('a[rel=external]')
		.click(
			function(e) {
				open(this.href);
				e.preventDefault();
			}
		)
		.attr('title', 'Opens in a new window');

  /* 
   * Easy slider
   */
   $("#slider_home").easySlider({
    auto: true, 
    continuous: true,
    controlsShow: true,
    numeric: true,
    speed:   1800,
    pause: 3000
  });


  $("#slider_sectors").easySlider({
    auto: true, 
    continuous: true,
    controlsShow: false,
    speed:   1800,
    pause: 3000
  });

  
  /* 
   * Useful Stuff
   */
  
  $('li:last-child').addClass('last-item');
  $('li:first-child').addClass('first-item');
  
	// Email Updates
	$('#emailsignup').hide();
	
	$('#btn_email')
		.click(
			function(e) {
				$('#emailsignup').toggle('slow');
				
				if ($(this).hasClass('open')) {
					$(this).removeClass('open');
				}
				else {
					$(this).addClass('open');
				}
				
				e.preventDefault();
			}
		);
		
    /* 
    * 
    * Twitter
    * 
    * * * * * * * * * * * * * * * * * * * * */

    $('.twitter').tweet({
        count: 1,
        join_text: 'auto',
        loading_text: '<div class="loading">loading...</div>',
        username: 'EvokeKiosks'
    });

  
});

