var CURRENT_DOMAIN = window.location.protocol + "//" + window.location.hostname;

// CHECK IF USER HAS AGREED TO ENTER TO THE PRIVATE ZONE, IN CASE WE'RE IN PRIVATE ZONE BY SCOTT
if(! DisplayThreadAlert_Cookied() ) {
	window.history.go(-1);
}

// START PZ CONFIRM BY SCOTT
function DisplayAlert_Cookied(){
	if ( this.href == CURRENT_DOMAIN + "/private-zone/" ) {
		if(readCookie('bPZConfirm') == '1') {
			return true;
		}
		var bIsConfirmed = confirm("WARNING!\n\nThe Private Zone forum is not moderated by SBR staff. Contents herein may be considered offensive. Minors are prohibited.");
		if (bIsConfirmed) {
			createCookie('bPZConfirm', '1', 7);
		}
		return bIsConfirmed;
	} else if ( this.href == CURRENT_DOMAIN+"/sports-promotions-links/" ) {
		return ( confirm("WARNING!\n\nThe Sports Promotions & Links forum may contain advertising claims of a highly questionable nature.  SBR does not validate nor endorse any posted content in Sports Promotions & Links and urges all visitors herein to exercise extreme caution.") );
	} else {
		return true;
	}
}

function DisplayThreadAlert_Cookied(){
	if ( window.location.href.match(CURRENT_DOMAIN+"/private-zone/") ) {
		if(readCookie('bPZConfirm') == '1') {
			return true;
		}
		var bIsConfirmed = confirm("WARNING!\n\nThe Private Zone forum is not moderated by SBR staff. Contents herein may be considered offensive. Minors are prohibited.");
		if (bIsConfirmed) {
			createCookie('bPZConfirm', '1', 7);
		}
		return bIsConfirmed;
	} else {
		return true;
	}
}
// END PZ CONFIRM BY SCOTT

// START COOKIE FUNCTIONS
function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}
// END COOKIE FUNCTIONS


// BEGIN YOUTUBE MOVIE FUNCTION BY IVAN
// UPDATE 10/19/2007

function youtubeMovie(str){
	try {
		var id;
		var re = new RegExp('value="http://(www.)?youtube.com/v/([^&"]+)');
		var m = re.exec(str);
		id = m == null ? (str.indexOf('=') > 0 ? str.split('=')[1] : str) : m[0].replace(re, "$2");
		document.write('<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/' + id + '"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/' + id + '" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>');
	} catch (er) {
	}
}

// BEGIN MYSBR MODULE FUNCTION BY BRIAN
// UPDATE 09/11/08
function MySBRModule(str) {
    var id = null;
    
    str = str.replace(/<script.*?src="http:\/\/www.mysbrforum.com\/module\/\?id=/ig, '');
    str = str.replace(/"><\/script>/ig, '');
    str = str.replace(/\[\/?Spreadsheet\]/ig, '');
    
    id = str;
    document.write(unescape("%3Cscript src='http://www.mysbrforum.com/module/%3fid=" + id+ "' type='text/javascript'%3E%3C/script%3E"));
}
// END MYSBR MODULE

// BEGIN SBR.TV MOVIE FUNCTION BY KASTHOR, BASED ON IVAN'S ORIGINAL youtubeMovie FUNCTION
// CREATED 08/23/2008
// 4/14/2009 -- Scott added URL and EMBED text boxes
//Modified on August4th by Jchaves & Rulloa in order to change the fplayer
var GanchrowSelectAll=function(A){A.focus();A.select();return false};

//function sbrtvMovie_old ( str )
//{
//	try {
//		var id;
//		var re = new RegExp('http://(.*?\.)?sbr.tv/.*?(?:postId=|video[-+])([0-9]+)');
//		var m = re.exec(str);
//		id = m[2];
//		var strEmbed =  '<object width="320" height="280"><param name="movie" value="http://www.sbr.tv/swf/mp.swf?postId=' + id + '"></param><param name="allowFullScreen" value="true"></param><param name="wmode" value="transparent"></param><embed src="http://www.sbr.tv/swf/mp.swf?postId=' + id + '" type="application/x-shockwave-flash" allowfullscreen="true" width="320" height="280" wmode="transparent"></embed></object>';
//		var strURL = 'http://www.sbr.tv/WatchVideo.aspx?postId=' + id;
//		document.write ( strEmbed );
//	} catch (er) {
//	}
//}

function sbrtvMovie ( str )
{
	try {
		var id;
		var re = new RegExp('http://(.*?\.)?(sbr\.tv|video\.sbrforum\.com)/.*?(?:postId=|video[-+])([0-9]+)');
		var m = re.exec(str);
		id = m[3];
		var strUniqId = (new Date()).getTime() + "z" + Math.random() + "z" + Math.random(); 
		document.write('<input type=hidden id="postid_' + strUniqId + '" value="' + id + '">');
		document.write('<span id=ganInfo_' + strUniqId + '></span>');
		ganAjaxFunction(id,strUniqId);
		create_vote_interface(strUniqId);
	} catch (er) {
	}
}
// END SBR.TV MOVIE FUNCTION

function PageQuery(q) {
	if(q.length > 1) this.q = q.substring(1, q.length);
		else this.q = null;
		this.keyValuePairs = new Array();
		if(q) {
			for(var i=0; i < this.q.split("&").length; i++) {
				this.keyValuePairs[i] = this.q.split("&")[i];
			}
		}
		this.getKeyValuePairs = function() { return this.keyValuePairs; }
		this.getValue = function(s) {
		for(var j=0; j < this.keyValuePairs.length; j++) {
			if(this.keyValuePairs[j].split("=")[0] == s)
			return this.keyValuePairs[j].split("=")[1];
		}
			return false;
		}
		this.getParameters = function() {
		var a = new Array(this.getLength());
		for(var j=0; j < this.keyValuePairs.length; j++) {
		a[j] = this.keyValuePairs[j].split("=")[0];
		}
		return a;
	}
	this.getLength = function() { return this.keyValuePairs.length; } 
}
function queryString(key){
	var page = new PageQuery(window.location.search); 
	return unescape(page.getValue(key)); 
}
function setSponsors(forum){
        var myImage = (document.getElementById('myBanner'));
        var myLink = (document.getElementById('thisLink'));
	if(myImage != null && myLink != null){
		switch(forum){
			case 2:
			      //myLink.href = "http://www.sportsbookreview.com/Sportsbook/?v=8&book=Pinnacle";
			      //myImage.src = "http://forum.sbrforum.com/sponsorbanners/pinnaclesponsor.gif";
			      //myImage.style.display = "block";
			      //break;
			      var myImage = (document.getElementById('myBanner'));
			      myImage.src = "http://forum.sbrforum.com/sponsorbanners/0.gif";
			      myImage.style.display = "block";
			      break;
			case 15:
			      //myLink.href = "http://www.sportsbookreview.com/Sportsbook/?v=8&book=Pinnacle";
			      //myImage.src = "http://forum.sbrforum.com/sponsorbanners/pinnaclesponsor.gif";
			      //break;
			      var myImage = (document.getElementById('myBanner'));
			      myImage.src = "http://forum.sbrforum.com/sponsorbanners/0.gif";
			      myImage.style.display = "block";
			      break;
			case 41:
			      //myLink.href = "http://www.sportsbookreview.com/Sportsbook/?v=8&book=Pinnacle";
			      //myImage.src = "http://forum.sbrforum.com/sponsorbanners/pinnaclesponsor.gif";
			      //break;
			      var myImage = (document.getElementById('myBanner'));
			      myImage.src = "http://forum.sbrforum.com/sponsorbanners/0.gif";
			      myImage.style.display = "block";
			      break;
			case 28:
			      myLink.href = "http://www.sportsbookreview.com/Sportsbook/?v=10&book=VIP";
			      myImage.src = "http://forum.sbrforum.com/sponsorbanners/"+forum+".gif";
			      break;
			case 30:
			      //myLink.href = "http://www.sportsbookreview.com/Sportsbook/?v=8&book=Pinnacle";
			      //myImage.src = "http://forum.sbrforum.com/sponsorbanners/pinnaclesponsor.gif";
			      //break;
			      var myImage = (document.getElementById('myBanner'));
			      myImage.src = "http://forum.sbrforum.com/sponsorbanners/0.gif";
			      myImage.style.display = "block";
			      break;
			case 31:
			      //myLink.href = "http://www.sportsbookreview.com/Sportsbook/?v=8&book=Pinnacle";
			      //myImage.src = "http://forum.sbrforum.com/sponsorbanners/pinnaclesponsor.gif";
			      //break;
			      var myImage = (document.getElementById('myBanner'));
			      myImage.src = "http://forum.sbrforum.com/sponsorbanners/0.gif";
			      myImage.style.display = "block";
			      break;
			case 36:
			      myLink.href = "http://www.sportsbookreview.com/Sportsbook/?v=11&book=PokerRoomReview";
			      myImage.src = "http://forum.sbrforum.com/sponsorbanners/"+forum+".gif";
			      break;
			case 46:
			      myLink.href = "http://www.sportsbookreview.com/Sportsbook/?v=6&book=DSI";
			      myImage.src = "http://forum.sbrforum.com/sponsorbanners/diamond.gif";
			      break;
			case 48:
			//      myLink.href = "http://www.sportsbookreview.com/Sportsbook/?v=9&book=BetCRIS";
			//      myImage.src = "http://forum.sbrforum.com/sponsorbanners/cris.gif";
			//      break; 
			default:
			      var myImage = (document.getElementById('myBanner'));
			      myImage.src = "http://forum.sbrforum.com/sponsorbanners/0.gif";
			      myImage.style.display = "block";
			      break;
		}
	}
}

// END SCRIPT BY ALLAN BANNER HANDLER 
/*
// BANNER ROTATING SCRIPT
var BannerRotator = Class.create({
    initialize: function(vars){
        var p = this;
        this.holder = $(vars.id);
        this.delay = vars.delay == null ? 1 : vars.delay;
        this.banners = this.Randomize(this.GetBanners(vars.flipDelay == null ? 1 : vars.flipDelay));
        this.currentBanner = 0;
    },
    Randomize: function(a){
        a = a.sort(function(){ return (Math.round(Math.random())-0.5); });
        a = a.sort(function(){ return (Math.round(Math.random())-0.5); });
        return a;
    },
    GetBanners: function(delay){  
        var b = new Array();
        var i = 0;
        this.holder.select('div.b_rotate').each(function(div){
            var banner = {
                index: i,
                object: div,
                link: div.select('a')[0],
                image1: div.select('img')[0],
                image2: div.select('img')[1],
                done1: false,
                done2: false,
                Rotate: function(bool, options){
                    new Effect.Morph(this.image1, {style: {height:'0px', opacity:'.5'}, afterFinish:function(){
                        banner.done1 = true;
                    }});
                    new Effect.Morph(this.image2, {style: {height:'44px', opacity:'1'}, afterFinish:function(){
                        banner.done2 = true;
                        if (banner.done1 && banner.done2)
                            banner.SwapImages(!bool, options);
                            
                        if (banner.done1 && banner.done2 && bool && options.onFinish)
                            options.onFinish(banner.object);
                    }});
                },
                SwapImages: function(goAgain, options){
                    var temp = this.image1;
                    
                    this.image1 = this.image2;
                    this.image2 = temp;
                    this.link.insertBefore(this.image1, this.image2);
                    this.image1.className = 'b_img1';
                    this.image2.className = 'b_img2';
                    
                    if (goAgain){
                        setTimeout(function(){
                            banner.Rotate(goAgain, options);
                        }, delay * 1000);
                    }
                }                
            };
            i++;
            b.push(banner);
        });
        return b;
    },
    Go: function(){
        var banner = this.banners[this.currentBanner];
        var me = this;
        banner.Rotate(false, {onFinish: function(o){
            //me.currentBanner = me.currentBanner + 1 >= me.banners.length ? 0 : me.currentBanner + 1;
            //setTimeout(function(){
            //    me.Go();
            //}, me.delay * 1000);
        }});
    }    
});
*/
// END BANNER ROTATING SCRIPT

function ganAjaxFunction(postid,uniqid,objTarget) {
	var xmlHttp;
	try {
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	} catch (e) {
		// Internet Explorer
		try {
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {
				document.write("Your browser does not support AJAX!");
				return false;
			}
		}
	}
	xmlHttp.onreadystatechange=function() {
		if(xmlHttp.readyState==4) {
			document.getElementById('ganInfo_'+uniqid).innerHTML=xmlHttp.responseText;
		}
	}
	
	xmlHttp.open("GET",CURRENT_DOMAIN+"/cgi-bin/get_vid_sbrforum.php?p=" + postid + "&uid=" + uniqid,true);
	//xmlHttp.open("GET",CURRENT_DOMAIN+"/cgi-bin/get_vid.php?p=" + postid + "&uid=" + uniqid,true);
	xmlHttp.send(null);
}

function ganAjaxGetTvUID() {
	var xmlHttp;
	try {
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	} catch (e) {
		// Internet Explorer
		try {
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {
				document.write("Your browser does not support AJAX!");
				return false;
			}
		}
	}
	xmlHttp.onreadystatechange=function() {
		if(xmlHttp.readyState==4) {
			document.sbrtvuserid=xmlHttp.responseText;
		}
	}
	xmlHttp.open("GET",CURRENT_DOMAIN+"/cgi-bin/whoami.php?tv",true);
	xmlHttp.send(null);
}

ganAjaxGetTvUID();

var sMax;	
var holder; 
var preSet; 
var rated = new Array();

function rating(num,uid){
	sMax = 0;	
	for(n=0; n<num.parentNode.childNodes.length; n++){
		if(num.parentNode.childNodes[n].nodeName == "A"){
			sMax++;	
		}
	}
	
	if(!rated[uid]){
		s = num.id.replace(/^.*?_/, ''); 
		a = 0;
		for(i=1; i<=sMax; i++){		
			if(i<=s){
				document.getElementById(uid+"_"+i).className = "on";
				document.getElementById(uid+"rateStatus").innerHTML = num.title;	
				holder = a+1;
				a++;
			} else {
				document.getElementById(uid+"_"+i).className = "";
			}
		}
	}
}


function off(me,uid){
	if(!rated[uid]){
		if(!preSet){	
			for(i=1; i<=sMax; i++){		
				document.getElementById(uid+"_"+i).className = "";
				document.getElementById(uid+"rateStatus").innerHTML = me.parentNode.title;
			}
		}else{
			rating(preSet,uid);
			document.getElementById(uid+"rateStatus").innerHTML = document.getElementById(uid+"ratingSaved").innerHTML;
		}
	}
}


function rateIt(me,uid){
	if(!rated[uid]){
//		document.getElementById(uid+"rateStatus").innerHTML = document.getElementById(uid+"ratingSaved").innerHTML + " :: "+me.title;
		preSet = me;
		rated[uid]=1;
		sendRate(me,uid);
		rating(me,uid);
	}
}


function sendRate(sel,uid,check){
	var sUserId = document.sbrtvuserid;
	var lRating = sel.id.replace(/^.*?_/, ''); 
	var lPostId = document.getElementById('postid_' + uid).value;

	var xmlHttp;
	try {
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	} catch (e) {
		// Internet Explorer
		try {
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {
				document.write("Your browser does not support AJAX!");
				return false;
			}
		}
	}
	xmlHttp.onreadystatechange=function() {
		if(xmlHttp.readyState==4) {
		}
	}
	var url = CURRENT_DOMAIN+'/cgi-bin/rate_vid.php?post=' + lPostId + '&user=' + sUserId + '&rating=' + lRating;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function create_vote_interface(uid) {
	var headID = document.getElementsByTagName("head")[0];         
	var cssNode = document.createElement('link');
	cssNode.type = 'text/css';
	cssNode.rel = 'stylesheet';
	cssNode.href = CURRENT_DOMAIN + '/css/vid_vote.css';
	cssNode.media = 'screen';
	headID.appendChild(cssNode);

	var quoted_uid = "'" + uid + "'";
	document.write('<span id="' + uid + 'voter" style="display:none;">');
	document.write('<hr>');
	document.write('<span class="ratingSaved" id="' + uid + 'ratingSaved">Thank you for voting!</span>');
	document.write('<span class="rateMe" id="' + uid + 'rateMe" title="Rate this video:">');
	document.write('<span class="rateStatus" id="' + uid + 'rateStatus">Rate this video:</span>');
	document.write('<a onclick="rateIt(this,' + quoted_uid + ')" id="' + uid + '_1" title="Poor" onmouseover="rating(this,' + quoted_uid + ')" onmouseout="off(this,' + quoted_uid + ')"></a>');
	document.write('<a onclick="rateIt(this,' + quoted_uid + ')" id="' + uid + '_2" title="Not Bad" onmouseover="rating(this,' + quoted_uid + ')" onmouseout="off(this,' + quoted_uid + ')"></a>');
	document.write('<a onclick="rateIt(this,' + quoted_uid + ')" id="' + uid + '_3" title="Pretty Good" onmouseover="rating(this,' + quoted_uid + ')" onmouseout="off(this,' + quoted_uid + ')"></a>');
	document.write('<a onclick="rateIt(this,' + quoted_uid + ')" id="' + uid + '_4" title="Excellent" onmouseover="rating(this,' + quoted_uid + ')" onmouseout="off(this,' + quoted_uid + ')"></a>');
	document.write('<a onclick="rateIt(this,' + quoted_uid + ')" id="' + uid + '_5" title="Awesome!" onmouseover="rating(this,' + quoted_uid + ')" onmouseout="off(this,' + quoted_uid + ')"></a>');
	document.write('</span>');
	document.write('<br><br><br><hr><br>');
	document.write('</span>');
	checkIfUserVoted(""+uid);
}

function checkIfUserVoted(uid) {
	if(!document.sbrtvuserid) {
		setTimeout("checkIfUserVoted('"+uid+"');", 500);
		return;
	}
	var sUserId = document.sbrtvuserid;
	var lPostId = document.getElementById('postid_' + uid).value;
	var xmlHttp;
	try {
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	} catch (e) {
		// Internet Explorer
		try {
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {
				document.write("Your browser does not support AJAX!");
				return false;
			}
		}
	}
	xmlHttp.onreadystatechange=function() {
		if(xmlHttp.readyState==4) {
			var lHAsVoted = parseInt(xmlHttp.responseText);
			var sVoteSpanID = uid + "voter";
			if (lHAsVoted == 0) {
				// user has not voted
				document.getElementById(sVoteSpanID).style.display = '';
			} else if (lHAsVoted == -1) {
				// user is not logged in
				document.getElementById(sVoteSpanID).innerHTML = '&nbsp;<a href="http://forum.sbrforum.com/" target=_blank style="font-size: 11px; font-weight: bold; font-family: Verdana;">You must be logged in to SBR Forum in order to rate this video.</a>';
				document.getElementById(sVoteSpanID).style.display = '';
			}
		}
	}
	var url = CURRENT_DOMAIN+'/cgi-bin/rate_vid.php?post=' + lPostId + '&user=' + sUserId + '&rating=&check=1';
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

//Application JS
/**TINY BOX**/
var TINY={};

function T$(i){return document.getElementById(i)}

TINY.box=function(){
	var p,m,b,cbtn,fn,ic,iu,iw,ih,ia,f=0;
	return{
		//html or ajax path, bool(int) is ajax, width, height, bool(1/0) animate, time in seconds to hide (optional!)
		show:function(c,u,w,h,a,t){
				
			if(!f){
				p=document.createElement('div'); p.id='tinybox';
				m=document.createElement('div'); m.id='tinymask';
				b=document.createElement('div'); b.id='tinycontent';
				cbtn=document.createElement('img'); cbtn.id='tinyimageclose';
			    cbtn.src = "/images/buttons/photoQuickViewClose.png";
			    cbtn.style.position='absolute';
				//document.body.appendChild(m); 
				document.body.appendChild(p); p.appendChild(b);document.body.appendChild(cbtn);
				m.onclick=TINY.box.hide; window.onresize=TINY.box.resize; f=1;cbtn.onclick=TINY.box.hide;
			}
			if(!a&&!u){
				p.style.width=w?w+'px':'auto'; p.style.height=h?h+'px':'auto';
				p.style.backgroundImage='none'; b.innerHTML=c;
				
			}else{
				b.style.display='none'; p.style.width=p.style.height='100px'
			}
			this.mask();
			ic=c; iu=u; iw=w; ih=h; ia=a; 
			this.alpha(m,1,80,1);
			
			if(t && t > 0){setTimeout(function(){TINY.box.hide()},1000*t)}
			
		},
		fill:function(c,u,w,h,a){
			if(u){
				p.style.backgroundImage='';
				var x=window.XMLHttpRequest?new XMLHttpRequest():new ActiveXObject('Microsoft.XMLHTTP');
				x.onreadystatechange=function(){
					if(x.readyState==4&&x.status==200){TINY.box.psh(x.responseText,w,h,a)}
				};
				x.open('GET',c,1); x.send(null)
			}else{
				this.psh(c,w,h,a)
				
			}
		},
		psh:function(c,w,h,a){
		
			if(a){
			
				if(!w||!h){
					var x=p.style.width, y=p.style.height; b.innerHTML=c;
					p.style.width=w?w+'px':''; p.style.height=h?h+'px':'';
					b.style.display='';
					w=parseInt(b.offsetWidth); h=parseInt(b.offsetHeight);
					b.style.display='none'; p.style.width=x; p.style.height=y;
					
				}else{
				
					b.innerHTML=c;
					
				}
				//p.style.width = w+'px';
				//p.style.height = h+'px';
				
				this.size(p,w,h,4)
				
			}else{
				p.style.backgroundImage='none'
				
			}
		},
		hide:function(){
			TINY.box.alpha(p,-1,0,1);
			cbtn.style.display='none';
		},
		resize:function(){
			TINY.box.pos(); TINY.box.mask()
		},
		mask:function(){
		return;
			m.style.height=TINY.page.theight()+'px';
			m.style.width=''; m.style.width=TINY.page.twidth()+'px'
		},
		pos:function(){
			var t=(TINY.page.height()/2)-(p.offsetHeight/2); t=t<10?10:t;
			p.style.top=(t+TINY.page.top())+'px';
			p.style.left=(TINY.page.width()/2)-(p.offsetWidth/2)+'px';
			
		},
		alpha:function(e,d,a,s){
			clearInterval(e.ai);
			if(d==1){
				e.style.opacity=0; e.style.filter='alpha(opacity=0)';
				e.style.display='block'; this.pos();
				
			}else{
			e.style.display='none';
	
			}
			e.ai=setInterval(function(){TINY.box.twalpha(e,a,d,s)},20)
		},
		twalpha:function(e,a,d,s){
			var o=Math.round(e.style.opacity*100);
			//alert(o);
			if(o==a){
				clearInterval(e.ai);
				if(d==-1){
					e.style.display='none';
					m.style.display='none';
					e==p?TINY.box.alpha(m,-1,0,1):b.innerHTML=p.style.backgroundImage='';
				}else{
					e==m?this.alpha(p,1,100,1):TINY.box.fill(ic,iu,iw,ih,ia)
				}
			}else{
				var n=o+Math.ceil(Math.abs(a-o)/s)*d;
				e.style.opacity=n/100; e.style.filter='alpha(opacity='+n+')'
			}
		},
		size:function(e,w,h,s){
			e=typeof e=='object'?e:T$(e); clearInterval(e.si);
			var ow=e.offsetWidth, oh=e.offsetHeight,
			wo=ow-parseInt(e.style.width), ho=oh-parseInt(e.style.height);
			var wd=ow-wo>w?-1:1, hd=(oh-ho>h)?-1:1;
			e.si=setInterval(function(){TINY.box.twsize(e,w,wo,wd,h,ho,hd,s)},20)
		},
		twsize:function(e,w,wo,wd,h,ho,hd,s){
		e.style.width = w+'px';
				e.style.height = h+'px';
				this.pos();
			var ow=e.offsetWidth-wo, oh=e.offsetHeight-ho;
			
			if(ow==w&&oh==h){
				clearInterval(e.si); p.style.backgroundImage='none'; b.style.display='block';
				cbtn.style.left=(parseInt(p.style.left)+parseInt(p.style.width)+20)+'px';
			cbtn.style.top=(parseInt(p.style.top)-10)+'px';
			cbtn.style.zIndex=9999;
			cbtn.style.display='block';
			}else{
				
				if(ow!=w){e.style.width=ow+(Math.ceil(Math.abs(w-ow)/s)*wd)+'px'}
				if(oh!=h){e.style.height=oh+(Math.ceil(Math.abs(h-oh)/s)*hd)+'px'}
				this.pos()
			}
		}
	}
}();

TINY.page=function(){
	return{
		top:function(){return document.body.scrollTop||document.documentElement.scrollTop},
		width:function(){return self.innerWidth||document.documentElement.clientWidth},
		height:function(){return self.innerHeight||document.documentElement.clientHeight},
		theight:function(){
			var d=document, b=d.body, e=d.documentElement;
			return Math.max(Math.max(b.scrollHeight,e.scrollHeight),Math.max(b.clientHeight,e.clientHeight))
		},
		twidth:function(){
			var d=document, b=d.body, e=d.documentElement;
			return Math.max(Math.max(b.scrollWidth,e.scrollWidth),Math.max(b.clientWidth,e.clientWidth))
		}
	}
}();

var SBR = {};
SBR = {
	PreloadImages : function(imgs){
		var imageArray = new Array();
		for(i=0;i<imgs.length;i++){
			imageArray[i] = new Image();
			imageArray[i].src = imgs[i];
		}
	}
}

SBR.PreloadImages(['/images/wi/buttons/searchloading.gif']);
YAHOO.sbrtv_video_carousel = function() {
	var $D = YAHOO.util.Dom;
	var $E = YAHOO.util.Event;
	var $A = YAHOO.util.Anim;
	var Y_M = YAHOO.util.Motion;
	var $DD = YAHOO.util.DD;
	var $ = $D.get;
	var x = 1;
	return {
		init : function() {
			elements = $D.getElementsByClassName('carouselButton');
			this.anim = new YAHOO.util.Motion('videos', null, 3, YAHOO.util.Easing.easeOut);
			
			$E.on(elements, 'click', this.move);
			this.set(1);
			$E.on(window,'load',function(){$D.get('sbr_tv_carousel_container').style.height = YAHOO.sbrtv_video_carousel.getScrollAmount()+'px';});
			
		},
		set : function(e){
			elements = $D.getElementsByClassName('handle'+e);
			$D.addClass(elements,'hidden');
		},
		getScrollAmount : function(){
			NumVideos = video_count;
			region = YAHOO.util.Dom.getRegion(YAHOO.util.Dom.getElementsByClassName('videoListItem')[0]);
			
			image_height = region.bottom-region.top;

			return image_height*(NumVideos/2);
		},
		move : function(e) {
			
			$E.stopEvent(e);
			if (YAHOO.sbrtv_video_carousel.anim.isAnimated())
				return;
			elements = $D.getElementsByClassName('handle1');
			$D.removeClass(elements,'hidden');
			elements = $D.getElementsByClassName('handle2');
			$D.removeClass(elements,'hidden');
			switch($D.hasClass($D.getAncestorByTagName(this,'li'),'handle1')) {
				case true:
					if ( x === 1 ) {
						YAHOO.sbrtv_video_carousel.set(1);
						return;
					}
					var attributes = {
						points : {
							by : [0, YAHOO.sbrtv_video_carousel.getScrollAmount()]
						}
					};
					x--;
					if ( x === 1 ) {
						YAHOO.sbrtv_video_carousel.set(1);
					}
				break;
				default:
					if ( x === 2 ) {
						YAHOO.sbrtv_video_carousel.set(2);
						return;
					}
					var attributes = {
						points : {
							by : [-0, (YAHOO.sbrtv_video_carousel.getScrollAmount()*-1)]
						}
					};
					x++;
					if ( x === 2 ) {
						YAHOO.sbrtv_video_carousel.set(2);
					}
				break;
			};
			YAHOO.sbrtv_video_carousel.anim = new YAHOO.util.Motion('videos', attributes, 3, YAHOO.util.Easing.easeOut);
			YAHOO.sbrtv_video_carousel.anim.animate();
		}
	};
}();

var MAXADS = 1;
function fillBanners(options){

	//Max banners
	//var MAX = 1;//Zero based, actually 2
	reg1 = YAHOO.util.Dom.getRegion('threadslist'); //Getting the height of list of threads
	if(!reg1){
		reg1 = YAHOO.util.Dom.getRegion('inlinemodform'); //Trying to get height of list of posts
	}

	if(!reg1){return;}
	reg2 = YAHOO.util.Dom.getRegion('rightAds');
	var height1= reg1.bottom - reg1.top;
	var height2= reg2.bottom - reg2.top;
	carouselC =YAHOO.util.Dom.getRegion('sbr_tv_video_carousel_container'); //Getting height of carousel if applicable
	
	if(carouselC){
		height1= height1 - (carouselC.bottom-carouselC.top); //subtracting height of carousel from free space
	}

	num = Math.floor((height1-height2)/height2); //subtracting the total height from available height, then seeing how many ads can fit
	var ads = "";
	var src = document.getElementById('rightfirstad').src;
	
	
	for(i=0;i<num && i<MAXADS;i++){
		 var b = document.createElement('script');
		 b.src = src+'?element_id=455_'+i;
		 b.type = 'text/javascript';
		document.getElementById('rightAds').appendChild(b);
	}

}
// nCode Image Resizer for vBulletin 3.6.0
// http://www.ncode.nl/vbulletinplugins/
// Version: 1.0.1
//
// (c) 2007 nCode


NcodeImageResizer.IMAGE_ID_BASE = 'ncode_imageresizer_container_';
NcodeImageResizer.WARNING_ID_BASE = 'ncode_imageresizer_warning_';
NcodeImageResizer.scheduledResizes = [];

function NcodeImageResizer(id, img) {
	this.id = id;
	this.img = img;
	this.originalWidth = 0;
	this.originalHeight = 0;
	this.warning = null;
	this.warningTextNode = null;
	this.originalWidth = img.originalWidth;
	this.originalHeight = img.originalHeight;
	
	img.id = NcodeImageResizer.IMAGE_ID_BASE+id;
}

NcodeImageResizer.executeOnload = function() {
	var rss = NcodeImageResizer.scheduledResizes;
	for(var i = 0; i  < rss.length; i++) {
		NcodeImageResizer.createOn(rss[i], true);
	}
}

NcodeImageResizer.schedule = function(img) {
	if(NcodeImageResizer.scheduledResizes.length == 0) {
		if(window.addEventListener) {
			window.addEventListener('load', NcodeImageResizer.executeOnload, false);
		} else if(window.attachEvent) {
			window.attachEvent('onload', NcodeImageResizer.executeOnload);
		}
	}
	NcodeImageResizer.scheduledResizes.push(img);
}

NcodeImageResizer.getNextId = function() {
	var id = 1;
	while(document.getElementById(NcodeImageResizer.IMAGE_ID_BASE+id) != null) {
		id++;
	}
	return id;
}

NcodeImageResizer.createOnId = function(id) {
	return NcodeImageResizer.createOn(document.getElementById(id));
}

NcodeImageResizer.createOn = function(img, isSchedule) {
	if(typeof isSchedule == 'undefined') isSchedule = false;
	
	if(!img || !img.tagName || img.tagName.toLowerCase() != 'img') {
		alert(img+' is not an image ('+img.tagName.toLowerCase()+')');
	}
	
	if(img.width == 0 || img.height == 0) {
		if(!isSchedule)
			NcodeImageResizer.schedule(img);
		return;
	}
	
	if(!img.originalWidth) img.originalWidth = img.width;
	if(!img.originalHeight) img.originalHeight = img.height;
	
	if((NcodeImageResizer.MAXWIDTH > 0 && img.originalWidth > NcodeImageResizer.MAXWIDTH) || (NcodeImageResizer.MAXHEIGHT > 0 && img.originalHeight > NcodeImageResizer.MAXHEIGHT)) {
		var isRecovery = false; // if this is a recovery from QuickEdit, which only restores the HTML, not the OO structure
		var newid, resizer;
		if(img.id && img.id.indexOf(NcodeImageResizer.IMAGE_ID_BASE) == 0) {
			newid = img.id.substr(NcodeImageResizer.IMAGE_ID_BASE.length);
			if(document.getElementById(NcodeImageResizer.WARNING_ID_BASE+newid) != null) {
				resizer = new NcodeImageResizer(newid, img);
				isRecovery = true;
				resizer.restoreImage();
			}
		} else {
			newid = NcodeImageResizer.getNextId();
			resizer = new NcodeImageResizer(newid, img);
		}
		
		if(isRecovery) {
			resizer.reclaimWarning(newid);
		} else {
			resizer.createWarning();
		}
		resizer.scale();
	}
}

NcodeImageResizer.prototype.restoreImage = function() {
	newimg = document.createElement('IMG');
	newimg.src = this.img.src;
	this.img.width = newimg.width;
	this.img.height = newimg.height;
}

NcodeImageResizer.prototype.reclaimWarning = function(id) {
	this.warning = document.getElementById(NcodeImageResizer.WARNING_ID_BASE+id);
	this.warningTextNode = this.warning.firstChild.firstChild.childNodes[1].firstChild;
	this.warning.resize = this;
	
	this.scale();
}

NcodeImageResizer.prototype.createWarning = function() {
	var mtable = document.createElement('TABLE');
	var mtbody = document.createElement('TBODY');
	var mtr = document.createElement('TR');
	var mtd1 = document.createElement('TD');
	var mtd2 = document.createElement('TD');
	var mimg = document.createElement('IMG');
	var mtext = document.createTextNode('');
	
	mimg.src = NcodeImageResizer.BBURL+'/images/statusicon/wol_error.gif';
	mimg.width = 16;
	mimg.height = 16;
	mimg.alt = '';
	mimg.border = 0;
	
	mtd1.width = 20;
	mtd1.className = 'td1';
	
	mtd2.unselectable = 'on';
	mtd2.className = 'td2';
	
	mtable.className = 'ncode_imageresizer_warning';
	mtable.textNode = mtext;
	mtable.resize = this;
	mtable.id = NcodeImageResizer.WARNING_ID_BASE+this.id;
	
	mtd1.appendChild(mimg);
	mtd2.appendChild(mtext);
	
	mtr.appendChild(mtd1);
	mtr.appendChild(mtd2);
	
	mtbody.appendChild(mtr);
	
	mtable.appendChild(mtbody);
	
	this.img.parentNode.insertBefore(mtable, this.img);
	
	this.warning = mtable;
	this.warningTextNode = mtext;
}

NcodeImageResizer.prototype.setText = function(text) {
	var newnode = document.createTextNode(text);
	this.warningTextNode.parentNode.replaceChild(newnode, this.warningTextNode);
	this.warningTextNode = newnode;
}

NcodeImageResizer.prototype.scale = function() {
	this.img.height = this.originalHeight;
	this.img.width = this.originalWidth;
	
	if(NcodeImageResizer.MAXWIDTH > 0 && this.img.width > NcodeImageResizer.MAXWIDTH) {
		this.img.height = (NcodeImageResizer.MAXWIDTH / this.img.width) * this.img.height;
		this.img.width = NcodeImageResizer.MAXWIDTH;
	}
	
	if(NcodeImageResizer.MAXHEIGHT > 0 && this.img.height > NcodeImageResizer.MAXHEIGHT) {
		this.img.width = (NcodeImageResizer.MAXHEIGHT / this.img.height) * this.img.width;
		this.img.height = NcodeImageResizer.MAXHEIGHT;
	}
	
	this.warning.width = this.img.width;
	this.warning.onclick = function() { return this.resize.unScale(); }
	
	if(this.img.width < 450) {
		this.setText(vbphrase['ncode_imageresizer_warning_small']);
	} else if(this.img.fileSize && this.img.fileSize > 0) {
		this.setText(vbphrase['ncode_imageresizer_warning_filesize'].replace('%1$s', this.originalWidth).replace('%2$s', this.originalHeight).replace('%3$s', Math.round(this.img.fileSize/1024)));
	} else {
		this.setText(vbphrase['ncode_imageresizer_warning_no_filesize'].replace('%1$s', this.originalWidth).replace('%2$s', this.originalHeight));
	}
	
	return false;
}

NcodeImageResizer.prototype.unScale = function() {
	switch(NcodeImageResizer.MODE) {
		case 'samewindow':
			window.open(this.img.src, '_self');
			break;
		case 'newwindow':
			window.open(this.img.src, '_blank');
			break;
		case 'enlarge':
		default:
			this.img.width = this.originalWidth;
			this.img.height = this.originalHeight;
			this.img.className = 'ncode_imageresizer_original';
			if(this.warning != null) {
				this.setText(vbphrase['ncode_imageresizer_warning_fullsize']);
				this.warning.width = this.img.width;
				this.warning.onclick = function() { return this.resize.scale() };
			}
			break;
	}
	
	return false;
}

/** ENCODE URL **/
function UrlEncode(str) {
	return escape(str).replace(/\+/g,'%2B').replace(/%20/g, '+').replace(/\*/g, '%2A').replace(/\//g, '%2F').replace(/@/g, '%40');
}


function MultiQuoteQuickReplyBuild(e){
	
	
	
}

function loadjscssfile(filename, filetype){
 if (filetype=="js"){ //if filename is a external JavaScript file
  var fileref=document.createElement('script')
  fileref.setAttribute("type","text/javascript")
  fileref.setAttribute("src", filename)
 }
 else if (filetype=="css"){ //if filename is an external CSS file
  var fileref=document.createElement("link")
  fileref.setAttribute("rel", "stylesheet")
  fileref.setAttribute("type", "text/css")
  fileref.setAttribute("href", filename)
  createCookie("cssStyle", filename, 1);
 }
 if (typeof fileref!="undefined")
  document.getElementsByTagName("head")[0].appendChild(fileref)
}

cssStyle = readCookie("cssStyle");
if(cssStyle != null)
	loadjscssfile(cssStyle, 'css');

SBRPick = {
	challenge:function(url){
		TINY.box.show('<iframe width="350" height="420" src="' + url + '"></iframe>', 0, 355, 425, 1);
	}

}
Points = {
	Transfer:function(url, width, height){
		TINY.box.show(url, 1, width, height, 1);
	},
	TransferMobile:function(url, divId){
	    YAHOO.util.Connect.asyncRequest('GET', url, 
	                {
	                success:
	                function(o){document.getElementById(divId).innerHTML = o.responseText;}
	                }
	           );
	}
}

Forum = {
	Post : {
		Nominate:function(id){
			if(confirm('Are you sure you want to nominate this post?')){
				YAHOO.util.Connect.asyncRequest('POST', '/feeds/Nomination/post.php', 
					{success:function(o){TINY.box.show(o.responseText, 0, 200, 80, 1);}}
					, 
					'a=nominate&id='+id);
			}
		},
		WhoNominated:function(A){
		   return openWindow("misc.php?"+SESSIONURL+"do=whonominated&t="+A,230,300);
		}
	
	},
	Tmp:'',
	MultiQuote : {
		text : "",
		
		//Takes cookies and populates the quick quote box
		BindData :function(e){
			replys = unescape(readCookie('vbulletin_multiquote')).split(',');
			Forum.MultiQuote.text = "";
				if(replys[0] == "" || replys[0] == "null")
				return;
			
			YAHOO.util.Connect.asyncRequest('POST', '/ajax.php', {
				success:function(o){
				 var xmlDoc;
					
					var posts = o.responseXML.getElementsByTagName("post");
					
					for(var i = 0;i<posts.length;i++){
					var post = posts[i];
						var username = post.attributes.getNamedItem("username").value, postId = post.attributes.getNamedItem("postid").value;
						Forum.MultiQuote.text +="[quote="+username+";"+postId+"]";
						Forum.MultiQuote.text += post.childNodes[0].nodeValue.replace(/\[quote[\S\s]*?\[\/quote\]/ig,'');
						Forum.MultiQuote.text += "[/quote]\n\n";
					}
					
					try{
					
						vB_Editor['vB_Editor_QR'].editdoc.activeElement.innerHTML = (e == "preserve" ? vB_Editor['vB_Editor_QR'].editdoc.activeElement.innerHTML : "")+Forum.MultiQuote.text;
					} catch(e){
					   try{
					   vB_Editor['vB_Editor_QR'].editdoc.value = (e == "preserve" ? vB_Editor['vB_Editor_QR'].editdoc.value : "")+Forum.MultiQuote.text;
					   }catch(e){
						//nothing
					   }
					}
					
					}
				}, 'securitytoken='+SECURITYTOKEN+'&do=posts&ids='+replys);
			
				
			/**
			for(i=0;i<replys.length;i++){
				try{
					t = document.getElementById('post_message_'+replys[i]).innerHTML;
					username = YAHOO.util.Dom.getElementsByClassName('bigusername', 'a', 'postmenu_'+replys[i]);
				if(username.length > 0){
					username = username[0].innerHTML;
					text += "[quote="+username+";"+replys[i]+"]";
				}else{
					text += "[quote]";
				}
				//removing all the quoted quote's quotes
				
				t = t.replace(/<div\ .*?class="?quoteWrapper"?[^}]*<span class="?quoteCloser"?><\/span>/ig,'');
				
				text+=t+"[/quote]"+"\n\n";
			}catch(err){
				//quote is not from this page
			}
			}
			**/
			
			
		
		}
	
	
	}

}

MySBR = {
	GetSubDomain:function(username){
		var search = "œ,ç,æ,œ,á,é,í,ó,ú,à,è,ì,ò,ù,ä,ë,ï,ö,ü,ÿ,â,ê,î,ô,û,å,e,i,ø,u,ý".split(',');
		var replace = "ce,c,ae,oe,a,e,i,o,u,a,e,i,o,u,a,e,i,o,u,y,a,e,i,o,u,a,e,i,o,u,y".split(',');
		return  str_replace(search, replace, username).replace(/&.*?;|[^A-Za-z\d]/g,'');
	}
	
}

function str_replace (search, replace, subject, count) {
    //      note 1: The count parameter must be passed as a string in order to work
    //      note 1:  to find a global variable in which the result will be given
    //      example 1: str_replace(' ', '.', 'Sports Book Review');
    //      returns 1: 'Sports.Book.Review'
    //      example 2: str_replace(['{name}', 'l'], ['hello', 'm'], '{name}, lars');
    //      returns 2: 'hemmo, mars'
 
    var i = 0, j = 0, temp = '', repl = '', sl = 0, fl = 0,
            f = [].concat(search),
            r = [].concat(replace),
            s = subject,
            ra = r instanceof Array, sa = s instanceof Array;
    s = [].concat(s);
    if (count) {
        this.window[count] = 0;
    }
 
    for (i=0, sl=s.length; i < sl; i++) {
        if (s[i] === '') {
            continue;
        }
        for (j=0, fl=f.length; j < fl; j++) {
            temp = s[i]+'';
            repl = ra ? (r[j] !== undefined ? r[j] : '') : r[0];
            s[i] = (temp).split(f[j]).join(repl);
            if (count && s[i] !== temp) {
                this.window[count] += (temp.length-s[i].length)/f[j].length;}
        }
    }
    return sa ? s : s[0];
}

var Counter = {
	EndDate: new Array(),
	UpdateIds: new Array(),
	Options: new Array(),
	Run:function(counterName){
		dateNow = new Date();									//grab current date
		amount = Counter.EndDate[counterName].getTime() - dateNow.getTime();		//calc milliseconds between dates
		delete dateNow;

		// time is already past
		if(amount < 0){
			document.getElementById(Counter.UpdateIds[counterName]).innerHTML=Counter.Options[counterName].finishedText;
		}
		// date is still good
		else{
			days=0;hours=0;mins=0;secs=0;out="";

			amount = Math.floor(amount/1000);//kill the "milliseconds" so just secs

			days=Math.floor(amount/86400);//days
			amount=amount%86400;

			hours=Math.floor(amount/3600);//hours
			amount=amount%3600;

			mins=Math.floor(amount/60);//minutes
			amount=amount%60;

			secs=Math.floor(amount);//seconds

			out = Counter.Options[counterName].format;
			replacement = Counter.Options[counterName].emptyReplacement;
			out = out.replace(/#days#/ig, days > 0 ? days : replacement ).replace(/#days_label#/ig, days > 0 ? days != 1 ? "days" : "day" : replacement );
			out = out.replace(/#hours#/ig, hours).replace(/#hours_label#/ig, hours != 1 ? "hours" : "hour");
			//if((days != 0 || hours != 0) && Counter.Options[counterName].show.hours){out += hours +" hour"+((hours!=1)?"s":"")+", ";}
			out = out.replace(/#minutes#/ig, mins > 9 ? mins : "0"+mins).replace(/#minutes_label#/ig, mins != 1 ? "minutes" : "minute");
			//if((days != 0 || hours != 0 || mins != 0) && Counter.Options[counterName].show.minutes){out += mins +" minute"+((mins!=1)?"s":"")+", ";}
			
			
			out = out.replace(/#seconds#/ig,secs > 9 ? secs : "0"+secs).replace(/#seconds_label#/ig, secs != 1 ? "seconds" : "second");
			
			out = "<span style=\"" + Counter.Options[counterName].GetWrapperStyle(days, hours, mins, secs) + "\">" + out + "</span>";
			document.getElementById(Counter.UpdateIds[counterName]).innerHTML=out;
			
			setTimeout(function(){Counter.Run(counterName);}, 1000);
		}
	},
	Start:function(counterName, endDate, updateId, options){
		if(options === undefined || options.format == undefined || options.GetWrapperStyle == undefined)
		{
		    if(options === undefined)
				options = {};
			if(options.format == undefined)
				options.format = "#days# #days_label#, #hours# #hours_label#, #minutes# #minutes_label#, #seconds# #seconds_label#";
			if(options.GetWrapperStyle == undefined)
				options.GetWrapperStyle = function(d){return ""};
			if(options.emptyReplacement == undefined)
				options.emptyReplacement = "";
			if(options.finishedText == undefined)
				options.finishedText = " - ";
		}
		Counter.Options[counterName] = options
		Counter.EndDate[counterName] = endDate;
		Counter.UpdateIds[counterName] = updateId;
		Counter.Run(counterName);
		
	}


}

var CountdownClock = {
	NumbersImageDir: "/feeds/Lottery/numbers/",
	Clocks : new Array(),
	Run:function(name){
		
		

		
		now = new Date();

		later = CountdownClock.Clocks[name];

		days = (later - now) / 1000 / 60 / 60 / 24;
		daysRound = Math.floor(days);
		hours = (later - now) / 1000 / 60 / 60 - (24 * daysRound);
		hoursRound = Math.floor(hours);
		minutes = (later - now) / 1000 /60 - (24 * 60 * daysRound) - (60 * hoursRound);
		minutesRound = Math.floor(minutes);
		seconds = (later - now) / 1000 - (24 * 60 * 60 * daysRound) - (60 * 60 * hoursRound) - (60 * minutesRound);
		secondsRound = Math.round(seconds);
		
		letter = "c";
		if(daysRound <= 0 && hoursRound <= 0)
			letter = "a";
		
		if(daysRound < 0 || hoursRound <= 0 && minutesRound < 0 && secondsRound < 0){
			document.getElementById('seconds1').src = eval("c0.src");
			document.getElementById('seconds2').src = eval("c0.src");
			document.getElementById('minutes1').src = eval("c0.src");
			document.getElementById('minutes2').src = eval("c0.src");
			return;
		}
		
			

		if (secondsRound <= 9) {
			document.getElementById('seconds1').src = eval(letter+"0.src");
			document.getElementById('seconds2').src = eval(letter+secondsRound+".src");
		}
		else {
			document.getElementById('seconds1').src = eval(letter+Math.floor(secondsRound/10)+".src");
			document.getElementById('seconds2').src = eval(letter+Math.floor(secondsRound%10)+".src");
		}

		if (minutesRound <= 9) {
			document.getElementById('minutes1').src = eval(letter+"0.src");
			document.getElementById('minutes2').src = eval(letter+minutesRound+".src");
		}
		else {
			document.getElementById('minutes1').src = eval(letter+Math.floor(minutesRound/10)+".src");
			document.getElementById('minutes2').src = eval(letter+(minutesRound%10)+".src");
		}

		if (hoursRound <= 9) {
		document.getElementById('hours1').src = c0.src;
		document.getElementById('hours2').src = eval("c"+hoursRound+".src");
		}
		else {
		document.getElementById('hours1').src = eval("c"+Math.floor(hoursRound/10)+".src");
		document.getElementById('hours2').src = eval("c"+(hoursRound%10)+".src");
		}

		if (daysRound <= 9) {
		
		document.getElementById('days2').src = c0.src;
		document.getElementById('days3').src = eval("c"+daysRound+".src");
		}
		if (daysRound <= 99) {
		document.getElementById('days2').src = eval("c"+Math.floor((daysRound/10)%10)+".src");
		document.getElementById('days3').src = eval("c"+Math.floor(daysRound%10)+".src");
		}
		if (daysRound <= 999){
		document.getElementById('days2').src = eval("c"+Math.floor((daysRound/10)%10)+".src");
		document.getElementById('days3').src = eval("c"+Math.floor(daysRound%10)+".src");
		}
	

		window.setTimeout(function(){
			CountdownClock.Run(name);
		}, 500);
	},
	Start:function(name, date){
	c1 = new Image(); c1.src =  CountdownClock.NumbersImageDir +"1c.gif";
		c2 = new Image(); c2.src =  CountdownClock.NumbersImageDir +"2c.gif";
		c3 = new Image(); c3.src =  CountdownClock.NumbersImageDir +"3c.gif";
		c4 = new Image(); c4.src =  CountdownClock.NumbersImageDir +"4c.gif";
		c5 = new Image(); c5.src =  CountdownClock.NumbersImageDir +"5c.gif";
		c6 = new Image(); c6.src =  CountdownClock.NumbersImageDir +"6c.gif";
		c7 = new Image(); c7.src =  CountdownClock.NumbersImageDir +"7c.gif";
		c8 = new Image(); c8.src =  CountdownClock.NumbersImageDir +"8c.gif";
		c9 = new Image(); c9.src =  CountdownClock.NumbersImageDir +"9c.gif";
		c0 = new Image(); c0.src =  CountdownClock.NumbersImageDir +"0c.gif";
		Cc = new Image(); Cc.src =  CountdownClock.NumbersImageDir +"Cc.gif";
		
		a1 = new Image(); a1.src = CountdownClock.NumbersImageDir +"1a.gif";
		a2 = new Image(); a2.src =  CountdownClock.NumbersImageDir +"2a.gif";
		a3 = new Image(); a3.src =  CountdownClock.NumbersImageDir +"3a.gif";
		a4 = new Image(); a4.src =  CountdownClock.NumbersImageDir +"4a.gif";
		a5 = new Image(); a5.src =  CountdownClock.NumbersImageDir +"5a.gif";
		a6 = new Image(); a6.src =  CountdownClock.NumbersImageDir +"6a.gif";
		a7 = new Image(); a7.src =  CountdownClock.NumbersImageDir +"7a.gif";
		a8 = new Image(); a8.src =  CountdownClock.NumbersImageDir +"8a.gif";
		a9 = new Image(); a9.src =  CountdownClock.NumbersImageDir +"9a.gif";
		a0 = new Image(); a0.src =  CountdownClock.NumbersImageDir +"0a.gif";
		
		CountdownClock.Clocks[name] = date;
		CountdownClock.Run(name);
	}


}



modal = false;
y_popup = false;
function ShowModal(title, body, width, drag){
	if(modal !== false)
	    modal.destroy();

	
	m = new YAHOO.widget.Panel("wait",  
			{ width:width,
			    fixedcenter: false, 
			  close:true, 
			  draggable:drag, 
			  zindex:4,
			  modal:true,
			  visible:true
			}
		);
		
	m.setHeader(title);
	m.setBody(body);
	m.render(document.body);
	m.center();
	modal = m;
	YAHOO.util.Event.addListener('wait_mask', 'click', CloseDialogs); 
	return m;
}

function CloseDialogs() {
    if (y_popup !== false)
        y_popup.hide();
    if (modal !== false)
        modal.hide();
}
function ShowPopup(title, body, width, drag) {
    if (y_popup !== false)
        y_popup.destroy();
        m = new YAHOO.widget.Panel("ypopup",
			    { width: width,
			        fixedcenter: false,
			        close: true,
			        draggable: drag,
			        zindex: 4,
			        modal: false,
			        visible: true
			    }
		    );
        m.setHeader(title);
        m.setBody(body);
        y_popup = m;
        m.render(document.body);
        m.center();
        YAHOO.util.Event.addListener('ypopup_mask', 'click', CloseDialogs); 
        return m;
}
ProMembers = {
    CloseBtn: "<p align='center'><input type='button' onclick='modal.hide();' value='Ok' /></p>",
    Guest: {
        success: function (o) {
            ShowModal("Become A Pro!", o.responseText, '675px', true);
        },
        failure: function (o) {
            ShowModal("Error", o.responseText + ProMembers.CloseBtn, '675px', true);
        }
    },
    SubmitApplication: function () {
        var formObject = document.getElementById('proMembershipApplication');
        var sportbook = document.getElementById('proMembers_sportsbook');
        var account = document.getElementById('proMembers_account');
        if (sportbook.value == '') {
            alert('Please specify a sportsbook.');
            return false;
        }

        if (account.value == '') {
            alert('Please enter your account number');
            return false;
        }
        YAHOO.util.Connect.setForm(formObject);
        var cObj = YAHOO.util.Connect.asyncRequest('POST', formObject.action, ProMembers.Ajax.HandleApplicationSubmission);
        return false;
    },
    Ajax: {
        HandleApplicationSubmission: {
            success: function (o) {
                ShowModal("Success!", o.responseText, '600px', true);
            },
            failure: function (o) {
                ShowModal("Error", o.responseText, '600px', true);
            }

        }

    }

}
YAHOO.util.Event.onDOMReady(function(){
    YAHOO.util.Dom.addClass(document.getElementsByTagName('body'), 'yui-skin-sam')
elements = YAHOO.util.Dom.getElementsByClassName('multiquotebtn');
//clearing multi quote cookies
Forum.MultiQuote.BindData("preserve");

//erases multiquote between threads
createCookie('vbulletin_multiquote','',1);
YAHOO.util.Event.on(elements,'click', Forum.MultiQuote.BindData);
});

