$(document).ready(function(){

/**
 * Scroll 
 **/

/** 
 * Lightbpox 
 **/
var lightbox_config = {
	maxWidth: '100%',
	maxHeight: '100%',
/*	opacity: 0.7,*/
	current: '{current} von {total}',
	prevous: 'Voriges',
	next: 'Nächstes',
	close: 'Schließen'
}


$('.entry img').parent('a[href$=.jpg], a[href$=.png], a[href$=.gif]').each(function (i) {
	id = $(this).parents('.post').attr('id');
	//console.log($(this));
	$(this).addClass('img-link');
	$(this).addClass('img-link').attr('rel',id);
	$(this).addClass('img-link').colorbox(lightbox_config);
});


 /**
 * YT-Player 
 **/
var videolinks = $('a[title=Flashvideo]');
videolinks.each(function (i) {
file_src = $(this).attr('href')+'&type=image';
image_src = $(this).find('img:first').attr('src');

config = {
	swf: "/media/mediaplayer/player.swf",
	width: 600,
	height: 450,
	hasVersion: 9,
	expressInstaller:  "/media/expressinstall.swf",
	params: {
		wmode: 'transparent',
		allowfullscreen: "true",
		allowscriptaccess: "always"					
	},
	flashvars: {
		image: image_src,
		file: file_src,
		width: 600,
		height: 450,
		controlbar: "bottom",
		playlist: "none",
		skin: "/media/skins/stylish/stylish.swf",
		autostart: "false",
		bufferlength: "1",
		displayclick: "play",
		linktarget: "_blank",
		quality: "true",
		repeat: "none",
		resizing: "true",
		shuffle: "false",
		stretching: "fill",
		volume: "50",
		abouttext: "Robin Schmitz| RS3D.de",
		aboutlink: "http://www.rs3d.de/"
	}
	
};
vimeo = file_src.search(/vimeo.com/);
if (vimeo != -1) {
	config.flashvars.plugins = '/media/vimeo.swf';
	config.flashvars.type = 'image';
}

//console.log(config);
$(this).parent('p:first').html('').addClass('flashplayer').flash(config); 
});
 	

/**
 * Search 
 **/
var e = new Object();
e['Suche'] = 'Suche';

if ($("input#s").attr('value') == '') {
	$("input#s").attr('value', e['Suche']);
}
$('input#s').focus(function(){
   if ($(this).attr('value') == e['Suche']) {
 		$(this).attr('value',  '');
   	}
}).blur(function () {
   	if ($(this).attr('value') == '') {
   		$(this).attr('value',  e['Suche']);
   	}
});

/**
 * Buttons 
 **/
var buttons = 'a.btn, a.more-link, .comments a, a.post-edit-link';
$(buttons).addClass('btn').wrapInner("<span><span></span></span>");
	
var input_button = $('input#searchsubmit');

var submit_txt = input_button.attr('value');
//console.log(submit_txt);

var submit = $('<button class="btn"><span><span>'+submit_txt+'</span></span>')
//$('input#submit').replaceWith(submit)
$('input#searchsubmit').replaceWith(submit);

//console.log($('input#submit'));


 


 }); // READY ENDE
