function changeVideo(guid, region)
{
	// SCROLL TO TOP OF PAGE
	JQ('html, body').animate({scrollTop:	JQ('div#feature_swf').offset().top	}, 'slow');

	if(!guid)
		return;
	var currentTime = new Date();
	var player = new SWFObject("/nikeos/global/modules/video/v1/swf/video_player_v2_0.swf?oem="+currentTime.getMilliseconds(), "feature", "908", "510", "9.0.28", "#000000");
	player.addParam("scale", "noscale");
	player.addParam("allowScriptAccess", "always");
	player.addParam("allowFullScreen", "true");
	player.addParam("wmode", "transparent");
	player.addVariable("guid", guid);
	player.addVariable("trackerObject", escape(JSON.stringify(nav_tracker_obj)));
    player.addVariable("locale", region);
    player.addVariable("regionConfig", "/nikeos/global/modules/video/v1/xml/reg/reg_config_" + region + ".xml");
	player.addVariable("siteConfig", "/nikebasketball/global/xml/videoSiteConfig.xml");
	
	//autoplay:
	player.addVariable("autoPlay", "true");
	
	// rewrite URL
	var thisUrl=location.href;
	var thisPathname=location.pathname;
	var thisHost=location.host;

	thisUrl = "http://" + thisHost + thisPathname + "#?guid=" + guid;
	
	location.href = thisUrl;
		
	var write=player.write("feature_swf");
	if(!write)
	{
		self.container.html("<div id=\"noflash\"><a href=\"http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash\"><img src=\"/sportswear/global/images/no_flash.jpg\" border=\"0\"></a></div>");
	}
}

function showStatus()
{
	window.status = "Watch this video";
	return true;
}

function hideStatus()
{
	window.status = "";
	return true;
}
	
	
function getParam( name )
{
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
    return "";
  else
    return results[1];
}

function loadCurrentGuid()
{
	var guid=getParam('guid');
	var directories = location.pathname.split('/');
	var currentLocale = "";
	var dirLen = directories.length;

	// get locale from url
	for ( var i=0, len=dirLen; i<len; ++i ){
		if (directories[i].indexOf("_") == 2 && directories[i].length == 5)
		{
			currentLocale = directories[i];
		}
	}

	if (guid.length > 1 && currentLocale.length == 5)
	{
		changeVideo(guid, currentLocale);
	}
}

function addLoadEvent(func) { 
var oldonload = window.onload; 
  if (typeof window.onload != 'function') { 
	    window.onload = func; 
	  } else { 
	    window.onload = function() { 
	      if (oldonload) { 
	        oldonload(); 
	      } 
	      func(); 
	    } 
	  } 
} 
	 
JQ(document).ready(
	function()
	{
		if (getParam('guid'))
		{
		setTimeout('loadCurrentGuid()', 1000); 
		}
	}
);