//Home testimonials pagination
function pageselectCallback(page_index, jq){
	var new_content = jQuery('#hiddenresult div.result:eq('+page_index+')').clone();
	$('#Searchresult').empty().append(new_content);
	return false;
}


/*Initialisation function for pagination */
function initPagination() {
	// count entries inside the hidden content
	var num_entries = jQuery('#hiddenresult div.result').length;
	 $(".pagination3").pagination(num_entries, {
		callback: pageselectCallback,
		items_per_page: 1 // Show only one item per page
	});
 }

$(document).ready(function() {   

$('#textScroll').cycle({
	    fx:    'scrollHorz',
	    easing: 'easeInOutExpo',
	    timeout: 11000,
	    pause: 'true',
	    speed:  1000, 
	    pager:  '#thumbs',
	    next:   '#next-thumb', 
	    prev:   '#prev-thumb'
	});
	
	

/*var submitheight = document.getElementById('frameheight');
var appheight = document.getElementById('page_container').clientHeight; 

var iframe = document.getElementById('application_form');


document.getElementById("application_form").style.height = appheight;*/
//submitheight.value= appheight;


/*	$('.slideshow').cycle({
		fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
		speed:  3000,	
   	    timeout:  7000 ,
		random:  1 
	});
	*/
	
     initPagination();
	
/*	$(':input[title]').each(function() {
  var $this = $(this);
  if($this.val() === '') {
    $this.val($this.attr('title'));
  }
  $this.focus(function() {
    if($this.val() === $this.attr('title')) {
      $this.val('');
    }
  });
  $this.blur(function() {
    if($this.val() === '') {
      $this.val($this.attr('title'));
    }
	  });
	});*/
        

	$('#paging_testimonials').pajinate({
		num_page_links_to_display : 0,
		items_per_page : 5,
		wrap_around: false,
		show_first_last: false
	});
	
	$('#paging_affiliates').pajinate({
		num_page_links_to_display : 0,
		items_per_page : 5,
		wrap_around: false,
		show_first_last: false
	});
 



		$(function(){ $(".application label").inFieldLabels(); });
	

$("input[type=file]").filestyle({ 
     image: "http://suppremo.com/wp-content/themes/supremotheme/images/browse.jpg",
     imageheight : 27,
     imagewidth : 105,
     width : 150
 });
 



});








//ENQUIRY FORM

/*$(function() {
  $('.error').hide();
  $('input.text-input').css({backgroundColor:"#FFFFFF"});
  $('input.text-input').focus(function(){
    $(this).css({backgroundColor:"#FFDDAA"});
  });
  $('input.text-input').blur(function(){
    $(this).css({backgroundColor:"#FFFFFF"});
  });

  $(".button").click(function() {
		// validate and process form
		// first hide any error messages
    $('.error').hide();
		
	  var name = $("input#name").val();
		if (name == "" | name == "name") {
      $("label#name_error").show();
      $("input#name").focus();
      return false;
    }
		var email = $("input#email").val();
		if (email == "" | email =="email" | email.indexOf("@") == -1| email.indexOf(".") == -1) {
      $("label#email_error").show();
      $("input#email").focus();
      return false;
    }
		var phone = $("input#phone").val();
		if (phone == "" | phone == "phone") {
      $("label#phone_error").show();
      $("input#phone").focus();
      return false;
    }
	var enquiry = $("textarea#enquiry").val();
		if (enquiry == ""| enquiry == "Brief description of requirements") {
      $("label#enquiry_error").show();
      $("textarea#enquiry").focus();
      return false;
    }	
	
		
		var dataString = 'name='+ name + '&email=' + email + '&phone=' + phone + '&enquiry=' + enquiry;
		//alert (dataString);return false;
		
		$.ajax({
      type: "POST",
      url: "http://loretta-taylor.com/client/suppremo/wp-content/themes/supremotheme/bin/process.php",
      data: dataString,
      success: function() {
        $('#contact_form').html("<div id='message_submitted'></div>");
        $('#message_submitted').html("<h2>Contact Form Submitted!</h2>")
        .append("<p>We will be in touch soon.</p>")
        .hide()
        .fadeIn(1500, function() {
          $('#message_submitted').append("&nbsp;");
        });
      }
     });
    return false;
	});
});*/


