$(document).ready(function(){
	$('.sub-list').hide();
	//$('#breadcrumb span').animate({width: 'toggle'});
	$(".tiptip").tipTip();
	//init_tooltip();
	//$('ul#sidebar > li a').sort(sortAlpha).appendTo('ul#sidebar > li');  
	$(".opacity").hover(function(){
		$(this).fadeTo("fast", 0.85);
	},function(){
		$(this).fadeTo("fast", 1.0);
	});
	var clearMePrevious = '';

	// clear input on focus
	$('.clearMeFocus').focus(function()
	{
		if($(this).val()==$(this).attr('title'))
		{
			clearMePrevious = $(this).val();
			$(this).val('');
		}
	});

	// if field is empty afterward, add text again
	$('.clearMeFocus').blur(function()
	{
		if($(this).val()=='')
		{
		$(this).val(clearMePrevious);
		}
	});
	
	// Padding on select options
	
	
});

function sortAlpha(a,b){  
	return a.innerHTML > b.innerHTML ? 1 : -1;  
};  
      

function init_tooltip() {
		//return false;
		//alert('tool tip init');
		/*
		$(document).ready(function() {
				$(".info_sticker, .tool_tip").tooltip({
						track: true, 
						delay: 0, 
						showURL: false, 
						showBody: " - ", 
						extraClass: "product_description", 
						fixPNG: true,
						opacity: 0.95, 
						left: -120 
				});
		});
		*/
		//$(".info_sticker, .tool_tip").tooltip();
		//$(".info_sticker, .tool_tip").html("Tip 2")
}

function init_tooltip2() {
		//$(".info_sticker, .tool_tip").html("Tip 2");
		$(".info_sticker, .tool_tip").tooltip({
				track: true, 
				delay: 0, 
				showURL: false, 
				showBody: " - ", 
				extraClass: "product_description", 
				fixPNG: true,
				opacity: 0.95, 
				left: -120 
		});
}

function processURL(url, success){
var id;

if (url.indexOf('youtube.com') > -1) {
    <!-- CHANGED -->
    id = url.split('v=')[1].split('&')[0];
    return processYouTube(id);
} else if (url.indexOf('youtu.be') > -1) {
    id = url.split('/')[1];
    return processYouTube(id);
} else if (url.indexOf('vimeo.com') > -1) {
    <!-- CHANGED -->
    if (url.match(/http:\/\/(www\.)?vimeo.com\/(\d+)($|\/)/)) {
        id = url.split('/')[1];
    } else if (url.match(/^vimeo.com\/channels\/[\d\w]+#[0-9]+/)) {
        id = url.split('#')[1];
    } else if (url.match(/vimeo.com\/groups\/[\d\w]+\/videos\/[0-9]+/)) {
        id = url.split('/')[4];
    } else {
        throw new Error('Unsupported Vimeo URL');
    }

    $.ajax({
        url: 'http://vimeo.com/api/v2/video/' + id + '.json',
        dataType: 'jsonp',
        success: function(data) {
            <!-- CHANGED -->
             success(data[0].thumbnail_large);
        }
    });
} else {
    throw new Error('Unrecognised URL');
}

function processYouTube(id) {
    if (!id) {
        throw new Error('Unsupported YouTube URL');
    }
    <!-- CHANGED -->
    success('http://i2.ytimg.com/vi/' + id + '/hqdefault.jpg');
}
}





