$(document).ready(function() {
///////////////////////////////////////////////////////

$("#subMenu ul").addClass("clearfix");

$('hr').wrap('<div class="hr" />');


$('span.year').each(function(){

	txt = $(this).html()
	year = (txt).substr(((txt).length - 4),((txt).length));
	$(this).html(year)

});



///////////////////////////////////////////////////////

$('#SSTL-Home #headerImage')
.cycle({ 
	fx: 'scrollHorz', 
	speed: 1000, 
	timeout: 5000,
	pager: '.nav',
	next: '.next', 
	prev: '.prev'
});

///////////////////////////////////////////////////////

/**
* The following variables may be adjusted
*/
var active_color = '#0D1625'; // Colour of user provided text
var inactive_color = '#5A5A5A'; // Colour of default text

/**
* No need to modify anything below this line
*/

  $("input.siteSearchTXT").css("color", inactive_color);
  var default_values = new Array();
  $("input.siteSearchTXT").focus(function() {
    if (!default_values[this.id]) {
      default_values[this.id] = this.value;
    }
    if (this.value == default_values[this.id]) {
      this.value = '';
      this.style.color = active_color;
    }
    $(this).blur(function() {
      if (this.value == '') {
        this.style.color = inactive_color;
        this.value = default_values[this.id];
      }
    });
  });

  $("input.productSearchTXT").css("color", inactive_color);
  var default_values = new Array();
  $("input.productSearchTXT").focus(function() {
    if (!default_values[this.id]) {
      default_values[this.id] = this.value;
    }
    if (this.value == default_values[this.id]) {
      this.value = '';
      this.style.color = active_color;
    }
    $(this).blur(function() {
      if (this.value == '') {
        this.style.color = inactive_color;
        this.value = default_values[this.id];
      }
    });
  });

///////////////////////////////////////////////////////
 //$("#tabs").tabs();
 
		$(function () {    // Tabs script
		var tabContainers = $('div.tabs > div');   
		$('div.tabs ul.tabNavigation a').click(function () {     
		tabContainers.hide().filter(this.hash).show();           
		$('div.tabs ul.tabNavigation a').removeClass('selected');   
		$('div.tabs ul.tabNavigation li').removeClass('selected');   
		$(this).addClass('selected');            
		$(this).parent('li').addClass('selected');            
		return false;  
		}).filter(':first').click();});
///////////////////////////////////////////////////////////


var zoomOptions =
	{
		zoomWidth: 450,
		zoomHeight: 400,
		xOffset: 24,
		yOffset: 7,
		title: false
	}
$(".productImage").jqzoom(zoomOptions);

$('input[type="text"]').addClass("textField");  
$('input[type="password"]').addClass("textField");  
$('input[type="select"]').addClass("selectField");  
$('input[type="radio"]').addClass("radioField");  
$('input[type="textarea"]').addClass("textareaField");  
$('input[type="button"]').addClass("buttonField");  



//$("a#inline").fancybox();

$("a.fileRequestLink").fancybox({
	'titleShow'		: false
	});
	
//$("a.fileRequestLink").colorbox();
//$("a.fileRequestLink").colorbox({inline:true, href:"#FileRequestForm"});

$('.form.popup input[type="submit"]').before('<input type="button" class="FormButton secondBTN" value="Submit" /> ');


$('.form.popup input.secondBTN').click(function () {

var name;
var email;
var phone;
name = $('.popup input.name').val();
email = $('.popup input.email').val();
phone = $('.popup input.phone').val();

if (name == '' || email == '' || phone == ''){
	$('.form.popup input.secondBTN').after('<div class="val"><br /><p>To download the file, please fill in the fields above</p></div>');
	}
else{
	
	$('.form.popup input[type="submit"]').trigger('click');
	}

	});
	


$('div.price strong').each(function(){
	txt = $(this).html();
	if (txt == "00"){
		$(this).html(" (TBA)");
	};
});	

$('div.price div.totalPrice div').each(function(){
	txt2 = $(this).html();
	if (txt2 == "$00"){
		$(this).html("$ (TBA)");
		$(this).parent().parent().find('.deposit').addClass("hidden"); 
		
	};
});	

$('#content.productPage').each(function(){
	
	 $('body').addClass("processed");
	 $('body').attr("id", "SSTLProductListTemplate");
});
	
	
	
	

///////////////////////////////////////////////////////////
});

