$(document).ready(function(){
 
	$('#s2').cycle({
	    fx:     'fade',
	//the speed between transitions    
	    speed:   1000,
	// the transition time
	    timeout: 3000,
	    next:   '#next',
	    prev: '#prev',
	    pause:   1
	
	});
		  
	$('.readmore').hover(function() {
	    $(this).css('background-image', 'url(/images/learnmore-btn-active.png)');
	   },
	  function() {
	  $(this).css('background-image', 'url(/images/learnmore-btn.png)');
	});
	
	$('.readmore-banner').hover(function() {
	    $(this).css('background-image', 'url(/images/learnmore-white.png)');
	   },
	  function() {
	  $(this).css('background-image', 'url(/images/learnmore-btn.png)');
	});
	$('.readmore-process').hover(function() {
	    $(this).css('background-image', 'url(/images/learnmore-white.png)');
	   },
	  function() {
	  $(this).css('background-image', 'url(/images/learnmore-btn-active.png)');
	});
	
	$('.visitnow').hover(function() {
	    $(this).css('background-image', 'url(/images/visit-now-btn.png)');
	   },
	  function() {
	  $(this).css('background-image', 'url(/images/visit-now-btn-orange.png)');
	});   
	$('#whoisitfor').click(function(event) {
	     window.location.href = '/who-can-use';		
	});
	$('#realityinsights').click(function(event) {
	     window.location.href = '/products/reality-insights/';		
	});
	$('#prev').hover(function() {
	     $(this).removeClass('prev');
	     $(this).addClass('prevhover');
	     },
	     function() {
	     $(this).removeClass('prevhover');
	     $(this).addClass('prev');
	});
	$('#next').hover(function() {
	   $(this).removeClass('next');
	   $(this).addClass('nexthover');
	  },
	  function() {
	  $(this).removeClass('nexthover');
	  $(this).addClass('next');
	});	  
		
	$('#monitoring').hide();
	$('#analysis').hide();
	$('#reporting').hide();
	
	
	$('#summary div').click(function(event) {
	      $('#monitoring').hide();
	      $('#analysis').hide();
	      $('#reporting').hide();
	      var expanddiv = $(this).attr('id').substr(5);
	    $('#'+expanddiv).show('slow');
	    return false;
	  });
	$('.btn').hover(function() {
	    $(this).css('background-image', 'url(/images/submit-grey.png)');
	   },
	  function() {
	  $(this).css('background-image', 'url(/images/submit-orange.png)');
	});
	
	//contact form validation
	$('#errormsg').hide();
	$(':input', this).each(function() {
	  $(this).focus(function() {
	  $(this).val('');
  	 });		
	
	});
	
	$('#contactform').submit(function() {
	   if($('input[name=companyname]').val() == '' || $('input[name=companyname]').val() == 'Company Name'){
	    $('#errormsg').html('Please enter your Company Name');
	    $('#errormsg').css('color','red');
	    $('#errormsg').show('slow');
	    $('input[name=companyname]').focus();
	    return false;
	   }
	   if($('input[name=firstname]').val() == '' || $('input[name=firstname]').val() == 'First Name'){
	    $('#errormsg').html('Please enter your First Name');
	    $('#errormsg').css('color','red');
	    $('#errormsg').show('slow');
	    $('input[name=firstname]').focus();
	    return false;
	   }
	   if($('input[name=lastname]').val() == '' || $('input[name=lastname]').val() == 'Last Name'){
	    $('#errormsg').html('Please enter your Last Name');
	    $('#errormsg').css('color','red');
	    $('#errormsg').show('slow');
	    $('input[name=lastname]').focus();
	    return false;
	   }
	   if($('input[name=email]').val() == '' || $('input[name=email]').val() == 'Email'){
	    $('#errormsg').html('Please enter your Email Address');
	    $('#errormsg').css('color','red');
	    $('#errormsg').show('slow');
	    $('input[name=email]').focus();
	    return false;
	   } else {
	   
	    var rege = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	    if(!rege.test($('input[name=email]').val())) {
	     $('#errormsg').html('Please enter a valid Email Address');
	     $('#errormsg').css('color','red');
	     $('#errormsg').show('slow'); 
	     $('input[name=email]').focus();
	     return false;
	    }
	    	    
	   }
	   
	   return true;
	});

  if ($.browser.msie && $.browser.version == '6.0') {
    jqPngFix();
  }

});	

