VidzBigger

By qufighter Last update Sep 23, 2009 — Installed 13,766 times. Daily Installs: 20, 7, 17, 32, 26, 23, 12, 15, 15, 13, 13, 25, 20, 19, 22, 13, 14, 22, 23, 22, 11, 14, 5, 16, 16, 19, 20, 15, 24, 8, 19, 28

There are 85 previous versions of this script.

the source is over 100KB, syntax highlighting in the browser is too slow

// ==UserScript==
// @name           VidzBigger
// @namespace      http://vidzbigger.com
// @description   Automatically Scale YouTube Video to Largest Possible Size Scroll down to read comments without missing video 
// @include       http://*.youtube.tld/*
// @include       http://youtube.tld/*
// @include       http://video.google.tld/*
// @include       http://www.dailymotion.com/*
// @include       http://www.metacafe.com/*
// @include       http://www.hulu.com/*
// @include       http://www.escapistmagazine.com/*
// @include       http://*vidzbigger.tld/*
// @match         http://www.youtube.com/watch*
// @exclude       http://vidzbigger.com/demo*
// @exclude       http://vidzbigger.com/videoSimple*
// @exclude       http://vidzbigger.com/blog*
// @exclude       http://video.google.tld/videosearch*
// @exclude       http://*youtube.tld/copyright*
// @exclude       http://*youtube.tld/my*
// @exclude       http://*youtube.tld/user*
// @exclude       http://*digg.com/tools*
// ==/UserScript==  
	
////*****************************************************************************///
///                                                                               //
//        LOOKS LIKE YOU FORGOT TO ENABLE GreaseMonkey!  Click the monkey!        //
//                                                                                //
//   (the monkey is located in the bottom right corner of your firefox window)    //
//   (in the status bar,which you can show using view status bar if you need)     //
//                                                                                //
//    Once the monkey is Lit Up (not grey) click your back button and try again!  //
//                                                                                //
//               SORRY IE USERS-NO SUPPORT for GreaseMonkey Yet.                  //
//                 Download Firefox and/or visit VidzBigger.com                   //
//                                                                                //
//********************************************************************************//
//********************************************************************************//
//*******************************************************************************//
//******************************************************************************//
var vidz_Version=0.055;
var startTime=new Date().getTime();

var detectn = false;
if(new String(navigator.userAgent).indexOf('Chrome/')>0){
	detectn = true;
}

if( typeof(GM_xmlhttpRequest)=='undefined' ){
function GM_xmlhttpRequest(obj){
	prHTM='<iframe id="tv_brsr" style="overflow:scroll;display:block" src="'+(obj.url)+'" width="100" height="100"></iframe>';
	var lastRequest=document.createElement("DIV");
	lastRequest.setAttribute('style','display:none;');
	document.body.appendChild(lastRequest);
	lastRequest.innerHTML=prHTM;
return;	}}

var styleelem;
if( typeof(GM_addStyle)=='undefined' ){	
function GM_addStyle(styles){
	styleelem = document.createElement('style');
	styleelem.type = 'text/css';
	styleelem.appendChild(document.createTextNode(''+styles+''));
	GM_addStyle=function(styles){
		styleelem.appendChild(document.createTextNode(''+styles+''));
	}
	VM_AppendStyles=function(){if(styleelem){//dont't append hte element until its mostly loaded with text nodes
		(document.getElementsByTagName('head')[0]||document.body).appendChild(styleelem);
	}}
}
}
if (typeof(GM_setValue)=='undefined'||GM_getValue('valtsave',false) ) {
  function GM_setValue(name, value) {
    var date = new Date();
    date.setTime(date.getTime() + (365 * 24 * 60 * 60 * 1000));   // expires one-year later
    var expires = "; expires="+date.toGMTString();
    document.cookie = name + "=" + value + expires + "; path=/";
  };
}
if(typeof(GM_getValue)=='undefined'||GM_getValue('valtsave',false)) {
  function GM_getValue(name, defaultValue) { 
    var nameEQ = name + "=";
    var cookieArr = document.cookie.split(';');
    for(var i=0;i < cookieArr.length;i++) {
      var cookie = cookieArr[i];
      cookie = cookie.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
      if (cookie.indexOf(nameEQ) == 0){//rt:Boolean,Integer,String
      	var theval = cookie.substring(nameEQ.length, cookie.length);
      	switch(theval){
	        case 'true': return true;
	        case 'false': return false;
	        default:var intval = new Number(theval);if(!isNaN(intval))return intval;return theval;
    	  }
      }
    }
    return defaultValue;
  };
}
///////////////////////////// START OF STRING FUNCTIONS /////////////////////////////
// Extends the String object with a trim funcion
String.prototype.trim=function(){
	return this.replace(/^\s+|\s+$/g,"");
};
// Extends the String object with a replace funcion,does the infinity replace (not just one instance)
String.prototype.qreplace=function(qsearch,qreplace){
	return this.split(qsearch).join(qreplace);
};
String.prototype.qslice=function(before,after){
	var s = this.indexOf(before)+before.length; 
	return this.substr(s,this.indexOf(after,s)-s);
}
// Adds !important to CSS rules of any type
String.prototype.makeImportant=function(){
	var Selector,DeclarationBlock,CssArray=this.match(/([^{]+)({[^{}]+})/);
	if (CssArray===null){
		// Inline CSS rule (e.g. "display: none") or scripting rule (e.g. element.style.display="none")
		Selector="";
		DeclarationBlock=this;
	}
	else{
		// Complete CSS rule (e.g. ".nd{display: none}")
		Selector=CssArray[1];
		DeclarationBlock=CssArray[2];
	}
	// Adds !important to each rule
	if (DeclarationBlock.indexOf(":") !=-1){
		DeclarationBlock=DeclarationBlock.replace(/[^:;{}]+:[^:;{}]+/g,"$& !important");
	}
	else{
		// No estructure could be recognized,so we'll just add !important
		DeclarationBlock+=" !important";
	}
	// Remove any !important duplicates
	DeclarationBlock=DeclarationBlock.replace(/(?:\s*!important\s*){2,}/gi," !important");
	return Selector+DeclarationBlock;
};
//Transforms a number into a valid CSS dimension (in pixels)
Number.prototype.toCSS=function(){
	return String(Math.round(new Number(this)))+"px";//maybe I should use this more...
};
String.prototype.CSStoInteger=function(){
	return this.qreplace('px','');
}
function _vt(id){// i like this saves so much time
	if(document.getElementById(id))//i hope thats not an expensive test
		return document.getElementById(id);
	else
		return false;
}

//added by vidzbigger// dolla g is only to be used if u already guaranteed with if(_vt('id')) (should only be called if nexted in an if statement using dolla $^
function $g(id){return document.getElementById(id);}
unwin = window;//:0
if( typeof(unsafeWindow)!='undefined' ) unwin=unsafeWindow;
unwin.colWidth=new Number(GM_getValue('colWidth','360'));
//unwin._vt=function(id){return _vt(id);}//not compatable...
var wUrl=new String(window.location);
/////////////////////////////START CSS STUFF FUNCTIONS /////////////////////////////
var scriptStyles=[];
// Adds a class to set anchors' text decoration
// Anchors with the class and descendant anchors of elements with the class are affected (text-decoration isn't automatically inherited)
scriptStyles.push("a.gsanchors,.gsanchors a{text-decoration: none}");
scriptStyles.push("a.gsanchors:hover,.gsanchors a:hover{text-decoration: underline}");
// Adds classes and a style for the easy-to-use download links (and its parent div)
scriptStyles.push(".gsdownloadLinks{margin: 0px 4px;font-weight: bold}");
scriptStyles.push(".gsdownloadLinkDisabled{color: gray;cursor: default}");
scriptStyles.push("#gsdownloadLinksDiv{border-top: 1px solid #CCCCCC;padding-top:5px;padding-left:10px;padding-bottom:3px;}");
//scriptStyles.push(".expand-content{height:300px;overflow:auto;overflow-x:hidden;position:relative;}");
//VB styles...
scriptStyles.push("#vizbigger_title{text-align:center;color:black;position:relative;}");
scriptStyles.push("#vidzBPrefsHolder{padding:5px;background-color:black;color:white;border:1px solid white;border-top:1px solid none;}");
scriptStyles.push("#vidzBPrefsHolder h3{border-top:1px solid #444; margin:2px;}");
scriptStyles.push("#vizbigger_footer{padding-top:10px;}");
scriptStyles.push(".vidzb_pref_row{padding:2px;position:relative;padding-right:10px;}");
scriptStyles.push("#vizbigger_content_column_left,#vizbigger_content_column_right{overflow:auto;overflow-x:hidden;}");
scriptStyles.push("#vidzbigger_prefs_menu input{font-size:10px;}");
scriptStyles.push("#vidzbigger_prefs_menu select{font-size:12px;}");
scriptStyles.push("#vb_scr_indiv {cursor:w-resize}");

//all sites
scriptStyles.push("body{margin:0px;overflow-x:hidden;}");
//These work great because u can nest them in a hirearchy!Seems not to work correct above always (a tags)
GM_addStyle(
"body{margin:0px;overflow-x:hidden;}"+"\r\n"+
"#vidz_message a{color:#4444FF;}"+"\r\n"+
"#vidzbigger_prefs_menu   a{color:#52A3EE;}");//52a3ee //52A3EE
////////////////////////////// END OF GLOBAL CSS STYLES //////////////////////////////
//thus begins                   var definitions 
unwin.ids_vb_hold="vizbigger_all_content_holder";
unwin.ids_vb_head="vizbigger_head";
unwin.ids_vb_titl="vizbigger_title";
unwin.ids_vb_foot="vizbigger_footer";
unwin.ids_vb_cont="vizbigger_content_area";
unwin.ids_vb_left="vizbigger_content_column_left";
unwin.ids_vb_midl="vizbigger_content_column_center";
unwin.ids_vb_rigt="vizbigger_content_column_right";

//lets us assign an ID to elements that only have a class... although it only matches the first result!
unwin.getElementByClassNameAndAssignID=function(searchelem,clasname,newid,idx){	
	if( searchelem.getElementsByClassName ){
		var elm = searchelem.getElementsByClassName(clasname)[0]
		if( elm ){
			 elm.id=newid;
			return elm;
		}
	}
	/*//attempt that failed, above is superior anyway 
	if( !searchelem.childNodes ) return;
	var q = "@class("+ clasname + ")";
	var elem=$x1("//]",searchelem)
	elem.id=newid;
	alert(elem.id);
	return elem;
	*/
	var cnt=0;var cn=searchelem.childNodes;
	if(typeof(idx)=='undefined') idx=0;
	for(var c=0;c<cn.length;c++){
		if(cn[c].className==clasname){
			cnt++;
			if(cnt>idx){
				var elem=cn[c];
				elem.id=newid;
				return elem;
			}
		}else if(cn[c].childNodes.length>0){
			unwin.getElementByClassNameAndAssignID(cn[c],clasname,newid);
		}
	}
}
unwin.vidzb_GrabNode=function(nodid){ if(_vt(nodid))return $g(nodid);	else return document.createElement('div');}
unwin.vidzb_GrabAndRemoveNode=function(nodid){if(_vt(nodid)) return $g(nodid).parentNode.removeChild($g(nodid));	else return document.createElement('div');}
unwin.videoitselfchildNodenumber=0;
unwin.jsapimessage='';
unwin.siteID=0;
//decoes data 
function decodeIncomingData(dattastr){
	var outData=[];
	var datapieces=dattastr.split('<br/>');

	for(i in datapieces){
		var datapiece=new String(datapieces[i]);
		var dataNameVal=datapiece.split("=>");
		if( dataNameVal[0] && dataNameVal.length > 1 )
			outData[dataNameVal[0]]=dataNameVal[1];
	}	
	return outData;
}
//....................................................................
// Events Factory // Copyright (c) 2005 Tim Taylor Consulting
//....................................................................
window.cevents={
	register : function(element,type,func){
		if (element.addEventListener){
			element.addEventListener(type,func,false)
		} else if (element.attachEvent){
			if (!element._listeners) element._listeners=[]
			if (!element._listeners[type]) element._listeners[type]=[]
			var workaroundFunc=function(){
				func.apply(element,[])
			}
			element._listeners[type][func]=workaroundFunc
			element.attachEvent('on'+type,workaroundFunc)
		}
	}
}
//END EVENTS FACTORY*****************************************************
unwin.adDivInfos=[];
unwin.vb_replacementAds=[];
unwin.vb_replacementAds['nothing']='';// these are defaults, can be overriden if vidzb_allowMyObnoxiousAds is checked in preferences under advertising
unwin.vb_replacementAds['box']='<div>Ad Blocked by <a href="http://www.vidzbigger.com/">VidzBigger.org</a> Beta</div>';
unwin.vb_replacementAds['skyscraper']='<div>Ad Blocked by <a href="http://www.vidzbigger.com/">VidzBigger.org</a> Beta</div>';
unwin.vbisreadytogo=true;
unwin.ids_vb_indi='vb_scr_indiv';
//GOOGLE*****************************************
if(wUrl.indexOf('video.google.')>0){
	if(wUrl.indexOf('videoplay')>0){
		/*unwin.getElementByClassNameAndAssignID(_vt('abs-video-container'),'titlebar','titlebar');
		unwin.getElementByClassNameAndAssignID(_vt('titlebar'),'titlebar-title','titlebar-title');
		unwin.ids_all_holder_hide='baseDiv';
		unwin.ids_video_holder='player';
		unwin.ids_video_positioner='player';
		unwin.ids_left_column='top-pane';
		//unwin.ids_left_column2='tv-related';
		unwin.ids_right_column='bottom-pane';
		unwin.ids_title='titlebar';
		unwin.ids_texttitle='titlebar-title';
		unwin.ids_header0='gbar,guser';
		unwin.ids_header='header';
		unwin.ids_header2='titlebar';
		unwin.ids_footer='guser';
		//unwin.ids_footer2='gbar';
		unwin.watchStrings='video.';
		unwin.videoitselfchildNodenumber=0;	*/
	}else{
		scriptStyles.push("#vizbigger_footer{border-top:1px solid #C9D7F1;}");
		scriptStyles.push("#gbar{display:block;}");
		scriptStyles.push("#guser{display:block;}");
		scriptStyles.push("#gbi{display:block;top:auto;top:-5px;}");
		scriptStyles.push(".gb2{display:block;}");
		scriptStyles.push("#vidzbigger_prefs_menu{top:19px;}");
	} 
	if(wUrl.indexOf('videosearch')>0){	
		//http://video.google.com/videosearch?q=cool+videos&hl=en&emb=0&aq=f#	
		unwin.ids_all_holder_hide='baseDiv';
		unwin.ids_video_holder='iplay-embed-container';
		unwin.ids_video_positioner='iplay-embed';
		unwin.ids_left_column='search-results';
		//unwin.ids_left_column2='iplay-container';
		unwin.ids_right_column='iplay-container';
		unwin.ids_title='iplay-title';
		unwin.ids_texttitle='current-title';
		unwin.ids_header0='gbar,guser';
		unwin.ids_header='videoheader';
		unwin.ids_header2='resultsheadertable';
		if(_vt('resultsheadertable')){
			_vt('resultsheadertable').nextSibling.nextSibling.id="suggestheadertable";
			unwin.ids_header3='suggestheadertable';}
		//unwin.ids_footer='gbar';
		//unwin.ids_footer2='guser';
		unwin.watchStrings='video.';
		//unwin.videoitselfchildNodenumber=0;
		scriptStyles.push("body{overflow-y:auto;}");
		scriptStyles.push("#tv-related{width:"+unwin.colWidth+"px;position:relative;height:auto;overflow:expand;}");
		scriptStyles.push(".video-list-row{display:inline-table;width:160px;}");
		scriptStyles.push("#video-data-spacer{top:auto;height:auto;position:relative;}");
		scriptStyles.push("#video-data{height:auto;}");
		scriptStyles.push("#search-results{height:auto;}");
		scriptStyles.push("#related-box{position:relative;}");
	}else{
		//http://video.google.com/?hl=en
		unwin.getElementByClassNameAndAssignID(_vt('hotstuff'),'hot_videos_title_bar','hot_videos_title_bar');
		unwin.getElementByClassNameAndAssignID(_vt('hotstuff'),'metadata','right1');
		unwin.ids_all_holder_hide='baseDiv';
		unwin.ids_video_holder='hs_player';
		unwin.ids_video_positioner='hs_player';
		unwin.ids_left_column='thumbnail_grid';
		unwin.ids_right_column='right1';
		unwin.ids_right_column2='recommended-pane';
		//unwin.ids_title='watch-vid-title';
		unwin.ids_texttitle='hs_title_link';
		unwin.ids_header0='gbar,guser';
		unwin.ids_header='videoheader';
		unwin.ids_header2='hot_videos_title_bar';
		if(_vt('resultsheadertable')){
			_vt('resultsheadertable').nextSibling.nextSibling.id="suggestheadertable";
			unwin.ids_header3='suggestheadertable';}
		//unwin.ids_footer='gbar';
		//unwin.ids_footer2='guser';
		unwin.watchStrings='video.';
		scriptStyles.push(".video-list-item{height:180px;}");
		scriptStyles.push(".thumbnail_grid{clear:both;}");
		scriptStyles.push(".thumbnail_grid td{vertical-align:top;display:inline-table;}");
		scriptStyles.push(".video{font-size:12px;}");
		scriptStyles.push(".thumbnail img{padding-right:50px;}");
		scriptStyles.push(".title,.title img{height:auto;position:relative;}");
		scriptStyles.push("td.right {text-align:right;width:"+unwin.colWidth+"px;}");
		scriptStyles.push(".page-numbers{float:right;}");
		scriptStyles.push(".hot_videos_title_bar{background:#F0F7F9 none repeat scroll 0 0;border-top:1px solid #6B90DA;margin-bottom:7px;width:100%;}");
	}
//YOUTUBE*****************************************
}else if(wUrl.indexOf('youtube.')>0){
	unwin.siteID=1;
	unwin.ids_all_holder_hide='baseDiv';
	unwin.ids_video_holder='watch-player-div';
	unwin.ids_video_positioner='watch-this-vid';
	unwin.ids_left_column='watch-this-vid-info';
	unwin.ids_right_column='watch-other-vids';
	unwin.ids_title='watch-vid-title';
	unwin.ids_header='masthead';
	unwin.ids_footer='footer';
	unwin.ids_footer2='copyright';
	unwin.ids_downloadLinks='watch-video-details-inner';
	unwin.watchStrings='watch';
	scriptStyles.push("#watch-longform-buttons{display:block;position:absolute;top:0px;right:"+(unwin.colWidth-100)+"px;z-index:999;}");
	scriptStyles.push("#annotations-toggle-switch{display:inline;z-index:999;}");
	scriptStyles.push("#watch-video-quality-setting{height:auto;}");
	scriptStyles.push(".watch-tabs{width:"+unwin.colWidth+"px;}");
	scriptStyles.push(".watch-video-response{width:67px;}");
	scriptStyles.push(".v90WideEntry{width:92px;}");
	scriptStyles.push(".v90WrapperOuter{width:92px;}");
	scriptStyles.push(".v90WrapperInner{width:90px;}");
	scriptStyles.push(".search-settings-link{position:relative;}");
	scriptStyles.push("#watch-vid-title{position:relative;text-align:center;}");
	scriptStyles.push(".watch-comment-entry{position:relative;}");
	scriptStyles.push(".spaceholder{color:white;visibility:hidden;}");
	scriptStyles.push(".floatytitle{width:99%;margin-left:auto;margin-right:auto;}");
	scriptStyles.push("#watch-highlight-racy-box{color:grey;border:1px solid #CCCCCC;}");
	scriptStyles.push("#watch-views-div{width:120px;}");
	scriptStyles.push("#watch-rating-div{width:220px;}");
	scriptStyles.push("#ratingWrapper{width:166px;}");
	scriptStyles.push("#search-form{padding-left:270px;}");
	scriptStyles.push("#save-changes-div{display:block;}");
	scriptStyles.push(".links{padding-bottom:0px;}");
	scriptStyles.push("#copyright{padding:0px;}");
	scriptStyles.push(".basic-dropdown-link .dropdown{font-size:9px;line-height:10px;}");
	//scriptStyles.push(".yt-dropdown-menu li{font-size:9px;line-height:10px;}");
	//scriptStyles.push(".yt-menulink-menu li a{font-size:8px;line-height:9px;}");
	scriptStyles.push(".watch-comment-action{position:absolute;top:0px;right:65px;}");
	if(new String(navigator.userAgent).indexOf('Firefox/2')>0){
		if((wUrl.indexOf('/user/')>0 || wUrl.indexOf('/profile')>0) && wUrl.indexOf('&eurl=')<0)
			scriptStyles.push("#util-links{position:relative;top:40px;}");//firefox2 youtube
	}
	scriptStyles.push(".user-thumb-medium div{margin-left:0px;width:0px;}");
	unwin.adDivInfos.push(Array('watch-channel-brand-div','box'));
	unwin.adDivInfos.push(Array('myAd_pva','box'));
	unwin.adDivInfos.push(Array('ad_creative_1','skyscraper'));
	unwin.adDivInfos.push(Array('chrome-promo','nothing'));//don't get me wrong I like chrome its just that vidzbigger does not work in it :/		YET...
//ESCAPIST*****************************************
}else if(wUrl.indexOf('escapistmagazine.')>0){
	unwin.ids_video_holder='video_player';
	unwin.ids_video_positioner='video_player';
	unwin.ids_left_column='content';
	unwin.ids_right_column='right_column';
	unwin.ids_title='video_detail_header';
	unwin.ids_header='site_header';
	unwin.ids_header2='site_menu';
	unwin.ids_footer='legal';
	unwin.ids_footer2='site_footer';
	unwin.watchStrings='/view';
	scriptStyles.push("#legal{margin-top:80px;}");
	scriptStyles.push("#site_header {width:1000px;margin:auto;}");
	scriptStyles.push("#site_menu {width:1000px;margin:auto;padding-left:0px;}");
	scriptStyles.push("body {background-image:none;}");
	scriptStyles.push("#video_detail_header{background-color:white;}");
	scriptStyles.push(".headline{width:auto;text-align:center;}");
	scriptStyles.push(".tags{width:auto;text-align:center;}");
	scriptStyles.push("#site_footer{width:1000px;margin:auto;}");
	scriptStyles.push("#ad_rectangle{height:auto;}");
	scriptStyles.push("#right_column{width:345;padding-left:15px;}");
	scriptStyles.push(".filmstrip_video{margin-left:25px;}");
	unwin.adDivInfos.push(Array('topads','box'));
	unwin.adDivInfos.push(Array('ad_rectangle','box'));
//HULU*****************************************
}else if(wUrl.indexOf('hulu.')>0){	
	unwin.getElementByClassNameAndAssignID(document.body,'fluid bar','id_fluid_bar');
	unwin.getElementByClassNameAndAssignID(document.body,'fluid','id_rightcol');
	unwin.getElementByClassNameAndAssignID(document.body,'fluid footer','dm_footer',0);
	unwin.getElementByClassNameAndAssignID(document.body,'fluid footer','dm_footer2',1);
	//http://www.hulu.com/watch/63877/family-guy-fox-y-lady
	unwin.ids_video_holder='player-container';
	unwin.ids_video_positioner='player-container';
	unwin.ids_left_column='show-and-watch-container';
	unwin.ids_right_column='description-container';
	unwin.ids_right_column2='id_rightcol';
	unwin.ids_title='description-container';
	unwin.ids_header='container';
	unwin.ids_header2='id_fluid_bar';
	unwin.ids_footer='dm_footer';
	unwin.ids_footer2='dm_footer2';
	if(wUrl.indexOf('/hd')>0){
		unwin.watchStrings='/hd';
		unwin.ids_left_column='all-container';
	}else unwin.watchStrings='/watch';
	scriptStyles.push("#all-container{min-height:500px;}");
	scriptStyles.push(".container {margin:0px;}");
	scriptStyles.push(".c0 {width:25px;}");
	scriptStyles.push(".c1 a{width:105px;display:block;}");
	scriptStyles.push(".description{width:"+unwin.colWidth+"px;}");
	window.vidzb_expnadhuluheader=function(evt){sstr="#id_fluid_bar {height:120px; !important;}";GM_addStyle(sstr);window.setTimeout(vidzb_colapshuluheader,6000)}
	window.vidzb_colapshuluheader=function(evt){sstr="#id_fluid_bar {height:30px; !important;}";GM_addStyle(sstr);}
	cevents.register(_vt('id_fluid_bar'),'mouseover',vidzb_expnadhuluheader);
	cevents.register(_vt('container'),'mouseover',vidzb_colapshuluheader);
	sstr=".absolutized {position:inline-table !important;}";
	GM_addStyle(sstr);
	
	var ht=new String(document.body.parentNode.firstChild.innerHTML)
	//ht=ht.qreplace("\n",'');
	var re = new RegExp(/video_cid = "[A-z0-9]+/);
  var m = re.exec(ht);
 	if (m == null) {
    //alert("No match");
  } else {
    var s = '';//"Match at position " + m.index + ":\n";
    for (i = 0; i < m.length; i++) {
      s = s + m[i] + "\n";
    }
    videoCID=s.qreplace('video_cid = "','');
  }
	//var standaloneurl='http://www.hulu.com/stand_alone/'+videoCID;
	//the pop out playe ris much cooler wish we could use that sinc eit scales all the time
	//../stand_alone/playerembed.swf?
	//_vt(unwin.ids_video_holder).firstChild.src='/playerembed.swf';
	//var fSEmbed='<embed id="player" height="100%" width="100%" flashvars="eid=8Li6Q36j74REF4_-kcS8DQ&lcname=SitePlayer_lcname_mc_49150_56&st=28&stage_width=512&stage_height=296" allowfullscreen="true" allowscriptaccess="sameDomain" quality="high" name="player" style="z-index: 10;" src="/playerembed.swf?referrer=http%3A//www.hulu.com/stand_alone/'+videoCID+'%3Flcname%3DSitePlayer_lcname_mc_49150_56" type="application/x-shockwave-flash"/>';
	//var fSEmbed='<object width="512" height="296"><param name="movie" value="http://www.hulu.com/embed/'+videoCID+'"></param><param name="allowFullScreen" value="true"></param><embed src="http://www.hulu.com/embed/'+videoCID+'" type="application/x-shockwave-flash" allowFullScreen="true"  width="512" height="296"></embed></object>';
	//_vt(unwin.ids_video_holder).innerHTML=fSEmbed;
	
	//'<embed height="368" width="790" flashvars="stage_width=790&amp;stage_height=368&amp;bitrate=700000&amp;user_id=-1&amp;=1&amp;=754&amp;=231&amp;content_id=m1pqcs9s&amp;cb=1238564015562" bgcolor="#000000" allowfullscreen="true" allowscriptaccess="sameDomain" quality="high" name="player" id="player" style="z-index: 10; height: 366px; width: 751px; margin-left: 0px; margin-top: 0px;" src="/player.swf" type="application/x-shockwave-flash"/>';
//DAILYMOTION*****************************************
}else if(wUrl.indexOf('dailymotion.')>0){
	unwin.getElementByClassNameAndAssignID(_vt('content'),'header_center','id_box_header');
	//unwin.getElementByClassNameAndAssignID(_vt('content'),'box_content','id_box_content');
	unwin.getElementByClassNameAndAssignID(_vt('content'),'dmco_box column span-8 left_content','id_leftcol');
	//unwin.getElementByClassNameAndAssignID(_vt('content'),'dm_widget_box sub_box proposed_by_box','id_rightcol');
	unwin.getElementByClassNameAndAssignID(_vt('content'),'dm_widget_videoplayer','videodiv_holder');
	//unwin.getElementByClassNameAndAssignID(_vt('id_box_content'),'box_header','id_box_header_2');
	//if(_vt('videodiv_holder')) $g('videodiv_holder').firstChild.id='just_videodiv_holder';
	unwin.ids_video_holder='videodiv_holder';
	unwin.ids_video_positioner='videodiv_holder';
	unwin.ids_left_column='id_leftcol';
	unwin.ids_right_column='right_content_box';
	unwin.ids_title='id_box_header';
	unwin.ids_header='header';
	//unwin.ids_header2='id_box_header_2';
	unwin.ids_footer='footer';
	unwin.watchStrings='/video';
	scriptStyles.push("body{background-image:none;");
	scriptStyles.push("div#right_content_box{margin-top:0px;}");
	//scriptStyles.push(".dm_widget_videotools {position:relative;left:0px;width:362px;}");
	//scriptStyles.push(".dm_widget_header {height:70px;}");
	//scriptStyles.push(".box_header {float:none;height:auto;}");
	//scriptStyles.push(".box_header_right {height:auto;text-align:center;}");
	//scriptStyles.push(".nav {color:grey;}");
	//scriptStyles.push(".right_title {position:relative;width:auto;}");
	//scriptStyles.push(".subtitle_link {display:none;}");
	//scriptStyles.push("#top_banner{display:none;}");
	//scriptStyles.push("#dm_header{height:auto;}");
	unwin.adDivInfos.push(Array('player_middle_ad','box'));
//METACAFE*****************************************
}else if(wUrl.indexOf('metacafe.')>0){
	unwin.ids_video_holder='FlashObj';
	unwin.ids_video_positioner='FlashObj';
	unwin.ids_left_column='AfterPlayer';
	unwin.ids_right_column='SideCol';
	unwin.ids_title='ItemContainer';
	unwin.ids_texttitle='ItemTitle';
	unwin.ids_header='Header';
	unwin.ids_header2='HeaderPos';
	unwin.ids_footer='Footer';
	unwin.watchStrings='watch';
	scriptStyles.push("body{background-image:none;}");
	scriptStyles.push("#Rate{height:55px;}");
	scriptStyles.push("#ItemInfo{clear:both;}");
	scriptStyles.push("#ItemContainer{background-color:transparent;background-image:none;}");
	scriptStyles.push("#FlashWrap{display:none;}");
	scriptStyles.push("#FlashObj{background-color:transparent;}");
	scriptStyles.push("#Tags dd{width:auto;margin-right:185px;}");
	scriptStyles.push("#Rate{position:absolute;left:0px;top:-57px;background-color:#030303;}");
	scriptStyles.push("#SocialTools{height:auto;text-align:center;}");
	scriptStyles.push("#SocialTools ul{height:25px;text-align:center;}");
	scriptStyles.push("#SocialTools li{float:none;display:inline-table;}");
	if(_vt('Rate')){ $g('Rate').innerHTML='';
		scriptStyles.push("#Rate{background-color:transparent;}");
	}
	unwin.adDivInfos.push(Array('MedRect','box'));
	unwin.adDivInfos.push(Array('MedRect2','nothing'));
//LIVELEAK*****************************************
}else if(false || wUrl.indexOf('liveleak.')>0){
	//unwin.videoitselfchildNodenumber=2;
	if(_vt('vid')){
		var vidHolderId=$g('vid').childNodes[2].id;
	}
	unwin.ids_video_holder=vidHolderId;//'vid' //kills download link :/
	unwin.ids_video_positioner=vidHolderId;
	unwin.ids_left_column='c_l';
	unwin.ids_right_column='c_r';
	unwin.ids_title='s_hd';
	unwin.ids_header='hd';
	unwin.ids_header2='nav';
	unwin.ids_footer='ft_s';
	unwin.ids_footer2='ft';
	unwin.watchStrings='view';
//FILECABI*****************************************
//http://filecabi.net/
//video.msn.com soapbox?
//PUTFILE*****************************************
}else if(wUrl.indexOf('putfile.')>0){
	unwin.ids_video_holder='vid';
	unwin.ids_video_positioner='vid';
	unwin.ids_left_column='c_l';
	unwin.ids_right_column='c_r';//these are classes no ids what a pain
	unwin.ids_title='s_hd';
	unwin.ids_header='dm_header';
	unwin.ids_footer='dm_footer';
	unwin.watchStrings='media.';
//BLIP.TV*****************************************
}else if(wUrl.indexOf('blip.')>0){
	unwin.videoitselfchildNodenumber=3;
	unwin.ids_video_holder='video_player';
	unwin.ids_video_positioner='video_player';
	unwin.ids_left_column='MetaPanel';
	unwin.ids_right_column='ContentPanel';
	unwin.ids_title='EpisodeTitle';
	unwin.ids_header='Header';
	unwin.ids_footer='Footer';
	unwin.watchStrings='blip.tv/file';
	scriptStyles.push("#Navigation{float:none;}");
	scriptStyles.push("#EpisodeTitle{float:none;text-align:center;max-width:auto;}");	
//VIDEO.AOL*****************************************
}else if(wUrl.indexOf('video.aol.')>0){	
	unwin.getElementByClassNameAndAssignID(document.body,'pnp_lf1','id_pnp_lf1');
	unwin.getElementByClassNameAndAssignID(document.body,'pnp_rt','id_pnp_rt');
	unwin.getElementByClassNameAndAssignID(document.body,'adcont','adcont');
	unwin.ids_video_holder='videoPlayerComponent';
	unwin.ids_video_positioner='videoPlayerComponent';
	unwin.ids_left_column='id_pnp_lf1';
	unwin.ids_right_column='id_pnp_rt';
	unwin.ids_title='bcau';
	unwin.ids_header='icehd';
	unwin.ids_footer='iceft';
	unwin.watchStrings='/video';
	unwin.adDivInfos.push(Array('adcont','box'));
	unwin.adDivInfos.push(Array('topads','skyscraper'));
//BREAK.COM*****************************************
}else if(wUrl.indexOf('break.')>0){
	if(_vt('video_wrap')){
		 $g('video_wrap').parentNode.id='id_left_column';
		 $g('video_wrap').parentNode.firstChild.id='id_vidtitle';
	}
	if(_vt('video_desc')) $g('video_desc').parentNode.id='id_right_column';
	unwin.ids_video_holder='defaultDiv';
	unwin.ids_video_positioner='defaultDiv';
	unwin.ids_left_column='id_left_column';//'video_wrap:::PARENTNODE';//attempt at dom travel notation
	unwin.ids_right_column='id_right_column';//'video_desc:::PARENTNODE';
	unwin.ids_title='id_vidtitle';			//'video_wrap:::PARENTNODE:::FIRSTCHILD';//what a table mess forget it
	unwin.ids_header='bman_head_top';
	unwin.ids_header2='hdr';
	unwin.ids_header3='subnav';
	unwin.ids_footer='footer';
	unwin.watchStrings='index';//this is not it
	scriptStyles.push("body{overflow:auto;}");
	scriptStyles.push("#playerwrap{height:auto;}");	
//THEONION*****************************************
}else if(wUrl.indexOf('theonion.')>0){
	unwin.videoitselfchildNodenumber=2;
	unwin.ids_video_holder='video_holder';
	unwin.ids_video_positioner='video_holder';
	unwin.ids_left_column='sidebar';//'video_wrap:::PARENTNODE';//attempt at dom travel notation
	unwin.ids_right_column='video_tabs';//'video_desc:::PARENTNODE';
	unwin.ids_title='onn_nav';			//'video_wrap:::PARENTNODE:::FIRSTCHILD';//what a table mess forget it
	unwin.ids_header='empire';
	unwin.ids_header2='header';
	unwin.ids_footer='footer';
	unwin.watchStrings='/video/';
	scriptStyles.push("#empire{position:relative;}");
	scriptStyles.push("#header{position:relative;}");
	scriptStyles.push("#sidebar{position:relative;}");
}else{
	//
	unwin.vbisreadytogo=false;
	sitecheckurl='http://www.vidzbigger.com/getsite.php?siteid='+window.location.host;
	//alert(sitecheckurl);
	GM_xmlhttpRequest({
	  method: 'GET',
	  url: sitecheckurl,
	  onload: function(responseDetails) 
	 {
			var rslt=new String(responseDetails.responseText);
			var aversiondata=rslt.qslice('<!--VZB_B-->','<!--VZB_E-->');
			aversiondata=aversiondata.qreplace('&gt;','>');
			//alert(aversiondata);
			var dDataBits=decodeIncomingData(aversiondata);
			var dsttr='';
			for( i in dDataBits ){
				if( i == 'Save' ) break;
				if(dDataBits[i].indexOf('.')===0){
					dDataBits[i]=dDataBits[i].replace('.','');
						unwin.getElementByClassNameAndAssignID(document.body,dDataBits[i],'id_'+dDataBits[i]);
						dDataBits[i] = 'id_'+dDataBits[i];				}
				unwin[i]=dDataBits[i];
				dsttr+=('['+ i + '] = '+dDataBits[i]);
			}
			if( unwin['css'] ){
				GM_addStyle(unwin['css']);
			}
			unwin.vbisreadytogo=true;
			if(typeof readyToVidsBig == 'function' )readyToVidsBig();
	  }
	});
}
if(!unwin.ids_texttitle)unwin.ids_texttitle=unwin.ids_title;
// Adds the styles from the script to the page,making them important
scriptStyles.forEach(function(s){GM_addStyle(s.makeImportant());});
//BEGIN FUNCTIONS &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
var video_bottom_button_bar_height=25;// for play button,volume,mute and stuff,cause otherwise if we don't account for it when scaling we get :ugly black bars
//var ratio=(385-video_bottom_button_bar_height)/640;//480;
var ratio=(385-video_bottom_button_bar_height)/480;
var fmt22ratio=(385-video_bottom_button_bar_height)/640;//480;

var lOpVideoWidths=[320,480,640,800,1024,1280,1600,2048,4096,8192,16384];
var lOpMinVideoWidths=[128,256,320,340,360,380,480,550,640,800,1024];
var lOpCommentCounts=[10,15,20,30,50,75,100,128,256,320,480,500];
var lOpColWidth=[150,200,250,300,320,340,360,380,400,420,440,480,550,640,800];
var lOpDisplayQualities={22:{v:22,q:'HD+'},35:{v:35,q:'HD'},34:{v:34,q:'HD-'},18:{v:18,q:'HQ'}};

unwin.lastTimer=0;
unwin.columnMode=0;
unwin.occuranceTestMonitor=0;
unwin.playerState=1;
unwin.prefsShowing=false;
unwin.defaultFlagMs='&nbsp;';// VidzBig';
unwin.defaultOverFlagMs=' &nbsp;Settings';
unwin.hasBeenAwayFromPageTopBtm=false;
unwin.needsFurtherUpdate=true;// this is a good one,if we can determine that no further changes/updates need to be made we can save a LOT of cpu,video plays back much smoother 
unwin.isLoadedOnce=false;
unwin.lastHeight=0;
unwin.lastWidth=0;
unwin.needToSavePreferences=false;
unwin.isInWatchMode=false;// are theres videos on the screens
unwin.myvideoalignThisUpdate="CENTER";
unwin.extraflashvars='';
unwin.vbmaxdisplayquality=0;//levels down from max display quality
unwin.vidzbigSITEenabled=true;//unless otherwise found
var vidzbigSITESdisabled='';

//global 1bit prefs 
unwin.vidzb_tf_prefs=[];
unwin.vidzb_tf_prefs['invertColorScheme']=false;
unwin.vidzb_tf_prefs['invertPrefColorScheme']=false;
unwin.vidzb_tf_prefs['autoScrollPastHeader']=true;
unwin.vidzb_tf_prefs['shareVideoViewStatistics']=true;//privacy
unwin.vidzb_tf_prefs['columnPriorityComments']=false;
unwin.vidzb_tf_prefs['columnScrollIndependent']=false;
unwin.vidzb_tf_prefs['prefer_png24bits']=true;
unwin.vidzb_tf_prefs['enable_jsapi']=true;//jsapi enable
unwin.vidzb_tf_prefs['biggerComments']=false;
unwin.vidzb_tf_prefs['allowPlayerClk']=false;
unwin.vidzb_tf_prefs['useHighQuality']=false;//(depricated) this one updates all links on pages to either fmt 22 or fmt 18 depending on availability... 
unwin.vidzb_tf_prefs['LoadHighQuality']=true;//when the video loads each version available is detected.  if this is true then fmt 22 is enabled when detected
unwin.vidzb_tf_prefs['animateVidThumbnails']=true;
unwin.vidzb_tf_prefs['alwaysAnimateVidThumbnails']=false;
unwin.vidzb_tf_prefs['alwaysAnimateVidThumbnails1LOOP']=false;
unwin.vidzb_tf_prefs['alwaysShowModControlsUnderVideo']=true;
unwin.vidzb_tf_prefs['preventVtBlackBars']=true;// prevent Vt black bars (above and below)
unwin.vidzb_tf_prefs['enableTopVidzBrowser']=true;
unwin.vidzb_tf_prefs['useNonFlashPlayer']=false;
unwin.vidzb_tf_prefs['dissableAnnotations']=false;
unwin.vidzb_tf_prefs['indicateHDQuality']=true;//free practically once far enough to do this... lol
unwin.vidzb_tf_prefs['donotautoplayVideos']=false;
unwin.vidzb_tf_prefs['donotautobuffer']=false;
unwin.vidzb_tf_prefs['positionVideoAutomatically']=true;//owns the b lo
unwin.vidzb_tf_prefs['centerVideoVertically']=true;//no effect?
unwin.vidzb_tf_prefs['scaleVideoAtPageBottom']=true;
//unwin.vidzb_tf_prefs['loadAllVideoResponseIcons']=false;//planned feature... easy enough... ask
unwin.vidzb_tf_prefs['flipVideo']=false;
unwin.vidzb_tf_prefs['autoLoopOnComplete']=false;
unwin.vidzb_tf_prefs['autoLoopDelay']=false;
unwin.vidzb_tf_prefs['reBrandYouTube']=false;//not re-implemented... yet...
unwin.vidzb_tf_prefs['vidzb_blockAds']=true; //site ads (as defined/submited)
unwin.vidzb_tf_prefs['vidzb_blockPlayerAds']=true; //flash player ads
unwin.vidzb_tf_prefs['vidzb_allowMyObnoxiousAds']=true; //allow vidzbigger ads to replace all youtube ones :)
unwin.vidzb_tf_prefs['autoExpandVideoDescriptions']=true;
unwin.vidzb_tf_prefs['autoConfirmAdultVideos']=false;
unwin.vidzb_tf_prefs['preventHzBlackBars']=false;		// left and right
unwin.vidzb_tf_prefs['snapfullscreenmode']=false; //UNSPECIFIED (new value), resolves to true by default based on auto configuration
unwin.vidzb_tf_prefs['fullscreenmode']=false;
unwin.vidzb_tf_prefs['delayVidzBiggerInit']=false;//delays load (1sec) so other plugins (youtrace) can finish loading first
for( z in lOpDisplayQualities ){
	unwin.vidzb_tf_prefs['l0pQualz'+lOpDisplayQualities[z].v]=true;//each quality boolen toggle
}
// so if its d3fault unwin delete value??
unwin.vidzb_last_url='';
unwin.fssnapHeight=0;

//preferences
unwin.setDefaultPreferences=function(){
	unwin.vidzbigenabled=true;
	unwin.myvideoalign="CENTER";//"LEFT"CENTER"RIGHT";
	unwin.mypreferednumcolumns=3;
	unwin.maximumVideoWidth=1280;// this can kill flash completely on any computer probably (if screens had enough resolution). Technically full screen mode performs better because it scales everything (rendering only 480x385 pixels) where as this renders a ton more pixels of flash video
	unwin.minimumVideoWidth=800;// this can ... 640
	unwin.maximumCommentCount=15;
	unwin.extraflashvars='&color1=0x000000&color2=0xDDDDDD';
	unwin.vbmaxdisplayquality=0;//levels down from max display quality
	vidzbigSITESdisabled='';
	//unwin.colWidth=360;
	unwin.jsapiRetries=5;
	for( i in unwin.vidzb_tf_prefs ){
		unwin[i]=unwin.vidzb_tf_prefs[i];
	}
}                         	
unwin.setDefaultPreferences();
unwin.vidzbadd1_html='<a target="_blank" href="http://vidzbigger.com/advertise.php">Your Ad Here</a> VidzBigger.org';

//CONSTRAINS VALUES TO THE LIST PASSSED-----------------------------------------------------------------------------
window.constrainValues=function(varib,valArr){
	for(i in valArr){
		if(valArr[i]==varib){
			return valArr[i];//found,return the value (from the array)
		}
	}
	return valArr[0];			//not found! return the first value (should be default,not first...)
}
window.cstrainIntToRange=function(varib,min,max){
	if(varib>=min && varib<=max)return varib;else return max;
}
unwin.arrayToString=function(parr){
	var ostr='';
	for(i in parr){
		ostr+=i+'=>'+parr[i]+':::';
	}
	return ostr;
}

window.savePreferences=function(){
	var atf=[true,false];
	//require values to be "safe" acceptable values (since we store this in preferences
	unwin.vidzbigenabled=constrainValues(unwin.vidzbigenabled,atf);
	unwin.myvideoalign=constrainValues(unwin.myvideoalign,Array("LEFT","CENTER","RIGHT"));
	unwin.mypreferednumcolumns=constrainValues(unwin.mypreferednumcolumns,Array(2,3));
	unwin.maximumVideoWidth=constrainValues(unwin.maximumVideoWidth,lOpVideoWidths);
	unwin.minimumVideoWidth=constrainValues(unwin.minimumVideoWidth,lOpMinVideoWidths);
	unwin.maximumCommentCount=constrainValues(unwin.maximumCommentCount,lOpCommentCounts);
	unwin.colWidth=constrainValues(unwin.colWidth,lOpColWidth);
	unwin.jsapiRetries=cstrainIntToRange(unwin.jsapiRetries,0,12);
	unwin.vbmaxdisplayquality=cstrainIntToRange(unwin.vbmaxdisplayquality,0,9);

	for( i in unwin.vidzb_tf_prefs ){
		unwin[i]=constrainValues(unwin[i],atf);
	}
	//all input we are saving should now be clean!		
	GM_setValue('vidzbigenabled',unwin.vidzbigenabled);
	GM_setValue('vidzbigSITESdisabled',vidzbigSITESdisabled);
	GM_setValue('myvideoalign',unwin.myvideoalign);
	GM_setValue('mypreferednumcolumns',unwin.mypreferednumcolumns);
	GM_setValue('maximumVideoWidth',unwin.maximumVideoWidth);
	GM_setValue('minimumVideoWidth',unwin.minimumVideoWidth);
	GM_setValue('colWidth',unwin.colWidth);
	GM_setValue('maximumCommentCount',unwin.maximumCommentCount);
	GM_setValue('jsapiRetries',unwin.jsapiRetries);
	GM_setValue('extraflashvars',unwin.extraflashvars);
	GM_setValue('vbmaxdisplayquality',unwin.vbmaxdisplayquality);
	for( i in unwin.vidzb_tf_prefs ){
		GM_setValue(i,unwin[i]);
	}
	GM_setValue('lastKnownVersionUsed',''+vidz_Version);	
	unwin.needToSavePreferences=false;//since we just savd
	unwin.SETvidz_message('<span style="color:#44FF44;">&nbsp;Preferences Saved</span>');
} 

window.loadPreferences=function(){//add constrained values...
	unwin.vidzbigenabled=GM_getValue('vidzbigenabled',unwin.vidzbigenabled);
	vidzbigSITESdisabled=GM_getValue('vidzbigSITESdisabled',vidzbigSITESdisabled);
	unwin.myvideoalign=GM_getValue('myvideoalign',unwin.myvideoalign);
	unwin.mypreferednumcolumns=GM_getValue('mypreferednumcolumns',unwin.mypreferednumcolumns);
	unwin.maximumVideoWidth=GM_getValue('maximumVideoWidth',unwin.maximumVideoWidth);
	unwin.minimumVideoWidth=GM_getValue('minimumVideoWidth',unwin.minimumVideoWidth);
	unwin.maximumCommentCount=GM_getValue('maximumCommentCount',unwin.maximumCommentCount);
	unwin.jsapiRetries=GM_getValue('jsapiRetries',unwin.jsapiRetries);
	unwin.extraflashvars=GM_getValue('extraflashvars',unwin.extraflashvars);
	unwin.vbmaxdisplayquality=GM_getValue('vbmaxdisplayquality',unwin.vbmaxdisplayquality);
	for( i in unwin.vidzb_tf_prefs ){
		unwin[i]=GM_getValue(i,unwin[i]);
	}
	if(unwin.snapfullscreenmode==3)unwin.snapfullscreenmode=unwin.autoScrollPastHeader?true:false;//'Cool trick' I can use to define a new default value for you based on your existing preferencez...
	unwin.lastKnownVersionUsed=GM_getValue('lastKnownVersionUsed',''+vidz_Version);
  unwin.fullscreenmode=false;//GM_getValue('fullscreenmode',unwin.fullscreenmode)||unwin.snapfullscreenmode;
  if(vidzbigSITESdisabled.length>0){//if this sites is in the disabled sites string, disable this site
  	if( vidzbigSITESdisabled.indexOf(window.location.host) > 0 )unwin.vidzbigSITEenabled=false;
  }
}
	
unwin.preferencesToString=function(){
	var parr=[];
	parr['vidzbigenabled']=unwin.vidzbigenabled;
	parr['vidzbigSITESdisabled']=vidzbigSITESdisabled;
	parr['myvideoalign']=unwin.myvideoalign;
	parr['mypreferednumcolumns']=unwin.mypreferednumcolumns;
	parr['maximumVideoWidth']=unwin.maximumVideoWidth;
	parr['minimumVideoWidth']=unwin.minimumVideoWidth;
	parr['vidzbcolWidth']=unwin.colWidth;
	parr['maximumCommentCount']=unwin.maximumCommentCount;
	parr['jsapiRetries']=unwin.jsapiRetries;
	parr['extraflashvars']=unwin.extraflashvars;
	parr['vbmaxdisplayquality']=unwin.vbmaxdisplayquality;
	for( i in unwin.vidzb_tf_prefs ){
		parr[i]=unwin[i];
	}
	parr['lastKnownVersionUsed']=''+vidz_Version;
	parr['fullscreenmode']=unwin.fullscreenmode;
	return unwin.arrayToString(parr);
}
// FORCE THE NEXT FUNCTION TO OCCUR COMPLETELY BY CLEARING SAVED STATE
unwin.forcevidzb_apply_selected_fixes=function(){
	unwin.p_refreshPrefs();
	if(!unwin.isInWatchMode) return false;
	unwin.needsFurtherUpdate=true;//force update
	unwin.hasBeenAwayFromPageTopBtm=false;
	unwin.lastHeight=0;
	unwin.lastWidth=0;
	unwin.vidzb_initialSetupAndResize();
	unwin.vidzb_apply_selected_fixes();
	//unwin.occuranceTestMonitor++;//expected: 1
}
unwin.headerHeight=0;
var foldAttempts=0;
var vbfoldRadius=11;//how thick the area that catches the video and forces it fullscreen is defined here... fold stickyness quotient... defines how easy to scroll past unscaled
// LOCKS THE VIDEO IN PLACE AND PERFORMS OTHER CLEANUP AND SIZE ORIENTATION FUNCTIONS (main function)
unwin.vidzb_apply_selected_fixes=function(){
	if(!unwin.isInWatchMode) return false;
	var startTime=new Date().getTime();
	//unwin.occuranceTestMonitor++;//expected: 1
	unwin.p_updatePrefwinHeight();//if pref win is showing make sure its Height fits on screen! (critical for 800x600)
	if(!unwin.needsFurtherUpdate) return true;
	unwin.myvideoalignThisUpdate=unwin.myvideoalign;
	unwin.headerHeight=unwin.getElementYpos($g(unwin.ids_vb_cont));//unwin.getElementHeight($g(unwin.ids_vb_head))+unwin.getElementHeight($g(unwin.ids_vb_titl))+10;
	var win_scr=unwin.getScroll();
	var scr=win_scr;
	var totalWindowHeight=unwin.getWindowHeight();
	var wHei=totalWindowHeight;
	var minm=unwin.headerHeight;//+15;//-0;//Approximate height of the header
	unwin.columnsavailable=3;
	var rightColTopPush=0;
	var colWidth=new Number(unwin.colWidth);//col width 360
	var extraVideoSpace=0;

	//if unwin.fssnapHeight is greater than zero too early... fail, or guarantee success??
	//alert(unwin.snapfullscreenmode && unwin.fullscreenmode && unwin.fssnapHeight>0 && win_scr!=unwin.fssnapHeight);
	if(unwin.snapfullscreenmode && unwin.fssnapHeight>0 || unwin.fullscreenmode ){
		if(!unwin.fullscreenmode && win_scr!=unwin.fssnapHeight&&Math.abs(win_scr-unwin.fssnapHeight)< vbfoldRadius ){
			win_scr=unwin.fssnapHeight,window.scroll(0,win_scr);//i suppose important to check in case of either condition below to avoid extra flips, although it makes scrolling sticky
			foldAttempts=0;//every time it moves zero the counter
		}else foldAttempts++;
		if( unwin.fullscreenmode && win_scr!=unwin.fssnapHeight ){
			//alert('leave?'+unwin.fullscreenmode +' '+ win_scr+' '+unwin.fssnapHeight);
			unwin.leaveFullscreen();return;
		}else if( !unwin.fullscreenmode && win_scr==unwin.fssnapHeight ){
			if(foldAttempts>3)unwin.goFullscreen();
			else window.setTimeout(function(){unwin.vidzb_apply_selected_fixes()},detectn?300:200);
			if(foldAttempts!=1)return;
		}
	}
	
	// THIS is independent col scrolling part 1
	if(unwin.needsFurtherUpdate){ 		
		if(unwin.columnScrollIndependent){
			var footerHeight=0;//unwin.getElementHeight($g(unwin.ids_vb_foot));
			var finHeight=totalWindowHeight-10;
			if(!unwin.autoScrollPastHeader){
				finHeight-=unwin.headerHeight+footerHeight;
				//if(unwin.myvideoalign !='RIGHT')
				extraVideoSpace=22;
			}else{
				extraVideoSpace=5;//not in 2 col
			}
			colWidth+=18;
			_vt(unwin.ids_vb_left).style.height=finHeight.toCSS();
			_vt(unwin.ids_vb_rigt).style.height=finHeight.toCSS();
			_vt(unwin.ids_vb_foot).style.height='0px';
			_vt(unwin.ids_vb_foot).style.overflow='hidden';

		}else{
			_vt(unwin.ids_vb_foot).style.height='auto';
			_vt(unwin.ids_vb_foot).style.overflow='auto';
			_vt(unwin.ids_vb_left).style.height='auto';
			_vt(unwin.ids_vb_rigt).style.height='auto';
		}
		_vt(unwin.ids_vb_left).style.width=new Number(colWidth).toCSS();
		_vt(unwin.ids_vb_rigt).style.width=new Number(colWidth).toCSS();
		//_vt(unwin.ids_vb_midl).style.marginLeft=colWidth.toCSS();
		//_vt(unwin.ids_vb_midl).style.marginRight=colWidth.toCSS();
	}
	var areaOffset=0;///-10;//10;
	//if(document.getElementById('watch-high-quality-link')){
	//	areaOffset=20;
	//}	//what a mess!  needs to be re-coded sometime
	
	minm-=areaOffset;
	var wWid=unwin.getWindowWidth();
	var minw=colWidth;//col width
	var atTop=false;
	
	if(scr>minm-5){
	    scr=-minm+5;
	    //wHei-=30;
	    wHei=totalWindowHeight-areaOffset+-10;
	    if(!unwin.positionVideoAutomatically){
    		wHei-=minm-video_bottom_button_bar_height
    	}
	}else{
	    //wHei-=minm-(scr);
	    scr=areaOffset-scr+0;//r+Math.floor(20*(scr/minm));
	    //wHei-=15;//areaOffset;
	    wHei=totalWindowHeight-minm-areaOffset-scr-5;
	    
	    if(!unwin.positionVideoAutomatically){
    		wHei+=scr
    	}
    	atTop=true;
    	unwin.hasBeenAwayFromPageTopBtm=false;
	}
	
	//account for footer (shrink video if we scroll that far down so we dont' cover it
	if(unwin.scaleVideoAtPageBottom==true){
		var scrolly=unwin.getScroll();
		var atBtm=false;
		var bodyHeight=unwin.getElementHeight(document.body);
		var footerStart=unwin.getElementYpos(document.getElementById(unwin.ids_vb_foot));
		if(scrolly+wHei>footerStart){
			atBtm=true;
			wHei-=(scrolly+wHei)-footerStart+0;
		 if(!unwin.positionVideoAutomatically){
    		wHei-=120;
    	}
     if(!unwin.centerVideoVertically){
    		wHei-=30;
    	}
		}
	}
	
	// width and columns
	if(wWid> ((minw<<1)+(new Number(unwin.minimumVideoWidth)+35)) && unwin.mypreferednumcolumns==3){
		minw=-35+wWid-(colWidth<<1)+Math.floor(extraVideoSpace*1.25);
		unwin.vidzb_SpreadColumns();// go to 3 column mode
		
	}else if(wWid> minw+(new Number(unwin.minimumVideoWidth)+35)){
		minw=-30+wWid-(colWidth)+Math.floor(extraVideoSpace*0.3);
		unwin.columnsavailable=2;
		if(unwin.myvideoalignThisUpdate=="CENTER") unwin.myvideoalignThisUpdate="LEFT";
		
		//unwin.ids_vb_left or unwin.ids_vb_rigt
		if(unwin.myvideoalignThisUpdate=='LEFT'){
			unwin.vidzb_ConsolodateColumns(unwin.ids_vb_rigt);
		}else{
			unwin.vidzb_ConsolodateColumns(unwin.ids_vb_left);
		}
		
	}else{
		
		minw=unwin.getWindowWidth()-35-minw;//minw;
		unwin.columnsavailable=1;
		//alert('one column not supported');//OR IS IT???...	
		if(unwin.myvideoalignThisUpdate=="CENTER") unwin.myvideoalignThisUpdate="LEFT";
		
		//unwin.ids_vb_left or unwin.ids_vb_rigt
		if(unwin.myvideoalignThisUpdate=='LEFT'){
			unwin.vidzb_ConsolodateColumns(unwin.ids_vb_rigt);
		}else{
			unwin.vidzb_ConsolodateColumns(unwin.ids_vb_left);
		}
	}
	
	if(unwin.positionVideoAutomatically){
  	document.getElementById(unwin.ids_vb_midl).style.marginTop=""+scr+"px"
  }
  
	if(unwin.fullscreenmode ){
		minw=wWid-5+(unwin.snapfullscreenmode?-15:0);//-25;
		wHei=totalWindowHeight;
		_vt(unwin.ids_vb_midl).style.marginLeft='0px';
	}
	
	//var YoutubeEnhancer=$x1("//*[@lang='fr']");

	//var decrease=totalWindowHeight-wHei;
	//get height of other controls
	if( unwin.alwaysShowModControlsUnderVideo && unwin.siteID == 1 && !unwin.fullscreenmode ){
		
		if( _vt('eLoopy') ){
			_vt('eLoopy').style.position='relative';
			wHei -= 15;//loop-over-sections-of-youtube-videos 
		}
		
		var tohei = unwin.getElementHeight($g(unwin.ids_video_holder));
		var vhei = unwin.getElementHeight(unwin.searchVideoPlayer($g(unwin.ids_video_holder)));
		var modCtrlHeight = tohei-vhei;
		wHei -= modCtrlHeight;
	}
	//if(tohei>wHei)alert(wHei+' - '+tohei+' = '+(wHei-tohei));;
	if((!unwin.hasBeenAwayFromPageTopBtm || atTop) || (atBtm && unwin.scaleVideoAtPageBottom)){
		unwin.setVideoSize(minw,wHei,totalWindowHeight,atBtm,scr);
		if(!atTop) unwin.hasBeenAwayFromPageTopBtm=true;
		if(atBtm && unwin.scaleVideoAtPageBottom) unwin.hasBeenAwayFromPageTopBtm=false;
	}
	
	if( detectn&& foldAttempts==1 ){ window.setTimeout(function(){unwin.vidzb_apply_selected_fixes()},0);return;}//y<0 = fail when set margin and height on pos fixd flash
	
	//only easy way to be sure,since comments can load much later
	var allComment=document.getElementsByName('comment');
	if(allComment.length>0){
		for(var c=0, l=allComment.length;c<l;c++){
			allComment[c].cols=36;
			allComment[c].style.width=(unwin.colWidth-10)+"px";
		}
	}
	
	//SAVE ON THAT CPU BABY
	if(unwin.isLoadedOnce && !unwin.scaleVideoAtPageBottom && !unwin.positionVideoAutomatically){
		unwin.needsFurtherUpdate=false;
		//alert('hai-you just saved some cpu');
	}
	
	var d=new Date();
	var endTime=d.getTime();
	unwin.lastTimer=((endTime-startTime)/1000);
	if(_vt('lastTimer')){
		$g('lastTimer').innerHTML=unwin.lastTimer;//probably slows it down but good for dev
	}
	
	if( unwin.snapfullscreenmode ){
		var totHeight = unwin.getElementHeight(document.body);//eeeewwwww
		var r = totalWindowHeight/totHeight;
		var sbHeight=totalWindowHeight-40;//arrows accounted4, and height of scroll bar removed frm distane it can travel
		var hob=Math.ceil(r*sbHeight);
		var fff= ((unwin.fssnapHeight/(totHeight-(totalWindowHeight-hob)))*totHeight)+20;
		//var fff= ((win_scr/(totHeight-(totalWindowHeight-hob)))*totHeight)+18;
		if(_vt(unwin.ids_vb_indi)){
			$g(unwin.ids_vb_indi).style.top=fff+'px';
			$g(unwin.ids_vb_indi).style.height=hob+'px';
		}else{//remove creation functionality... but now supports turn on in real time...
			div_indi=document.createElement('div');
			div_indi.setAttribute('id',unwin.ids_vb_indi);
			div_indi.setAttribute('style','position:absolute;top:'+fff+'px;right:0px;width:2px;height:'+hob+'px;background-color:#000;');
			document.body.appendChild(div_indi);
			div_indi.addEventListener('click',function(e){vidzb_cancelFulscButton()},false);
		}
	}
}

if(_vt('watch-longform-player')){$g('watch-longform-player').addEventListener('click',function(e){//fail
	if(!unwin['snapfullscreenmode']&&confirm('You must enable (autoclick fullscreen on scroll).  Enable now?\r\n\r\nIf you enable it just scroll to leave fullscreen.')){
		window.setTimeout(function(){if(!unwin['snapfullscreenmode']){unwin['snapfullscreenmode']=true};vidzb_cancelFulscButton();unwin.needToSavePreferences=true;unwin.p_hidePrefs();unwin.checkSavePreferences();},3)
	}else{ vidzb_cancelFulscButton()}
},false)
}




// remove,hijack,difference?? opinions? (none)
unwin.vidzb_removeAdvertisements=function(){
	//unwin.occuranceTestMonitor++;//expected: 1
	if(unwin.vidzb_blockAds && unwin.adDivInfos.length > 0 ){
	 //remove ads
		for(var a in unwin.adDivInfos){
			var divname=unwin.adDivInfos[a][0];
			var adtype=unwin.adDivInfos[a][1];
			if(_vt(divname)){
				$g(divname).innerHTML=unwin.vb_replacementAds[adtype];
			}
		}
	}
}
unwin.vidzb_oneTimeSetupAndResize=function(){
	unwin.colWidth=new Number(unwin.colWidth);
	n_vb_div_holder=document.createElement('div'),n_vb_div_holder.setAttribute('id',unwin.ids_vb_hold),n_vb_div_holder.setAttribute('style','');
	n_vb_div_title=document.createElement('div'),n_vb_div_title.setAttribute('id',unwin.ids_vb_titl),n_vb_div_title.setAttribute('style','');
	n_vb_div_header=document.createElement('div'),n_vb_div_header.setAttribute('id',unwin.ids_vb_head),n_vb_div_header.setAttribute('style','');
	n_vb_div_footer=document.createElement('div'),n_vb_div_footer.setAttribute('id',unwin.ids_vb_foot),n_vb_div_footer.setAttribute('style','clear:both;text-align:center;');	
	n_vb_div_content=document.createElement('div'),n_vb_div_content.setAttribute('id',unwin.ids_vb_cont),n_vb_div_content.setAttribute('style','');
	n_vb_div_left=document.createElement('div'),n_vb_div_left.setAttribute('id',unwin.ids_vb_left),n_vb_div_left.setAttribute('style','float:left;width:'+unwin.colWidth+'px;');
	n_vb_div_right=document.createElement('div'),n_vb_div_right.setAttribute('id',unwin.ids_vb_rigt),n_vb_div_right.setAttribute('style','float:right;width:'+unwin.colWidth+'px;');
	n_vb_div_midl=document.createElement('div'),n_vb_div_midl.setAttribute('id',unwin.ids_vb_midl),n_vb_div_midl.setAttribute('style','position:fixed;margin-left:'+(10+unwin.colWidth)+'px;margin-right:'+(10+unwin.colWidth)+'px;');
	
	//TEST STYLES-borders for all boxen
	/*
	_vt(unwin.ids_vb_hold).style.border="1px solid red";
	_vt(unwin.ids_vb_titl).style.border="1px solid grey";
	_vt(unwin.ids_vb_head).style.border="1px solid green";
	_vt(unwin.ids_vb_foot).style.border="1px solid blue";
	_vt(unwin.ids_vb_cont).style.border="1px solid purple";
	_vt(unwin.ids_vb_left).style.border="1px solid pink";
	_vt(unwin.ids_vb_rigt).style.border="1px solid orange";
	_vt(unwin.ids_vb_midl).style.border="1px solid black";
	*/

	// NOW grab content from the page and place it in the correct boxen
	//_vt(unwin.ids_left_column).cloneNode(true);
	
	if(_vt(unwin.ids_right_column2)){
		var rcol2=unwin.vidzb_GrabNode(unwin.ids_right_column2);
		_vt(unwin.ids_right_column).appendChild(rcol2);
	}
	if(_vt(unwin.ids_left_column2)){
		var rcol2=unwin.vidzb_GrabNode(unwin.ids_left_column2);
		_vt(unwin.ids_left_column).appendChild(rcol2);
	}
	
	// advice: remove smaller items first from the large ones
	var newVideoItself=unwin.vidzb_GrabNode(unwin.ids_video_holder);
	var newVideoTitle=unwin.vidzb_GrabNode(unwin.ids_title);
	var newHeader=unwin.vidzb_GrabNode(unwin.ids_header);
	var newHeader2=unwin.vidzb_GrabNode(unwin.ids_header2);
	var newHeader3=unwin.vidzb_GrabNode(unwin.ids_header3);
	var newFooter=unwin.vidzb_GrabNode(unwin.ids_footer);
	var newFooter2=unwin.vidzb_GrabNode(unwin.ids_footer2);
	var newLeftCol=unwin.vidzb_GrabNode(unwin.ids_left_column);
	var newRigtCol=unwin.vidzb_GrabNode(unwin.ids_right_column);

	//r div?? typically this was done search:GTO599 //append title to heade
	n_vb_div_header.appendChild(newHeader),n_vb_div_header.appendChild(newHeader2),n_vb_div_header.appendChild(newHeader3),n_vb_div_header.appendChild(n_vb_div_title),n_vb_div_footer.appendChild(newFooter),n_vb_div_footer.appendChild(newFooter2),n_vb_div_left.appendChild(newLeftCol),n_vb_div_right.appendChild(newRigtCol),n_vb_div_title.appendChild(newVideoTitle),n_vb_div_midl.appendChild(newVideoItself);                 // _vt(unwin.ids_vb_midl).
	
	//add after creation!
	if(unwin.columnPriorityComments){
		n_vb_div_content.appendChild(n_vb_div_left);
		n_vb_div_content.appendChild(n_vb_div_right);
	}else{
		n_vb_div_content.appendChild(n_vb_div_right);
		n_vb_div_content.appendChild(n_vb_div_left);
	}
	n_vb_div_content.appendChild(n_vb_div_midl);

	n_vb_div_holder.appendChild(n_vb_div_header);
	//GTO599//n_vb_div_holder.appendChild(n_vb_div_title);
	n_vb_div_holder.appendChild(n_vb_div_content);
	n_vb_div_holder.appendChild(n_vb_div_footer);
	
	document.body.appendChild(n_vb_div_holder);
	
	//_vt(unwin.ids_vb_midl).appendChild(newFooter2);
	//_vt('n_vb_div_adz1').innerHTML='hi';
	/*
	if(_vt(unwin.ids_title)){
		//var titleHTML=new String($g(unwin.ids_title).innerHTML);
		//titleHTML=titleHTML.qreplace('<h1>','<h1 class="spaceholder">')+titleHTML.qreplace('<h1>','<h1 id="vidz_floatytitle" class="floatytitle"><div style="margin-left:auto;margin-right:auto;position:relative;top:0px;text-align:center;">').qreplace('</h1>','</div></h1>');
		//$g(unwin.ids_title).innerHTML=titleHTML;
		
		titlePosY=unwin.getElementYpos($g(unwin.ids_title));
		titleHeight=unwin.getElementHeight($g(unwin.ids_title));
	}*/
	//now that we grabbed all the content we wanted,hide everything else
	//if(_vt(unwin.ids_all_holder_hide)){
		//$g(unwin.ids_all_holder_hide).style.display='none';
	//}
	
	//if(_vt(unwin.ids_vb_titl)){
	//	titlePosY=unwin.getElementYpos($g(unwin.ids_vb_titl));
	//	titleHeight=unwin.getElementHeight($g(unwin.ids_vb_titl));
	//}
	
	//OK now REALLY hide everything!!
	unwin.vidzb_hideEverythingNotUs();
}

//INitial setup and resize of elements.  
unwin.vidzb_initialSetupAndResize=function(){
	
	
	//guessing some of this stuff can go to one time setup?
	unwin.columnMode=0;
	
	if(unwin.ids_footer&&document.getElementById(unwin.ids_footer)){
		var fs=document.getElementById(unwin.ids_footer).style;
		fs.marginLeft="auto",fs.marginRight="auto";
	}
	//I think a few things are missing here,since this is called when we (force apply fixes updates resze)
	// as we apply preferences things need to be applied here..... not that difficult to set up
	
	//shrink or expand stuff to fit within our column sizes
	unwin.vidzb_SizeMaxWidthOfChildNodes(_vt(unwin.ids_vb_left),unwin.colWidth);
	unwin.vidzb_SizeMinWidthOfChildNodes(_vt(unwin.ids_vb_rigt),unwin.colWidth);
		
	unwin.vidzb_initialSkinSetup();
	var vbpm=document.getElementById('vidzbigger_prefs_menu');
	//preference menu positioning &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
	if(unwin.myvideoalign=="LEFT"){
		//*************************************************************************LEFT 
		vbpm.style.left="auto";
		vbpm.style.right="0px";
	}else if(unwin.myvideoalign=="CENTER"){
		//*************************************************************************CENTER 
		vbpm.style.left="auto";
		vbpm.style.right="0px";
	}else if(unwin.myvideoalign=="RIGHT"){
		//*************************************************************************RIGHT 
		vbpm.style.right="auto";
		vbpm.style.left="0px";
		//do something special here to flip the flag around...?
	}else{
		alert('something mysterious code 0x0NINEFIVETWO');
	}
}
unwin.invertColorSchemeLoadValue=unwin.invertColorScheme;
unwin.vidzb_initialSkinSetup=function(){
	var scriptStyles=[];
	
	if( unwin.invertPrefColorScheme ){
		scriptStyles.push("#vidzBPrefsHolder{background-color:#FFF;color:black;border:1px solid #999;}");
	}else{
		scriptStyles.push("#vidzBPrefsHolder{background-color:black;color:white;border:none;}");
	}
	
	if(unwin.invertColorScheme){
		scriptStyles.push("body{background-color:black;color:grey;}");
		scriptStyles.push(".watch-comment-head{background-color:black;color:grey;}");
		scriptStyles.push(".watch-comment-auth-head{background-color:#333;color:grey;}");
		scriptStyles.push("#watch-channel-vids-div{background-color:black;color:grey;}");
		scriptStyles.push("#footer{background-color:#111;color:grey;}");
		scriptStyles.push("textarea{background-color:#666;color:white;}");
		scriptStyles.push(".search-term{background-color:#666;color:white;}");
		scriptStyles.push("input{background-color:#555;color:#AAAAAA;}");
		scriptStyles.push("select{background-color:#555;color:#AAAAAA;}");
		scriptStyles.push("#vidzbigger_prefs_menu input{background-color:#AAA;color:#000;}");
		scriptStyles.push("#watch-channel-brand-div{background-color:#000;color:#FFF;}");
		scriptStyles.push(".expand-header{color:#333;}");
		scriptStyles.push(".watch-stat{color:#333;}");
		scriptStyles.push(".watch-tab-sel{background-color:#000;");
		scriptStyles.push(".watch-tab-sel{feedmodule-data:#000;");
		scriptStyles.push(".watch-tab-sel a{color:#BBBBBB;");
		scriptStyles.push("#left-col{color:#FFF;");
		scriptStyles.push(".radio-label{color:#FFF;");
		scriptStyles.push("#mymedia #list-pane .folder a{color:grey;");
		scriptStyles.push("#mymedia #list-pane .subfolder a{color:grey;");
		scriptStyles.push(".feedmodule-anchor{background-color:black;");
		scriptStyles.push("#watch-video-owner{background-color:black;");
		scriptStyles.push(".statModule-item-line{background-color:black;");
		scriptStyles.push(".img-gray-bottom-cap,.main-tabs-bottom-cap{background-image:none;border-top:1px solid grey;");
		scriptStyles.push("#vizbigger_title{text-align:center;color:grey;}");
		var sstr='';
		//sstr=".master-sprite{background-image:url(\"http://vidzbigger.com/img/master-vfl72305f.png\")}";
		sstr=".master-sprite{background-image:url(\""+unwin.vidzb_vidzBiggerInvertedTemplateImage()+"\")}";
		GM_addStyle(sstr);
		unwin.invertColorSchemeLoadValue=true;
	}else if(unwin.invertColorSchemeLoadValue==true){
		scriptStyles.push("body{background-color:white;color:black;}");
		scriptStyles.push(".watch-comment-head{background-color:white;color:grey;}");
		scriptStyles.push(".watch-comment-auth-head{background-color:#AAA;color:grey;}");
		scriptStyles.push("#watch-channel-vids-div{background-color:white;color:grey;}");
		scriptStyles.push("#footer{background-color:#EEE;color:grey;}");
		scriptStyles.push("textarea{background-color:#FFF;color:black;}");
		scriptStyles.push(".search-term{background-color:#FFF;color:black;}");
		scriptStyles.push("input{background-color:#FFF;color:#black;}");
		scriptStyles.push("select{background-color:#FFF;color:#black;}");
		scriptStyles.push("#vidzbigger_prefs_menu input{background-color:#FFF;color:#000;}");
		scriptStyles.push("#watch-channel-brand-div{background-color:#fff;color:#000;}");
		scriptStyles.push(".expand-header{color:#999;}");
		scriptStyles.push("#left-col{color:#000;");
		scriptStyles.push(".radio-label{color:#000;");
		scriptStyles.push(".watch-stat{color:#999;}");
		scriptStyles.push(".watch-tab-sel{background-color:#FFF;");
		scriptStyles.push(".watch-tab-sel{feedmodule-data:#FFFF;");
		scriptStyles.push(".watch-tab-sel a{color:#000;");
		scriptStyles.push("#watch-video-owner{background-color:#e4edfc;");
		scriptStyles.push("#vizbigger_title{text-align:center;color:black;}");
		var sstr='';
		//sstr=".master-sprite{background-image:url(\"http://vidzbigger.com/img/master-vfl72305f.png\")}";
		sstr=".master-sprite{background-image:url("+'http://s.ytimg.com/yt/img/master-vfl72305.png'+")}";
		GM_addStyle(sstr);
	}
	scriptStyles.forEach(function(s){GM_addStyle(s.makeImportant());});
}
//unwin.ids_vb_left or unwin.ids_vb_rigt
unwin.vidzb_ConsolodateColumns=function(destinationColumn){
	if(unwin.columnMode==2) return;//already in 2 col mode
	unwin.columnMode=2;
	unwin.thedestinationColumn=destinationColumn;
	var newLeftCol=unwin.vidzb_GrabNode(unwin.ids_left_column);
	var newRigtCol=unwin.vidzb_GrabNode(unwin.ids_right_column);
	if(unwin.columnPriorityComments){
		$g(destinationColumn).appendChild(newLeftCol);
		$g(destinationColumn).appendChild(newRigtCol);
	}else{
		$g(destinationColumn).appendChild(newRigtCol);
		$g(destinationColumn).appendChild(newLeftCol);
	}
	unwin.handleColumnAd();
	var cw=new Number(unwin.colWidth);
	if(unwin.columnScrollIndependent){
		if(unwin.columnsavailable>2)
		 	cw+=35;
		else
			cw+=14;
	}
	if(destinationColumn==unwin.ids_vb_left){
		$g(unwin.ids_vb_midl).style.marginRight='5px';
		$g(unwin.ids_vb_midl).style.marginLeft=(cw+10)+'px';
	}else{
		$g(unwin.ids_vb_midl).style.marginRight=(cw+10)+'px';
		$g(unwin.ids_vb_midl).style.marginLeft='5px';
	}
}//alert('inteligent designs naturally selected');
//back to 3 column mode
unwin.vidzb_SpreadColumns=function(){
	
	if(unwin.columnMode==3) return;//already in 3 col mode
	unwin.columnMode=3;
	var newLeftCol=unwin.vidzb_GrabNode(unwin.ids_left_column);
	var newRigtCol=unwin.vidzb_GrabNode(unwin.ids_right_column);
	

	if(unwin.columnPriorityComments){
		_vt(unwin.ids_vb_left).appendChild(newLeftCol);
		_vt(unwin.ids_vb_rigt).appendChild(newRigtCol);
		
	}else{
		_vt(unwin.ids_vb_left).appendChild(newRigtCol);
		_vt(unwin.ids_vb_rigt).appendChild(newLeftCol);
	}
	
	unwin.handleColumnAd();

	var cw=new Number(unwin.colWidth);
	if(unwin.columnScrollIndependent) cw+=14;
	
	$g(unwin.ids_vb_midl).style.marginRight=(cw+10)+'px';
	$g(unwin.ids_vb_midl).style.marginLeft=(cw+10)+'px';
	
	
	

}
unwin.handleColumnAd=function(){
	
	var oldadd=unwin.vidzb_GrabAndRemoveNode('n_vb_div_adz1');

	//<div id="n_vb_div_adz1">
	n_vb_div_adz1=document.createElement('div');
	n_vb_div_adz1.setAttribute('id','n_vb_div_adz1');
	n_vb_div_adz1.setAttribute('style','');
	
	if(unwin.columnMode==3){
		//taller column does not get ad...	
		if(unwin.getElementHeight(_vt(unwin.ids_vb_rigt)) >unwin.getElementHeight(_vt(unwin.ids_vb_left))){
			_vt(unwin.ids_vb_left).appendChild(n_vb_div_adz1);
		}else{
			_vt(unwin.ids_vb_rigt).appendChild(n_vb_div_adz1);
		}
	}else{
		_vt(unwin.thedestinationColumn).appendChild(n_vb_div_adz1);
	}
	
	_vt('n_vb_div_adz1').innerHTML=unwin.vidzbadd1_html;
}

unwin.vidzb_hideEverythingNotUs=function(){
	var cNodes=document.body.childNodes;
	for(var x=0, l=cNodes.length;x<l;x++){
		if(cNodes[x].id=='vizbigger_all_content_holder' || cNodes[x].id=='vidzbigger_prefs_menu'){
			return;
		}else{
			if(cNodes[x].style){
				cNodes[x].style.display="none";
			}
		}
	}
}

unwin.vidzb_SizeMaxWidthOfChildNodes=function(node,maxw){
	if(node){
		var cNodes=node.childNodes;
		if(cNodes && cNodes.length>0){
			for(var x=0, l=cNodes.length;x<l;x++){
				if(unwin.getElementWidth(cNodes[x])>maxw){
					cNodes[x].style.width=maxw+'px';
				}
				unwin.vidzb_SizeMaxWidthOfChildNodes(cNodes[x],maxw);
			}
		}
	}
}
//okay you two combine
unwin.vidzb_SizeMinWidthOfChildNodes=function(node,minw){
	if(node){
		var cNodes=node.childNodes;
		if(cNodes && cNodes.length>0){
			for(var x=0, l=cNodes.length;x<l;x++){
				//if(unwin.getElementWidth(cNodes[x])>minw){
				if(cNodes[x].style.width.CSStoInteger()<minw){
					cNodes[x].style.width=minw+'px';
				}
				unwin.vidzb_SizeMaxWidthOfChildNodes(cNodes[x],minw);
			}
		}
	}
}

unwin.setVideoSize=function(w,h,totalWindowHeight,atBtm,scr){
	var fvp=0;//finalVideoPosition;
	var fhp=0;//finalHorozontalVideoPosition;
	//385 / 480  ratio
	var fullwidth=w;
	var fullheight=h;

	if(!unwin.fullscreenmode){
		if(w>unwin.maximumVideoWidth) w=unwin.maximumVideoWidth;
		//if(w<unwin.minimumVideoWidth)w=unwin.minimumVideoWidth;
		// now prevent black bars on teh sides if the video is crushed vertically
		if(unwin.preventHzBlackBars){
			var twid=(h-video_bottom_button_bar_height) / ratio;
			if(w>twid){
				//fullwidth=twid;
				w=twid;
			}
		}
		// prevent black bars above and below video
		if(unwin.preventVtBlackBars){
			var maxHeight=Math.floor(w*ratio)+video_bottom_button_bar_height;
			if(h>maxHeight){
				h=maxHeight;
			}
		}
	}
	
	if(unwin.fullscreenmode){
		if(scr>-unwin.headerHeight) fvp=-unwin.headerHeight-scr;
		else fvp=0;
		//console.log(fvp.toString());
		//fvp+=20
		// compute video positioning and or centering (do not do for no centering)
	}else if(unwin.positionVideoAutomatically){
		//if(atBtm) fullheight*=1;//1.05;//at btm add extra space above video for mouse
		fvp=(fullheight-h)>>1;//Math.floor((fullheight-h)/2);
	}
	
	if(w<fullwidth){
			if(unwin.fullscreenmode || unwin.columnsavailable==1){
				fhp=0;
			}else{
				leftpad=(fullwidth>>1)-(w>>1);//(fullwidth/2)-(w/2);
				fhp=leftpad;
			}
	}
	unwin.lastHeight=h;
	unwin.lastWidth=w;
	unwin.applyVideoSizePos(w,h,fhp,fvp);
}
unwin.videoPlayerItself=false;
unwin.searchVideoPlayer=function(startNode){
	if(unwin.videoPlayerItself)return unwin.videoPlayerItself;
	var cn=startNode.childNodes;
	for(var i in cn){
		if(cn[i].nodeName=="EMBED"){ 
			 unwin.videoPlayerItself=cn[i];
			 return cn[i];
		}else{
			var thenode= unwin.searchVideoPlayer(cn[i]);
			if(thenode) return thenode;
		}
	}
}
unwin.applyVideoSizePos=function(w,h,x,y){
	var mdl = $g(unwin.ids_vb_midl).style;//a simplified function but also always does both
	h=Math.floor(h),w=Math.floor(w),x=Math.floor(x),y=Math.floor(y),mdl.height=(h)+"px",mdl.width=(w)+"px";
		if($g(unwin.ids_video_holder)){var videoItself = unwin.searchVideoPlayer($g(unwin.ids_video_holder)).style;
		if(videoItself)videoItself.height=(h)+"px",videoItself.width=(w)+"px",videoItself.marginLeft=(x)+"px",videoItself.marginTop=(y)+"px";
	}
}

unwin.linksByURL=[];
//THIS ONE MAKES ALL LINKS HIGH QUALITY 
unwin.vidzb_fmt18ALlLinks=function(){
	unwin.vidzb_animateAllVideoIcons();
	if(unwin.useHighQuality !=true) return;
	unwin.linksByURL=[];
	var allLinks=document.getElementsByTagName('a');
	var gotcount=0;
	for(var x=0,l=allLinks.length;x<l;x++){
		var chref=new String(allLinks[x].href);
		
		if(chref.indexOf('youtube')>0 && chref.indexOf('watch')>0 && chref.indexOf('fmt=18')<0 && chref.indexOf('fmt=22')<0 && chref.indexOf('checkedhd')<0 && chref.indexOf('#')<0 && chref.indexOf('feature=hd')<0){
			var myHref=new String(allLinks[x].href);
			if(myHref.indexOf('&')>0)
				myHref=myHref.substr(0,myHref.indexOf('&'));
			if( unwin.flipVideo )allLinks[x].href+='&flip=1';
			allLinks[x].href+='&fmt=18';
			if(!unwin.linksByURL[myHref]) unwin.linksByURL[myHref]=[];
			unwin.linksByURL[myHref].push(allLinks[x]);
			gotcount++;
		}
		
	}
	if(gotcount>0) vidzb_visualize(allLinks);//Youtube HD Suite functionality to check for HQ version and update each link
}
unwin.vbcheckIfImageIsThumb=function(srs){
	if( srs.indexOf('default.jpg')>0 || srs.indexOf('1.jpg')>0 || srs.indexOf('2.jpg')>0 || srs.indexOf('3.jpg')>0 ){return true;}return false;
}
unwin.vbattachHoverEventsToThumb=function(img){
	cevents.register(img,'mouseover',vidzb_mouseoverthumb );
	cevents.register(img,'mouseout',vidzb_mouseoutthumb );
}
unwin.imgsToAnimateList=[];//in case we animate in a single timeout instead of a unique timeout for each button
unwin.vidzb_animateAllVideoIcons=function(){
	if(unwin.animateVidThumbnails !=true) return;
	var allImages=document.getElementsByTagName('img');
	for(var x=0,l=allImages.length;x<l;x++){
		if(allImages[x].name=='ready' || allImages[x].name=='loading') continue;//already got this img/skip it
		var srs = new String(allImages[x].src);
		//if( unwin.alwaysAnimateVidThumbnails ){
		//	allImages[x].addEventListener('load',function(e){var timg=vidzb_getEventTarget(e);timg.name='ready';vidzb_mouseoverthumb(timg,1000)},false)
		//}else{
		//	allImages[x].addEventListener('load',function(e){var timg=vidzb_getEventTarget(e);timg.name='ready';},false)
		//}
		if(!unwin.alwaysAnimateVidThumbnails||(unwin.alwaysAnimateVidThumbnails&&!unwin.alwaysAnimateVidThumbnails1LOOP)){
			allImages[x].addEventListener('load',function(e){var timg=vidzb_getEventTarget(e);timg.name='ready';},false)
		}
		if(unwin.vbcheckIfImageIsThumb(srs)){
			allImages[x].name='ready';//probably loaded - we use teh name atrb to store info about if the next image is loaded or not
			if( unwin.alwaysAnimateVidThumbnails ){
				if(unwin.alwaysAnimateVidThumbnails1LOOP){
					unwin.imgsToAnimateList.push(allImages[x]);
				}else{				//allImages[x].addEventListener('load',function(e){var timg=vidzb_getEventTarget(e);timg.name='ready';},false)
					vidzb_mouseoverthumb(allImages[x],(1000 + (x<<8))); //image is loaded probably... do it now
				}
			}else{
				//allImages[x].addEventListener('load',function(e){var timg=vidzb_getEventTarget(e);timg.name='ready';},false)
				unwin.vbattachHoverEventsToThumb(allImages[x]);
			}
		}else{
			//not loaded yet but it might still be a video or video thumbnail
			var srs = new String(allImages[x].getAttribute('thumb'));
			if(unwin.vbcheckIfImageIsThumb(srs)){
				if( unwin.alwaysAnimateVidThumbnails ){
					if(unwin.alwaysAnimateVidThumbnails1LOOP){
						unwin.imgsToAnimateList.push(allImages[x]);
					//allImages[x].addEventListener('load',function(e){var timg=vidzb_getEventTarget(e);timg.name='ready';vidzb_mouseoverthumb(timg,1000)},false)
					}else{
						allImages[x].addEventListener('load',vidzb_mouseoverthumb,false)//when it is loaded start animating!
					}
				}else{
					//allImages[x].addEventListener('load',function(e){var timg=vidzb_getEventTarget(e);timg.name='ready';},false)
					unwin.vbattachHoverEventsToThumb(allImages[x]);//even tho its not loaded attach the events for hover 
				}
			}
		}
	}
	//if( unwin.alwaysAnimateVidThumbnails ){//if we scroll down we will be dissapointed unless this happens again!
	//	window.setTimeout(function(){unwin.vidzb_animateAllVideoIcons()},4000);
	//}
}
var vidzb_anithumb_timeout = 0;
window.vidzb_animateAllSingleTimeout=function(){
	for( i in unwin.imgsToAnimateList){
		vidzb_animatethumb(unwin.imgsToAnimateList[i]);
	}
}
window.vidzb_animatethumb=function(w){
	if( w.src.indexOf('.jpg') < 1 )return;// w.src=w.getAttribute('thumb');
	srs=new String(w.src);var sp = srs.lastIndexOf('/');
	cur = new Number(srs.substr(sp+1,1));
	if( isNaN(cur) ) cur = 0;cur++;if( cur > 3 ) cur = 1;
	w.src = srs.substr(0,sp) + '/'+cur+'.jpg';
	//w.name='loading';//store the next value, so we know if its loaded yet
}
window.vidzb_mouseoverthumb=function(ev,dl){
	var w=0;
	if( ev.src ) w=ev;else w=vidzb_getEventTarget(ev);
	try{w.removeEventListener('load',vidzb_mouseoverthumb,false);}catch(xe){GM_log('failed to remove');}//remove the listener for the ones that are not loaded until u scroll if exists
	if( typeof(dl)=='undefined' ){
		dl=0;if(w.name!='ready')dl=1000;//next image is not loaded yet... wait...
	}
	if( dl > 0){//inital delay if animating ALL thumbs
		vidzb_anithumb_timeout = window.setTimeout(function(){vidzb_mouseoverthumb(w)},dl);
		return;
	}
	vidzb_animatethumb(w);
	vidzb_anithumb_timeout = window.setTimeout(function(){vidzb_mouseoverthumb(w)},1000);//doing this onload instead
}
window.vidzb_mouseoutthumb=function(ev){
	clearTimeout(vidzb_anithumb_timeout);
	w=vidzb_getEventTarget(ev);
	srs=new String(w.src);
	var sp = srs.lastIndexOf('/');
	w.src = srs.substr(0,sp) + '/default.jpg';
}
/***create XmlHttpRequest Youtube HD Suite*/
function createXHR(){
    if (window.ActiveXObject){
        try{
            return new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e){
            try{
                return new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e2){
                return null;//lol
            }
        }
    } else if (window.XMLHttpRequest){
        return new XMLHttpRequest();
    } else{
        return null;
    }
}
/***check URL Youtube HD Suite*/
function vbcheckURL(video_id){
		var burl='http://'+location.host+'/watch'+'?v='+video_id;
    var url=burl+'&fmt=22';
    var curl=burl+'&fmt=35';
    var XHR=createXHR();
    XHR.open('GET',url,true);
    XHR.onreadystatechange=function(){ 
        if (XHR.readyState==4){
            if ( match = XHR.responseText.match(/var swfArgs = ({.*})/) ){
                json=eval('('+RegExp.$1+')');
                //var s=document.getElementsByTagName('strong');
                var s=unwin.linksByURL[burl];
                if(!s) return;
                var rStr=new String(XHR.responseText);
                for (var i=0,l=s.length;i<l;i++){
               		if (json['fmt_map'].indexOf('22/2000000/9/0/115')>=0){
               	 		//s[i].href=burl+"&fmt=22";
               	 		s[i].href=new String(s[i].href).qreplace('&fmt=18',"&fmt=22");
               	 		if (s[i].innerHTML.indexOf('<img')<0 && s[i].innerHTML.indexOf('&nbsp;HD&nbsp;')<0){
	               	 		if(unwin.indicateHDQuality)	s[i].innerHTML=' <span style="background-color:red;color:#FFF;">&nbsp;HD&nbsp;</span>'+s[i].innerHTML;
	               	 		if(rStr.indexOf('authorized')>0){
	               				s[i].innerHTML='<span style="background-color:red;color:#FFF;">&nbsp;MUTED&nbsp;</span>'+s[i].innerHTML;
			                }else if(rStr.indexOf('This video has been removed by the user')>0){
	               				s[i].innerHTML='<span style="background-color:red;color:#FFF;">&nbsp;DELETED&nbsp;</span>'+s[i].innerHTML;
			                }
	               		}
               		}else{
               				//s[i].href=burl+"&fmt=18&why=false";//already applied
               				if (new String(s[i].href).indexOf('checkedhd')<0) 
               					s[i].href=new String(s[i].href).qreplace('&fmt=18',"&fmt=18&checkedhd=t");
               		}
              	}
            }
        }
    }
    XHR.send('');
}
/***Add HD or MP4 on each links in YouTube List Page Youtube HD Suite*/
function vidzb_visualize(alllinks){
    var a=alllinks;//document.getElementsByTagName('a');
    var a_text='';
    for (var i=0,l=a.length;i<l;i++){
        match='';
        if (a[i].innerHTML.indexOf('<img')>-1)       continue;// Skip Image Link
        if (a[i].getAttribute('vid'))                  continue;// Skip checked Link
        if (a[i].getAttribute('class')=='yt-button') continue;// Skip Button Link
        if (a[i].href.match(/#$/))                     continue;// Skip functional Link
        if (new String(a[i].href).indexOf('fmt=22')>0)                 continue;// Skip already fmt22 Link
        if (new String(a[i].href).indexOf('checkedhd')>0)              continue;// Skip already checked fmt 18 link

        if (a[i].href.match(/watch\?v=([a-zA-Z0-9_-]*)/)){
            match=RegExp.$1;
            vbcheckURL(match);
        }
    }
}

//THIS ONE CREATES VidzBig PREFERENCES AREA
unwin.p_createPreferencesArea=function(){
	nPDiv=document.createElement('div');	
	nPDiv.setAttribute('id','vidzbigger_prefs_menu');
	var opacity=100;
	nPDiv.setAttribute('style','position:fixed;overflow:auto;right:0px;min-width:160px;top:0px;padding:0px;z-index:10000;font-size:12px;font-family:arial,sans-serif;background-color:transparent;color:black;opacity:'+(opacity/100)+';filter: alpha(opacity='+(opacity)+');-moz-opacity: '+(opacity/100)+';');
	if(document.body){
		document.body.appendChild(nPDiv);
		unwin.p_hidePrefs(true);
	}else{
		return;
	}
}
unwin.vidzbPrefsDoNotFitUntilResize=false;
unwin.p_updatePrefwinHeight=function(){
	if(unwin.prefsShowing){
		if( unwin.vidzbPrefsDoNotFitUntilResize ) return;
		if(_vt('vidzbigger_prefs_menu')){
			var pMenuH=unwin.getElementHeight($g('vidzbigger_prefs_menu'));
			var winHei=unwin.getWindowHeight();
			if(unwin.vidzbPrefsDoNotFitUntilResize||pMenuH>winHei){
				$g('vidzbigger_prefs_menu').style.height=(winHei-10)+'px';
				$g('vidzbigger_prefs_menu').style.overflow='scroll';
				$g('vidzbigger_prefs_menu').style.overflowX='hidden';
				unwin.vidzbPrefsDoNotFitUntilResize=true;
			}else{
				$g('vidzbigger_prefs_menu').style.height='auto';
				$g('vidzbigger_prefs_menu').style.overflow='auto';
			}
		}
	}else{
		if(_vt('vidzbigger_prefs_menu')){
			$g('vidzbigger_prefs_menu').style.height='auto';
			$g('vidzbigger_prefs_menu').style.overflow='auto';
		}
	}
}
unwin.p_refreshPrefs=function(){
	if(unwin.prefsShowing){
		unwin.prefsShowing=false;
		unwin.p_vidzbShowPrefs();
	}
}
unwin.p_beginPrefSectn=function(id, title,viz){
	if( typeof(viz)=='undefined')viz='none';
	ost='<h3>';
	ost+='<img id="vizcolexpnader'+id+'_hid" style="display:inline;cursor:pointer;" src="'+unwin.p_vidzColapzed(this)+'" align="bottom" title="Expand" alt="&gt;" />';
	ost+='<img id="vizcolexpnader'+id+'_shw" style="display:none;cursor:pointer;" src="'+unwin.p_vidzXpandD(this)+'" align="bottom" title="Collapse" alt="&lt;" />';
	ost+='&nbsp;<span style="cursor:pointer;color:#52A3EE;" id="vizcolexpnader'+id+'_tog">'+title+'</span></h3>';
	ost+='<div id="vizcolexpnader'+id+'_viv" style="display:'+viz+';">';
	VBlistenersToAdd.push(createPendingEventObject('vizcolexpnader'+id+'_hid','mousedown',eventvidzbpreftoggleme,true));
	VBlistenersToAdd.push(createPendingEventObject('vizcolexpnader'+id+'_shw','mousedown',eventvidzbpreftoggleme,true));
	VBlistenersToAdd.push(createPendingEventObject('vizcolexpnader'+id+'_tog','mousedown',eventvidzbpreftoggleme,true));
	return ost;
}
unwin.p_createPrefCheckbox=function(id, title, help,ndent){
	if( typeof(ndent) == 'undefined' )ndent=0;
	if(unwin[id])checkd=' checked';
	else checkd='';
	ost=unwin.p_beginPrefItemRow();
	for(var i=0;i<ndent;i++){
		ost+='&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
	}
	ost+='<label><input type="Checkbox" id="vbg_prefInput_'+id+'" name="pref_'+id+'" '+checkd+'/>';
	VBlistenersToAdd.push(createPendingEventObject('vbg_prefInput_'+id,'click',vidzb_clickPrefCheckbox,true));
	ost+=title+'</label>'+unwin.p_getQuestionMarkImage(help);
	ost+=unwin.p_endPrefItemRow();
	return ost;
}
window.vidzb_cancelFulscButton=function(){unwin.finVidzBToggleFullscreen();}
window.vidzb_cancelPrefsButton=function(){unwin.p_hidePrefs();}
window.vidzb_savePrefsButton=function(){	unwin.needToSavePreferences=true;unwin.p_hidePrefs();unwin.checkSavePreferences();}
window.vidzb_resetPrefsButton=function(){if(confirm('Are you sure you want to erase ALL of your custom preferences and restore VidzBigger Defaults?\\n\\nNOTE: to apply some settings you must also reload the page after pressing OK reset.')){unwin.setDefaultPreferences();unwin.forcevidzb_apply_selected_fixes();unwin.needToSavePreferences=true;unwin.p_hidePrefs();unwin.checkSavePreferences();}}
window.eventvidzbpreftoggleme=function(evt){unwin.vidzbpreftoggleme(vidzb_getEventTarget(evt));}
window.vidzb_clickPrefCheckbox=function(evt){
	var elem = vidzb_getEventTarget(evt);var pid=elem.id.replace('vbg_prefInput_','');
	if(elem.checked){unwin[pid]=true}else{unwin[pid]=false};unwin.forcevidzb_apply_selected_fixes();
}
window.vidzb_clickSiteEnablePrefCheckbox=function(evt){
	var elem = vidzb_getEventTarget(evt);var pid=elem.id.replace('vbg_prefInput_','');
	if(elem.checked){unwin[pid]=true}else{unwin[pid]=false};unwin.forcevidzb_apply_selected_fixes();
	if(unwin.vidzbigSITEenabled){
		//make sure its NOT in the vidzbigSITESdisabled list
		vidzbigSITESdisabled.replace(','+window.location.host,'');
	}else{
		//add it to the 
		vidzbigSITESdisabled+=','+window.location.host
	}
}
window.vidzb_clickPrefTextbox=function(evt){
	var elem = vidzb_getEventTarget(evt);var pid=elem.id.replace('vbg_prefInput_','');
	if(elem.value){unwin[pid]=elem.value}else{unwin[pid]=''};unwin.forcevidzb_apply_selected_fixes();
}

window.vidzb_clickPrefSelect=function(evt){
	var elem = vidzb_getEventTarget(evt);var pid=elem.id.replace('vbg_prefInput_','');var val=elem.value;
	if( new Number(val)>0 ) val=new Number(val);
	unwin[pid]=val;unwin.forcevidzb_apply_selected_fixes();
}
function createPendingEventObject(elID,tpe,func,bubl){var lobj = new Object();lobj.eid=elID;lobj.etype=tpe;lobj.efunc=func;lobj.ebubl=bubl;return lobj;}
var VBlistenersToAdd=new Array();
unwin.p_vidzbShowPrefs=function(){
	if(unwin.prefsShowing) return true;
	unwin.prefsShowing=true;
	VBlistenersToAdd=new Array();
	$g('vidzbigger_prefs_menu').removeEventListener("click",vidzb_showPrefs,true);
	$g('vidzbigger_prefs_menu').removeEventListener("mouseover",vidzb_MouseOverFlag,true);
	$g('vidzbigger_prefs_menu').removeEventListener("mouseout",vidzb_MouseOutFlag,true);
	if( _vt('vidzbigger_prefs_menu') ){
		$g('vidzbigger_prefs_menu').style.textAlign="left";
		$g('vidzbigger_prefs_menu').style.maxHeight="1024px";
		$g('vidzbigger_prefs_menu').style.width="auto";
	}	////questionable... ^ (but has a counterpart elswhere)
	var prHTM="";
	var checkd='';	
	prHTM+='<div id="vidzBPrefsHolder" style="width:'+(unwin.colWidth-15)+'px;">';
	var myFloat='right';
	if(unwin.myvideoalignThisUpdate=="RIGHT"){
		myFloat="left";
	}else if(unwin.myvideoalignThisUpdate=="CENTER"){
		myFloat="right";
	}else if(unwin.myvideoalignThisUpdate=="LEFT"){
		myFloat="right";
	}
  var extraCmds='';
	if(unwin.allowPlayerClk||unwin.snapfullscreenmode){
  	extraCmds+='<input type="button" id="vb_xfs" value="Fullscreen" />';
  }
	prHTM+='<span style="float:'+myFloat+'">'+extraCmds+'<input type="button" id="vb_x1" value=" X " /><input id="vb_s1" type="button" onclick="" value="Save" /></span>';	
	prHTM+='<b style="position:relative;top:0px;"><big><img src="'+unwin.vidzb_vidzBiggerFlagImageFull()+'" align="top"/><span style="position:relative;top:3px;"> PREFERENCES</span></big></b><br/>';
	if(unwin.latestversion>vidz_Version){
		var updateAge=Math.round(new Number(unwin.latestversion)*1000-(vidz_Version*1000));
		var plurlal='s';
		if(updateAge==1) plurlal='';
		prHTM+='<div id="upgradeinfo"><br/><big><u><b style="color:red;">Your Version is Outdated</b></u></big>('+(updateAge)+" update"+plurlal+" old)<br/>"+unwin.upgradeMessage+'<br/><a style="font-weight:bold;font-size:14px;" href="'+unwin.latestversionurl+'" onclick="document.getElementById(\'upgradeinfo\').innerHTML=\'<br/><b><big>Thanks for Upgrading!  After installing the upgrade Refresh the page or cointinue browsing to use the new version!</big></b>\'">Click Here & Upgrade to VidzBigger '+unwin.latestversion+'</a><br/></div>';
	}else{
		//prHTM+="<i>Your Version is up to Date!</i><br/>";
	}
	prHTM+='<br style="height:6px;line-height:6px;" />';
	//DISSABLE
	
	var tname='vidzbigSITEenabled';
	if(unwin[tname])checkd=' checked';
	else checkd='';
	var disableThisSiteOnly = '</label><label><input type="Checkbox" id="vbg_prefInput_'+tname+'" name="pref_'+tname+'" '+checkd+'/> Enable This Site</label>';
	VBlistenersToAdd.push(createPendingEventObject('vbg_prefInput_'+tname,'click',vidzb_clickSiteEnablePrefCheckbox,true));
	
	prHTM+=unwin.p_createPrefCheckbox('vidzbigenabled','Enable VidzBigger '+disableThisSiteOnly+' (on reload)','When something goes wrong,this checkbox allows you to dissble vidzbigger features without breaking update notifications.\\n\\nDefault Value: ON');
	
	if(unwin.enableTopVidzBrowser){
		prHTM+=unwin.p_beginPrefSectn('topvidz','Top Vidz');
		if(typeof(window.vb_bigged) == 'undefined' ){
			window.vb_bigged=function(evt){if(evt.preventDefault) evt.preventDefault();evt.returnValue = false;return unwin.vb_loadWebpage(versioncheckurl.qreplace('version.php','bigger.php'))}
			window.vb_loadWebpageEvent=function(evt){if(evt.preventDefault) evt.preventDefault();evt.returnValue = false;return unwin.vb_loadWebpage('http://vidzbigger.com/videoSimpleList.php?page='+_vt('tvb_page').value);}
			window.vb_loadWebpageEvent2=function(evt){if(evt.preventDefault) evt.preventDefault();evt.returnValue = false;return unwin.vb_loadWebpage();}
			unwin.vb_loadWebpage=function(pURL){
				_vt('tv_brsr').src=typeof(pURL)!='undefined'?pURL:_vt('tvb_page1').value;
				_vt('tv_brsr').height=300;
				unwin.vidzb_last_url=_vt('tv_brsr').src;
				return false;
			}
			unwin.vb_graburl=function(pURL){
				_vt('tv_brsr').contentWindow.location.href !=''?_vt('tvb_page1').value=_vt('tv_brsr').contentWindow.location.href :null;
				_vt('tvb_page1').select();
				return false;
			}
		}
		//return vb_loadWebpage(\'http://vidzbigger.com/videoSimpleList.php?page=\'+_vt(\'tvb_page\').value);
		
		VBlistenersToAdd.push(createPendingEventObject('vb_BiggedEvent','click',vb_bigged,true));
		VBlistenersToAdd.push(createPendingEventObject('load_top_vid_form','submit',vb_loadWebpageEvent,true));
		VBlistenersToAdd.push(createPendingEventObject('load_top_vid_form2','submit',vb_loadWebpageEvent2,true));
		
		prHTM+='<form id="load_top_vid_form">Top Videos Browser Page:<input type="text" size="2" value="1" id="tvb_page" /><input type="submit" value="Load Top Vidz" />';
		prHTM+='<input type="button" id="vb_BiggedEvent" value="Big" title="Click button to have Bigged curent video" /></form><iframe id="tv_brsr" style="overflow:scroll" src="'+unwin.vidzb_last_url+'" width="100%" height="'+(unwin.vidzb_last_url==''?'0':"300")+'">';
			prHTM+='</iframe><form  id="load_top_vid_form2" onsubmit="return vb_loadWebpage();">';
		prHTM+='Load URL:<input type="text" size="20" value="'+(unwin.vidzb_last_url==''?'http://':unwin.vidzb_last_url)+'" id="tvb_page1" /><input type="submit" value="Go" />';
		prHTM+='</form>';//<input type="button" onclick="vb_graburl()" value="a" />
		prHTM+='</div>';//end  div
	}
	if(unwin.vidzbigenabled && unwin.vidzbigSITEenabled){
		prHTM+=unwin.p_beginPrefSectn('layout','Inst-Layout');
		
		//unwin.myvideoalign="RIGHT";//"LEFT"CENTER"RIGHT";
		VBlistenersToAdd.push(createPendingEventObject('vbg_prefInput_myvideoalign','change',vidzb_clickPrefSelect,true));
		prHTM+=unwin.p_beginPrefItemRow()+'Video Layout <select id="vbg_prefInput_myvideoalign">';
		if(unwin.myvideoalign=='RIGHT')checkd=' selected';
			else checkd='';
			prHTM+='<option value="RIGHT"'+checkd+'>Right &rarr;<br/>';
			if(unwin.myvideoalign=='CENTER')checkd=' selected';
			else checkd='';
			prHTM+='<option value="CENTER"'+checkd+'>Middle<br/>';
			if(unwin.myvideoalign=='LEFT')checkd=' selected';
			else checkd='';
			prHTM+='<option value="LEFT"'+checkd+'>Left &larr;<br/>';
		prHTM+="</select>";
		VBlistenersToAdd.push(createPendingEventObject('vbg_prefInput_mypreferednumcolumns','change',vidzb_clickPrefSelect,true));
		prHTM+=' with <select id="vbg_prefInput_mypreferednumcolumns">';
			if(unwin.mypreferednumcolumns==3)checkd=' selected';
			else checkd='';
			prHTM+='<option value="3"'+checkd+'>3<br/>';
			if(unwin.mypreferednumcolumns==2)checkd=' selected';
			else checkd='';
			prHTM+='<option value="2"'+checkd+'>2<br/>';
		prHTM+="</select>Columns "+unwin.p_getQuestionMarkImage('3 Columns requires ~1024 or greater window width.\\n\\nOtherwise it will default to 2 columns (Just scroll down to see the right column)\\n\\nI&rsquo;m not sure if anyone will use 2 column mode anyway,but if so perhaps you would like to see \\n  a) the option to position the comments below the info/video links or \\n  b) the option to have the setting middle-3 default to right-2 instead of left-2 when space runs out.  \\nLet me know which you like,if any or all.\\n\\nDefault Value: Middle,3 &rarr;uses up to 3 &rarr;If too thin for 3 &rarr;Left,2');
		prHTM+=unwin.p_endPrefItemRow();
		// end first row
		//MinVW
		VBlistenersToAdd.push(createPendingEventObject('vbg_prefInput_minimumVideoWidth','change',vidzb_clickPrefSelect,true));
		prHTM+=unwin.p_beginPrefItemRow()+' Min Video Width <select id="vbg_prefInput_minimumVideoWidth">';
			for(i in lOpMinVideoWidths){
				if(unwin.minimumVideoWidth==lOpMinVideoWidths[i])checkd=' selected';
				else checkd='';
				prHTM+='<option value="'+lOpMinVideoWidths[i]+'"'+checkd+'>'+lOpMinVideoWidths[i]+'<br/>';
			}
		prHTM+="</select>px [2 vs 3 col threshold]"+unwin.p_getQuestionMarkImage('When the video width drops below this value,the third column will be dropped in favor of a 2 column layout. \\n\\nMakes sure your video is at least as big if not bigger than before.  This is for knowing when to drop 3 and go to 2 columns.  Does not go to 1 column at thsi time,so sizes smaller than 800x600 should choose 128.  This is only a horozontal maximum,and is not vertically enforced.\\n\\nDefault Value: 480');
		prHTM+=unwin.p_endPrefItemRow();
		//MaxVW
		VBlistenersToAdd.push(createPendingEventObject('vbg_prefInput_maximumVideoWidth','change',vidzb_clickPrefSelect,true));
		prHTM+=unwin.p_beginPrefItemRow()+' Max Video Width <select id="vbg_prefInput_maximumVideoWidth">';
			for(i in lOpVideoWidths){
				if(unwin.maximumVideoWidth==lOpVideoWidths[i])checkd=' selected';
				else checkd='';
				prHTM+='<option value="'+lOpVideoWidths[i]+'"'+checkd+'>'+lOpVideoWidths[i]+'<br/>';
			}
		prHTM+="</select>px [Saves CPU]"+unwin.p_getQuestionMarkImage('Flash (video) does not always do well at high resolutions,and though you might say &ldquo;but fullscreen works perfectly smooth&rdquo;you would be right,but thats because full screen mode uses your video card to scale up the flash,so its still really only rendering at ~480 pixels wide which is the defalt maximum video width for non-fullscreen mode.\\n\\nVidzBigger bypasses all of that,and changes the dimensions of the flash plugin on the screen,which means that when the video reaches ~1024 width [or &gt;],your CPU has to scale a frame of video and render each of those pixels of video to the screen for each frame [which is a lot of work,one second of 1024 video is typically at least 18,874,368 pixels,not that every last one gets update every time,or so you might hope].\\n\\nIf you notice your CPU is all full up,you might have too much stuff going,or you should use this option to enforce a maximum.  If you don&rsquo;t belive this option works see what happens to your CPU when you drop the video from 1024 [that is,if the video is acutally 1024 wide] to 320.\\n\\n  VidzBigger really only does stuff when you first load the page,scroll,or resize the window,so most of the time the only thing processing is flash. \\n\\nDefault Value: 1024');
		prHTM+=unwin.p_endPrefItemRow();
		
		//VT and HZ black bars 
		prHTM+=unwin.p_beginPrefItemRow()+'Prevent extra black bars '
		if(unwin.preventVtBlackBars)checkd=' checked';
		else checkd='';
		prHTM+='<label><input type="Checkbox" onclick="if(this.checked){preventVtBlackBars=true}else{preventVtBlackBars=false};forcevidzb_apply_selected_fixes();" name="ap" '+checkd+'/>';
		prHTM+=' Above&Below</label> ';
		if(unwin.preventHzBlackBars)checkd=' checked';
		else checkd='';
		prHTM+='<label><input type="Checkbox" onclick="if(this.checked){preventHzBlackBars=true}else{preventHzBlackBars=false};forcevidzb_apply_selected_fixes();" name="ap" '+checkd+'/>';
		prHTM+=' Left&Right</label>';
		prHTM+=unwin.p_getQuestionMarkImage('If you uncheck both of these boxes,the video window will always fill to the maximum size,but the video itself remains the same dimensions,so you will have black bars.  It can be nice if you find that the video is changing size and frequently ends up under your m pointer preventings scroll whell control (flash plugin bug me that there is no parm to dissable flash scrolling...)\\n\\nDefault Value: ON & ON');
		prHTM+=unwin.p_endPrefItemRow();
	
		//POSITION AUTOMATICALLY ect
		prHTM+=unwin.p_createPrefCheckbox('positionVideoAutomatically','Position & Scale video automatically [more jumpy]','Window 1024x768 or smaller should probably check this,1280x1024 should not.  For larger screen sizes consider your window aspect ratio-Widescreen generally performs better with this option ON.\\n\\nTrivia:  When this option is off,search box and window title remained in fixed position for ease of use specifically to make use of the extra space at 1280 or larger 4:3 (b0x) aspect.  This is the reason turning this option off performs so poorly at 800 and 1024,since the title takes up so much space (and the video really ought to be up-sized to fill the space as the user scrolls down and more space becomes available,which is precisely what this option does)!\\n\\nDefault Value: ON');
		//prHTM+=unwin.p_createPrefCheckbox('centerVideoVertically','Center Video Vertically Automatically','Only valid if Position Automatically is ON.\\n\\nThis will attempt to center the video in vertical space.  DOES NOT apply when window scroll is near page TOP or BOTTOM,but when scrolling is centered.  Perhaps center vartically when scroll is centered would be more apt title.\\n\\nDoes not apply if the video is already being crushed vertically (ie: video must be at full width,with no black borders on left and right side).  If there is extra space below the video,the video will jump down to a centered position.  The idea behind this is that your mousewheel cannot scroll the window unless its over whitespace,so we distribute the whitespace around the video so that its easier to access for your scrolling pleasure.  Also you may notice this &ldquo;feature&rdquo;when Scale Video at Page Bottom is on.  Any feedback welcome.\\n\\nYou may also note,this option is rendered non-effective by unchecking Prevent Extra Black Bars Above/Below.\\n\\nDefault Value: ON',1);
		prHTM+=unwin.p_createPrefCheckbox('scaleVideoAtPageBottom','Allow Position & Scale at page Footer','When you get to the bottom of the page,there is this pesky thing that happens where the video covers up the search box and whatever other legal nonsense and potentially useful links exist at the bottom of the page!  I don&rsquo;t necessarly endorce ignoring legal stuff so by default the video will shrink so you can see all that.\\n\\nDefault Value: ON');
		prHTM+=unwin.p_createPrefCheckbox('columnPriorityComments','Comment column First (toggle column order)','In 2 column mode this setting determines if the comment column will be added first or second\\n\\nIn 3 column mode this determines if the comments are on the left or the right.\\n\\nDefault Value: OFF');
		prHTM+=unwin.p_createPrefCheckbox('columnScrollIndependent','Scroll columns independent of page (experimental)','Also hides the footer \\n\\nBe aware that checking Auto Scroll Past Header causes the page to get tripple scroll bars but larger video and column size in 2 col mode. \\n\\nDefault Value: OFF');
		prHTM+=unwin.p_createPrefCheckbox('autoScrollPastHeader','Auto Scroll Past Header (bigger video on load)','Jumps the page down past the header on page load which makes the video area as large as possible.\\n\\nThis is a nice option for 2 column mode. \\n\\nDefault Value: OFF');
		prHTM+=unwin.p_createPrefCheckbox('snapfullscreenmode','Auto Snap Fullscreen on ScrolL <span style="color:red;">(N-E-W)</span>','Scroll to the magic spot (happens automatically with auto scroll past header, and you will go fullwindowmaximizedmode otherwise known as double click fullscreen under JSAPI preferences, but this is the shortcut XD  \\n\\nDefault Value: ONN??',(unwin.snapfullscreenmode&&unwin.autoScrollPastHeader)?1:0);

		prHTM+='</div>';//end layout hider div
		
		prHTM+=unwin.p_beginPrefSectn('display','Display');
		//ColWidth
		VBlistenersToAdd.push(createPendingEventObject('vbg_prefInput_colWidth','change',vidzb_clickPrefSelect,true));
		prHTM+=unwin.p_beginPrefItemRow()+'Column Width <select id="vbg_prefInput_colWidth">';
			for(i in lOpColWidth){
				if(unwin.colWidth==lOpColWidth[i])checkd=' selected';
				else checkd='';
				prHTM+='<option value="'+lOpColWidth[i]+'"'+checkd+'>'+lOpColWidth[i]+'<br/>';
			}
		prHTM+="</select>px (On Reload)"+unwin.p_getQuestionMarkImage('Especially cool if you scroll content to a huge size on a high density display or protjector, widescreen ratio display.  You must reload the page to get the real effect of this unfortunately.  Perhaps I can make this more agressive if you require. \\n\\nDefault Value: 360');
		prHTM+=unwin.p_endPrefItemRow();
		
		/*
		VBlistenersToAdd.push(createPendingEventObject('vbg_prefInput_vbmaxdisplayquality','change',vidzb_clickPrefSelect,true));
		prHTM+=unwin.p_beginPrefItemRow()+'Maximum Quality <select id="vbg_prefInput_vbmaxdisplayquality">';
			for(i in lOpDisplayQualities){
				if(unwin.vbmaxdisplayquality==i)checkd=' selected';
				else checkd='';
				prHTM+='<option value="'+i+'"'+checkd+'>'+lOpDisplayQualities[i].q+' (fmt'+lOpDisplayQualities[i].v+')<br/>';
			}
		prHTM+="</select> (On Load)"+unwin.p_getQuestionMarkImage('Lets you define a maximum quality!  This is especially helpful if you are on crappy internet that is tuned to be just so slow that HD does not buffer in time. \\n\\nDefault Value: HD');
		prHTM+=unwin.p_endPrefItemRow();
		*/

		for( z in lOpDisplayQualities ){
			prHTM+=unwin.p_createPrefCheckbox('l0pQualz'+lOpDisplayQualities[z].v,'Enable Format '+lOpDisplayQualities[z].q+' '+lOpDisplayQualities[z].v,'Allows dissable of a particular video quality.\\n\\nDefault Value: ON (idk');
		}
		
	  if(unwin.siteID == 1)
	  prHTM+=unwin.p_createPrefCheckbox('alwaysShowModControlsUnderVideo','Always show extra controls under video (if installed)','There are many other user scripts besides this one that work great on youtube.  Many of these place extra controls underneath the video.  Normally these are only accessable when you scroll all the way down, however if this box is checked, they will stay on screen all the time under the video.  Controls that load before VidzBigger show initially, while the rest will show after you move the scroll bar.  Check the box at any tiem to toggle.  To add your controls here just append a new DIV position relative to the watch-player-div (or video positioner) (whatever that container is identified by).\\n\\nDefault Value: OFF');
		
	  prHTM+=unwin.p_createPrefCheckbox('delayVidzBiggerInit','Delay Load for Extra Mod-Support [new]','Other mods such as YouTraceX will work if they have enough time to finish loading first. \\n\\nDefault Value: OFF',1);
		
	  prHTM+=unwin.p_createPrefCheckbox('enableTopVidzBrowser','Enable Top Vidz In-Prefs WebBrowser','This allows you to load TopVidz or other webpages /within this frame/. \\n\\nDefault Value: ON');

		//AUOTCLICK PREFS 
		prHTM+=unwin.p_createPrefCheckbox('autoExpandVideoDescriptions','Auto-Expand Video Description (on load)','So many people post stupid comments answered by the description.  Showing the full description by default reduces the chance of this and gives useful details about the movie,making it easier to spot blatant advertising (and avoid it this one hopes).\\n\\nDefault Value: ON');
		//prefer_png24bits
		prHTM+=unwin.p_createPrefCheckbox('prefer_png24bits','Use 24 Bit PNG Images','If this is checked 24 bit PNG with transparncy will be used.\\n\\nOtherwise 8 bit PNG with a 1 bit mask will be used. \\n\\nThe preference flag and any other embeded images will have nicer rounder corners and smoother fades in 24 bit mode at minimal processing expense.  This option is for people who would notice small visual things like this,otherwise the max performance setting is the default.\\n\\nDefault Value: OFF (8 bit)');
		//invert scheme
		prHTM+=unwin.p_createPrefCheckbox('invertColorScheme','Dimm Background/Invert Color Scheme (on reload)','Inverts the color scheme dimming the youtube background.\\n\\nDebating the option of including a color chooser for text and background color,let me know if your interested.  Also dimming other elements with transparency or removing them completely is a possibility. \\n\\nCAUTION: beware of firebug inspecting base 64 encoded PNG images after they have been replaced in this step may crash scripts\\n\\nDefault Value: OFF');
		prHTM+=unwin.p_createPrefCheckbox('invertPrefColorScheme','Invert Preferences Color Scheme','Makes preferences more reader-friendly Default: OFF');
		//biggerComments
		var thtm='Show </label>';
		VBlistenersToAdd.push(createPendingEventObject('vbg_prefInput_maximumCommentCount','change',vidzb_clickPrefSelect,true));
		thtm+='<select id="vbg_prefInput_maximumCommentCount">';
			for(i in lOpCommentCounts){
				if(unwin.maximumCommentCount==lOpCommentCounts[i])checkd=' selected';
				else checkd='';
				thtm+='<option value="'+lOpCommentCounts[i]+'"'+checkd+'>'+lOpCommentCounts[i]+'<br/>';
			}
		thtm+='</select><label> comments per page (on reload)<label>';
		
		prHTM+=unwin.p_createPrefCheckbox('biggerComments',thtm,'Another Feature Thanks to YousableTubeFix\\n\\n500 comments are loaded per page (They are then reversed and the first so many you specify are displayed.  Too many IS SLOW on most compuers).\\n\\nThis can be a little slow on some systems,or generate bugs in 2 column mode. \\n\\nDefault Value: OFF');

		//AUTOPLAy and QUALITY settings
		prHTM+=unwin.p_createPrefCheckbox('useHighQuality','Link to HQ/HD Videos, or use <a href="http://www.youtube.com/account#playback/quality" target="_blank">Account Settings</a>','When a youtube page loads,this feature updates all links so that when u click them,you will get the HQ video.  Does not work if you click before the page fully loads,but you can probably watch your links in the status bar as you hover,if it says fmt=18 at the end you are set for HQ.\\n\\nAlso sends an XMLhttp request which checks for fmt=22 which is the latest widescreen HD format.  The second checkbox allows you to enable or disable indicators.\\n\\nSince the whole idea of making Vids Bigger would be to have a closer to widescreen HD expereince,it only makes sense to maximize the video quality by default.  WARNING: does not make much sense at 1024 or 800 pixel width!  Fortunately this is relatively trivial unless you are charged by the megabyte (although I could auto check your window width and turn this on or off automatically if you like,so send feedback if anythings not working for you!). \\n\\nDefault Value: ON');
		if( unwin.useHighQuality ){
			prHTM+=unwin.p_createPrefCheckbox('indicateHDQuality','Indicate <span style="background-color:red;font-weight:bold;">&nbsp;HD&nbsp;</span> when available','If we already are linking to the highest quality videos, also tag HD videos with an HD flag.  Youtube seems to be doing this on their own, but for now this feature has more widespread results.  \\n\\nDefault Value: ON',1);
		}
		prHTM+=unwin.p_createPrefCheckbox('LoadHighQuality','Else load HD as soon as deteced on page load','Not necessarily useful unless the above is turned off.  As soon as an HD/Q (FMT22,FMT35,FMT18) version is detected it is swtiched on support for FMT18 also... basically teh highest avaialable format detected will load.  Dissable the above features and save bandwidth with this...  \\n\\nDefault Value: ON');

		if(unwin.siteID == 1){
			prHTM+=unwin.p_createPrefCheckbox('animateVidThumbnails','Animate Video Thumbnails (on hover)','Animates the 3 video thumbnails.  Does not load them unitl you mouse over.  The rate is ~1.5 seconds but can vary if your internet is slow.  If you want an option to simply preload all thumbs or to modify the rate, just ask!  \\n\\nDefault Value: ON');
			if(unwin.animateVidThumbnails)prHTM+=unwin.p_createPrefCheckbox('alwaysAnimateVidThumbnails','Always Animate All Video Thumbnails (slow)','Animates the icons even if your mouse is not over them.  The rate is the same but there is a 1+(0.2*n) second delay before this starts happening but it probably still happens for all images at close to the same time which may over trafic your intertubes.  \\n\\nDefault Value: OFF',1);
				if(unwin.alwaysAnimateVidThumbnails)prHTM+=unwin.p_createPrefCheckbox('alwaysAnimateVidThumbnails1LOOP','Use Single Interval (slower?)','Unchecking this looks cooler, using the multi interval, but its more system intensive theoretically.  Using one interval they all flip at the same time.  Thinking about limiting the number they can flip each time to 22.  \\n\\nDefault Value: ON',2);
			prHTM+=unwin.p_createPrefCheckbox('flipVideo','Link to Fliped Videos (on links, after reload)','April Fools!\\n\\nDefault Value:D OFF');
			prHTM+=unwin.p_createPrefCheckbox('dissableAnnotations','Disable Annotations (on reload)','Disables annotations (and the annotations editor).\\n\\nNot default because sometimes annotations contain traces of useful or pertinent information.  Or some hyperlink youtube maze game...\\n\\nDefault Value: OFF');
			if(!unwin.enable_jsapi)prHTM+=unwin.p_createPrefCheckbox('useNonFlashPlayer','Use Non-Flash Player [not-finished!] (QT or VLC ect)','Attempt to use the non-flash player if available.  JSAPI must be dissabled before this option will show up since JSAPI only works with the flash player.  Depending on the format you will either get Quicktime or VLC (if you have the browser plugin installed) I know these featues need improvement, but at least they are pulbic now!  This is mostly for my parents old computer which cannot handle the flash player.  Still have to add the controller for VLC somehow (without breaking other media players) \\n\\nDefault Value: OFF');
		}
		/*
		if(unwin.reBrandYouTube)checkd=' checked';
		else checkd='';
		prHTM+=unwin.p_beginPrefItemRow()+'<input type="Checkbox" onclick="if(this.checked){reBrandYouTube=true}else{reBrandYouTube=false};forcevidzb_apply_selected_fixes();" name="ap" '+checkd+'/>';
		prHTM+='Re-Brand YouTube (on reload)';
		prHTM+=unwin.p_getQuestionMarkImage('Cover the YouTube logo with the VidzBigger logo!  Rock out!\\n\\nDefault Value: OFF');
		prHTM+=unwin.p_endPrefItemRow();
		*/
		//AUTO SKIP
		prHTM+=unwin.p_createPrefCheckbox('autoConfirmAdultVideos','Skip Adult Confirmation (when logged in)','Extra button you have to press after logging in to say you are old enough to watch adult content.  Check the box to skip this extra annoying step.\\n\\nDefault Value: OFF');
		prHTM+='</div>';//end display hider div
		if( unwin.siteID == 1 ){
			//jsapi
			var jsamsg=unwin.jsapimessage;
			if( jsamsg.length < 1 ){
				if( unwin.enable_jsapi )jsamsg='<span style="color:orange;">status unknown...</span>';
				else jsamsg='off';
			}
			prHTM+=unwin.p_beginPrefSectn('JSAPI','YouTube JSAPI <span id="jsapimsg" style="font-size:12px;position;relative;top:-2px;">('+jsamsg+')</span>');
			var selHTM=''
			if(unwin.enable_jsapi){
				VBlistenersToAdd.push(createPendingEventObject('vbg_prefInput_jsapiRetries','change',vidzb_clickPrefSelect,true));
				selHTM+=' up to <select id="vbg_prefInput_jsapiRetries">';
				for(var x=0; x<=12; x++ ){
					if(unwin.jsapiRetries==x)checkd=' selected';
					else checkd='';
					selHTM+='<option value="'+x+'"'+checkd+'>'+x+'<br/>';
				}
				selHTM+="</select> retry";
			}
			prHTM+=unwin.p_createPrefCheckbox('enable_jsapi','Enable Youtube JSAPI (on load)'+selHTM,'The JSAPI is required for certain YouTube features such as Toggling the Annotations Editor to work properly,so this is enabled by default.  Also possible to access VidzLoops features when this is enabled.');
			if(unwin.enable_jsapi){
				//autoplay
				prHTM+=unwin.p_createPrefCheckbox('donotautoplayVideos','Prevent Video Autoplay','Great for the office (or on a slow connection where you need to preload)!  Videos will not play automatically when this box is checked,allowing you to check your volume.  Possible future options might include,auto mute video,if requested.\\n\\nIf the JSAPI fails to pause the video,other JSAPI calls on the page will also fail (such as timecode jump and dissable annotations)\\n\\nDefault Value: OFF');
				if(unwin.donotautoplayVideos)prHTM+=unwin.p_createPrefCheckbox('donotautobuffer','Prevent Video Auto-Buffer (more reliable)','Great for the office (actually)!  \\n\\nDefault Value: OFF',1);
				//Allow Player to be Clicked
				prHTM+=unwin.p_createPrefCheckbox('allowPlayerClk','Enable Double Click Fillscreen (on reload, cpu itensive)','Lets you double-click the player to go fullscreen(youtube) and scroll the window when mouse is over player (requires youtube jsapi).\\n\\nSets the WMODE of the Flash Player element to transparent which means that flash will run more slowly and is rendered as an interactive page element. \\n\\nInadvertently allows you to scroll the page much easier (even if mouse is over video) \\n\\nDefault Value: OFF');
				
				prHTM+=unwin.p_beginPrefItemRow();
				prHTM+='Flash Vars:';
				prHTM+='<input style="width:200px;" type="text" value="'+unwin.extraflashvars+'" id="vbg_prefInput_extraflashvars" />';
				VBlistenersToAdd.push(createPendingEventObject('vbg_prefInput_extraflashvars','change',vidzb_clickPrefTextbox,true));
				prHTM+=unwin.p_getQuestionMarkImage('Extra Flash Vars for the Player to Customize it Further.\\n\\n color1:border color\\n color2:bottom color \\n\\n Modifies ONCHANGE so do NOT change it unless you know what you are doing (reload player using the yousable pulldown to see new variables), if you mess up use UNDO (ctrl z) before your cursor leaves the field in your web browser or reset preferences!')+unwin.p_endPrefItemRow();
			}
			prHTM+='</div>';//end jsapi div
			if( unwin.enable_jsapi ){//youtube looper
				prHTM+=unwin.p_beginPrefSectn('vidzLoops','VidzLoops');
					prHTM+='<span style="font-size:12px;">';
					prHTM+=' <a title="Grab Loop Start from Current Time" href="javascript:void(0);" onmousedown="document.getElementById(\'vbstartseconds\').value=vbGetCurrentPosition();">Start</a>: <input type="text" size="4" id="vbstartseconds" Value="'+unwin.vidzbLoopTimerStart+'" />';
					prHTM+=' <a title="Grab Loop End from Current Time" href="javascript:void(0);" onmousedown="document.getElementById(\'vbendseconds\').value=vbGetCurrentPosition();">End</a>: <input type="text" size="4" id="vbendseconds" Value="'+unwin.vidzbLoopTimerEnd+'" />';
					prHTM+=' <input type="button" onclick="vbResetLoopTimersFromFields();p_refreshPrefs();" Value="go" />';
					prHTM+=' <input type="button" Value="clear" onclick="resetVdizLoops();p_refreshPrefs();" /><br/>';
					prHTM+=' <a title="First Click: Start Time, Second Click: End Time and Begin Loop, Third Click: Stop Loop.  Use while video is playing." href="javascript:void(0);" onmousedown="vidzbLoopButtonClicked();p_refreshPrefs();">'+unwin.p_vidzbWebLoopButtonText()+'</a>';
					prHTM+=' | <a title="Save & Share Loop at VidzLoop.com" href="'+shareLoopsVidzLoops()+'" onclick="vidzPausePlayer();" target="_blank">Share Loop</a>';
					prHTM+=' | <a title="Save & Share Loop at VidzLoop.com and leave this instance playing" href="'+shareLoopsVidzLoops()+'" target="_blank">Duplicate</a></span>';
					prHTM+=unwin.p_createPrefCheckbox('autoLoopOnComplete','Auto Loop Videos at End (beta)','The JSAPI is required for this feature to work.  When the video state changes to STOPPED the player is automatically reset to timecode zero and playing should resume.\\n\\nDefault Value: OFF\\n\\n VidzLoopz Instructions: To submit loops all you have to do is specify start and end seconds.  Click start while the player is at the start time and end when the player is at the end time, or just click the a-b-reset button two times while the video is playing to make a short loop.  Once your loop looks good, click Share Loop.  You will be able to fine tune your loop on the next page, name and describe it, and click save.  The newly saved loop can be linked to anyone in the world. \\n\\nDefault Value: ON');
					if(unwin.autoLoopOnComplete) prHTM+=unwin.p_createPrefCheckbox('autoLoopDelay','Delay End Looping','Adds a 1.5 second delay after the video is complete before it loops.  \\n\\nDefault Value: OFF',1);
				prHTM+='</div>';//end looper
			}
		}
		//ADVERTISING PREFS
		prHTM+=unwin.p_beginPrefSectn('Advr','Advertising');
		prHTM+=unwin.p_createPrefCheckbox('vidzb_blockPlayerAds','Disable in-video Ads (on reload)','Removes ads that show up in the flash player on youtube.  For other sites please request!  \\n\\nDefault Value: ON');
		prHTM+=unwin.p_createPrefCheckbox('vidzb_blockAds','Disable or Replace Normal Ads (on reload)','Removes annoying (often hideously slow flash based) YouTube ads, replacing them with a link to VidzBigger.com... or if the [allow replace with vidzbigger ads] setting is checked, my ads show instead of the flash ads or regular BOX ads.  My ads will be less annoying and more simple than youtube ads. [donate to remove these for your IP...]\\n\\nDefault Value: ON');
		if( unwin.vidzb_blockAds) prHTM+=unwin.p_createPrefCheckbox('vidzb_allowMyObnoxiousAds','Replace Normal Ads with VidzBigger Ads','Removes annoying YouTube ads,replacing them with VidzBigger.com ads which will serve to pay for all the time that went into this project and promote future development... [donate to remove these for your IP...]\\n\\nDefault Value: ON');
		prHTM+='</div>';//end ads div
		
		//PRIVACY
		prHTM+=unwin.p_beginPrefSectn('Priva','Privacy');
		prHTM+=unwin.p_createPrefCheckbox('shareVideoViewStatistics','Share view statistics','When a video gets popular in the VidzBigger community (10+ hits from anywhere in the world), it shows up on a list of top videos.  Only the title of the video, and the video URL are transmitted (http).  vidzbigger.com/videos');
		prHTM+=unwin.p_createPrefCheckbox('valtsave','Alternative Prefs Save Mechanism (on reload)','I had a report of someone not being able to save preferences, possibly due to their FF install version, or GM version, or some combination.  If you insist on saving preferences under these conditions try this feature which will write prefs to a site cookie (WARNING: this feature causes all preferences to on a per-site basis, meaning you must reconfigure each site), this feature is always on in chrome).  TO get the latest versions please visit the vidzbigger.com/downloads now!');
		prHTM+='<span style="margin:10px;font-size:10px;">All features are supported as much as possible for the latest versions of everything.  Its your responsibility to keep software upgraded.  If it matters I can delete any period of hit history for a particular IP address and time range.  I hope people donate and support continued development and completion of hit management and sharing/publishing features, no personal data about you will be made public unless you create an account with a public profile or link your VidzBigger account with another service.</span>';
		prHTM+='</div>';//end privacy div
	}//end enabled
	
	prHTM+='<br style="height:3px;line-height:3px;" />';
	prHTM+='Last update took: <span id="lastTimer">'+unwin.lastTimer+'</span> seconds [on Scroll or Resize]';

	var binfo='';
	binfo+='clientHeight=>'+document.body.clientHeight+':::';
	binfo+='clientWidth=>'+document.body.clientWidth+':::';
	binfo+='vidz_Version=>'+vidz_Version+':::';	
	binfo+='lastTimer=>'+unwin.lastTimer+':::';	
	binfo+='vuseragent=>'+navigator.userAgent+':::';
	binfo+='vvideourl=>'+window.location+':::';
  binfo+=unwin.preferencesToString();
	binfo+=':::';
	binfo+=':::';
	binfo+=':::';
	binfo+='Your Greasemonkey Version=>'+'?????  '+':::';
	prHTM+='<br/><b><a href="http://www.vidzbigger.com/contact.php?BugReportInfo=1&browserinfoHEX='+encodeHex(binfo)+'" target="_blank">Report Bug/Question/Comment</a> &bull; <a target="_blank" href="http://vidzbigger.com/index.php?v=projects&RD=vb_preferences_myProjects">Projects</a> &bull; <a target="_blank" href="http://www.vidzbigger.com/index.php?v=donate">Donate</a></b><br/>';
	
	var sites={'YouTube':'http://www.youtube.com',
	'Google':'http://video.google.com',
	'Metacafe':'http://www.metacafe.com',
	'DailyMotion':'http://www.dailymotion.com',
	'Hulu':'http://www.hulu.com',
	'Escapist':'http://www.escapistmagazine.com'
	};
	
	for( i in sites ){
		prHTM+='<a href="'+sites[i]+'"><img src="'+sites[i]+'/favicon.ico" title="'+i+'" /></a> ';//
	}
	
	//prHTM+='<input type="button" value="Save" />';
	prHTM+='<br/><br/><div style="float:right;margin-right:0px;position:relative;top:-4px;text-align:right;">';
	prHTM+='<a target="_blank" href="http://www.vidzbigger.com?RD=vb_preferences">VidzBigger.com</a>&nbsp;';
	prHTM+=' &bull; <a target="_blank" href="http://www.vidzbigger.com/videos?RD=vb_preferences_topvidz">Top videos</a>';
	prHTM+='<br/>Your version:<a target="_blank" href="http://www.vidzbigger.com/versioninfo.php?v='+vidz_Version+'">'+vidz_Version+'</a>&nbsp;</div>';
	prHTM+='<input type="button" id="vb_x2" value="  X " />';	
	prHTM+='<input type="button" id="vb_s2" value=" OK-Save" />';	
	prHTM+='<input type="button" id="vb_rst" value="Reset" />';	
	prHTM+='</div>';
	document.getElementById('vidzbigger_prefs_menu').innerHTML=prHTM;
	
	//THSE COULD BE DONE IN THE LOOP BELOW, BUT STILL WOULD HAVE ONE LINE EACH ELSEWHERE, SO THIS IS SIMPLER
	$g('vb_x1').addEventListener("click",vidzb_cancelPrefsButton,true);
	$g('vb_x2').addEventListener("click",vidzb_cancelPrefsButton,true);
	$g('vb_s1').addEventListener("click",vidzb_savePrefsButton,true);
	$g('vb_s2').addEventListener("click",vidzb_savePrefsButton,true);
	$g('vb_rst').addEventListener("click",vidzb_resetPrefsButton,true);
	if(_vt('vb_xfs'))$g('vb_xfs').addEventListener("click",vidzb_cancelFulscButton,true);

	for( var zi in VBlistenersToAdd ){
		$g(VBlistenersToAdd[zi].eid).addEventListener(VBlistenersToAdd[zi].etype,VBlistenersToAdd[zi].efunc,VBlistenersToAdd[zi].bubl);
	}
	for( zi in unwin.visvidzbpPrefItems ){
		if( unwin.visvidzbpPrefItems[zi] != false && _vt(unwin.visvidzbpPrefItems[zi]) ){
			unwin.vidzbpreftoggleme($g(unwin.visvidzbpPrefItems[zi]));
		}else{
			
		}
	}	
	unwin.p_updatePrefwinHeight();
}

unwin.p_beginPrefItemRow=function(){
	return '<div class="vidzb_pref_row" onmouseover="this.style.backgroundColor=\'#'+(unwin.invertPrefColorScheme?'DDDDDD':'181818')+'\';" onmouseout="this.style.backgroundColor=\'transparent\';">';
}
unwin.p_vidzbWebLoopButtonText=function(){
	var aval=unwin.vidzbLoopTimerStart;//document.getElementById('vbstartseconds').value;
	var bval=unwin.vidzbLoopTimerEnd;//document.getElementById('vbendseconds').value;
	var ostr = 'Loop ';
	if( aval > 0 ) ostr+='A:'+aval+' / ';
	if( bval > 0 && aval > 0 ){
		ostr+='B:'+bval+' / ';
		ostr+='[Reset]';
	}else if(aval==0){
		ostr+='[A:-- ] / ';
		ostr+='B:| Reset';
	}else{
		ostr+='[B:-- ] / ';
		ostr+=' Reset';
	}
	return ostr;
}
unwin.nodeToToggle=0;
unwin.p_endPrefItemRow=function(){
	return '</div>';
}

unwin.visvidzbpPrefItems = [];
unwin.vidzbpreftoggleme=function(who){
	var idstr = who.id;
	pice = idstr.split('_');
	if(pice[1]=='tog'){
		if( _vt(pice[0]+'_viv').style.display=='block' ){
			pice[1]='shw';
			_vt(pice[0]+'_shw').style.display='none';
			//_vt(pice[0]+'_hid').style.display='inline';
		}else{
			pice[1]='hid';
			_vt(pice[0]+'_hid').style.display='none';
			//_vt(pice[0]+'_shw').style.display='inline';
		}
	}else{
		who.style.display='none';
	}
	if( pice[1]=='hid'){
		_vt(pice[0]+'_viv').style.display='block';
		unwin.visvidzbpPrefItems[pice[0]+'_hid']=pice[0]+'_hid';
		_vt(pice[0]+'_shw').style.display='inline';
	}else{
		_vt(pice[0]+'_viv').style.display='none';
		unwin.visvidzbpPrefItems[pice[0]+'_hid']=false;
		_vt(pice[0]+'_hid').style.display='inline';
	}
}

unwin.p_vidzColapzed=function(){if(unwin.prefer_png24bits)return 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAQCAYAAADNo/U5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAd5JREFUeNqM0jtIHEEYB/BvZ+6xmhwiJ2hIQMTgCT6KGJJYSUwIFiKkSe0LH0UiWAgSgpVVCgvTKKSJTQikEfEsNKYNBCQqCAkEE7HxcaKnd7d7uzP+v2UW5AjBD36zy+z3zew8LK01ISTUQBtUwg78gix4VBooknAbRmEz73h46GXoh7sQ5YGv4uYm9HBB+runGRf+zeg8+qYgVVoozK9VFFy/hWeeWZf0ekVQziXbKfpv0NULjVAOnB80efhhx+Rc3R1J9bd82v5p0asFovVNkiicwPeXZr03wjUxG9qUUh8KjqfepS/0s7c6wO/8u56v0shp4HzL7B6HDSkYxejDuxlJ89805bOKyhKChh5alKqmx/j+VZiCcG0uHMWjslBb6dN0lwo+cqGJGDcRk5yEe9ANzx3Xt/+cSFrdyGGWsiCbB0HqaVhUDV0wUvTU/d/HwlrdcGhxuzzYsJ7mHA10xpUQ1ho69sOiDpjAlqfef3Ho01I2GLmpPU5jTyXVJe2dWESMo2sLDsOiB6UFk31V1NlqHUipZ6UQH9G1B064sEg4JceL7gQNPomfI3EhIq05dO2a+6dK714zTOJ8cq7nf8b7I0iaO0n/wucUNbuXgDPIQJH+E1cP99pxKcAAgzkmQ9381EAAAAAASUVORK5CYII='; else return 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAQCAMAAAD6fQULAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAwBQTFRF////9/n8lLf12Oj/Rov/t8z8crH+aaT8+Pr8Pmvo+Pn8+/z+/v7//P3++vv94+///v7++vz9/f7++vr9/f3+////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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ORK5CYII=';}
unwin.p_vidzXpandD=function(){if(unwin.prefer_png24bits)return 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAQCAYAAADNo/U5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAhhJREFUeNqc0s9rE0EUB/A3k002JjXWpiWWpKVKaqtiQUREtFULCl4KQm8K6U0QxIMoeOpfoBdPXi0qlF6jWAS1RSo5RCQ9VU0hWH+lv4jZzXY3M8/vhkU8FAsOfA6Z7Htv5r0RzEz/WAZEIARugI0dArrgEHTAF/gMm4RKHbAXoiD8yoEEjGmtXzeVqm15eg6/r0DazzYOAhZhqZWJSEMnXLBcGlmqsCj/5OHjWdGTSYqbxFpbWisXGd8hywT0B9UvQmmhzDz+QPH9vGLWTRd7Z41i2Yt9qCg6lTVO7u8OZU1DPEXhWVQ5jTsPvl/26Lsdoa59mixPrsUjtGFU60zP3jZoelbT5eFoMnep7RopOm8a1F6zlfFxhclDz4ZSkuoOVxG0Kc8Mhss3xmK0utqkx3mLZuatsOWoI6iSJhmiFduk3j1oX0RRajc9wQnWZdyUt0eGzNLUZIoP90fp4bxJjxZC9BVJGprJQktO9LrUnRS/SIgXCLL97r3BHW4NZPjO3Vzi3HRBGPmiplhY01pDUl9C0bEDmqQQM8GstB+0AQUETva0c+76KOc6w475ydlFpWWmJI52MGP6z+Yl1FpjDwbpDzUGR9HXe15T/ShUFD9fVFysMFfr+hVGMoD/pf+9+Ovt+QM2IY29UWS6iju4tium4ibNYf8bbLU+3ObBhqEN4uAFR3L8Q/3JvsMr33ZJ+o/1W4ABAFNZIJvqesvtAAAAAElFTkSuQmCC';else return 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAQCAMAAAD6fQULAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAwBQTFRF/////v7+///+9fr+4e7+/P39+/z/nr727PP+8ff+4uv9/v797fP8e7f+S5b/z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jbg8GPS4GcE8e1dlXQ8GEXZTYyYPBiZLOzVmDwYrISlHJRsGQSd5OQ4PBmlFGVkLHiZOfS13kClMkuoC4obCfAasYBtUWHQUrE3EJBgh9jEya/I6OLPAbGcSdbPV1kC4xYURzZ2EeAABBgCkLSw6KXC9KAAAAABJRU5ErkJggg==';}
unwin.p_getQuestionMarkImageData=function(){return 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAQCAMAAAAYoR5yAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAEVQTFRF////2dnZ/v7+3Nzc2tra/f398/Pz4+Pj6urq4ODg8vLy/Pz8+vr629vb+fn53t7e+/v74eHh9PT0+Pj45ubm6enp////7ZKi7QAAABd0Uk5T/////////////////////////////wDmQOZeAAAAZElEQVR42mSMWQ6AQAhDW2ZzH1fuf1Q7Rr8spLwUAhwpl5ITXFUpVUiZMQRyF26zzFjkXQd3xB5wM5HxEkpAiPYgbObRnimLXNpUr5yepToFvOjjmvxNl96+g4H4o03n2PAWYADdiAaTb28wwQAAAABJRU5ErkJggg==';}
unwin.p_getQuestionMarkImage=function(altTip){return '<a href="javascript:void(0);" style="position:absolute;right:5px;top:4px;"><img border="0" align="bottom" onclick="alert(\''+altTip+'\');" src="'+unwin.p_getQuestionMarkImageData()+'" alt="?"></a>';}
unwin.vidzb_vidzBiggerInvertedTemplateImage=function(){return 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMAAAArwCAMAAADFCMTWAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAJ8UExURQAAABcXF0pKShgYGDExMRkZGRoaGkhJSUpIOEpEJTs7Ozk8RDAwMD8/PxYWFkZGRko/CERGSUREREhISEpHMUBESUJCQkpHND9DSUpFKEJFSUpJP0pGLkZHSTw8PENDQxsbGy8vL0NGST1CSUBAQEFBQUdISd4sLEpGKz9CRkpAD0FDR0o/DEJER0pINzs+RDtASEpCG0pCGEpBEi4uLkpEIUpBFUpIO0pDHj5ARklJSTk+RyUlJd1GRs51dQgICGZmZhAQEOksLNddXSwsLBoeJCIiIjMzMz4+PkpHNysrKyoqKkpFKzw/RUVFRT1ARSkpKTc8RUNFSD09PRUVFUdHR30wMHV1dVRUVOc0NBoWFqG02kxMTGJ5rbKysl0yMtVTU3U6Ois5ANTU1NWWlqczM11dXZ4/PyQZGQIBAfX19bpdXVk+PldXVyUWFos8PWFhYUAnJy93K4tLSzaPK1kqKallKS9LY0FKWXNWOEJXdkhlk/8zMw4JCRsmL/5NTRYQENU2Nk5/qsM4ODJplQgHBzQ7TBMaCUBaADF1q1iHFTwgIP1iYu1oaE5yuE2WRThcMk52AJOp6ahIS7K+0Px2dW2RyM1ISc+8vDQfIL+CgiItICtHDw0KChENBTgrKwMEAi94ySVFIw0QDaioqAoLDAoIAf2HhlZAKhwYBStgp/6oqPuWlkx8f5d5dwQFBYWFhaamphkcGVB4VP+7uwkHB+QsUBcoGBYTAp87T2ovOkQuC3RzhR8bEwICAQYGBhMTEywaHjY0LqKiomlkUJGuyKOjo9Y2NkCAuhcXFc6HlvPExPjR0QoJCJNvtyQjIgMDAukuGtpbdAAAAA47L1UAAADUdFJOU/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////8Ag4CCPQAAIIhJREFUeNrs3Y1jG3d9x/HvYBuwjfH8tDHpjiczxjY2BnuSLF1c7/n5QVISIdvEkvNU2XFivNl1E8dpumLaBJrFSdO0JFlYKOsT0EKhHQw2xtjz/A/t97s7SacHu5Wrk+/bvD9xpfNPqv173e/h7idZkshLTN1koWAz0hm/tLBu7xHcd3OIeYm1H+mVu+46efLkZz7zmb/18xmbkydXkghYH9kCYAk+4O//4R++9KWvfvXf/+NLJ9eTB1gZ2RowcrKD8NWTyQNUR0b2ZrOTQbIRgfn2rrAfGUFI+PuTwwXM5fOOrWU+n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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALh9AP8vwAD1EChczkY4KQAAAABJRU5ErkJggg==';}
unwin.vidzb_vidzBiggerFlagImage=function(){
	if(unwin.prefer_png24bits)return 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADsAAAATCAYAAAAu2nXoAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAlwSURBVHja5FhpbFTXFf5m88x4B68YG9vYgBfwEkBUhABhaS1SC4gSSqpWtAqRgogQKDQKgiaiIDUVVVWqQJSgVCZpk7pNQymBiuK4gkKIcQOOMRhsbGOMd489nn3evPdOz73P2AbS/gj51R7p6s1979579u+cOyYAhP8Tsj74wmw2Iz4+HhkZGbDZbOjt7YXL5YKmabBarUhOTkZqaioCgQB6enrk85uk2NhYZGZmSj6Cn6qqcLvd6Ovrk08xfxSie4MVpYKCAtq7dy9dvXqVrly5Qtu3b6f09HRixam8vJzefPNNam1tpePHj1NFRQVFR0fT5DMeZcTFxdH69euppqaGgsEgCRLP5uZmOnz4MK1evZoSEhIehcfEhK1Ku3btokCY6FKLRqcva5LhunXrKCcnh44cOUIuL/F7na52Ep08eZJmz579jSm7YMECamxsHOOt8zB4ibnLq9P169dp8eLFX/v8+8LY4XCgpKQEvcM69v0xLN8tnOXAqlWrZHht3rwZJ+p1vPupCc+vBCrXrMGFCxdw8eJFdHR0yPW5ubmYNm0aoqKi5FyEufjG0SDDUJyTn58vh/h9j3w+H5YsWYJ58+bh9Q8UnPjCBKfdBjNUKBENT84F3thUiJUrV0JRFMlD7BHn9vf3y/SbPn065s6di1mzZkn+AwMDaGlpwc2bN2UqPuTZQ4cOUTCs05Oveehbr7ipvU+lhoYGOnHiBL8n+sFvwvTUzyM07KNx8ng89NZbb8khfj9IbW1ttG3bNiotLaUNGzZQfX09/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RdHUPYkpsCD+qTJb7zpw5M15SJZbw+Phe2yhaK3HbmUx79uwhTnKaOXMmHThw4L5vp06d+o+tH5cA2rFjB3GnQ1+Xzp49Sy+99BLt27fvIZlEq8hNBXEd/cq94vIibnKyPMsiTQYYmEwmEc6vMoo6RV6KxM7KykJ3dze4H32o4earn2wvRcEW64qKisDXNHnnFEAn9t24cUN+F6VAnHdvzWTyer3jOCHu0ZPPuHv3LviKJ5/i4vBVMvE1E8XFxVImIbfolu5dQEQZFZEqqsh9yo4pnMKPZ3gs45EvLjI8pv4v/FPxbwEGAOem5+z3fCMwAAAAAElFTkSuQmCC';
	else return 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADsAAAATCAMAAAAZBIXaAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAADAUExURY239tHR0VNxz5iYmAAAAMbZ+DJp7bW1tXp6etTj+i1VyygoKP///2ZmZkZGRlRUVBgYGJzD8muO6mSq+Tg4OFyZ9ery/abF+mmn6lek+WyG1bfM+xdI01qd5j938kuG9qi46LfS++bm5vLy8g0NDUyW+leY2+Ls+2q0+yla4fT4/qrP9z5k1AUFBZep33y580Fhw7rG6/j4+EiJ5Xyj9g09y/D1/l980YCX3/j7/jt/6oSi5xtDwFOS71OR4wAAAJcwnMcAAABAdFJOU////////////////////////////////////////////////////////////////////////////////////wDCe7FEAAACg0lEQVR42pyT23KjMAyGcagBxz+YFHBIaSAHEnIi55LSNu37v9UKmNmZ3fZm978wwtIny0IYD/8vo11zKf3yofSlzH8KymXohU3ED6x0GHP8MjSZ7f0A58o+48zMv30NmzsbnkBJUyfClt/ZkPEkSbhm4XfWt4ssq0yFJEvgeFJ6ynVVmFOtZLjKxNVK0/QKJ/Q8vyylchw39Mv2XLN+Swtm11FWAXPTnIM0c6Vi6JRZ02maFjOGuSOV3bn99r4OojcBiGwIMZwCU4PEYTMxIGMgqiwDrpmAHiQwz9Xwfjc4C1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FBY697lad4oCX3H2z7D9hybvH61t4z/D2/g8+zHmt6YOk9k+S5UKE65Om4YKc6AAAALWbhD8AAABAdFJOU////////////////////////////////////////////////////////////////////////////////////wDCe7FEAAADO0lEQVR42qxUa3OiSBQ90gGap0QaRImCKAgmNvEFTkwm//9f7W3MbtXszIeZqrlV2qf7nj73pY2Hv28YvivXDduHNnTd6lekyk28RDH+QNPVNU0PW9fKbO8XolVgS8jM8qrf16x0yQsEoSUKZrs/cxKNF0XBhZb8vmZol+u1sAIU6wK6F4Ze4DhBUlHNBJzAwpux2Wx20BPPC9vW9XTdScKW3LoeuKFiBZ6bDAt1aMjTkptNqdlysu6B2rJqkGWOG2i429pYLIiSaah1N7B/cGv6sK/tYVfr4b2fOtJ3BrB1BBYtgMWSjMPOWERgzPr1GtgRRYwLWLKPJpMZzywIAhFdJJa6psjUw3bQdLB858AyFeATcs7y3SRXgEfL9D0VZT5Bn6c9+G0MiF2e73bkZUTa7SjSJF9GHCJ93xHZDgfNAPvbHmVKF/Y+iccTIXke9zWNO71xsDyO4gklxFPynvJZiV6if86jHgIo/Zkqu0xP+HbjWTJoJpIfxlisSmAcEz/eEiX2qcXYpxFJ+b6fD96UgaVxD02rsfCfpdSIw/2x0mTpK74dWObef59aeVj1q1fUeN4KiO0MEttYpbA69Sr5PZv5M4lXEt77EYZ5zHzVcgwhn8cS/HB6PZykVQ2aoS1Wh8WKSQ1bSpFt90C/3faQsxWDjYiSL32KsVqJoTt1vyiH8HVJYB/P9tTe/eFwOwh497m3Ooxr8whLYwZNuDCo3oL2eGveQMVtDCq5MYQwDHU2J++mwKahDs83DI/kJnts5k1TZu4DPu+Dn16fLtLJWPMdeKFb5cbgpGtQ/ZBNI8UjxWDmlFQakpjTh06UnoDRlEpzZJbfzbnK8/M++OPTSFqBvJgfINxNz+c5xOhqTo8fnJnXzjRHDBfzSD+l7snszDNlflZgBGFep8cXWs5EmEJv8alEk+zSUQSvnncXgASnH1TOpTufz6OOc1q7j1IdzKUlS/KPXqjNjED3Akbu0ZSWI8ruKP7VDHXKXQ9dixb7/nfUdB0/mOYMJNfJhq2VfIHsfzRPaZJqG3rO/XVwPPVC6E7gVqECZEHw34EiVYmjDt3qCyTeF8tx1NtDT8+gOeT69+wfAQYAa8hivtefKOEAAAAASUVORK5CYII=';
}
window.vidzb_MouseOverFlag=function(){document.getElementById('vidzbfLagimg').src=unwin.vidzb_vidzBiggerFlagImageFull();document.getElementById('vidzbfLagmsg').innerHTML=''+unwin.defaultOverFlagMs+'';}
window.vidzb_MouseOutFlag=function(){document.getElementById('vidzbfLagimg').src=unwin.vidzb_vidzBiggerFlagImage();document.getElementById('vidzbfLagmsg').innerHTML=''+unwin.defaultFlagMs+'';}
window.vidzb_showPrefs=function(elvent){unwin.finVidzBToggleFullscreen(false);unwin.p_vidzbShowPrefs();}
unwin.p_hidePrefs=function(first){
	unwin.prefsShowing=false;
	//var clickEvents='onclick="p_vidzbShowPrefs();" onmouseover="document.getElementById(\'vidzbfLagimg\').src=vidzb_vidzBiggerFlagImageFull();document.getElementById(\'vidzbfLagmsg\').innerHTML=\''+unwin.defaultOverFlagMs+'\';" onmouseout="document.getElementById(\'vidzbfLagimg\').src=vidzb_vidzBiggerFlagImage();document.getElementById(\'vidzbfLagmsg\').innerHTML=\''+unwin.defaultFlagMs+'\';"';
	var clickEvents='';
	var vdzbflagimg='<a href="javascript:void(0)" '+clickEvents+'><img align="top" style="position:relative;" id="vidzbfLagimg" src="'+unwin.vidzb_vidzBiggerFlagImage()+'" border="0" /></a>';
	if( _vt('vidzbigger_prefs_menu') ){
		$g('vidzbigger_prefs_menu').innerHTML='<div '+clickEvents+' style="display:inline;position:relative;max-height:19px;height:19px;float:right;background-color:black;padding-top:0px;padding-bottom:0px;"><span id="vidz_message" style="position:relative;top:3px;color:#FF4444;font-weight:bold;"></span><span style="text-decoration:none;color:white;padding-right:0px;cursor:pointer;position:relative;top:3px;" id="vidzbfLagmsg">'+unwin.defaultFlagMs+'</span></div>'+vdzbflagimg;
		$g('vidzbigger_prefs_menu').style.textAlign="right";
		$g('vidzbigger_prefs_menu').style.maxHeight="19px";
		//$g('vidzbigger_prefs_menu').style.width=unwin.colWidth+"px";//chrome compatability
		//nPDiv.setAttribute('style','position:fixed;overflow:auto;right:0px;top:0px;padding:0px;z-index:10000;font-size:12px;font-family:arial,sans-serif;background-color:transparent;color:black;opacity:'+(opacity/100)+';filter: alpha(opacity='+(opacity)+');-moz-opacity: '+(opacity/100)+';');
		$g('vidzbigger_prefs_menu').addEventListener("click",vidzb_showPrefs,true);
		$g('vidzbigger_prefs_menu').addEventListener("mouseover",vidzb_MouseOverFlag,true);
		$g('vidzbigger_prefs_menu').addEventListener("mouseout",vidzb_MouseOutFlag,true);
	}
	if(!first && !unwin.needToSavePreferences){
		unwin.SETvidz_message('&nbsp;Preferences not Saved');
	}else if(unwin.needToSavePreferences){
		unwin.SETvidz_message('<span style="color:#ff9f22;">&nbsp;Please Wait Saving Preferences...</span>',2500);
	}
	unwin.p_updatePrefwinHeight();
}
unwin.SETvidz_message=function(w,tmt){
	_vt('vidz_message').innerHTML=w;
	if(w.length>0){
		if(tmt==undefined) tmt=2000;
		unwin.setTimeout(function(){unwin.SETvidz_message('');},tmt);
	}
}
//HERE IS MY LIBRARY OF POINTLESSLY IE COMPATABLE FUNCTIONS
unwin.fireEvent=function(element,event){
    if (document.createEventObject){
        // dispatch for IE (NEVER happens this is a greasemonkey script! lol)
        var evt=document.createEventObject();
        return element.fireEvent('on'+event,evt)
    }else{
        // dispatch for firefox+others
        var evt=document.createEvent("HTMLEvents");
        evt.initEvent(event,true,true);// event type,bubbling,cancelable
        return !element.dispatchEvent(evt);
    }
}
unwin.fireUIEvent=function(element,event){
    if (document.createEventObject){
        // dispatch for IE (NEVER happens this is a greasemonkey script! lol)
        var evt=document.createEventObject();
        return element.fireEvent('on'+event,evt)
    }else{
        // dispatch for firefox+others
        var evt=document.createEvent("UIEvents");
        evt.initUIEvent(event,true,true,window,1);// event type,bubbling,cancelable,view,detail) 
        return !element.dispatchEvent(evt);
    }
}
unwin.fireMouseEvent=function(element,event){
    if (document.createEventObject){
        // dispatch for IE (NEVER happens this is a greasemonkey script! lol)
        var evt=document.createEventObject();
        return element.fireEvent('on'+event,evt)
    }else{
        // dispatch for firefox+others
        var evt=document.createEvent("MouseEvents");
        //event.initMouseEvent(type,canBubble
        evt.initMouseEvent(event,false,true,null,1,1,1,1,1,false,false,false,false,0,element);
        return !element.dispatchEvent(evt);
    }
}
unwin.getScroll=function(){
    if(document.all){
        return document.body.scrollTop;
    }else{
        return window.pageYOffset;
    }
}
unwin.getWindowHeight=function(){
    if(document.all){
        return document.body.clientHeight;
    }else{
        return window.innerHeight;
    }
}
unwin.getWindowWidth=function(){
    if(document.all){
        return document.body.clientWidth
    }else{
        return window.innerWidth;
    }
}//i give up no more IE compatibility 
unwin.getElementYpos=function(elem){
   return elem.offsetTop
}
unwin.getElementHeight=function(elem){
   return elem.clientHeight
}
unwin.getElementWidth=function(elem){
   return elem.clientWidth
}
// "BORROWED" CODE-// I AM only stealing this code for the auto pause feature,and the EZ download links.  If you feel any additional credit is due notify me.  I did slightly modify this code so its not quite the same although very similar.  I will very gladly contribute to you a portion of any donations I recieve (none yet) and I am linking to your script next to the download links
//Taken FROM: YousableTubeFix //Author: Mindeye-Script initially based on ETcelera's YousableTube userscript (http://userscripts.org/scripts/show/5906) Version: 23 Sep 2008
// Runs a particular XPath expression p against the context node context (or the document,if not provided)
// If a document (docObj) is provided,its evaluate method is used instead of document.evaluate (and it's also the default context)
// Returns the results as an array
function $x(p,context,docObj){
	if (!docObj) docObj=document;
	if (!context) context=docObj;
	var arr=[],xpr=docObj.evaluate(p,context,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);
	for (var i=0,l=xpr.snapshotLength;i<l;i++) arr.push(xpr.snapshotItem(i));
	return arr;
}
// Returns only the first element of the array returned by $x (or null if the array was empty)
function $x1(p,context,docObj){
	var nodeArray=$x(p,context,docObj);
	return (nodeArray.length>0) ? nodeArray[0] : null;
}
// Returns a node from its id or a reference to it
function $ref(idRef){
	return (typeof(idRef)=="string") ? _vt(idRef) : idRef;
}
// Gets a Flash string variable from the player// Returns null if the variable isn't found// The function doesn't escape/unescape variables or values (be careful with special characters like "&" or "=")
function getFlashVar(varName){
	var player=_vt("movie_player");
	// Gets the flashvars from the player
	if(!player.getAttribute) return;
	var flashVars=String(player.getAttribute("flashvars"));
	// Searchs for the varName in the flashvars
	var queryRE=new RegExp("(?:^|&)"+varName+"=([^&]*)");
	var queryRet=queryRE.exec(flashVars);
	// Returns the corresponding value or null (if not found)
	return (queryRet===null) ? null : unescape(queryRet[1]);
}
// Sets a Flash string variable to the player// If doReloadPlayer is true it also reloads the player// The function doesn't escape/unescape variables or values (be careful with special characters like "&" or "=")
function setFlashVar(varName,varNewValue,doReloadPlayer,skipEscape){
	var player=_vt("movie_player");
	if( typeof(skipEscape) == 'undefined' || (typeof(skipEscape) != 'undefined' && !skipEscape) ) varNewValue=escape(varNewValue)
	// Gets varName value now and the flashvars from the player
	var varValue=getFlashVar(varName);
	var flashVars=String(player.getAttribute("flashvars"));
	// If varName isn't set,just adds it
	// If varName is set,replaces its value with varNewValue
	if (varValue===null){
		player.setAttribute("flashvars",flashVars+"&"+varName+"="+varNewValue);
	}
	else{
		var replaceRE=new RegExp("(^|&)"+varName+"="+varValue);
		flashVars=flashVars.replace(replaceRE,"$1"+varName+"="+varNewValue);
		player.setAttribute("flashvars",flashVars);
	}
	// Reloads the player
	if (doReloadPlayer) reloadPlayer();
}
// Function to initialize the YouTube API code to stop autoplay// It registers our state change event listener (gsStateChangeListener) and then executes the default YouTube initialization function// It is called by the player when its API module is ready (if the corresponding jsapicallback variable is set)// Although the function is accesible from unwin,it's executed in the script context
var gsPlayerReady=function(playerId){
	unwin.gsPlayerReady();//does this actually work?
}
unwin.gsPlayerReady=function(playerId){
	//alert('hi you can try this too, it often helps, if jsapi fails, uncomment this line');
	var player=_vt("movie_player");
	var uwPlayer=player.wrappedJSObject;
	// Initializes the "first reproduction" flag
	if(unwin.donotautoplayVideos)
		unwin.autoplay1Rep=true;//set already in theory..
	// Tries to register the state change event listener	// This sometimes fails for unknown reasons,so the error is cached and the player reloaded up to 4 times to try to do it again
	try{
		uwPlayer.addEventListener("onStateChange","gsStateChangeListener");
	}
	catch(err){
		if (autoplayFailedRegs<unwin.jsapiRetries){
			autoplayFailedRegs++;// Increments the counter by one
			$g('movie_player').style.backgroundColor="#000";//prevent flashy screen while JSAPI is initialized
			//reloadPlayer();
			window.setTimeout(reloadPlayer,22*autoplayFailedRegs);//if this function is too big it fails,or does wrong things at end
				//wait logner and longer each time...??? maybe
		}
		else{
			// Too many failed registration attempts. The API method will be disabled and the video will be substituted with an icon as a fallback mechanism
			deleteFlashVar("jsapicallback",true);
			unwin.jsapimessage='<span style="color:red;">Failed!</span>';
		}
		return;
	}
	if(autoplayFailedRegs<1 && new String(navigator.userAgent).indexOf('Ubuntu') > 0 ){
	 //do at least one reload to fix ubuntu error... i think this should be optional
	 autoplayFailedRegs++;
	 window.setTimeout(reloadPlayer,35*autoplayFailedRegs);
	 return;
	}
	var clr='green';
	if(autoplayFailedRegs>=3) clr='orange';
	unwin.jsapimessage='<span style="color:'+clr+';">OK ['+autoplayFailedRegs+']</span>';
	initPauseClickFullscreenDoubleclick();

	// The registration was successful. Resets the "failed attempts" counter
	autoplayFailedRegs=0;
	// If the player is unmuted,mutes it	// As the pause video code can't pause the video till it's already playing,the sound is muted so the small delay is less noticeable
	if(unwin.autoplay1Rep)
		if (uwPlayer.isMuted()===false) uwPlayer.mute();
	// The default YouTube initialization function is called if it exists
	if (unwin.onYouTubePlayerReady) unwin.onYouTubePlayerReady(playerId);
};
// Function to pause the video first reproduction// It is called by the player when its state changes// Although the function is accesible from unwin,it's executed in the script context
unwin.gsStateChangeListener=function(stateId){
		unwin.playerState=stateId;
		var player=_vt("movie_player");		
		var uwPlayer=player.wrappedJSObject;
		if( unwin.autoLoopOnComplete && stateId==0 ){
			if( unwin.autoLoopDelay ){
				window.setTimeout(function(){
					uwPlayer.seekTo(0,true);uwPlayer.playVideo();
				},1500);
			}else{
				uwPlayer.seekTo(0,true);uwPlayer.playVideo();
			}
		}
		if (unwin.autoplay1Rep && (stateId===1)){
			// The "first reproduction" flag is active and the player state is PLAYING (1)			// Pauses the video
			uwPlayer.pauseVideo(); 
		}else if (unwin.autoplay1Rep && stateId===2){
			// The player state is now confirmed to have changed to PAUSED (2)			// Deactivates the "first reproduction" flag
			unwin.autoplay1Rep=false;
			// Seeks to the beginning of the video and unmutes it (if it is muted)			// This undoes the muting of the video by gsPlayerReady and corrects the small delay before the pause video code acted
			uwPlayer.seekTo(0,true);uwPlayer.pauseVideo(); 
			if (uwPlayer.isMuted()===true) uwPlayer.unMute();
		}
		vbinitPassedLoop();//if this is a problem contact me
};
// Reloads the player by removing it from the DOM tree and inserting it again in the same position// If the video is substituted by an icon,it won't do anything (a reload isn't necessary)
function reloadPlayer(){
	if(_vt("movie_player")){
		var player=$g("movie_player");
		//if (isVideoIcon()) return;
		var playerParent=player.parentNode;
		var playerNextSibling=player.nextSibling;
		playerParent.removeChild(player);
		playerParent.insertBefore(player,playerNextSibling);
	}else if(_vt("fpObj")){
		//haced reload code for metacafe-need a generic player reload function for all sites
		var player=$g("fpObj");
		//if (isVideoIcon()) return;
		var playerParent=player.parentNode;
		var playerNextSibling=player.nextSibling;
		playerParent.removeChild(player);
		playerParent.insertBefore(player,playerNextSibling);
	}
	//unwin.occuranceTestMonitor++;// expected: 2
}
// Deletes a Flash string variable from the player// If doReloadPlayer is true it also reloads the player// The function doesn't escape/unescape variables or values (be careful with special characters like "&" or "=")
function deleteFlashVar(varName,doReloadPlayer){
	var player=_vt("movie_player");
	// Gets varName value now and the flashvars from the player
	var varValue=getFlashVar(varName);
	var flashVars=String(player.getAttribute("flashvars"));
	// Deletes varName if it's set
	if (varValue !==null){
		// Searchs for varName and deletes it
		var replaceRE=new RegExp("(^|&)"+varName+"="+varValue+"(&?)");
		flashVars=flashVars.replace(replaceRE,lambdaReplacer);
		player.setAttribute("flashvars",flashVars);
	}
	// Reloads the player
	if (doReloadPlayer) reloadPlayer();
	// Lambda function to remove varName in all scenarios	// It is a nested function
	function lambdaReplacer(str,p1,p2,soffset,s){
		return (p1=="") ? p1 : p2;// p1=="" if (^|&) matches ^ (start of string)
	}
}
// Returns an object with the details of the passed video format (or null is the format is unknown)
function getVideoFormatDetails(vFormat){//awesome
	var sFmt,sVq,sMIME,iQI;// iQI is a internal "quality index" used to order the video formats according to its expected quality (higher is better)
	var unknownFormat=false;
	switch(vFormat){
		case "":// FLV Low Quality format
			sVq="1";sFmt="";sMIME="video/x-flv";iQI=1;break;
		case "5":// FLV Mid Quality format
			sVq="2";sFmt="5/0/7/0/0";sMIME="video/x-flv";iQI=2;break;
		case "6":// FLV High Quality format
			sVq="2";sFmt="6/720000/7/0/0";sMIME="video/x-flv";iQI=3;break;
		case "13":// 3GP LOW Quality format
			sVq="2";sFmt="13/720000/7/0/0";sMIME="video/3gpp";iQI=3;break;
		case "17":// 3GP High Quality format
			sVq="2";sFmt="17/720000/7/0/0";sMIME="video/3gpp";iQI=3;break;	
		case "18":// MPEG-4 H.264 format
			sVq="2";sFmt="18/512000/9/0/115";sMIME="video/mp4";iQI=5;break;
		case "22":// MPEG-4 H.264 HQ format
			sVq="2";sFmt="22/2000000/9/0/115";sMIME="video/mp4";iQI=7;break;
		case "34":
			sVq="2";sFmt="34/0/9/0/115";sMIME="video/mp4";iQI=4;break;	
		case "35":
			sVq="2";sFmt="35/640000/9/0/115";sMIME="video/mp4";iQI=6;break;		
		default:// Unknown format
			unknownFormat=true;break;
	}
	return (unknownFormat) ? null :{vq: sVq,fmt_map: sFmt,MIMEString: sMIME,iQI: iQI};
}
// Creates a new node with the given attributes and properties (be careful with XPCNativeWrapper limitations)
function createNode(type,attributes,props){
	var node=document.createElement(type);
	if (attributes){
		for (var attr in attributes){
			node.setAttribute(attr,attributes[attr]);
		}
	}
	if (props){
		for (var prop in props){
			if (prop in node) node[prop]=props[prop];
		}
	}
	return node;
}
// Function to abort the ajax transaction// It is called by the ajax abort button event listener
function abortAjax(evt){
	abortButton.disabled=true;
	if (xhrComments) xhrComments.abort();
	restoreComments();
}
// Function to remove the ajax wrapper (with the loading icon,etc...) and restore the original comments// It is called if the ajax transaction fails or is aborted
function restoreComments(){
	recentComments.replaceChild(recentCommentsFrag,ajaxWrapper);
}
// Removes all the contents of a node and returns a document fragment with them (or null if the node isn't found)
function removeAllChildren(targetNode){
	// Checks targetNode
	var iNode=$ref(targetNode);
	if (!iNode) return null;
	// Selects the contents of the node with a range and extracts them from the DOM tree into a document fragment
	var contentsRange=document.createRange();
	contentsRange.selectNodeContents(iNode);
	var contentsFrag=contentsRange.extractContents();
	contentsRange.detach();
	// Returns the document fragment
	return contentsFrag;
}
// Builds the download video URL from its parameters (videoId,tId y videoFormat)
function getDownloadVideoURL(vId,vTId,vFormat){
	return ytHost+"/get_video?video_id="+vId+"&t="+vTId+((vFormat=="") ? "" : "&fmt="+vFormat);
}
// Returns an array with the contents of the HTMLCollection,HTMLOptionsCollection or NodeList object passed// This is useful because we can use Array methods like forEach,map,filter,etc... then with the returned array// Returns null if htmlCol is undefined,but its type isn't checked
function colToArray(htmlCol){
	if (!htmlCol) return null;
	var arrayCol=[];
	for (var i=0;i< htmlCol.length;i++) arrayCol.push(htmlCol.item(i));
	return arrayCol;
}
// Updates the URL Input field according to the videoId and the current video format
function updateURLInputField(){
	var URLInput=_vt("watch-url-field");
	if (URLInput) URLInput.value=ytHost+"/watch?v="+videoId+"&fmt="+videoFormat;// &fmt is always included to force LQ if videoFormat is ""
}
// Returns an array with the Options in the Select element (selNode) with the specified value (or null if none is found)// selNode can be a Select node id or a reference to it (if selNode doesn't exist or it's not a Select,the function returns null)// If singleNode is true,it only returns the first Option node found (or null if none)
function selGetOptionsFromValue(selNode,optValue,singleNode){
	var iNode=$ref(selNode);
	if ((!iNode) || (iNode.nodeName.toUpperCase() !="SELECT")) return null;
	var optsArr=colToArray(iNode.options).filter(function(opt){return (opt.value==optValue);});	// Gets a filtered array with the elements with the same value as the one requested
	if (optsArr.length>0){
		return (singleNode) ? optsArr[0] : optsArr;
	}
	else{
		return null;// The array is empty
	}
}
// Gets the YouTube base URL,the video download URL and the MIMEString
var videoId=getFlashVar("video_id");
var tId=getFlashVar("t");
var ytHost=window.location.protocol+"//"+window.location.host;
var videoFormatMatch=null,videoFormat=getFlashVar("fmt_map");
var ovformat = videoFormat;
if (videoFormat !==undefined && videoFormat !==null) videoFormatMatch=videoFormat.match(/^(\d+)(?:\/\d+){4}(?:,|$)/);
if ((videoFormat===null) || (videoFormatMatch===null)){
	// Video is LQ (its fmt_map isn't set or doesn't match the regex)
	videoFormat="";
}
var videoFormats=new String(videoFormatMatch).split(',');

if(tId===null || videoId===null){}else{
	var videoURL=getDownloadVideoURL(videoId,tId,videoFormat);
}
var selVideoFormat=createNode("select",{id: "gsselVideoFormat",size: "1",title: "Choose video format"});
var defaultVideoFormat=GM_getValue("defaultVideoFormat","0");
var defaultVideoFormatInt=parseInt(defaultVideoFormat,10);// An integer representation of the default video format (it can be NaN)

function videoDownloadLinks(){  //lovely
	var player=_vt("movie_player");
	//var tId=getFlashVar("t");//var videoId=getFlashVar("video_id");
	thanksstr=ovformat+" Thanks to YousableTubeFix for Download Links & Quality Menu, Please click to Visit & Donate!";
	var quality=createNode("a",{id: "qqu",class: "dllabel",	href:'http://userscripts.org/scripts/show/13333',target:"_blank",title:thanksstr,style:"font-weight:bold;"},{textContent: " YousableTubeFix Quality & Download Features: "});											
	var downloadas=createNode("a",{id: "dl",class: "dllabel",	href:'http://userscripts.org/scripts/show/13333',target:"_blank",title:thanksstr},{textContent: " Download: "});											
	var br=createNode('br');var br2=createNode('br');var br3=createNode('br');
	var addEasyDownloadLinks=true;
	if (addEasyDownloadLinks){
		var videoDetailsDiv=_vt(unwin.ids_downloadLinks);
		if (videoDetailsDiv){
			// Creates the easy-to-use download links and a container div
			var downloadLinksDiv=createNode("div",{id: "gsdownloadLinksDiv"});
			var downloadLinkFormatLQ=createNode("a",{id: "gsdownloadLinkFormatLQ",class: "gsdownloadLinks",href: getDownloadVideoURL(videoId,tId,""),title: "FLV Low Quality",type: getVideoFormatDetails("").MIMEString,gsvideoFormat: ""},{textContent: "FLV"});
			var downloadLinkFormat6=createNode("a",{id: "gsdownloadLinkFormat6",class: "gsdownloadLinks",href: getDownloadVideoURL(videoId,tId,"6"),title: "FLV High Quality",type: getVideoFormatDetails("6").MIMEString,gsvideoFormat: "6"},{textContent: "FLV HQ"});
			
			//var downloadLinkFormat13=createNode("a",{id: "gsdownloadLinkFormat13",class: "gsdownloadLinks",href: getDownloadVideoURL(videoId,tId,"13"),title: "3GP H264/SAMR",type: getVideoFormatDetails("13").MIMEString,gsvideoFormat: "13"},{textContent: "3GP LQ"});
			//var downloadLinkFormat17=createNode("a",{id: "gsdownloadLinkFormat17",class: "gsdownloadLinks",href: getDownloadVideoURL(videoId,tId,"17"),title: "3GP MPEG4/ACC",type: getVideoFormatDetails("17").MIMEString,gsvideoFormat: "17"},{textContent: "3GP HQ"});

			
			var downloadLinkFormat34=createNode("a",{id: "gsdownloadLinkFormat34",class: "gsdownloadLinks",href: getDownloadVideoURL(videoId,tId,"34"),title: "MPEG-4 34 H.264",type: getVideoFormatDetails("34").MIMEString,gsvideoFormat: "34"},{textContent: "FLV 34"});
			var downloadLinkFormat18=createNode("a",{id: "gsdownloadLinkFormat18",class: "gsdownloadLinks",href: getDownloadVideoURL(videoId,tId,"18"),title: "MPEG-4 18 H.264",type: getVideoFormatDetails("18").MIMEString,gsvideoFormat: "18"},{textContent: "MP4"});
			var downloadLinkFormat35=createNode("a",{id: "gsdownloadLinkFormat35",class: "gsdownloadLinks",href: getDownloadVideoURL(videoId,tId,"35"),title: "MPEG-4 35 H.264",type: getVideoFormatDetails("35").MIMEString,gsvideoFormat: "35"},{textContent: "FLV 35"});
			var downloadLinkFormat22=createNode("a",{id: "gsdownloadLinkFormat22",class: "gsdownloadLinks",href: getDownloadVideoURL(videoId,tId,"22"),title: "MPEG-4 H.264 High Quality",type: getVideoFormatDetails("22").MIMEString,gsvideoFormat: "22"},{textContent: "MP4 HQ"});
			// Creates and adds the CVF options to the CVF select
			var optVideoFormat22=createNode("option",{id: "gsoptVideoFormat22",value: "22"},{textContent: "MPEG-4 H.264 HD"});
			var optVideoFormat35=createNode("option",{id: "gsoptVideoFormat35",value: "35"},{textContent: "FLV H.264 35 HQ"});
			var optVideoFormat18=createNode("option",{id: "gsoptVideoFormat18",value: "18"},{textContent: "MPEG-4 H.264 18 HQ"});
			var optVideoFormat34=createNode("option",{id: "gsoptVideoFormat34",value: "34"},{textContent: "FLV H.264 34 HQ"});
			
			//var optVideoFormat17=createNode("option",{id: "gsoptVideoFormat17",value: "17"},{textContent: "3GP HQ"});
			//var optVideoFormat13=createNode("option",{id: "gsoptVideoFormat13",value: "13"},{textContent: "3GP LQ"});
			
			var optVideoFormat6=createNode("option",{id: "gsoptVideoFormat6",value: "6"},{textContent: "FLV High Quality"});
			var optVideoFormatLQ=createNode("option",{id: "gsoptVideoFormatLQ",value: ""},{textContent: "FLV Low Quality"});
			selVideoFormat.add(optVideoFormatLQ,null);
			selVideoFormat.add(optVideoFormat6,null);
			//selVideoFormat.add(optVideoFormat13,null);
			//selVideoFormat.add(optVideoFormat17,null);
			selVideoFormat.add(optVideoFormat34,null);
			selVideoFormat.add(optVideoFormat18,null);
			selVideoFormat.add(optVideoFormat35,null);
			selVideoFormat.add(optVideoFormat22,null);
			var selVideoFormatOptArray=colToArray(selVideoFormat.options);// Saves an array of the CVF select options for later use
			// Chooses the CVF select selected option based on the current video format
			var optVideoFormatCurrent=selGetOptionsFromValue(selVideoFormat,videoFormat,true);
			if (optVideoFormatCurrent===null){
				// There isn't any option with a value equal to the current video format. No option is selected
				selVideoFormat.selectedIndex=-1;
			}
			else{
				// Selects the option with a value equal to the current video format
				optVideoFormatCurrent.selected=true;
			}
			
			//It stores how many options in the CVF select are still unckecked for selVideoFormatAvailability's use (all of them at this point) Then sends requests to get information for each CVF option video format availability
			selVideoFormat.setAttribute("gsavToCheck",selVideoFormat.options.length);
			selVideoFormatOptArray.forEach(function(opt){checkVideoAvailability(videoId,tId,opt.value,selVideoFormatAvailability);});
			
			downloadLinksDiv.appendChild(quality);
			downloadLinksDiv.appendChild(br);
			// Inserts the CVF select into the video resize links div
			downloadLinksDiv.appendChild(selVideoFormat);
			selVideoFormat.addEventListener("change",selChangeVideoFormat,false);// Adds an event listener to the CVF select
			
			// Append the links to the div
			downloadLinksDiv.appendChild(br2);
			downloadLinksDiv.appendChild(downloadas);
			downloadLinksDiv.appendChild(downloadLinkFormatLQ);
			downloadLinksDiv.appendChild(downloadLinkFormat6);
			//downloadLinksDiv.appendChild(downloadLinkFormat13);
			//downloadLinksDiv.appendChild(downloadLinkFormat17);
			downloadLinksDiv.appendChild(downloadLinkFormat34);
			downloadLinksDiv.appendChild(downloadLinkFormat18);
			downloadLinksDiv.appendChild(downloadLinkFormat35);
			downloadLinksDiv.appendChild(downloadLinkFormat22);
			downloadLinksDiv.appendChild(br3);
			// Appends the div to the right column (YouTube layout)
			videoDetailsDiv.appendChild(downloadLinksDiv);
			//selVideoFormat.value = unwin.gFormatBestAvail;
			
			if(_vt('annotations-toggle-switch')){
				var annotationsed=unwin.vidzb_GrabNode('annotations-toggle-switch');
				_vt('gsdownloadLinksDiv').appendChild(annotationsed);
			}
			
			if(_vt('watch-longform-buttons')){
				var dimmingFeature=unwin.vidzb_GrabNode('watch-longform-buttons');
				_vt(unwin.ids_vb_titl).appendChild(dimmingFeature);
			}
		}
	}
}
// Function to change the player and the video download link to the selected video format in the CVF select
// It is called by the CVF select event listener
function selChangeVideoFormat(evt){
	var selNewValue=evt.target.value;
	// Gets the video format details and updates the player,videoFormat and MIMEString
	
	//alert(fmtDetail.fmt_map  fmtDetail.iQI);
	if(  unwin.useNonFlashPlayer && !unwin.enable_jsapi ){
		unwin.videoPlayerItself=false;//force find element again 
		var fmtDetail = getVideoFormatDetails(selNewValue);
		var video_id = videoId;//location.search.replace(/.*v=/,'').replace(/&.*/,'');
	  var video_t = tId; //.replace(/.*&t=/,'').replace(/&.*/,'');
	  var video_src = location.protocol + '//' + location.host + '/get_video?video_id=' + video_id + '&t=' + video_t + '&fmt='+selNewValue;
		var new_player = '<embed id="movie_player" type="'+fmtDetail.MIMEString+'" src="'+video_src.replace(/&/g, "&amp;") + '" '+'height="100%" width="100%" scale="aspect"></embed>';
		$g(unwin.ids_video_holder).innerHTML = new_player;
		unwin.needsFurtherUpdate=true;
	}else{
		var videoFormatDetails=getVideoFormatDetails(selNewValue);
		if (videoFormatDetails !==null){
			//var player=_vt("movie_player");var uwPlayer=player.wrappedJSObject;
			setFlashVar("vq",videoFormatDetails.vq,false);
			//setFlashVar("start",Math.floor(uwPlayer.getCurrentTime()),false);
			setFlashVar("fmt_map",videoFormatDetails.fmt_map,true);
			videoFormat=selNewValue;
			MIMEString=videoFormatDetails.MIMEString;
		}
	}
	// Makes sure that the CVF select color is the same one of the selected option for esthetic purpose
	if (selVideoFormat.selectedIndex !=-1){
		selVideoFormat.style.color=selVideoFormat.options.item(selVideoFormat.selectedIndex).style.color;
	}
	// Updates the download video link
	videoURL=getDownloadVideoURL(videoId,tId,videoFormat);
	// Updates the URL input field
	updateURLInputField();
}


/*
if( new Number(unwin.vbmaxdisplayquality) > 0 && new Number(videoFormats[2])!=new Number(lOpDisplayQualities[unwin.vbmaxdisplayquality].v) ){
	var tvfmt = ovformat.split(',');
	for( i in tvfmt ){
		if( tvfmt[i].indexOf(lOpDisplayQualities[unwin.vbmaxdisplayquality].v) == 0 ){
			videoFormats[2]=lOpDisplayQualities[unwin.vbmaxdisplayquality].v; alert(videoFormats[2]); break;
		}
	}
}*/
loadPreferences();
unwin.hqLoaded=false;
//unwin['l0pQualz'+videoFormats[2]]!=false &&
if(lOpDisplayQualities[videoFormats[2]] && unwin['l0pQualz'+lOpDisplayQualities[videoFormats[2]]] && unwin['l0pQualz'+lOpDisplayQualities[videoFormats[2]]].v && (videoFormats[2] == '22' || videoFormats[2] == '18' || videoFormats[2] == '35' || videoFormats[2] == '34' )){
	fmtDetail = getVideoFormatDetails(videoFormats[2]);
	unwin.gFormatBestAvail=fmtDetail.iQI
	//unwin.gFormatBestAvail=new Number(videoFormats[2]);
	if(unwin.LoadHighQuality){
		var evt = new Object();evt.target=new Object();evt.target.value=videoFormats[2];
		selChangeVideoFormat(evt);
		unwin.hqLoaded=true;
	}
}else unwin.gFormatBestAvail=0;

// Function to change the CVF options' appearance to indicate the availability of their formats// It is called by the checkVideoAvailability function when the request returns
function selVideoFormatAvailability(vId,vTId,vFormat,vAvailabilityRet){
	var optAvailability=selGetOptionsFromValue(selVideoFormat,vFormat,true);
	if (optAvailability !==null){
		switch(vAvailabilityRet){
			case true:
			
			
				if(vFormat==22){
					ratio=fmt22ratio;
				}

				//unwin.forcevidzb_apply_selected_fixes(); //ah ha!
				
				if(!unwin.hqLoaded&&unwin.LoadHighQuality){
					var fmtDetail = getVideoFormatDetails(vFormat);
					if(fmtDetail.iQI>unwin.gFormatBestAvail) unwin.gFormatBestAvail=fmtDetail.iQI;
					//unwin.curentVideoFormat = new String(getFlashVar("fmt_map"));
						var evt = new Object();evt.target=new Object();evt.target.value=vFormat;
						selChangeVideoFormat(evt);
						if(_vt('gsselVideoFormat'))$g('gsselVideoFormat').value=vFormat;
						unwin.hqLoaded=true;
				}
				optAvailability.style.color="green";
				optAvailability.textContent+=" (available)";
				optAvailability.setAttribute("gsavailable",1);
				break;
			case false:
				optAvailability.style.color="red";
				optAvailability.textContent+=" (unavailable)";
				optAvailability.setAttribute("gsavailable",0);
				break;
			case null:
				optAvailability.style.color="purple";
				optAvailability.textContent+=" (request error)";
				optAvailability.setAttribute("gsavailable",-1);
				break;
		}
		// Makes sure that the CVF select color is the same one of the selected option for esthetic purpose
		if (selVideoFormat.selectedIndex !=-1){
			selVideoFormat.style.color=selVideoFormat.options.item(selVideoFormat.selectedIndex).style.color;
		}
		// If the video format is unavailable,disables the corresponding easy-to-use download link
		if (vAvailabilityRet !==true){
			var downloadLinkAvailability=$x1("//div[@id='gsdownloadLinksDiv']/a[@gsvideoFormat='"+vFormat+"']");
			if (downloadLinkAvailability){
				downloadLinkAvailability.className+=" gsdownloadLinkDisabled";
				downloadLinkAvailability.href="javascript:void(null)";
				downloadLinkAvailability.title="This video format is unavailable";
			}
		}
		// Updates the "options still unckecked" counter
		selVideoFormat.setAttribute("gsavToCheck",selVideoFormat.getAttribute("gsavToCheck")-1);
		if (selVideoFormat.getAttribute("gsavToCheck")<=0){
			// All the CVF options have been checked. If the user has chosen to autoselect a video format according to its availability,does it now
			if ((defaultVideoFormatInt===-1) || (defaultVideoFormatInt===-2)){
				// Gets the preferred available option according to the user preferences
				var optQualityAuto=selGetAvailableVideoFormatOption((defaultVideoFormatInt===-2) ? true : false);
				if ((optQualityAuto !==null) && (optQualityAuto.selected==false)){
					// The returned options isn't selected. Selects it
					optQualityAuto.selected=true;
					fireChangeEvent(selVideoFormat);// Manual fire of the change event (script changes don't fire it)
				}
			}
		}
	}
}
// Asynchronously checks if a video with the provided parameters is available
// Calls callbackFunc with the video paramaters and an additional one (true,false or null if error) indicating the result
// Returns true if the request was sent,false otherwise
// It uses an indirect method because of the multiple bugs of XMLHttpRequest and redirections (bug 343028,238144,etc...)
function checkVideoAvailability(vId,vTId,vFormat,callbackFunc){
	if ((!callbackFunc) || (typeof(callbackFunc) !="function")) return false;
	if((','+getFlashVar("fmt_map")).indexOf(','+vFormat)>-1){
		// Low Quality Format ('') availability can't be checked with this method,so it's asummed to be always available
		callbackFunc(vId,vTId,vFormat,true);
		return true;
	}
	// Gets the Watch Video URL of the requested format and downloads it
	// Then checks the swfArgs object in its source code for the fmt_map parameter of the would be player
	// YouTube checks the video format availability,and only sends the corresponding fmt_map if it is available
	var vURL=ytHost+"/watch?v="+vId+"&fmt="+vFormat;
	var xhrVideo=new XMLHttpRequest();
	xhrVideo.onerror=function(evt){
		xhrVideo.abort();
		callbackFunc(vId,vTId,vFormat,null);// Error retrieving video availability
	};
	xhrVideo.onload=function(evt){
		// Checks for errors
		if ((xhrVideo.readyState !=4) || (xhrVideo.status !=200)){
			callbackFunc(vId,vTId,vFormat,null);// Error retrieving video availability
			return;
		}
		// Gets the swfArgs object string from the source code
		var responseMatch = xhrVideo.responseText.match(/^\s*var swfArgs = ({[^}]*});\s*$/im);
		if (responseMatch===null){
			callbackFunc(vId,vTId,vFormat,null);// Error retrieving video availability
			return;
		}
		else{
			responseMatch=responseMatch[1];
		}
		// Evals the swfArgs object string to a real object and gets its fmt_map member
		var objArgs=eval("("+responseMatch+")");
		var sMap=unescape(objArgs.fmt_map) || "";
		// Tests if the fmt_map correspond to the requested format (that should only happen if the video is available)
		if ((new RegExp("^"+vFormat+"(/\\d+){4}(?:,|$)")).test(sMap)){
			callbackFunc(vId,vTId,vFormat,true);// Video available
		}
		else{
			callbackFunc(vId,vTId,vFormat,false);// Video unavailable
		}
	};
	xhrVideo.open("GET",vURL,true);
	xhrVideo.send(null);
	return true;

}
var abortButton,recentCommentsFrag,ajaxWrapper,xhrComments,recentComments;
unwin.cpageSize='100';//mayiremov?
function bigifyComments(){
	// Substitutes the original page size of comments in video page (10) for the bigger one used in the view all comments page (500)
	// Other page sizes can't be easily used because Youtube ajax page only accepts those values in the pagesize parameter (others seem to default to 10)
	if (unwin.biggerComments){
		// Gets necessary data from the page
		recentComments=_vt("recent_comments");
		var commentsThreshold=$x1("//div[@id='watch-comment-filter']//form//select[@name='commentthreshold']");
		if (recentComments){
			// Creates the elements that will indicate that the comments are being loaded
			var loadingIcon=createNode("img",{id: "gsloadingIcon",alt: "Loading...",
																					 src: ytHost+"/img/icn_loading_animated.gif"});
			var progressMeter=createNode("span",{id: "gsprogressMeter"});
			abortButton=createNode("input",{id: "gsabortButton",title: "Abort the transaction",type: "button",value: "Abort"});
			ajaxWrapper=createNode("div",{id: "gsajaxWrapper",title: "The comments are being loaded..."});
			// Inserts the contents within the wrapper
			ajaxWrapper.appendChild(loadingIcon);
			ajaxWrapper.appendChild(progressMeter);
			ajaxWrapper.appendChild(abortButton);
			// Removes the original comments and save them into a document fragment
			recentCommentsFrag=removeAllChildren(recentComments);
			// Inserts the wrapper within the now empty div
			recentComments.appendChild(ajaxWrapper);
			// Adds an event listener to the abort button
			abortButton.addEventListener("click",abortAjax,false);
			// Gets the XML data from Youtube
			// GM_xmlhttpRequest's privileged features aren't necessary and it doesn't support responseXML without using DOMParser
			xhrComments=new XMLHttpRequest();
			xhrComments.onload=function(evt){
				//responseDetails.responseText
				// Checks for errors
				var cmode_allow=false;
				var finhtml='';
				if ((xhrComments.readyState !=4) || (xhrComments.status !=200)){
					restoreComments();	
					return;
				}else{
				 	if((!xhrComments.responseXML)){
					 	if(xhrComments.responseText){
							//no xml,so check for a html/text response to parse....
							var mhtm=new String(xhrComments.responseText);
							finhtml=qslice.mhtm('<div id="recent_comments">','<!--end recent_comments-->')
							//finhtml=finhtml.qreplace('class="watch-comment-entry"','class="watch-comment-entry" style="display:none;"');
							if(finhtml.length>5)
								var cmode_allow=true;
						}else{
							restoreComments();	
							return;
						}
					}else{
						//regular yousable way
						// The data was received. It is now used to fill the recent comments div
						var xmlData=$x1("//html_content/text()",null,xhrComments.responseXML);
						var xmlReturnCodeNode=$x1("//return_code/text()",null,xhrComments.responseXML);
						var xmlReturnCode=((xmlReturnCodeNode) && (xmlReturnCodeNode.data)) ? xmlReturnCodeNode.data : null;
						if(xmlData)
							finhtml=xmlData.data
						else{restoreComments();	
							return;
						}
					}
				}
				if (cmode_allow || (xmlData) && (xmlData.data) && (xmlReturnCode==="0")){
					recentComments.innerHTML=finhtml;
					//reversify comments!!!!
					var allCommentNodes=[];
					var s=recentComments.childNodes;
					for(var x=0,l=s.length;x<l;x++){
						if(s[x].nodeType==1){allCommentNodes.push(s[x]);}
					}recentComments.innerHTML='';//now we got them,blank and reverse them
					recentComments.style.borderBottom='10px solid blue;';
					var countDisplayed=0;
					var repliesTOFlip=[];//if you reverse them all replies come before instead of after the orig,this captures these and flips them to the corret side
					//this adds them in reverse
					for(var i=allCommentNodes.length-1;i>=0;i--){
						if(new String(allCommentNodes[i].innerHTML).indexOf('watch-comment-entry-reply')>0){
							repliesTOFlip.push(allCommentNodes[i]);continue;
						}recentComments.appendChild(allCommentNodes[i]);
						countDisplayed++;
						if(repliesTOFlip.length>0){
							for(var r=repliesTOFlip.length-1;r>=0;r--){
								recentComments.appendChild(repliesTOFlip[r]);
								//countDisplayed++;//count or not count thread replies in total
							}repliesTOFlip=[];
						}if(countDisplayed>=unwin.maximumCommentCount) break;//allCommentNodes[x].style.display="none";}
					}//end comment reversal!!!!
					unwin.handleColumnAd();
				}else{
					restoreComments();return;
				}// Change the commentsThreshold combobox (if it exists) so it won't restore the old pagesize
				if ((commentsThreshold) && (commentsThreshold.hasAttribute("onchange"))){
					commentsThreshold.setAttribute("onchange",commentsThreshold.getAttribute("onchange").replace("&page_size=10","&page_size=500"));
				}
			};
			xhrComments.onprogress=function(evt){
				progressMeter.textContent=Math.round(((evt.position / evt.totalSize)*100))+"% completed";
			};
			xhrComments.onerror=function(evt){
				restoreComments();
			};
			//var commentsURL=http://gdata.youtube.com/feeds/api/videos/"+videoId+"/comments";
			var commentsURL=ytHost+"/watch_ajax?v="+videoId+"&action_get_comments=1&p=1&commentthreshold="+((commentsThreshold) ? commentsThreshold.value :-5)+"&page_size=500";
			//var commentsURL=ytHost+"/comment_servlet?all_comments&v="+videoId+"&fromurl=/watch%3Fv%3D"+videoId;
			xhrComments.open("GET",commentsURL,true);
			xhrComments.send(null);
		}
	}
}
// END "BORROWED" YOUSABLE CODE*************************************************************************END STEALING (ITS WRONG)
//encode and decode functions from here: http://ostermiller.org/calc/encode.html
function urlDecode(str){
    str=str.replace(new RegExp('\\+','g'),' ');
    return unescape(str);
}
function urlEncode(str){
    str=escape(str);
    str=str.replace(new RegExp('\\+','g'),'%2B');
    return str.replace(new RegExp('%20','g'),'+');
}
var digitArray=['0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'];
function toHex(n){
    var result=''
    var start=true;
    for (var i=32;i>0;){
        i-=4;
        var digit=(n>>i) & 0xf;
        if (!start || digit !=0){
            start=false;
            result+=digitArray[digit];
        }
    }
    return (result==''?'0':result);
}
function pad(str,len,pad){
    var result=str;
    for (var i=str.length;i<len;i++){
        result=pad+result;
    }
    return result;
}
function encodeHex(str){
    var result="";
    for (var i=0;i<str.length;i++){
        result+=pad(toHex(str.charCodeAt(i)&0xff),2,'0');
    }
    return result;
}
var hexv={"00":0,"01":1,"02":2,"03":3,"04":4,"05":5,"06":6,"07":7,"08":8,"09":9,"0A":10,"0B":11,"0C":12,"0D":13,"0E":14,"0F":15,"10":16,"11":17,"12":18,"13":19,"14":20,"15":21,"16":22,"17":23,"18":24,"19":25,"1A":26,"1B":27,"1C":28,"1D":29,"1E":30,"1F":31,"20":32,"21":33,"22":34,"23":35,"24":36,"25":37,"26":38,"27":39,"28":40,"29":41,"2A":42,"2B":43,"2C":44,"2D":45,"2E":46,"2F":47,"30":48,"31":49,"32":50,"33":51,"34":52,"35":53,"36":54,"37":55,"38":56,"39":57,"3A":58,"3B":59,"3C":60,"3D":61,"3E":62,"3F":63,"40":64,"41":65,"42":66,"43":67,"44":68,"45":69,"46":70,"47":71,"48":72,"49":73,"4A":74,"4B":75,"4C":76,"4D":77,"4E":78,"4F":79,"50":80,"51":81,"52":82,"53":83,"54":84,"55":85,"56":86,"57":87,"58":88,"59":89,"5A":90,"5B":91,"5C":92,"5D":93,"5E":94,"5F":95,"60":96,"61":97,"62":98,"63":99,"64":100,"65":101,"66":102,"67":103,"68":104,"69":105,"6A":106,"6B":107,"6C":108,"6D":109,"6E":110,"6F":111,"70":112,"71":113,"72":114,"73":115,"74":116,"75":117,"76":118,"77":119,"78":120,"79":121,"7A":122,"7B":123,"7C":124,"7D":125,"7E":126,"7F":127,"80":128,"81":129,"82":130,"83":131,"84":132,"85":133,"86":134,"87":135,"88":136,"89":137,"8A":138,"8B":139,"8C":140,"8D":141,"8E":142,"8F":143,"90":144,"91":145,"92":146,"93":147,"94":148,"95":149,"96":150,"97":151,"98":152,"99":153,"9A":154,"9B":155,"9C":156,"9D":157,"9E":158,"9F":159,"A0":160,"A1":161,"A2":162,"A3":163,"A4":164,"A5":165,"A6":166,"A7":167,"A8":168,"A9":169,"AA":170,"AB":171,"AC":172,"AD":173,"AE":174,"AF":175,"B0":176,"B1":177,"B2":178,"B3":179,"B4":180,"B5":181,"B6":182,"B7":183,"B8":184,"B9":185,"BA":186,"BB":187,"BC":188,"BD":189,"BE":190,"BF":191,"C0":192,"C1":193,"C2":194,"C3":195,"C4":196,"C5":197,"C6":198,"C7":199,"C8":200,"C9":201,"CA":202,"CB":203,"CC":204,"CD":205,"CE":206,"CF":207,"D0":208,"D1":209,"D2":210,"D3":211,"D4":212,"D5":213,"D6":214,"D7":215,"D8":216,"D9":217,"DA":218,"DB":219,"DC":220,"DD":221,"DE":222,"DF":223,"E0":224,"E1":225,"E2":226,"E3":227,"E4":228,"E5":229,"E6":230,"E7":231,"E8":232,"E9":233,"EA":234,"EB":235,"EC":236,"ED":237,"EE":238,"EF":239,"F0":240,"F1":241,"F2":242,"F3":243,"F4":244,"F5":245,"F6":246,"F7":247,"F8":248,"F9":249,"FA":250,"FB":251,"FC":252,"FD":253,"FE":254,"FF":255};
function decodeHex(str){
    str=str.toUpperCase().replace(new RegExp("s/[^0-9A-Z]//g"));
    var result="";
    var nextchar="";
    for (var i=0;i<str.length;i++){
        nextchar+=str.charAt(i);
        if (nextchar.length==2){
            result+=ntos(hexv[nextchar]);
            nextchar="";
        }
    }
    return result;
}
//end encode and decode functions
// RESUME origional VidzBigger code ///  This section does most basic setup stuff...
// Initializes the needed variables and sets the player to call gsPlayerReady when the player API module is ready
unwin.autoplay1Rep=unwin.donotautoplayVideos;//set autoplay value
autoplayFailedRegs=0;
var chref=wUrl;//new String(window.location);

if(chref.indexOf('/group')<=0 && chref.indexOf('profile_')<=0){
	unwin.p_createPreferencesArea();
}
if(new Number(unwin.lastKnownVersionUsed)<vidz_Version){
	//you just upgraded
	if(!unwin.vidzbigenabled){
		unwin.vidzbigenabled=true;
		window.setTimeout(savePreferences,999);
		alert('Thanks for Upgrading!  VidzBigger will now be Re-Enabled.  Please let me know if you are still experiencing problems!');
	}
}

function vidzb_getEventTarget(evt){
    var targ=(evt.target) ? evt.target : evt.srcElement;
    if(targ !=null){
        if(targ.nodeType==3)
            targ=targ.parentNode;
    }
    return targ;
}
function shareLoopsVidzLoops(){
	return 'http://www.vidzbigger.com/VidzLoops/index.php?new_loop=true&loadvideoid='+videoId+'&startseconds='+unwin.vidzbLoopTimerStart+'&endseconds='+unwin.vidzbLoopTimerEnd;
}	
function initPauseClickFullscreenDoubleclick()
{
	if(!unwin.allowPlayerClk || !_vt("movie_player")) return;
	window.setTimeout(function(){
		var player=_vt("movie_player");
		var uwPlayer=player.wrappedJSObject;
		player.addEventListener('click',function(e)
		{
			if (e.layerY-$g('movie_player').offsetTop>=$g('movie_player').clientHeight-35) return;
			unwin.isdoubleclick=false;
			window.setTimeout(function(){
				if(!unwin.isdoubleclick){
					//click to pause video
					//var state=uwPlayer.getPlayerState();
					//if(state==1) uwPlayer.pauseVideo();
					//else if(state==2||state==-1||state==0) uwPlayer.playVideo();
				}
			},unwin.dblClickTimer);
			},false);
		
		player.addEventListener('dblclick',function(e)
		{
			if (e.layerY-$g('movie_player').offsetTop>=$g('movie_player').clientHeight-35) return;
			unwin.isdoubleclick=true;
			unwin.finVidzBToggleFullscreen();
		},false);
		
	},1000);
};
unwin.finVidzBToggleFullscreen=function(ttt){//accounts for snap mode
	if(unwin.snapfullscreenmode){
		//if( typeof(ttt) != "undefined" ){ if( ttt ) unwin.goFullscreen(); else unwin.leaveFullscreen();}
		if(unwin.fullscreenmode || (typeof(ttt) != "undefined" && !ttt ) )window.scroll(0,unwin.autoScrollPastHeader?0:80);else window.scroll(0,unwin.autoScrollPastHeader?unwin.fssnapHeight:0);
	}else if(typeof(ttt) == "undefined"){if(unwin.fullscreenmode)unwin.leaveFullscreen();else unwin.goFullscreen();}
	foldAttempts=14;
}
function readyToVidsBig(){
	if(unwin.vidzbigenabled && unwin.vidzbigSITEenabled){
		if(typeof(VM_AppendStyles)!='undefined')VM_AppendStyles();

		unwin.goFullscreen=function(){
			unwin.fullscreenmode=true;
			unwin.oldValue=($g(unwin.ids_vb_midl))?_vt(unwin.ids_vb_midl).style.marginLeft:'0px';
			document.body.style.height=(unwin.getElementHeight(document.body)+15)+"px";
			_vt(unwin.ids_vb_head).style.display='none';
			_vt(unwin.ids_vb_left).style.display='none';
			_vt(unwin.ids_vb_rigt).style.display='none';
			_vt(unwin.ids_vb_foot).style.display='none';
			unwin.forcevidzb_apply_selected_fixes();
		}
		unwin.leaveFullscreen=function(){
			unwin.fullscreenmode=false
			_vt(unwin.ids_vb_midl).style.marginLeft=unwin.oldValue;
			_vt(unwin.ids_vb_head).style.display='block';
			_vt(unwin.ids_vb_left).style.display='block';
			_vt(unwin.ids_vb_rigt).style.display='block';
			_vt(unwin.ids_vb_foot).style.display='block';
			document.body.style.height="auto";
			unwin.forcevidzb_apply_selected_fixes();
		}
		
		unwin.vidzb_removeAdvertisements();
		unwin.vidTitleOrigPosY=unwin.getElementYpos(_vt(unwin.ids_title));
		var ctitle=document.title;//new String(_vt(unwin.ids_texttitle).innerHTML);
		
		if( unwin.siteID!=1 ) unwin.fullscreenmode=false; //yet somehow htey all do it anyay?
		
		window.vidzb_checkForNewLinks=function(evt){
			var theElem=vidzb_getEventTarget(evt);
			//if(unwin.fullscreenmode){
			//	if(theElem.nodeName !="EMBED")
			//		unwin.leaveFullscreen();
			//}
			if(theElem.className=='expand-header' || theElem.parentNode.className=='expand-header'){
				//if the document is clicked, they may have expanded a new section, so check for HD for each once it loads
				window.setTimeout(function(){unwin.vidzb_fmt18ALlLinks();},3000);
			}
		}
		
		//NOT in share_inline?v=dfsdf
		//not /my_profile_theme_background_frame
		//chref.indexOf('next')<=0
		//alert(chref+' '+unwin.watchStrings+' '+_vt(unwin.ids_video_holder));
		// NOT watch_editaudio
			//	alert('ok'+chref.indexOf(unwin.watchStrings)+_vt(unwin.ids_video_holder));
			//alert(unwin.watchStrings + chref.indexOf(unwin.watchStrings));
			
		if(chref.indexOf('contact.php')<=0 && chref.indexOf('watch_')<=0 && ((chref.indexOf(unwin.watchStrings)>0) &&  _vt(unwin.ids_video_holder))){
			//ARE WE ON A VIDEO PAGE???
		  unwin.isInWatchMode=true;
		  unwin.vidzb_oneTimeSetupAndResize();
		  GM_addStyle("embed{display:block}");
			unwin.vidzb_initialSetupAndResize();
	
			//if(unwin.isInWatchMode){//always in watch mode here.. should it be?
			
				unwin.headerHeight=unwin.getElementHeight($g(unwin.ids_vb_head))+unwin.getElementHeight($g(unwin.ids_vb_titl));
				
				if(unwin.autoScrollPastHeader){
					if(unwin.getScroll()==0)window.scroll(0,unwin.headerHeight-10);
					unwin.fssnapHeight = unwin.headerHeight-10;
				}else{
					unwin.fssnapHeight = 1;//serves as a ready point
				}
				//apply watch mode CSS
				
				var scriptStyles=[];
			
				scriptStyles.push(".video-bar-item{width:70px;}");
				scriptStyles.push(".v90WideEntry{padding-left:0px;;}");
				
				// Adds the styles from the script to the page,making them important
				scriptStyles.forEach(function(s){GM_addStyle(s.makeImportant());});
			//}
	
			if(chref.indexOf('youtube.')>0 && _vt('movie_player') ){
				
				if (unwin.dissableAnnotations){
					setFlashVar("iv_module","",false);
					setFlashVar("iv_storage_server","",false);
				}
				if( unwin.vidzb_blockPlayerAds ){
					setFlashVar("ad_host","",false);
					setFlashVar("ad_module","",false);
					//setFlashVar("ctb_xml","",false);
				}
				if(unwin.enable_jsapi ){
					
					if(unwin.allowPlayerClk){
						$g('movie_player').setAttribute('wmode','transparent');
					}
					if(unwin.donotautoplayVideos&&unwin.donotautobuffer)setFlashVar("autoplay","0",false);
					//if(unwin.donotautoplayVideos){
					setFlashVar("jsapicallback","gsPlayerReady"+unwin.extraflashvars,false,true);// Depends on the Main Reload
					//setFlashVar("color1","0",false);//0x
					//setFlashVar("color2","0",false);
					//setFlashVar("wheelScrollEnabled","0");
					reloadPlayer();//now or later......
				}else{
					//no JSAPI
					
					
					//if(unwin.useNonFlashPlayer){
					//	var video_id = location.search.replace(/.*v=/,'').replace(/&.*/,'');
					//  var video_t = $g('movie_player').getAttribute('flashvars').replace(/.*&t=/,'').replace(/&.*/,'');
					//  var video_src = location.protocol + '//' + location.host + '/get_video?video_id=' + video_id + '&t=' + video_t + '&fmt=18';
					//	var new_player = '<embed id="mp4-player" type="video/mp4" src="'+video_src.replace(/&/g, "&amp;") + '" '+'height="385" width="640" scale="aspect"></embed>';
					//	$g(unwin.ids_video_holder).innerHTML = new_player;
					//}
					
				}
			}else if(_vt('fpObj')){//metacafe performs better this way?
				 $g('fpObj').setAttribute('wmode','opaque');
				 reloadPlayer();
			}
			unwin.needsFurtherUpdate=true;//force update
			unwin.isLoadedOnce=true;
			
			//unwin.onload=function(){	
			//	window.setInterval(function(){unwin.vidzb_apply_selected_fixes()},10);
			//}	
			//ADD EVENT LISTENERS
			//unwin.onload=function(){
				unwin.onscroll=function(){
					unwin.vidzb_apply_selected_fixes();//doing these on load or else you catch the scroll event we do
				}
			
				unwin.onresize=function(){
					unwin.needsFurtherUpdate=true;//force update
					unwin.hasBeenAwayFromPageTopBtm=false;
					unwin.vidzbPrefsDoNotFitUntilResize=false;
					//unwin.forcevidzb_apply_selected_fixes();
					unwin.vidzb_apply_selected_fixes();
				}
			//}
			cevents.register(document.body,'mouseup',vidzb_checkForNewLinks);
		
			//CALL THINGS AT LEAST ONCE (ON DOCUMENT READY<WHICH IS WHEN THE USERSCRIPT STARTS)
			//unwin.vidzb_apply_selected_fixes(); //(AH HA!)
			//unwin.forcevidzb_apply_selected_fixes();
			videoDownloadLinks();
			bigifyComments();
		}else{
			
			if(chref.indexOf('vidzbigger.com')<=0)
				unwin.vidzb_initialSkinSetup();
		}
		
		//unwin.vidzb_fmt18ALlLinks();// update video links into HQ video links
		window.setTimeout(function(){unwin.vidzb_fmt18ALlLinks();},1500);
		
		if(unwin.alwaysAnimateVidThumbnails1LOOP){
			window.setInterval(vidzb_animateAllSingleTimeout,1800);
		}
		
		unwin.isdoubleclick=false;
		unwin.dblClickTimer=250;
		readyToVidsBig=function(){return 'WRONG';/*some asshole calls this more than once... well not anynmore tehehehe*/}
	}
	
	//see if prefs need to be saved (when called)
	unwin.checkSavePreferences=function(){
		if(unwin.needToSavePreferences){
			window.setTimeout(savePreferences,999);
		}
	}
	//If there is a "more" for the description,click it
	if(unwin.autoExpandVideoDescriptions){
		if(_vt('watch-video-details-toggle-less')&&$g('watch-video-details-toggle-less').getElementsByTagName('a').length>0){
			window.setTimeout(function(){unwin.fireMouseEvent($g('watch-video-details-toggle-less').getElementsByTagName('a')[0],'click')},10);
		}
	}
	//If there is a extra click through for adult videos
	if(unwin.autoConfirmAdultVideos){
		if(document.getElementsByName('action_confirm')[0]){
			window.setTimeout(function(){unwin.fireMouseEvent(document.getElementsByName('action_confirm')[0],'click')},10);
		}
	}
	
	if(_vt('copyright')){
		$g('copyright').innerHTML=$g('copyright').innerHTML+' &bull; Thanks for using VidzBigger <a href="http://www.VidzBigger.com" target="_blank">Info/Donate</a>';
	}
	
	versioncheckurl='http://www.vidzbigger.com/version.php?version='+vidz_Version+'&watch='+unwin.isInWatchMode+'&png24='+unwin.prefer_png24bits;
	var nowViewing='&url='+escape(chref)+'&title='+escape(ctitle);
	if(unwin.shareVideoViewStatistics){
	versioncheckurl+=nowViewing//know
	}unwin.versioncheckurl=new String(versioncheckurl+nowViewing);
	//alert(versioncheckurl);
	GM_xmlhttpRequest({
	  method: 'GET',
	  url: versioncheckurl,
	  onload: function(responseDetails) 
	 {
	  	//				 VERSION CHECK ! ! ! (important)*************************************************
	  	//return;//uncomment this line (return) to dissable auto update notification
	  	//return;
			var rslt=new String(responseDetails.responseText);
			var versiondata=rslt.qslice('<!--VZB_B-->','<!--VZB_E-->');
			var versionDataBits=decodeIncomingData(versiondata);
			if(versionDataBits['a'] !=undefined && versionDataBits['a'] !='ad'){
				unwin.vidzbadd1_html=versionDataBits['a'].qreplace('width="360"','width="'+unwin.colWidth+'"');
				if(unwin.vidzb_allowMyObnoxiousAds){
					unwin.vb_replacementAds['box']=unwin.vidzbadd1_html;
					unwin.vidzb_removeAdvertisements()//re-apply
				}
				if(_vt('n_vb_div_adz1')) $g('n_vb_div_adz1').innerHTML=unwin.vidzbadd1_html;
			}
			if(versionDataBits['v']>vidz_Version){
				unwin.latestversion=versionDataBits['v'];
				unwin.latestversionurl=versionDataBits['url'];
				unwin.upgradeMessage=versionDataBits['msg'];
				unwin.defaultFlagMs=versionDataBits['smsg'];	//disliking yo tab getting messed with comment this or change what it says when u got an update
				unwin.defaultOverFlagMs=' &nbsp;Settings & Upgrade!&nbsp;';	//also this to change the rollover when u gots a nupdate
				if(!unwin.prefsShowing) unwin.p_hidePrefs(true);//refresh tab
				else unwin.p_vidzbShowPrefs();//testing...
			}else{
				//alert('noupgrade');
			}
	    //GM_log(responseDetails.responseText)
	  }
	});
	//LOOPING FUNCTIONS -- only define if jsapi is enabled.  
	if( unwin.enable_jsapi ){
		unwin.vidzbLoopExpectedLoopEnd=0;
		unwin.vidzbLoopTimeoutId=0;
		unwin.resetVdizLoops=function(){
			unwin.vidzbLoopTimerEngaged = false;
			unwin.vidzbLoopTimerStart=0;
			unwin.vidzbLoopTimerEnd=0;
		};unwin.resetVdizLoops();
		unwin.vidzbLoopButtonClicked=function(){
			if( unwin.vidzbLoopTimerEngaged && unwin.vidzbLoopTimerEnd > 0 ){
				unwin.resetVdizLoops();
			}else{
				var player=_vt("movie_player");
				var uwPlayer=player.wrappedJSObject;
				if( unwin.vidzbLoopTimerStart > 0 && !unwin.vidzbLoopTimerEngaged ){
					//loop timer started, set end time and engage looping
					//var d=new Date();
					unwin.vidzbLoopTimerEnd=uwPlayer.getCurrentTime();//d.getTime();
					unwin.vidzbLoopTimerEngaged=true;
					var currentTime = uwPlayer.getCurrentTime();
					unwin.vidzbLoopExpectedLoopEnd = currentTime;
					vidzbLoopButtonEngage();
				}else{
					//loop timer stopped?
					//var d=new Date();
					unwin.vidzbLoopTimerStart=uwPlayer.getCurrentTime();//d.getTime();
					unwin.vidzbLoopTimerEngaged=false;
				}
			}
		}
		unwin.vbGetCurrentPosition=function(){
			var player=_vt("movie_player");var uwPlayer=player.wrappedJSObject;
			var tme = uwPlayer.getCurrentTime();
			if( tme > 0 ) return tme;
			else return 0;
		}
		unwin.vbResetLoopTimersFromFields=function(){		 	
	   	unwin.vidzbLoopTimerStart=_vt('vbstartseconds').value;
			unwin.vidzbLoopTimerEnd=_vt('vbendseconds').value;
			unwin.vidzbLoopTimerEngaged=true;
			unwin.vidzbLoopExpectedLoopEnd = unwin.vidzbLoopTimerEnd;
			vidzbLoopButtonEngage();
		}
		function vidzbLoopButtonEngage(){
			if( unwin.vidzbLoopTimerEngaged && unwin.vidzbLoopTimerEnd > 0 ){
				var player=_vt("movie_player");
				var uwPlayer=player.wrappedJSObject;
				var loopDuration = (unwin.vidzbLoopTimerEnd-unwin.vidzbLoopTimerStart);
				var currentTime = uwPlayer.getCurrentTime();
				if( currentTime >= unwin.vidzbLoopExpectedLoopEnd ){
					//loop
					//alert( 'cur:'+currentTime+' dur:'+loopDuration);
					uwPlayer.seekTo(unwin.vidzbLoopTimerStart);//currentTime-loopDuration,true);
					unwin.clearTimeout(unwin.vidzbLoopTimeoutId);
					unwin.vidzbLoopTimeoutId=window.setTimeout(function(){vidzbLoopButtonEngage()},loopDuration);
				}else{
					//determine distance from loop end..
					loopDuration = unwin.vidzbLoopExpectedLoopEnd-currentTime;//it should always be slower than expected??
					unwin.clearTimeout(unwin.vidzbLoopTimeoutId);
					unwin.vidzbLoopTimeoutId=window.setTimeout(function(){vidzbLoopButtonEngage()},loopDuration);
				}
			}
		}
		unwin.vidzPausePlayer=function(){
			var player=_vt("movie_player");var uwPlayer=player.wrappedJSObject;
			uwPlayer.pauseVideo();
		}
	}
	var loopinited=false;
	function vbinitPassedLoop(){
		if( !loopinited && chref.indexOf('vidloopzstart')>=0 &&  chref.indexOf('vidloopzend')>=0 ){
			unwin.vidzbLoopTimerStart=chref.qslice('vidloopzstart=','&');
			unwin.vidzbLoopTimerEnd=chref.qslice('vidloopzend=','&');
			unwin.vidzbLoopTimerEngaged=true;
			unwin.vidzbLoopExpectedLoopEnd = unwin.vidzbLoopTimerEnd;
			var player=_vt("movie_player");var uwPlayer=player.wrappedJSObject;
			uwPlayer.seekTo(unwin.vidzbLoopTimerStart,true);uwPlayer.playVideo();
			vidzbLoopButtonEngage();
			loopinited=true;
			unwin.autoplay1Rep=false;
		}
	}
	
	//end looping functions
	//if(unwin.vidzbigenabled&&unwin.vidzbigSITEenabled){//redundant if statement...,move this block up to previous if? NOt exactly
	//	this is a space holder in case something breaks, you know what to do >..<
	//}
	
	var endTime=new Date().getTime();
	unwin.startupTimer=((endTime-startTime)/1000);
	//document.title+=" VB:"+unwin.startupTimer;
	
	//forcevidzb_apply_selected_fixes()
	if(unwin.snapfullscreenmode){unwin.goFullscreen();}//resume fullscreen if previously fullscreen
	else unwin.vidzb_apply_selected_fixes();//forcevidzb_apply_selected_fixes();//first full apply of fixes
	
	var endTime=new Date().getTime();
	unwin.startupTimer=((endTime-startTime)/1000);
	//document.title+=" VB:"+unwin.startupTimer;
	
}
//if we dont need to download this site profile, load it regularly
if( unwin.vbisreadytogo ){
	var endTime=new Date().getTime();
	unwin.startupTimer=((endTime-startTime)/1000);
	//document.title+=" VB:"+unwin.startupTimer;
	
	if( unwin.delayVidzBiggerInit ){
		window.setTimeout(readyToVidsBig,1000);
	}else{
		readyToVidsBig();
	}
}
document.body.focus();

//if(_vt(unwin.ids_title)){
//	$g(unwin.ids_title).focus();
//	window.setTimeout(function(){unwin.fireMouseEvent($g(unwin.ids_title),'click')},10);
//}
//DEBUG ONLY CODE should not exist... but as long as they are all commented out,this should be fine...
//if(unwin.occuranceTestMonitor>=1){
//	window.setTimeout(function(){alert('OCM:'+unwin.occuranceTestMonitor)},4000);
//}