$(document).ready(function(){
	$('INPUT[name=login]').addClass('auto-hint').attr('title', 'Username');
	$('INPUT[name=password]').addClass('auto-hint').attr('title', 'Password');
	$('INPUT.auto-hint').each(function(i, el){
        if($(this).val() == ''){
            $(this).val($(this).attr('title'));
        }
        $(el).focus(function(){
            if ($(this).val() == $(this).attr('title')) {
                $(this).val('');
            }       
        });
        $(el).blur(function(){
            if ($(this).val() == '') {
                $(this).val($(this).attr('title'));
            }
        });
    });
	
	// var h = ($(document).height()/2)-360;
	// var w = ($(document).width()/2)-360;
	var vfile = 'http://www.stiffrichards.net/layout/themes/dp/video/'+$('#player').attr('class');
	
	$('.preview-video A').click(function(){
		// $('#player').css('top', h);
		// $('#player').css('left', w);
		$('#player').show();
		initPlayer(vfile);
	});
	
	$('#close').click(function(){
		$('#player').hide();
		$('#mediaplayer_wrapper').remove();
		$('#close').after('<div id="mediaplayer">JW Player goes here</div>');
	});

});

function initPlayer(vfile){
	/*
	jwplayer("mediaplayer").setup({
		flashplayer: "http://www.stiffrichards.net/layout/themes/dp/js/player.swf",
		'width': '720',
		'height': '540',
		'icons': true,
		'controlbar.position': 'none',
		'autostart': true,
		'bufferlength': 5,
		file: vfile
	});
	*/
	
	var flashvars = { file: vfile,autostart: true, 'controlbar.position': 'none' };
	var params = { allowfullscreen:true, allowscriptaccess:'always', 'wmode': 'opaque' };
	var attributes = { id:'mediaplayer_wrapper', name:'mediaplayer_wrapper' };
	swfobject.embedSWF('http://www.stiffrichards.net/layout/themes/dp/js/player.swf','mediaplayer','720','540','9.0.115','false', flashvars, params, attributes);
}
