

	$(document).ready(function() {
		$.ajaxSetup({cache:true});

		if ($('#vendorRegistrationForm').length > 0) {
			$.getScript('/common/js/rc-vendorRegistration.js');
		}

		if ($('#sendToFriendForm').length > 0) {
			$.getScript('/common/js/rc-sendToFriend.js');
		}

		if ($('#rc_search_results_content').length > 0) {
			$.getScript('http://www.google.com/jsapi', function(){
				$.getScript('/js/search.js');
			});
		}
	});



	$(document).ready(function(){
		// If there are any objects on this page with a class 
		// of "focus-blur", then load the focus-blur plug-in on demand.
		if ($('.focus-blur').length > 0){
			$.getScript("/common/js/jquery/jquery.valueFx.js",function(){ 
				// Execute this function once the plugin is loaded
				$('.focus-blur').valueFx();
			});
		}
	});

	function googleSearchFocus(obj)
	{
		if(!$(obj).hasClass('search-focus-blur'))
		{
			$(obj).addClass('search-focus-blur');

			obj.focus();
		}
	}

	function googleSearchBlur(obj)
	{
		if($(obj).val() <= '')
		{
			$(obj).removeClass('search-focus-blur');
		}
	}


$(document).ready(function(){
	if ($('div.slide').length > 0){
		// hide those divs
		$('div.rc_slide_sample').show();
		// slide effect
		$('div.slide').click(function(){
			$(this).parent().parent().next('div').slideToggle('fast');
			if($(this).hasClass('expand')){
				$(this).removeClass('expand');
				$(this).text('Hide');
			} else {
				$(this).addClass('expand');
				$(this).text('Show');
			}
			return false;
		});
	}
});

$(document).ready(function(){
	$('ul.popout').superfish({
	
		// Settings
		navArrow	: "/photo/317/317402-Nav_Arrow_Right.gif",
		navArrowHover: "/photo/317/317403-Nav_Arrow_Down.gif",

		hoverClass	: "hover",
		delay		: 600,
		animation	: {opacity:"show"},
		speed		: "normal",
		
		// Optional callback functions
		onInit		: function(){},
		onBeforeShow	: function(){},
		onShow		: function(){},
		onHide		: function(){}
	});
	
	var $width = $('a.share').outerWidth();
	$('.superfish ul').css({
		'left':$width
	});
	
});

function enterShareDiv() {
	$('#shareItBox').show();
}

function leaveShareDiv() {
	$('#shareItBox').hide();
}

$(document).ready(function() {
	$('#shareItBox').hide();
});


$(document).ready(function() {
	if ($('#companies_listing').length > 0) {
		$.getScript("/common/js/jquery/jquery.listnav.js",function(){ 
			// Execute this function once the plugin is loaded
			$('#companies_listing').listnav(opts);
		});
	}
	if ($('#companies_listing,#categories_listing').length > 0) {
		$.getScript("/common/js/jquery/jquery.tinysort.min.js");
	}

	var paginationOpts = {
		countPerPage : 10
	};
	if ($('#category-assets').length > 0) {
		$.getScript("/common/js/rc-pagination.js", function() {
			initRCPagination('category-assets', paginationOpts);
		});
	}
	if ($('#company-assets').length > 0) {
		$.getScript("/common/js/rc-pagination.js", function() {
			initRCPagination('company-assets', paginationOpts);
		});
	}

	if ($('a.show').length > 0) {
		// hide those divs
		$('div.rc_other_centers').hide();
		// slide effect
	}
});

var opts = {
	//initLetter: '',
	includeAll: true,
	flagDisabled: true,
	noMatchText: 'Nothing matched your filter, please click another letter.',
	selectedClass: 'ln-selected',
	showCounts: false
};

var sort_order = [];
var col;
function sort_me(mainId, id, other_sort_columns) {
	sort_order[id] = sort_order[id] == "desc" ? "asc" : "desc";
	$("ul#" + mainId + ">li").tsort("span[id=" + id + "]", {order: sort_order[id]});
	$("#" + id + "_sort").attr('src',
		(sort_order[id] == "desc" ?
		"/photo/317/317446-Nav_Arrow_Desc.gif" :
		"/photo/317/317445-Nav_Arrow_Asc.gif"));
	$('div.listing-header span#header_' + id).removeClass("table_header");
	$('div.listing-header span#header_' + id).addClass("table_header_selected");
	for (col in other_sort_columns){
		document.getElementById(other_sort_columns[col] + '_sort').src = "/photo/317/317444-Nav_Arrow_Unsorted.gif";
		$('div.listing-header span#header_' + other_sort_columns[col]).removeClass("table_header_selected");
		$('div.listing-header span#header_' + other_sort_columns[col]).addClass("table_header");
	}
}


