// JavaScript Document

$(function() {
	Cufon.replace('#box-plans .plan .title', { fontFamily: "Droid Sans" });
	Cufon.replace('#box-plans .plan .price', { fontFamily: "Droid Sans" });
	Cufon.replace('#box-plans .plan .price span', { fontFamily: "Droid Sans" });
	Cufon.replace('#box-plans .plan .tagline', { fontFamily: "Droid Sans" });
	Cufon.replace('#whois h1', { fontFamily: "Dezen Pro Regular" });
	Cufon.replace('#whois h2', { fontFamily: "Dezen Pro Regular" });
	Cufon.replace('#whois .domain-prices span', { fontFamily: "Droid Sans" });
	Cufon.replace('#footer .widget > h4', { fontFamily: "Droid Sans" });
	Cufon.replace('#internal-content .left h1:not(.clean)', { fontFamily: "Dezen Pro Regular", hover:true });
	Cufon.replace('#internal-content .left h2:not(.clean)', { fontFamily: "Dezen Pro Regular", hover:true });
	Cufon.replace('.accordion-faq h3', { fontFamily: "Dezen Pro Regular", hover: true });
	Cufon.replace('#sidebar-tabs h3', { fontFamily: "Dezen Pro Regular" });
	Cufon.replace('#sidebar h3', { fontFamily: "Dezen Pro Regular" });
	Cufon.replace('#sidebar .widget ul.social li a', { fontFamily: "Dezen Pro Regular", hover: true });
});

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

(function($) {
	$.fn.customFadeIn = function(speed, callback) {
		$(this).fadeIn(speed, function() {
			if(jQuery.browser.msie)
				$(this).get(0).style.removeAttribute('filter');
			if(callback != undefined)
				callback();
		});
	};
	$.fn.customFadeOut = function(speed, callback) {
		$(this).fadeOut(speed, function() {
			if(jQuery.browser.msie)
				$(this).get(0).style.removeAttribute('filter');
			if(callback != undefined)
				callback();
		});
	};
})(jQuery);

jQuery(document).ready(function() {
	$('#menu > li.dropdown').hover(
		function () {
			$('a', this).addClass('active');
	 		$('ul', this).slideDown({
				duration: 'fast'
				/*easing: 'easeOutBounce'*/
			});
		},
		function () {
			$('a', this).removeClass('active');
	 		$('ul', this).customFadeOut({
				duration: 'fast'
				/*easing: 'easeOutBounce'*/
			});
		}
	);
});

$(document).ready(function() {
	$('#box-plans .plan').hover(function() {
		$(".plan-info", this).stop().animate({top:'0px'},{queue:false,duration:200, easing:"easeOutQuad"});
	}, function() {
		$(".plan-info", this).stop().animate({top:'-350px'},{queue:false,duration:200, easing:"easeOutQuad"});
	});
});

$(document).ready(function(e) {
	$('#form-whois #domain').inactiveValue({inactiveValue: "suaempresa", inactiveColor: "#ccc"})
});


/* accordions */
$(function() {
	$('.accordion-faq').accordion({
		collapsible: false,
		active: 0,
		header: 'h3',
		clearStyle: true,
		autoHeight: false,
		change: function() {
			Cufon.refresh();
		}
	});
	$('#accordion-web-hosting').accordion({
		create: function() {
			$('#accordion-web-hosting h3:first-child').before('<h2 class="accordion-info">Somos a solu&ccedil;&atilde;o perfeita em hospedagem para o seu site.</h2>')
		},
		collapsible: false,
		active: 0,
		header: 'h3',
		clearStyle: true,
		autoHeight: false,
		change: function() {
			Cufon.refresh();
		}
	});
});

/* jscrollpane */
$(function() {
	$('.scroll-pane').jScrollPane({
		showArrows: true,
		/*verticalDragMaxHeight: 70,*/
		autoReinitialise: true
	});
});

/* tabs */
$(document).ready(function(e) {
	
	/* tabs compare plans home */
	$('#tabs-compare').tabify();
	
	/* internal tabs */
	$('#internal-tabs-nav').tabify(function() {
		var initialTabTitle = $('#internal-tabs-nav li.active a').text();
		var pagetitle = $(document).attr('title');
		document.title = pagetitle + ' > ' + initialTabTitle;
		$('#breadcrumb li.current').html(initialTabTitle);
		$('#internal-tabs-nav li a').click(function() {
			var currentTabTitle = $(this).text();
			$('#breadcrumb li.current').html(currentTabTitle);
			document.title = pagetitle + ' > ' + currentTabTitle;
		});
	});
	
	/* features tabs */
	$('#features-tabs').tabify();
});

/* get tweets footer */
jQuery(document).ready(function() {
	jQuery("#footer .widget .content.tweets").getTwitter({
		userName: 'century_co',
		numTweets: '3',
		loaderText: "Loading tweets...",
		slideIn: false,
		showHeading: false,
		headingText: "",
		showProfileLink: false
	});
});

/* zoom images hover */
$(document).ready(function(e) {
	
	$('a.zoom').hover(function() {
		var imgWidth = $(this).find('img').width();
		var imgHeight = $(this).find('img').height();
		$('span.zoom').css({ 'width': imgWidth, 'height': imgHeight });
		$('span.zoom').customFadeIn('fast');
	}, function() {
		$('span.zoom').customFadeOut('fast');
	});
});

/* fancybox */
$(document).ready(function(e) {
	$('a.fancybox').fancybox({
		'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic',
		/*'speedIn'		:	300, 
		'speedOut'		:	300,*/
		'overlayShow'	:	true,
		'overlayOpacity':	0.8,
		'overlayColor'	:	'#000'
		/*'titlePosition'	:	'over'*/
	});
	$('a.fancybox-faq').fancybox({
		'transitionIn'	:	'fade',
		'transitionOut'	:	'fade',
		'width'			:	'30%',
		'height'		:	'auto',
		'autoDimensions':	false,
		/*'speedIn'		:	300, 
		'speedOut'		:	300,*/
		'overlayShow'	:	true,
		'overlayOpacity':	0.7,
		'overlayColor'	:	'#000',
		'type'			:	'inline',
		'onStart'		:	function() {
			$('.accordion-faq > div > div').css('line-height', '17px');
		}
		/*'titlePosition'	:	'over'*/
	});
	$("a.fancybox-iframe").fancybox({
		'width'			:	'95%',
		'height'		:	'100%',
        'autoScale'		:	false,
        'transitionIn'	:	'fade',
		'transitionOut'	:	'fade',
		'overlayShow'	:	true,
		'overlayOpacity':	0.7,
		'overlayColor'	:	'#000',
		'type'			:	'iframe'
	});
	$("a.fancybox-googlemaps").fancybox({
        'autoScale'		:	true,
        'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic',
		'overlayShow'	:	false,
		'titlePosition'	:	'inside',
		'type'			:	'iframe'
	});
	$("a.fancybox-youtube").fancybox({
        'autoScale'		:	true,
        'transitionIn'	:	'elastic',
		'transitionOut'	:	'fade',
		'overlayShow'	:	true,
		/*'titlePosition'	:	'inside',*/
		'speedIn'		:	300,
		'speedOut'		:	300,
		'overlayOpacity':	0.9,
		'overlayColor'	:	'#000',
		'type'			:	'iframe'
	});
});


/* spacegallery datacenter */
$(document).ready(function(e) {
	$('#spacegallery-datacenter').spacegallery({
		loadingClass:	'loading',
		perspective:	150
	});
});


/* tooltips */
$(function() {
	$("#recaptcha_widget .icons a[title]").tooltip({
		effect: "fade"
	});
	$("#quick-contact :input:not('#recaptcha_response_field')").tooltip({
		position: "center right",
		offset: [0, 10],
		effect: "fade",
		opacity: 0.8,
		tipClass: 'tooltip-form'
	});
	$("#footer .widget li a[title]").tooltip({
		position: "center right",
		offset: [0, -45],
		effect: "fade",
		opacity: 1,
		tipClass: 'tooltip-footer'
	});
	$("#compare-plans th[title]").tooltip({
		offset: [10, 0],
		effect: "fade",
		opacity: 1,
		tipClass: 'tooltip'
	});
	$('#compare-plans td > img.info').tooltip({
		offset: [-225, -308],
		position: 'center right',
		effect: "slide",
		opacity: 0.8
	});
	$('#copyright').children('a').tooltip({
		effect: 'fade',
		opacity: 1
	});
});

/* table resources */
/*$(document).ready(function(e) {
	$("table#id2 tr:even").css("background-color", "#F4F4F8");
	$('table#compare-plans tr:odd').css("background-color", "#EFF1F1");
});*/

/*$(document).ready(function(e) {
	$('#compare-plans').tableHover({
		colClass: 'hover',
		rowClass: 'row'
	});
});*/


/* rounded corners example */
/*$(function() {
	$('#selector').corner();
});*/


