function twitterCallback2(twitters) {
  var statusHTML = [];
  for (var i=0; i<twitters.length; i++){
    var username = twitters[i].user.screen_name;
    var status = twitters[i].text.replace(/((https?|s?ftp|ssh)\:\/\/[^"\s\<\>]*[^.,;'">\:\s\<\>\)\]\!])/g, function(url) {
      return '<a href="'+url+'">'+url+'</a>';
    }).replace(/\B@([_a-z0-9]+)/ig, function(reply) {
      return  reply.charAt(0)+'<a href="http://twitter.com/'+reply.substring(1)+'">'+reply.substring(1)+'</a>';
    });
    statusHTML.push('<p>&ldquo;'+status+'&rdquo; &ndash; <small>'+relative_time(twitters[i].created_at)+'</small></p>');
  }
  
  $('.loading').fadeOut(750, function() {
		 $('#latest_tweet').append($(statusHTML.join('')).hide().fadeIn(750));									
  });
  
  //document.getElementById('latest_tweet').innerHTML = statusHTML.join('');
}

function relative_time(time_value) {
  var values = time_value.split(" ");
  time_value = values[1] + " " + values[2] + ", " + values[5] + " " + values[3];
  var parsed_date = Date.parse(time_value);
  var relative_to = (arguments.length > 1) ? arguments[1] : new Date();
  var delta = parseInt((relative_to.getTime() - parsed_date) / 1000);
  delta = delta + (relative_to.getTimezoneOffset() * 60);

  if (delta < 60) {
    return 'less than a minute ago';
  } else if(delta < 120) {
    return 'about a minute ago';
  } else if(delta < (60*60)) {
    return (parseInt(delta / 60)).toString() + ' minutes ago';
  } else if(delta < (120*60)) {
    return 'about an hour ago';
  } else if(delta < (24*60*60)) {
    return 'about ' + (parseInt(delta / 3600)).toString() + ' hours ago';
  } else if(delta < (48*60*60)) {
    return '1 day ago';
  } else {
    return (parseInt(delta / 86400)).toString() + ' days ago';
  }
}




$(document).ready(

	function(){

		$('.blog-item:last').addClass('last');
		$('#testimonial').cycle({ 
    fx:    'fade', 
    delay: -3000 ,
	height: 135,
	pause: true
});

});

// Search
$(document).ready(function() {
		swapValue = [];
		 $("#form input").each(function(i){
		 swapValue[i] = $(this).val();
		 $(this).focus(function(){
		   if ($(this).val() == swapValue[i]) {
			 $(this).val("");
		    }
		   $(this).addClass("focus");
		 }).blur(function(){
		   if ($.trim($(this).val()) == "") {
		       $(this).val(swapValue[i]);
		       $(this).removeClass("focus");
	            }
		 });
	     });
	});


function update_paypal(method) {

	// change the value of the buy now button, shipping or download and different price

	if (method=="mail") {

		document.paypal_form.amount.value="15.99";

		document.paypal_form.no_shipping.value="2";

		document.paypal_form.os0.value="Mail";

	}

	

	if (method=="download") {

		document.paypal_form.amount.value="12.99";

		document.paypal_form.no_shipping.value="1";

		document.paypal_form.os0.value="Download";		

	}	



}



function update_paypal_2(method) {

	// change the value of the buy now button, shipping or download and different price

	if (method=="mail") {

		document.paypal_form_2.amount.value="15.99";

		document.paypal_form_2.no_shipping.value="2";

		document.paypal_form_2.os0.value="Mail";

	}

	

	if (method=="download") {

		document.paypal_form_2.amount.value="12.99";

		document.paypal_form_2.no_shipping.value="1";

		document.paypal_form_2.os0.value="Download";		

	}	



}



/*
 * jQuery.BiggerLink v2.0.1
 * http://www.ollicle.com/eg/jquery/biggerlink/
 *
 * Copyright (c) 2009 Oliver Boermans
 * http://creativecommons.org/licenses/MIT/
 *
 * 2009-11-22 (22 Nov 2009)
*/ 
(function($) {
	$.fn.biggerlink = function(options) {

		// Default settings
		var settings = {
			biggerclass:'bl-bigger', 	// class added to the first contained link and others that trigger it
			hoverclass:'bl-hover', 		// class added to parent element on hover/focus
			hoverclass2:'bl-hover2', 	// class added to parent element on hover/focus of other links
			clickableclass:'bl-hot', 	// class added to parent element with behaviour
			otherstriggermaster: true,	// will all links in containing biggerlink element trigger the first link
			follow: 'auto'				// follow master link on click? : 'auto',true,false
		};
		if(options) {
			$.extend(settings, options);
		}
		$(this).filter(function(){
			 return $('a',this).length > 0;

		}).addClass(settings.clickableclass).css('cursor', 'pointer').each(function(i){
			
			// store element references
			var big = $(this).data('biggerlink',{hovered:false,focused:false,hovered2:false,focused2:false});
			var links = {
				all: $('a',this),
				big: $(this),
				master: $('a:first',this).data('biggerlink',{status:'master'}).addClass(settings.biggerclass),
				other: $('a',this).not($('a:first',this)).data('biggerlink',{status:'other'})
			};
			
			
			$('a',this).andSelf().each(function(){
				var newdata = $.extend($(this).data('biggerlink'),links);
				$(this).data('biggerlink',newdata);
			});
			
			
			
			// Add title of first link with title to parent if not already set
			var thistitle = big.attr('title');
			var newtitle = big.data('biggerlink').master.attr('title');
			if(newtitle && !thistitle)
			{
				big.attr('title', newtitle);
			}
			


		// events on biggerlink element
		
		big
			.mouseover(function(event){
				window.status = $(this).data('biggerlink').master.get(0).href;
				$(this).addClass(settings.hoverclass);
				$(this).data('biggerlink').hovered = true;
			})
			.mouseout(function(event){
				window.status = '';
				if(!$(this).data('biggerlink').focused)
				{
					$(this).removeClass(settings.hoverclass);
				}
				$(this).data('biggerlink').hovered = false;
			})
			.bind('click',function(event){

				// if clicked direct or non-link
				if(!$(event.target).closest('a').length)
				{
					$(this).data('biggerlink').master.trigger({type:'click',source:'biggerlink'});
					event.stopPropagation();
				}
			});
			
			
			
			// focus/blur
			
			links.all
			.bind('focus',function(){
				$(this).data('biggerlink').big.addClass(settings.hoverclass);
				$(this).data('biggerlink').big.data('biggerlink').focused = true;
			}).bind('blur',function(){
				if(!$(this).data('biggerlink').big.data('biggerlink').hovered)
				{
					$(this).data('biggerlink').big.removeClass(settings.hoverclass);
				}
				$(this).data('biggerlink').big.data('biggerlink').focused = false;
			});
			
		
			
			// click/focus/blur event on master (first) link within biggerlink
		
			links.master
			.bind('click',function(event){
				if(event.source == 'biggerlink')
				{
					if(settings.follow === true || settings.follow == 'auto' && event.result !== false)
					{
						window.location = $(this).attr('href');
					}
					else
					{
						event.stopPropagation();
					}
				}
			});
			
			
			// links other than the first (master) link also within biggerlink
			
			// other links are independent
			if(settings.otherstriggermaster)
			{
				links.other.addClass(settings.biggerclass)
				.bind('click',function(event){
					// trigger click events on master link instead
					$(this).data('biggerlink').master.trigger({type:'click',source:'biggerlink'});
					
					// stop this link being followed
					event.preventDefault();
					
					// prevent events on parent elements being triggered
					event.stopPropagation();
				});
			}
			
			// other links are slaves of master link 
			else
			{
				links.other
				.bind('focus',function(){
					$(this).data('biggerlink').big.addClass(settings.hoverclass2);
					$(this).data('biggerlink').big.data('biggerlink').focused2 = true;
				})
				.bind('blur',function(){
					if(!$(this).data('biggerlink').big.data('biggerlink').hovered2)
					{
						$(this).data('biggerlink').big.removeClass(settings.hoverclass2);
					}
					$(this).data('biggerlink').big.data('biggerlink').focused2 = false;
					
				})
				.bind('mouseover',function(event){
					$(this).data('biggerlink').big.addClass(settings.hoverclass2);
					$(this).data('biggerlink').big.data('biggerlink').hovered2 = true;
					event.stopPropagation();
				})
				.bind('mouseout',function(event){
					if(!$(this).data('biggerlink').big.data('biggerlink').focused2)
					{
						$(this).data('biggerlink').big.removeClass(settings.hoverclass2);
					}
					$(this).data('biggerlink').big.data('biggerlink').hovered2 = false;
					event.stopPropagation();
				});
				
				if(!links.other.attr('title'))
				{
					links.other.attr('title','');
				}
			}
		});
		return this;
	};
})(jQuery);


$(function(){
		$('#featured').biggerlink();
	});
