// JavaScript Document

$(document).ready(function() {
	
	var _sid = $("META[name='sid']").attr('content');
	$('<input type="hidden" name="sid" value="'+_sid+'">').appendTo('FORM');
	
	_form();
	
	$('a[rel="extern"]').attr('target', '_blank');
	
//	Confirm link

	$("a.confirm").click(function() {
		if (confirm($(this).attr('title'))) {
			return true;							 
		}
		else {
			return false;
		}
	});
	
//	Print link

	$("a.print").click(function() {
		print();
		return false;
	});
	
// PNG FIX

	$.pngfix('/images/common/pixel.gif');
	$("#button-gastenboek IMG, #button-home IMG, #film IMG, #button-add-recepie IMG, #button-recepies IMG, #button-info IMG, #recept-next IMG, #recept-previous IMG").pngfix();
	
//	FILM

	
	$('#film-content').flash(		
		{src: 'http://st1.streamzilla.jet-stream.nl/questmedia/StreamZillaLoader.php?rtmpURL=rtmp://fl1.streamzilla.jet-stream.nl:80/VOD&amp;previewImage=http://www.zomerlof.nl/images/common/film.jpg&amp;movieName=questmedia/greenery/witlof.flv&amp;width=400&amp;height=300&amp;autoStart=0&amp;initVolume=75&amp;autoHide=1&amp;playerType=4',
		width: 400,
		height: 300, 
		flasvars: {backcolor: '0xFFFFFF',frontcolor: '0xFFFFFF',lightcolor: '0xFFFFFF',screencolor: '0xFFFFFF'}},
		{ version: 9 }
	);
	
	$('input[type=checkbox], input[type=radio]').checkbox({
		cls: 'jquery-checkbox',
		empty:'/images/common/pixel.gif'
	});

	
	$('select').selectbox();	
	$('input[type=file]').filestyle({image:'/images/backgrounds/form-file-browse.png', imageheight:27,imagewidth:80, width:170});

	
	
//	RATEN

	$("#rating A.star").click(function() {
		var _length = $(this).parents('ul').children().length;
		var _current = $(this).parent().nextAll().length;
		var _qty = _length - _current - 1;
		
		$("#rating A.star IMG").attr('src', '/images/icons/star-green-normal.png');
		
		for (var i=0;i<= _qty;i++) {
			$("#rating A.star").eq(i).children('img').eq(0).attr('src', '/images/icons/star-green-active.png');
		}
								  
		return false;
	});

	$("#rating A.vote").click(function() {
		var _url = $(this).attr('href');
		var _qty = $("#rating A.star IMG[src='/images/icons/star-green-active.png']").length;
		$(this).attr('href', _url+_qty+'/');		
	});

	
//	Breadcrumb 

	$("#breadcrumb UL LI:first").css('margin-left','0');
	
	
	 
//	Zoeken

	$("#search-input").focus(function() {
		if ($(this).val() == $(this).attr('alt')) {
			$(this).val('');	
		}
	});
	
	
	$("#search-input").blur(function() {
		if ($(this).val() == '') {
			$(this).val($(this).attr('alt'));	
		}
	});
	

//	Zoeken

	$(".form-input, .form-input-small, .form-textarea, .form-textarea-pink, .form-input-pink").focus(function() {
		if ($(this).val() == $(this).attr('rel')) {
			$(this).val('');	
		}
	});
	
	
	$(".form-input, .form-input-small, .form-textarea, .form-textarea-pink, .form-input-pink").blur(function() {
		if ($(this).val() == '') {
			$(this).val($(this).attr('rel'));	
		}
	});
	
	

});

