// pkLaunch 0.0.0
// 2007-05-25
// (c) 2005-2007, Pooya Karimian
//  http://www.pooyak.com/p/pklaunch/
//
//  The script is DISABLED for now. I just left the update script to
//  let people know when I released a new version.
//
//  This Greasemonkey script changes all Yahoo Launch videos with 
//  an embed tag in a new window so that they'll be playable with
//  MS Windows Media Player or mplayerplug-in. It is released 
//  under GPL.
//
// ==UserScript==
// @name            pkLaunch
// @namespace   http://www.pooyak.com/p/pklaunch
// @description  Changes all Yahoo Launch videos with an embed tag in a new window
// @include        http://*launch.yahoo.com/*
// @include        http://*music.yahoo.com/*
// ==/UserScript==

// pkUpdate 0.1 
// pkUpdate - start
var pkfu_version='0.0.0';
pkupdate_check('pkLaunch',pkfu_version); // Comment this line with a // if you want to disable the auto-update feature
function pkupdate_check(pk_scriptname, pk_ver) {
	var current_time=(new Date().getTime()) / 1000;
	var last_time=GM_getValue('pkUpdate_lastupdate');
	if (!last_time) 
		last_time=0 
	if (current_time-last_time<2*3600) 
		return;
	GM_setValue('pkUpdate_lastupdate',current_time.toString());

	GM_xmlhttpRequest({
		method: 'GET',
		url: 'http://www.pooyak.com/p/pkupdate/?n='+escape(pk_scriptname)+'&v='+escape(pk_ver),
		headers: {
			'User-agent': 'Mozilla/4.0 (compatible) pkUpdate',
		},
		onload: function(responseDetails) {
			if(responseDetails.status==200) {
				var t=responseDetails.responseText;
				var data_array=t.split(/\n/);
				if (data_array[0]!='PKUPDATEAVAILABLE') 
					return;
				
 				var r=confirm('A new update is available for '+pk_scriptname+
							' Greasemonkey script\n'+
							'Proceed to the update it at '+data_array[1]+'?\n'+data_array[2]);
				if (r==true) {
					//window.open(data_array[1],'_blank');
					window.location=data_array[1];
				}
		    }
		}
	});
}
// pkUpdate - end

/*
 
 DISABLED!

*/
