var bandwidth ="null";
var firstScreen = 'hide';
if(readCookie('bandwidth')!= null)
{
	bandwidth = readCookie('bandwidth');
}
function setBandwidth(value) {
	//if(readCookie('bandwidth')== null)
	//{	
		createCookie('bandwidth',value,'')//name,value,days		
	//}
	bandwidth = value;
}

//Cookie manipulation


function changeVideo1(xmlfile)
{
	var obj = document.getElementById('weekvideo');
		
	var temp = eval("New_AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0','width','525','height','445','id','homepage','movie','coaching_video?videoName="+xmlfile+".xml&bandwidth="+bandwidth+"&firstScreen="+firstScreen+"','wmode','transparent','quality','high','pluginspage','http://www.macromedia.com/go/getflashplayer' );");
	obj.innerHTML = temp;

	var iobj = document.getElementById('imgweek1');
	var dobj = document.getElementById('week2');
	if(xmlfile=="week1")
	{
		
		dobj.innerHTML = "<a href=\"javascript:changeVideo('week1');\"><img src='images/week8_off.gif' width='98' height='23' border='0' alt='' vspace='6' hspace='8'></a>";

		iobj.src = "images/week2_on.gif";
	}
	else
	{
		dobj.innerHTML = '<img src="images/week2_on.gif" width="98" height="23" border="0" alt="" vspace="6" hspace="8" id="imgweek2">';

		iobj.src = "images/week1_off.gif";
	}
}

function changeVideo(xmlfile)
{
	var obj = document.getElementById('weekvideo');
		
	var temp = eval("New_AC_FL_RunContent('codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0','width','525','height','445','id','homepage','movie','/images/stories/coaching_video?videoName=/images/stories/"+xmlfile+".xml&bandwidth="+bandwidth+"&firstScreen="+firstScreen+"','wmode','transparent','quality','high','pluginspage','http://www.macromedia.com/go/getflashplayer');");
	//var temp = eval("New_AC_FL_RunContent('codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0','width','525','height','445','id','homepage','movie','coaching_video?videoName="+xmlfile+".xml','wmode','transparent','quality','high','pluginspage','http://www.macromedia.com/go/getflashplayer' );");
	obj.innerHTML = temp;

	if(xmlfile!="week1")
		var vspace = "vspace='6'";
	else
		var vspace = "";

	if(prev_video!="week1")
		var pvspace = "vspace='6'";
	else
		var pvspace = "";

	var current_obj = document.getElementById(xmlfile);
	if(prev_video!="")
	{
		var prev_obj = document.getElementById(prev_video);
		prev_obj.innerHTML = "<a href=\"javascript:changeVideo('"+prev_video+"');\"><img id='img"+prev_video+"' src='images/"+prev_video+"_off.gif' width='98' height='23' border='0' alt='' hspace='8' ></a>";
	}

	current_obj.innerHTML = "<img id='img"+xmlfile+"' src='images/"+xmlfile+"_on.gif' width='98' height='23' border='0' alt='' hspace='8' >";

	prev_video = xmlfile;
}


function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}

