$(document).ready(function() {

	$("a.video").click(function() {
		$.fancybox({
			'padding'		: 0,
			'height'		: 385,
			'width'			: 640,
			'autoScale'		: false,
			'transitionIn'	: 'none',
			'transitionOut'	: 'none',
			'title'			: this.title,
			'href'			: this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
			'type'			: 'swf',
			'swf'			: {
				'wmode'			: 'transparent',
				'allowfullscreen'	: 'true'
			}
		});
		return false;
	});

	/* This is basic - uses default settings */
	$(".fancybox").fancybox({
		'speedIn'		:	600, 
		'speedOut'		:	200, 
		'overlayOpacity':	0.7,
		'titleShow'		: 	true,
		'titlePosition'	: 	'inside',
		'centerOnScroll': 	false,
		'showCloseButton': 	true
	});

	$(".fancybox_devel").fancybox({
		'speedIn'		:	600, 
		'speedOut'		:	200, 
		'overlayOpacity':	0.7,
		'titleShow'		: 	true,
		'titlePosition'	: 	'inside',
		'centerOnScroll': 	false,
		'showCloseButton': 	true
	});

	$("a.iframe").fancybox({
		'type':'iframe',
		'min-width':200,
		'min-height':200,
		'showCloseButton': true
		});
	
	// Fancybox - Lightbox title :)
	function formatTitle(title, currentArray, currentIndex, currentOpts) {
	return '<div id="tip7-title">' + (title && title.length ? '<em>' + title + '</em>' : '' ) + '<span>Image ' + (currentIndex + 1) + ' of ' + currentArray.length + '</span></div>';
	}
	
	$(".tip7").fancybox({
	'showCloseButton'	: true,
	'titlePosition' 		: 'inside',
	'titleFormat'		: formatTitle
	});
	
	// Fancybox video
	$("a.video").click(function() {
		$.fancybox({
		'padding' : 0,
		'height' : 600,
		'width' : 900,
		'autoScale' : false,
		'transitionIn' : 'none',
		'transitionOut' : 'none',
		'title' : this.title,
		'href' : this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
		'type' : 'swf',
		'swf' : {
		'wmode' : 'transparent',
		'allowfullscreen' : 'true'
		}
		});
			return false;
	});

	// Form Input
	$('.change').focus(function() {
	if (this.value == this.defaultValue) {
	this.value = ''; }});
	$('.change').blur(function() {
	if (this.value == '') {
	this.value = this.defaultValue; }});

	// News main
	$('.news-main li:even').addClass('colored');
	$(".news-main li").hover(function() {
    $(this).addClass("hover");
	}, 
	  function () {
		$(this).removeClass("hover");
	});
	
	// Accordion
	$("#accordion div").hide();
	  $("#accordion em").click(function()
	  {
		$(this).next("div").slideToggle();

	if($(this).hasClass('selected')) {
		$(this).removeClass("selected");
	}
	else {
		$(this).addClass("selected");
	}
	});
	  
	$("#accordion em").hover(function() {
    $(this).addClass("hover");
	}, 
	  function () {
		$(this).removeClass("hover");
	});
	
	//table.table-projects-list
	$('table.table-projects-list tbody tr:even').addClass('colored');
	
	//table
	$('#about table tbody tr:even').addClass('colored');
		
});

