$(document).ready(function() {
	$('.roundleft').wrap('<div class="round_wrap alignleft">');
	$('.roundright').wrap('<div class="round_wrap alignright">');
	$('.round').wrap('<div class="round_wrap">');
	$('#twitter').after('<div id="bird"></div>');
	$('#sidebar ul li:last-child').css('border','0px none');
	$('#blog_wrap:last-child').css('margin','0px');
	$('.comments li:last-child').css('margin','0px');
	$(".portfolio_item:even").addClass('portfolio_left');
	$(".tablesorter").tablesorter(); 
	$(".enlarge").fancybox();

	$(".social_icon").qtip({
		style: { 
			padding: 5,
			color: 'white',
			textAlign: 'center',
			fontSize: '14px',
			border: {
				width: 1,
				radius: 5,
				color: '#FFFFFF'
			},
			tip: {
				corner: 'bottomMiddle',
				size: {
					x: 10,
					y : 10
				}
			},
			name: 'dark'
		},
		position: {
		  corner: {
			 target: 'topMiddle',
			 tooltip: 'bottomMiddle'
		  }
		}
	});
	
//Portfolio slider on portfolio page (black semi-transparent slider)
	
	$('.boxgrid.captionfull').hover(function(){
		$(".cover", this).stop().animate({top:'50px'},{queue:false,duration:160});
		curvyCorners.redraw()
	}, function() {
		$(".cover", this).stop().animate({top:'150px'},{queue:false,duration:160});
	});
	
});

// This is for the contact form

	$(document).ready(function() { 
		var options = { 
		target:        '#alert'
		}; 
		$('#contactForm').ajaxForm(options); 
	}); 
	
	$(document).ajaxError(function(){
    if (window.console && window.console.error) {
        console.error(arguments);
    }
	});


	$.fn.clearForm = function() {
	  return this.each(function() {
		var type = this.type, tag = this.tagName.toLowerCase();
		if (tag == 'form')
		  return $(':input',this).clearForm();
		if (type == 'text' || type == 'password' || tag == 'textarea')
		  this.value = '';
		else if (type == 'checkbox' || type == 'radio')
		  this.checked = false;
		else if (tag == 'select')
		  this.selectedIndex = -1;
	  });
	};

// This here is for browser specific CSS

	function css_browser_selector(u){var ua = u.toLowerCase(),is=function(t){return ua.indexOf(t)>-1;},g='gecko',w='webkit',s='safari',o='opera',h=document.getElementsByTagName('html')[0],b=[(!(/opera|webtv/i.test(ua))&&/msie\s(\d)/.test(ua))?('ie ie'+RegExp.$1):is('firefox/2')?g+' ff2':is('firefox/3.5')?g+' ff3 ff3_5':is('firefox/3')?g+' ff3':is('gecko/')?g:is('opera')?o+(/version\/(\d+)/.test(ua)?' '+o+RegExp.$1:(/opera(\s|\/)(\d+)/.test(ua)?' '+o+RegExp.$2:'')):is('konqueror')?'konqueror':is('chrome')?w+' chrome':is('iron')?w+' iron':is('applewebkit/')?w+' '+s+(/version\/(\d+)/.test(ua)?' '+s+RegExp.$1:''):is('mozilla/')?g:'',is('j2me')?'mobile':is('iphone')?'iphone':is('ipod')?'ipod':is('mac')?'mac':is('darwin')?'mac':is('webtv')?'webtv':is('win')?'win':is('freebsd')?'freebsd':(is('x11')||is('linux'))?'linux':'','js']; c = b.join(' '); h.className += ' '+c; return c;}; css_browser_selector(navigator.userAgent);