$(document)
		.ready(
				function() {
					$(function(){ $("submit").uniform(); });
					$(".miscHover a").hover(function() {
						$(this).stop().animate({
							"opacity" : .5
						});
					}, function() {
						$(this).stop().animate({
							"opacity" : 1
						});
					});

					$('div .faqHidden').hide();
					$(".faqLink").click(
							function() {
								$(".faqLink").fadeIn();
								faqID = $(this).attr("id");
								$(this).hide();
								$("div > .faqHidden").slideUp("slow");
								$('div > #' + faqID).toggleClass("active")
										.slideToggle("slow").delay(800);
							});

					$(".readerList a[rel]").overlay({
						mask : "#000",
						effect : "apple",
						onBeforeLoad : function() {
							var wrap = this.getOverlay().find(".contentWrap");
							wrap.load(this.getTrigger().attr("href"));
						}
					});

					$.easing.bouncy = function(x, t, b, c, d) {
						var s = 1.70158;
						if ((t /= d / 2) < 1)
							return c / 2
									* (t * t * (((s *= (1.525)) + 1) * t - s))
									+ b;
						return c
								/ 2
								* ((t -= 2) * t
										* (((s *= (1.525)) + 1) * t + s) + 2)
								+ b;
					};
					$.tools.tooltip.addEffect("bouncy", function(done) {
						this.getTip().animate({
							top : "+=15"
						}, 500, "bouncy", done).show();
					}, function(done) {
						this.getTip().animate({
							top : "-=15"
						}, 500, "bouncy", function() {
							$(this).hide();
							done.call();
						});
					});
					jQuery('.bookmarks a.external').attr("target", "_blank");
					var sexyBaseHeight = jQuery('.bookmarks').height();
					var sexyFullHeight = jQuery('.bookmarks ul.socials')
							.height();
					if (sexyFullHeight > sexyBaseHeight) {
						jQuery('.bookmarks-expand').hover(function() {
							jQuery(this).animate({
								height : sexyFullHeight + 'px'
							}, {
								duration : 400,
								queue : false
							});
						}, function() {
							jQuery(this).animate({
								height : sexyBaseHeight + 'px'
							}, {
								duration : 400,
								queue : false
							});
						});
					}

					if (jQuery('.bookmarks-center')
							|| jQuery('.bookmarks-spaced')) {
						var sexyFullWidth = jQuery('.bookmarks').width();
						var sexyBookmarkWidth = jQuery(
								'.bookmarks:first ul.socials li').width();
						var sexyBookmarkCount = jQuery('.bookmarks:first ul.socials li').length;
						var numPerRow = Math.floor(sexyFullWidth
								/ sexyBookmarkWidth);
						var sexyRowWidth = Math.min(numPerRow,
								sexyBookmarkCount)
								* sexyBookmarkWidth;

						if (jQuery('.bookmarks-spaced').length > 0) {
							var sexyLeftMargin = Math
									.floor((sexyFullWidth - sexyRowWidth)
											/ (Math.min(numPerRow,
													sexyBookmarkCount) + 1));
							jQuery('.bookmarks ul.socials li').css(
									'margin-left', sexyLeftMargin + 'px');
						} else if (jQuery('.bookmarks-center'.length > 0)) {
							var sexyLeftMargin = (sexyFullWidth - sexyRowWidth) / 2;
							jQuery('.bookmarks-center').css('margin-left',
									sexyLeftMargin + 'px');
						}

					}

					jQuery('.bookmarks a.external')
							.click(
									function() {
										var url = encodeURIComponent(window.location.href), desc = '';
										if (jQuery('p.bookmarks-content').length) {
											desc = encodeURIComponent(jQuery(
													'p.bookmarks-content')
													.text());
										}
										switch (this.parentNode.className) {
										case 'digg':
											this.href += '?phase=2&title='
													+ document.title + '&url='
													+ url + '&desc=' + desc;
											break;
										case 'twitter':
											this.href += '?status=RT+@your_twitter_id:+'
													+ document.title
													+ '+-+'
													+ url;
											break;
										case 'delicious':
											this.href += '?title='
													+ document.title + '&url='
													+ url;
											break;
										case 'stumbleupon':
											this.href += '?title='
													+ document.title + '&url='
													+ url;
											break;
										case 'myspace':
											this.href += '?t=' + document.title
													+ '&u=' + url;
											break;
										case 'facebook':
											this.href += '?t=' + document.title
													+ '&u=' + url;
											break;
										case 'linkedin':
											this.href += '?mini=true&title='
													+ document.title + '&url='
													+ url;
											break;
										case 'google':
											this.href += '?op=add&title='
													+ document.title + '&bkmk='
													+ url;
											break;
										}
									});

					$('#reviews').click(function(e) {
						e.preventDefault();
						goToByScroll("reviews_div");
					});

					$(".jHover").hover(function() {
						$(this).stop().animate({
							"opacity" : .5
						});
					}, function() {
						$(this).stop().animate({
							"opacity" : 1
						});
					});
					$(
							"select, input:checkbox, input:radio, input:file, input:text, textarea, input:submit, input:password")
							.uniform();
					$('#tf').focus(function() {
						$(this).val('');
					});

				});

function hideshow(el, act) {
	if (act)
		$('#' + el).css('visibility', 'visible');
	else
		$('#' + el).css('visibility', 'hidden');
}

$.easing.bouncy = function(x, t, b, c, d) {
	var s = 1.70158;
	if ((t /= d / 2) < 1)
		return c / 2 * (t * t * (((s *= (1.525)) + 1) * t - s)) + b;
	return c / 2 * ((t -= 2) * t * (((s *= (1.525)) + 1) * t + s) + 2) + b;
};
$.tools.tooltip.addEffect("bouncy", function(done) {
	this.getTip().animate({
		top : '+=15'
	}, 500, 'bouncy', done).show();
}, function(done) {
	this.getTip().animate({
		top : '-=15'
	}, 500, 'bouncy', function() {
		$(this).hide();
		done.call();
	});
});
function externalLinks() {
	if (!document.getElementsByTagName)
		return;
	var anchors = document.getElementsByTagName("a");
	for ( var i = 0; i < anchors.length; i++) {
		var anchor = anchors[i];
		if (anchor.getAttribute("href")
				&& anchor.getAttribute("rel") == "external")
			anchor.target = "_blank";
	}
}
window.onload = externalLinks;

(function($) {
	$.fn.simpleSpy = function(limit, interval) {
		limit = limit || 3;
		interval = interval || 7000;
		return this.each(function() {
			var $list = $(this), items = [], // uninitialised
			currentItem = limit, total = 0, // initialise later on
			height = $list.find('> li:first').height();
			$list.find('> li').each(function() {
				items.push('<li>' + $(this).html() + '</li>');
			});
			total = items.length;
			$list.wrap('<div class="spyWrapper" />').parent().css({
				height : height * limit
			});
			$list.find('> li').filter(':gt(' + (limit - 1) + ')').remove();
			function spy() {
				var $insert = $(items[currentItem]).css({
					height : 0,
					opacity : 0
				});
				$insert.prependTo($list);
				$list.find('> li:last').animate({
					opacity : 0
				}, 1000, function() {
					$insert.animate({
						height : height
					}, 1000);
					$insert.animate({
						opacity : 1
					}, 1000);
					$(this).remove();
				});
				currentItem++;
				if (currentItem >= total) {
					currentItem = 0;
				}
				setTimeout(spy, interval);
			}
			spy();
		});
	};
})(jQuery);
function goToByScroll(id) {
	$('html,body').animate({
		scrollTop : $("#" + id).offset().top
	}, 1500);
}

function setRadio(radio, value){
	 
	 
	   for(i=0; i<radio.length; i++){
	      if(radio[i].value == value){
	         radio[i].checked = true;
	      } else {
	         radio[i].checked = false;
	      }
	   }
	 
	}


