﻿$(document).ready(function() {
	$.externallinks();
	$.firstchildamend();
	$('#devcarousel').jcarousel();
	$('.views').accordion({ header: 'h3' });
	$('ul.banner').innerfade({
		animationtype: 'fade',
		speed: 1500,
		timeout: 5000,
		containerheight: '337px'
	});
	/*type: 'random_start',*/
	$(".banner li span").css("display", "block");
	$('input.cpicker').ColorPicker({
		onSubmit: function(hsb, hex, rgb, el) {
			$(el).val("#" + hex);
			$(el).ColorPickerHide();
		},
		onBeforeShow: function() {
			$(this).ColorPickerSetColor(this.value);
		}
	})
	.bind('keyup', function() {
		$(this).ColorPickerSetColor(this.value);
	});
});

$.firstchildamend = function() {
	$(".footnav li:first-child")
	.css("border", "0")
	.css("padding-top", "0")
}

$.externallinks = function() {
	$('a[href^="http://"],a[rel="external"]')
	.attr({
		target: "_blank",
		title: function(arr) {
			if ($(this).attr("title").length > 0) {
				$(this).attr("title", $(this).attr("title") + " (opens in a new window)");
			}
			else {
				$(this).attr("title", "opens in a new window");
			}
		}
	});
	$('a[href^="http://www.pharmaceuticalmarkets.com/"]')
	.attr({
		target: "_self",
		title: function(arr) {
			$(this).attr("title", $(this).attr("title").replace(/ (opens in a new window)/, ""));
			$(this).attr("title", $(this).attr("title").replace(/(opens in a new window)/, ""));
		}
	});
}
