// ==UserScript==
// @name           YouTube Googler
// @namespace      http://werktheweb.com/greasemonkey
// @description    Make YouTube more like Google Video
// @include        http://www.youtube.com/watch*
// @include        http://youtube.com/watch*
// ==/UserScript==

(function() {
		

		//**********************************//
		//* These functions are real handy *//
		//**********************************//
		var snapshotToArray = function(snapshot)
		{
				var ar = new Array();

				for (var i = 0; i < snapshot.snapshotLength; i++) {
						ar.push(snapshot.snapshotItem(i));
				}

				return ar;
		}

		var $x = function(xpath, node)
		{
				if (!node) node = document;

				var result = document.evaluate(xpath, node, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);

				return snapshotToArray(result);
		}

		var $ = function(id)
		{
				return document.getElementById(id);
		}

		//Functions taken from quirksmode.org, thanks!
		var findPosX = function (obj)
		{
			var curleft = 0;
			if (obj.offsetParent)
			{
				while (obj.offsetParent)
				{//alert(obj.offsetLeft + "   " + obj.nodeName);
					curleft += obj.offsetLeft
					obj = obj.offsetParent;

				}
			}
			else if (obj.x)
				curleft += obj.x;
			return curleft;
		}

		var findPosY = function (obj)
		{
			var curtop = 0;
			if (obj.offsetParent)
			{
				while (obj.offsetParent)
				{
					curtop += obj.offsetTop
					obj = obj.offsetParent;
				}
			}
			else if (obj.y)
				curtop += obj.y;
			return curtop;
		}

		//Modify the Flash player first
		var playerDiv = document.getElementById('playerDiv');
		var embed = playerDiv.getElementsByTagName('embed')[0];

		var nembed = document.createElement('embed');

		var val;
		var name;
		for each (attr in embed.attributes) {
				if (attr.nodeName == 'bgcolor') {
					val = '#000000';
					name = attr.nodeName;
				} else if (attr.nodeName == 'src') {
						val = attr.nodeValue + '&fs=1';
						name = attr.nodeName;
				} else {
						name = attr.nodeName;
						val = attr.nodeValue;
				}

				nembed.setAttribute(name, val);
		}
		nembed.setAttribute("width", "100%");
		nembed.setAttribute("wmode", "opaque");
		//nembed.setAttribute("height", "100%");

		playerDiv.removeChild(embed);
		playerDiv.appendChild(nembed);

	



		//Add an id to make applying styles easier
		var td_right_side = $('aboutExploreDiv').parentNode;
		td_right_side.id = "-moogoo-right-side-cell";
		$('interactDiv').parentNode.id = "-moogoo-left-side-cell";

		//*********************//
		//*    CSS Styles     *//
		//*********************//
		/*var css = "
			div#baseDiv,
			div#interactDiv {
					width: 100% !important;
			}

			div#leaderboardAd,
			div#footerDiv,
			div.spOffersDiv {
					display: none !important;
			}
		";*/

		var css = new Array(
			"td#-moogoo-right-side-cell { position: relative !important; display: block !important; width: 332px; overflow: hidden !important; margin-left: 1em; padding: 0 !important; margin-right: 0 !important; }",
			"div#baseDiv, div#interactDiv, td#-moogoo-left-side-cell, div#actionsAndStatsDiv { width: 100% !important; }",
			/*"div#actionsAndStatsDiv { padding-left: 8em !important  }",
			"div#actionsAndStatsDiv div.actionsDiv { float: none !important; font-size: .8em !important; }",
			"div#ratingDiv { position: absolute !important; top: 4px; left: 4px;}",
			"div#actionsAndStatsDiv div.actionsDiv div.actionRow { float: left !important; display: inline !important; width: 13em !important; }",*/
			"div#leaderboardAd, div#footerDiv, div.spOffersDiv, div#sideAdDiv, div#exploreDiv map+div, div#brandChannelCapDiv { display: none !important; }",
			"div#aboutExploreDiv { width: 332px !important }",
			"div#interactDiv > div#commentsDiv { display: none !important; }",
			"div#exCommentsDiv { background: #eee !important; }",
			"div#exploreBody > div#exCommentsDiv > div#commentsDiv { overflow: auto !important; margin: 0; }",
			"div#exCommentsDiv > div#commentsDiv > table { display: none !important; }",
			"div.commentHead, div#commentsDiv > div > b, div#commentPostDiv > table { background: #ccc !important; }",
			"div#commentsDiv > div > b, div#commentPostDiv > table { padding: .3em !important; display: block !important; }",
			"div#commentsDiv > div > b { display: none !important; }",
			"div#commentsDiv > div#commentPostDiv > b { display: block !important; }",
			"div#hidden-commentsDiv { display: none !important; }",
			"div#commentPostDiv > table h2 { font-size: 1.2em !important; }",
			"div#commentPostDiv > table a { font-size: .8em !important; }",
			"div#commentPostDiv > table { padding-right: .3em !important }",
			"div#commentPostDiv > table td { white-space: nowrap !important; }",
			"div#commentPostDiv > table td[align='right'] { width: 100% !important; white-space: wrap !important; text-align: right !important }",
			"div#commentsDiv h2 { display: none !important }",
			"h2.commentHeading { background: #ccc; }",
			"div.standaloneComments, div#actionsAndStatsDiv { width: auto !important; }",
			"div.standaloneComments * { width: auto !important; }", 
			"div.standaloneComments div#recent_comments { display: none !important; }",
			"div.commentEntryReply { margin-left: 20px !important; }",
			"div#tabsDiv a { margin: 0 1px 0 0; padding: .3em .3em; font-weight: bold; float: left; display: block; border: solid 1px #ccc; background: #ccc; cursor: pointer; color: #555;}",
			"textarea[name='comment'], input[name='add_comment_button'], input[name='discard_comment_button'] { width: 275px !important; margin: .7em; }",
			"input[name='add_comment_button'], input[name='discard_comment_button'] { margin-top: 0 !important; }",
			"div.commentAction > div { margin: 0 !important; height: auto !important; }",
			"div.commentEntry > * { padding-right: 1em !important }",
			"div#tabsDiv a:hover { color: #000; background-color: #eee }",
			"div#tabsDiv a.active { background: #fff; border-bottom-color: #fff; color: #000;}",
			"div#tabsDiv { position: relative; top: 1px; }",
			"div#tabsDiv span.clear { float: none; clear: both; display: block; }",
			"div#exploreBody { border-top: solid 1px #ccc !important; }",
			"h1#video_title { position: relative !important; }",
			"h1#video_title a { font-size: .6em !important; position: absolute; right: 0px; bottom: -3px; background: #ccc; padding: .2em .5em; border: solid 1px #ccc; border-bottom: none;}",
			"h1#video_title a:hover { background-color: #eee; }",
			"div.rtab { float: left !important; }",
			"div.quicklist_container { border: solid 1px #ccc !important; margin-top: 12px !important; padding-top: 0 !important}",
			"div.quicklist_container div, div.quicklist_container, div.quicklist_container table { width: 100% !important; }",
			"div.quicklist_container div.watchlist_videos { margin-right: 100px !important; position: relative !important; border: none !important; }",
			"div.quicklist_container > div > img { display: none !important; }",
			"div.quicklist_container div.quicklistActions { float: none !important; position: absolute !important; right: 0 !important; text-align: right !important; bottom: 3px !important; }",
			"div#save_row { position: relative !important; }",
			"table#watchlist_table tr:hover { background: #fcfcfc !important; }",
			"table#watchlist_table td[width='55'] { width: 1% !important; padding-right: 10px !important;}",
			"div#aboutVidDiv, div#actionsAndStatsDiv { position: relative !important; overflow: hidden !important; }",
			"div#actionsAndStatsDiv { margin-bottom: 0 !important; }",
			"span.minimize, span.maximize { position: absolute !important; display: block !important; top: -1px; left: -1px; border: solid 1px #ccc; height: .6em; width: .7em; cursor: pointer; color: #ccc; line-height: .4em;}",
			"span.minimize:hover, span.maximize:hover {background: #f9f9f9; }",
			"span.minimize:before { content: '-'; margin-left: 2px; }",
			"span.maximize:after { content: '+'; line-height: 7px; }",
			"body > span.maximize, body > span.minimize { right: 0 !important; left: auto; top: 0 !important; }",
			"div#showRating { padding: 1px 0; position: absolute; bottom: 8px; right: 0px; cursor: pointer; white-space: nowrap; z-index: 99999999 !important; background: #ccc; color: #333; }",
			"div#playerDiv { position: relative !important; }",
			"div#showRating:hover {background: #eee; }"
			/*"div#fullStatsClose { position: relative; bottom: 6px; }",*/
		);

		var addStyleRules = function(css) {
				var stylesheet = unsafeWindow.document.styleSheets[unsafeWindow.document.styleSheets.length-1];

				var rule;
				for each (rule in css) {
						stylesheet.insertRule(rule, stylesheet.cssRules.length);
				}
		}

		addStyleRules(css);

		

		/*var head = document.getElementsByTagName('head')[0];
		var style = document.createElement("style");
		style.textContent = css;

		head.appendChild(style);*/


		//*********************//
		//* Start doing stuff *//
		//*********************//

		/*var baseDiv = document.getElementById('baseDiv');
		var interactDiv = document.getElementById('interactDiv');

		var wideDivs = new Array(baseDiv, interactDiv);

		for (i=0; div=wideDivs[i]; i++) {
				div.style.width = "100%";
		}

		var rightJunk = document.getElementById('dVidsDiv').parentNode;
		rightJunk.style.display = "none";

		var leaderboardAd = document.getElementById('leaderboardAd');
		leaderboardAd.style.display = "none";

		var footerDiv = document.getElementById('footerDiv');
		footerDiv.style.display = "none";

		var spOffersDiv = $x('//div[@class="spOffersDiv"]')[0];
		spOffersDiv.style.display = "none";*/

		//On fontresize
		/*var iframe = document.createElement('iframe');
		iframe.style.position = "absolute";
		iframe.style.top = '-5000px';
		iframe.style.width = '100em';
		iframe.id = '-moogoo-iframe';
		document.body.insertBefore(iframe, document.body.firstChild);
		unsafeWindow.console.log(unsafeWindow.document.getElementById('-moogoo-iframe').contentWindow);
		iframe.contentWindow.addEventListener('resize', function() { alert('resized'); }, true);
*/

		//Maximize
		var max = document.createElement('span');
		max.className = 'maximize';
		max.id='mmaxmin';

		document.body.appendChild(max);

		max.addEventListener('click', function() {
				if (this.className == 'maximize') {
						this.className = 'minimize';
						var display = "none !important";
						var width = "0 !important";
						//More weirdness
						var margin = "1px !important";
				} else {
						this.className = 'maximize';
						var display = "";
						var width = "";
						var margin = "";
				}

				var eles = new Array($('logoTagDiv'), $('utilDiv'), $('searchDiv'), $('video_title'), $x('ancestor::table', $('gNavDiv'))[0], $('aboutExploreDiv'), $('-moogoo-right-side-cell'));
				
				var ele;
				for each (ele in eles) {
					ele.style.display = display;
					ele.style.width = width;
					ele.style.marginLeft = margin;
				}

				resize();
		}, false);

		var video_title = $('video_title');
		var fs = document.createElement('a');
		fs.href = nembed.src.replace('player2.swf', 'watch_fullscreen') + '&title=' + video_title.textContent;
		fs.target = "__blank";
		fs.textContent = "Full Screen";

		video_title.appendChild(fs);

	

		var exploreDiv = $('exploreDiv');
		var tabs = document.createElement("div");
		tabs.id = "tabsDiv";

		/*var showRelatedVideosContent = function() {};
		var showRelatedUserContent = function() {};
		var showRelatedPlaylistContent = function() {};*/
		var showCommentsContent = function() { 
				var exCommentsDiv = $('exCommentsDiv');

				var exploreBody = $('exploreBody');

				var i;
				var child;

				for (i=0; child = exploreBody.childNodes[i]; i++) {
						if (child.nodeName == "DIV") {
								child.style.display = "none !important";
						}
				}

				exCommentsDiv.style.display = "block !important";
		};

		var activateTab = function() {
				var as = this.parentNode.getElementsByTagName('a');

				var a;
				for (i=0; a=as[i]; i++) {
						if (a.className == 'active') {
								a.className = '';
						}
				}

				if (this.textContent != "Comments") {
						$('exCommentsDiv').style.display = "none !important";
				}

				this.className = 'active';
				//this.activateFunction();
				eval(this.getAttribute("activateFunction") + "()");
				resize();
		}

		var tabinfo = new Array(
			{name: "Related", click: "unsafeWindow.showRelatedVideosContent", refdiv: $('exRelatedDiv')},
			{name: "More from this user", click: "unsafeWindow.showRelatedUserContent", refdiv: $('exUserDiv')},
			{name: "Playlists", click: "unsafeWindow.showRelatedPlaylistContent", refdiv: $('exPlaylistDiv')},
			{name: "Comments", click: "showCommentsContent"}
		);

		var tab;
		for each (tab in tabinfo) {
				var a = document.createElement("a");
				a.textContent = tab.name;
				if (tab.refdiv && !tab.refdiv.textContent.match(/Loading.../)) {
						a.className = 'active';
				}
				a.setAttribute("activateFunction", tab.click);
				a.addEventListener('click', activateTab, false);
				tabs.appendChild(a);
		}
		var clear = document.createElement("span");
		clear.className = "clear";

		tabs.appendChild(clear);

		exploreDiv.insertBefore(tabs, exploreDiv.firstChild);

		var aboutVidDiv = $('aboutVidDiv');
		var mini = document.createElement('span');
		mini.className="minimize";


		aboutVidDiv.appendChild(mini);

		
		var aboutVidShade = function() {
				if (this.className == "minimize") {
						this.className = "maximize";
						this.parentNode.style.height = "0px !important";
						this.parentNode.style.paddingBottom = "1px !important";
				} else {
						this.className = "minimize";
						this.parentNode.style.height = "auto !important";
						this.parentNode.style.paddingBottom = "6px !important";
				}
		}

		/*var actionsAndStatsShade = function () {
				if (this.className == "minimize") {
						this.className = "maximize";
						this.parentNode.style.height = "50px !important";
						this.parentNode.style.paddingBottom = "1px !important";
						this.parentNode.style.width = "5px !important";
						this.parentNode.style.position = "absolute !important";
						this.parentNode.style.left = "0 !important";
				} else {
						this.className = "minimize";
						this.parentNode.style.height = "auto !important";
						this.parentNode.style.paddingBottom = "6px !important";
						this.parentNode.style.width = "";
						this.parentNode.style.position = "";
						this.parentNode.style.left = "";
				}
		}*/

		mini.addEventListener('click', aboutVidShade, false);

		/*var mini2 = mini.cloneNode(true);

		var actionsAndStatsDiv = $('actionsAndStatsDiv')
		actionsAndStatsDiv.appendChild(mini2);

		actionsAndStatsDiv.style.display = "none !important";

		mini2.addEventListener('click', aboutVidShade, false);

		aboutVidDiv.parentNode.insertBefore(actionsAndStatsDiv, aboutVidDiv.nextSibling);
		*/
		var showRating = document.createElement("div");
		showRating.id = "showRating";

		showRating.textContent = "Show Stats";

		$('playerDiv').appendChild(showRating);

		$('actionsAndStatsDiv').style.display = "none";

		showRating.addEventListener('click', function() {
				if (this.textContent == "Show Stats") {
						$('actionsAndStatsDiv').style.display = "block !important";
						this.textContent = "Hide Stats";
						this.style.right = "3px";
				} else {
						$('actionsAndStatsDiv').style.display = "none !important";
						this.textContent = "Show Stats";
						this.style.right = "";
				}
		}, false);

		

		//Do comments
		var commentsDiv = $('commentsDiv');
		var exploreBody = $('exploreBody');

		commentsDiv.className = 'exploreContent';

		//*****************************
		//**   Find Total number of comments
		//*****************************
		var statsDiv = $('statsDiv');
		var i;
		var child;

		for (i=0; child = statsDiv.childNodes[i]; i++) {
				if (child.nodeName == "#text" && child.nodeValue.match(/Comments:/)) {
						var num_comments = child.nextSibling.textContent;
						break;
				}
		}
		//******************************
		//******************************

		var showingTableTop = $x('//table[@class="showingTable"]')[0].cloneNode(true);

		var recent_comments = $('recent_comments');

		var showing_string = ''

		if (recent_comments) {
				var count = 0;
				for (i=0; child=recent_comments.childNodes[i]; i++) {
					if (child.nodeName == "DIV" && child.id != 'div_main_comment2') {
							count++;
					}
				}
				showing_string = 'Showing ' + count + ' of ' + num_comments;

		} else {
				showing_string = 'Showing ' + num_comments + ' comments';
		}

		var tds = showingTableTop.getElementsByTagName('td');

		tds[0].textContent = showing_string;

		if (recent_comments) {
				sac = document.createElement('a');
				sac.href = '#';
				sac.textContent = 'See All Comments';

				tds[1].textContent = '';
				tds[1].appendChild(sac);
		} else {
				tds[1].textContent = '';
		}

		var fetchAllComments = function() {
				var params = new Object();
				
				params.method = "GET";

				var mc = $x('//div[@id="recent_comments"]/b/a[starts-with(@href, "/comment_servlet?all_comment")]');

				if (mc.length) {
						var url = mc[0].href;
				} else {
						return false;
				}

				/********************************************/
				/********************************************/
				/*** If your computer sucks (like mine)   ***/
				/*** use this to make videos with a large ***/
				/*** amount of comments not stall up when ***/
				/*** trying to load all the comments      ***/
				/********************************************/
				/********************************************/
				if (num_comments >= 1000) {

					var eb = $('exploreBody');

					window.open(url, '', 'height=' + eb.offsetHeight + ',width=587,left=100000,resizable=yes,scrollbars=yes');

					return true;
				}

				//xmlDoc = document.implementation.createDocument("", "", null);
				//xmlDoc.addEventListener('load', function() { unsafeWindow.console.log(this); }, false);

				//xmlDoc.load(url);

				params.url = url;
				params.onload = function(responseDetails) {
						/****************************************/
						/****************************************/
						/**** This is some pretty weak regex, ***/
						/**** even a small change could break ***/
						/**** it, so if more comments stops   ***/
						/**** working, come back here.        ***/
						/****************************************/
						/****************************************/

						var html = responseDetails.responseText;

						var frag = html.match(/(<div style="clear: both">[\s\S]*<\/div>)[^`]*<div class="spacer">/);
						//var frag = 'dude';


						//unsafeWindow.console.log(frag);
						var commentsDiv = $('commentsDiv');
						var parent = commentsDiv.parentNode;

						var newCommentsDiv = commentsDiv.cloneNode(false);

						//commentsDiv.id = 'hidden-commentsDiv';
						newCommentsDiv.innerHTML = frag[1];

						var div_main_comment = $('div_main_comment');
						var commentPostDiv   = $('commentPostDiv');

						parent.replaceChild(newCommentsDiv, commentsDiv);

						if (div_main_comment) {
							newCommentsDiv.appendChild(div_main_comment.cloneNode(true));
						} else if (commentPostDiv) {
							newCommentsDiv.appendChild(commentPostDiv.cloneNode(true));
								
						}



						var comments = $x('div/div[@class="standaloneComments"][2]/div[@id!="div_main_comment2"]', newCommentsDiv);

						var comment_count = comments.length;

						

						for each (t in ts) {
								var a = document.createElement('a');
								a.textContent = "See Less Comments";
								a.href = "#";
								a.addEventListener('click', function() {
										//var sc = $('hidden-commentsDiv');
										//var bc = $('commentsDiv');

										//sc.id = 'commentsDiv';
										//bc.id = 'hidden-commentsDiv';
										var t2;
										
										if (this.textContent == "See Less Comments") {
											parent.replaceChild(commentsDiv, newCommentsDiv);
											/*for each (t2 in ts) {
												t2.getElementsByTagName('a')[0].textContent = "See All Comments";
												t2.parentNode.getElementsByTagName('td')[0].textContent = "Showing " + comment_count + " of " + num_comments;
											}*/
											updateShowTables("See All Comments");
										} else {
											parent.replaceChild(newCommentsDiv, commentsDiv);
											/*for each (t2 in ts) {
												t2.getElementsByTagName('a')[0].textContent = "See Less Comments";
												t2.parentNode.getElementsByTagName('td')[0].textContent = "Showing " + comment_count + " of " + num_comments;
											}*/
											updateShowTables("See Less Comments");
										}
								}, false);

								t.textContent = '';
								t.appendChild(a);
								t.parentNode.getElementsByTagName('td')[0].textContent = "Showing " + comment_count + " of " + comment_count;
						}


				}
				
				var ts = $x('//div[@id="exCommentsDiv"]/table[@class="showingTable"]//td[2]');

				for each (t in ts) {
						t.textContent = "Loading...";
				}

				GM_xmlhttpRequest(params);
		}

		var updateShowTables = function (string) {
				var trs = $x('//div[@id="exCommentsDiv"]/table[@class="showingTable"]//tr');

				var cDiv = $('commentsDiv');
				var cs = $x('div/div[@class="standaloneComments"][2]/div[@id!="div_main_comment2"]', cDiv);

				if (cs.length) {
					var ccount = cs.length;
				} else {
						var ccount = count;
				}

				var tcount = num_comments;

				var tr;

				for each (tr in trs) {
					var tds = tr.getElementsByTagName('td');

					tds[0].textContent = "Showing " + ccount + " of " + tcount;
					tds[1].getElementsByTagName('a')[0].textContent = string;
				}
		};




		var exCommentsDiv = document.createElement('div');
		exCommentsDiv.id = 'exCommentsDiv';
		exCommentsDiv.style.display = "none !important";

		commentsDiv.parentNode.removeChild(commentsDiv);

		exCommentsDiv.appendChild(showingTableTop);
		exCommentsDiv.appendChild(commentsDiv);
		if (typeof sac != 'undefined') {
				sac.addEventListener('click', fetchAllComments, false);
		}
		var showingTableBottom = showingTableTop.cloneNode(true);
		exCommentsDiv.appendChild(showingTableBottom);
		//Werid
		if (typeof sac != 'undefined') {
				showingTableBottom.getElementsByTagName('td')[1].getElementsByTagName('a')[0].addEventListener('click', fetchAllComments, false);
		}



		exploreBody.appendChild(exCommentsDiv);




		//Override functions
		unsafeWindow.showRelatedVideosResponseParent = unsafeWindow.showRelatedVideosResponse;
		unsafeWindow.showRelatedVideosResponse = function(req) {
				unsafeWindow.showRelatedVideosResponseParent(req);
				resize();
		}

		unsafeWindow.setContentLoaded = function() {};

		var resize = function() {
			removeMutationEvents();
			var vidposY = findPosY(nembed);
			var height = (unsafeWindow.innerHeight - vidposY) - 10;
			nembed.setAttribute("height", height);
			td_right_side.style.height = height + "px !important";

			if (window.innerHeight < document.body.offsetHeight) {
					var diff = document.body.offsetHeight - window.innerHeight;

					var newheight = nembed.getAttribute('height') - (diff + 18);

					nembed.setAttribute("height", newheight);

			}

			var exploreBody = $('exploreBody');

			var contents = $x('//div[@class="exploreContent"]');
			//var side_results = $('side_results');

			var exploreHeight = (unsafeWindow.innerHeight - findPosY(exploreBody)) - 25;

			if (exploreHeight <= 45) {
					exploreHeight = 100;
			}

			exploreBody.style.height = exploreHeight + "px !important";

			var content;
			for each (content in contents) {
				content.style.height = (exploreHeight - 45) + "px !important";
			}

			registerMutationEvents();

		}

		var timeoutId;

		var delayedResize = function() {
				if (timeoutId) {
					clearTimeout(timeoutId);
				}

				timeoutId = setTimeout(resize, 100);
		}

		var eles = new Array($('-moogoo-left-side-cell'), $('aboutVidDiv'));
		var events = new Array('DOMAttrModified', 'DOMNodeInserted', 'DOMNodeRemoved', 'DOMNodeRemovedFromDocument', 'DOMNodeInsertedIntoDocument', 'DOMCharacterDataModified') 

		var registerMutationEvents = function() {
				for each (ele in eles) {
					for each (event in events) {
						ele.addEventListener(event, delayedResize, false);
					}
				}
		}

		var removeMutationEvents = function() {
				for each (ele in eles) {
					for each (event in events) {
						ele.removeEventListener(event, delayedResize, false);
					}
				}
		}
 

		unsafeWindow.addEventListener('resize', resize, false);
		//unsafeWindow.addEventListener('load', registerMutationEvents, false);
		//unsafeWindow.document.addEventListener('DOMAttrModified', resize, false);
		resize(); 


		//var embed = $('playerDiv').getElementsByTagName('embed')[0];

		//embed.width = String(interactDiv.parentNode.offsetWidth - 10);
		//embed.height = String(interactDiv.parentNode.offsetHeight - 10);
		//$('playerDiv').style.background = "#000;";
		//embed.setAttribute("bgcolor", '#000000');
				
}) ();




