///////////////////////////////// Media Center////////////////////////////var totvs_lastVideo = 0;	var totvs_thisVideo = 0;	var totvs_videoQuality = 'medium';	var totvs_autoPlay = false;		function totvs_setQuality(quality){		totvs_videoQuality = quality;		totvs_changeMovie(totvs_thisVideo, totvs_lastVideo);	}		function totvs_changeMovie(pos, last){		var i;		var s = '';		var next = '';		var width = 640;		var height = 480;		var url;		var urlMain = totvs_setVideoName(document.getElementById('totvs_video'+pos).value);		var obj = document.getElementById('totvs_videotecaVideoPlayer');		totvs_thisVideo = pos;				if(totvs_videoQuality == 'low'){			width = 432;			height = 316;		} else if(totvs_videoQuality == 'medium'){			width = 560;			height = 416;		}				s = '<OBJECT id="totvs_player" CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab" WIDTH='+width+' HEIGHT='+height+'>';		s = s + '<PARAM NAME="src" VALUE="'+urlMain+'" >';		s = s + '<PARAM NAME="SCALE" VALUE="tofit">';		s = s + '<PARAM NAME="WIDTH" VALUE='+width+'>';		s = s + '<PARAM NAME="HEIGHT" VALUE='+height+'>';		if(!totvs_autoPlay)			s = s + '<PARAM NAME="AUTOPLAY" VALUE="false">';		for(i = pos+1;i<=last;i++){			url = totvs_setVideoName(document.getElementById('totvs_video'+i).value);			s = s + '<PARAM NAME="QTNEXT'+(i-pos)+'" VALUE="<'+url+'>T<myself>">';			next += ' QTNEXT'+(i-pos)+'="<'+url+'>T<myself>"';		}		s = s + '<EMBED name="totvs_player" SRC="'+urlMain+'" WIDTH='+width+' HEIGHT='+height		s = s + next;		s = s + ' TYPE="video/quicktime" PLUGINSPAGE="http://www.apple.com/quicktime/download/" SCALE="tofit"';		s = s + ' AUTOPLAY='		if(totvs_autoPlay)			s = s + '"true"';		else			s = s + '"false"';		s = s + '/>';		s = s + '</OBJECT>'				obj.innerHTML = s;		obj.style.width = width+'px';		obj.style.height = height+'px';	}		function totvs_setVideoName(url){	var idx = url.lastIndexOf('.');	var newUrl;	if(idx >= 0)		newUrl = url.substring(0,idx)+'_'+totvs_videoQuality+url.substring(idx);	else		newUrl = url+'_'+totvs_videoQuality;	return newUrl;	}///////////////////////////////// Pop-up Videos////////////////////////////function showPopVideo(id, video1, video2, video3, video4, video5, video6, video7, video8, video9, video10){	//posiciona o video	videoPosition(id);	showVideo(id,changevideourl(video1),changevideourl(video2),changevideourl(video3),changevideourl(video4),changevideourl(video5),changevideourl(video6),changevideourl(video7),changevideourl(video8),changevideourl(video9),changevideourl(video10));}function changename(name){var x = name.replace('.mov','_medium.mov');changeVideo(x);return x;}function changevideourl(name){var x = name.replace('.mov','_medium.mov');return x;}function videoPosition(id){	var browserWidth = document.documentElement.clientWidth;	var divWidth = document.getElementById(id).offsetWidth;	var positionLeft = 0;	var newpositionLeft;	if (browserWidth - divWidth <= 0) {	   	positionLeft = 0;      newpositionLeft = positionLeft.toString() + "px";    }else{	   	positionLeft = (browserWidth - divWidth)/2;      newpositionLeft = Math.round(positionLeft).toString() + "px";    }    document.getElementById(id).style.zIndex=9999;	document.getElementById(id).style.left = newpositionLeft;}function changeVideo(url){	var s = '';		document.totvs_player.Stop();		var s = '';	var width = 640;	var height = 480;		s = '<OBJECT id="totvs_player_'+id+'" CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab" WIDTH='+width+' HEIGHT='+height+'>';	s = s + '<PARAM NAME="src" VALUE="'+url+'" >';	s = s + '<PARAM NAME="SCALE" VALUE="tofit">';	s = s + '<PARAM NAME="WIDTH" VALUE='+width+'>';	s = s + '<PARAM NAME="HEIGHT" VALUE='+height+'>';	s = s + '<EMBED name="totvs_player_'+id+'" SRC="'+url+'" WIDTH='+width+' HEIGHT='+height+' TYPE="video/quicktime" PLUGINSPAGE="http://www.apple.com/quicktime/download/" SCALE="tofit"/>';	s = s + '</OBJECT>'	document.getElementById('streamDiv_'+id).innerHTML = s;}function showVideo(id,video1,video2,video3,video4,video5,video6,video7,video8,video9,video10) {	var s = '';	var width = 640;	var height = 480;		s = '<OBJECT id="totvs_player_'+id+'" CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab" WIDTH='+width+' HEIGHT='+height+'>';	s = s + '<PARAM NAME="src" VALUE="'+video1+'" >';	s = s + '<PARAM NAME="SCALE" VALUE="tofit">';	s = s + '<PARAM NAME="WIDTH" VALUE='+width+'>';	s = s + '<PARAM NAME="HEIGHT" VALUE='+height+'>';		if (video2 != "") s = s + '<PARAM NAME="QTNEXT1" VALUE="<'+video2+'>T<myself>">';	if (video3 != "") s = s + '<PARAM NAME="QTNEXT2" VALUE="<'+video3+'>T<myself>">';	if (video4 != "") s = s + '<PARAM NAME="QTNEXT3" VALUE="<'+video4+'>T<myself>">';	if (video5 != "") s = s + '<PARAM NAME="QTNEXT4" VALUE="<'+video5+'>T<myself>">';	if (video6 != "") s = s + '<PARAM NAME="QTNEXT5" VALUE="<'+video6+'>T<myself>">';	if (video7 != "") s = s + '<PARAM NAME="QTNEXT6" VALUE="<'+video7+'>T<myself>">';	if (video8 != "") s = s + '<PARAM NAME="QTNEXT7" VALUE="<'+video8+'>T<myself>">';	if (video9 != "") s = s + '<PARAM NAME="QTNEXT8" VALUE="<'+video9+'>T<myself>">';	if (video10 != "") s = s + '<PARAM NAME="QTNEXT9" VALUE="<'+video10+'>T<myself>">';											s = s + '<EMBED name="totvs_player_'+id+'" SRC="'+video1+'" WIDTH='+width+' HEIGHT='+height+' TYPE="video/quicktime" PLUGINSPAGE="http://www.apple.com/quicktime/download/" SCALE="tofit" AUTOPLAY="true" ENABLEJAVASCRIPT="true"';		if (video2 != "") s = s + 'QTNEXT1="<'+video2+'>T<myself>"';	if (video3 != "") s = s + '<QTNEXT2="<'+video3+'>T<myself>"';	if (video4 != "") s = s + '<QTNEXT3="<'+video4+'>T<myself>"';	if (video5 != "") s = s + '<QTNEXT4="<'+video5+'>T<myself>"';	if (video6 != "") s = s + '<QTNEXT5="<'+video6+'>T<myself>"';	if (video7 != "") s = s + '<QTNEXT6="<'+video7+'>T<myself>"';	if (video8 != "") s = s + '<QTNEXT7="<'+video8+'>T<myself>"';	if (video9 != "") s = s + '<QTNEXT8="<'+video9+'>T<myself>"';	if (video10 != "") s = s + 'QTNEXT9="<'+video10+'>T<myself>"';		s = s + '/>';	s = s + '</OBJECT>'	document.getElementById('streamDiv_'+id).innerHTML = s;	document.getElementById(id).style.visibility="visible";		//if (isIE||isNN)	//	whichDog.style.visibility="visible";	//else if (isN4)	//	document.theLayer.visibility="show";}


////////////////////////////
// COCKIES
////////////////////////////

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);
}
