
var divInfoName ;
var menuState ;
var menuState_current ;
var reOpenDiv ;

function setVoteCookie(){
	var options = { path: '/', expires: 1 };
	var _numVotes = getVoteCheck() ;
	_numVotes = (_numVotes + 1) ;
	
	$.cookie("numVotes", _numVotes, options);
	//return false ;
	 //alert($.cookie("numVotes"));
}

function getVoteCheck(){
	var numVotes = $.cookie("numVotes") ;
	//if(numVotes == null)
		numVotes = 0 ;
	
	return parseFloat(numVotes) ;	
	//alert($.cookie("numVotes"));
}
	
function set_bzx_html(htmlObj, type){
		//***SET HTML**
		
		//***GET COMMENT XML URL***
		bzx_app.comment_urlXml = bzx_app.get_commentUrl(htmlObj) ;
		//$("strong.addedtext").remove();
		$("#commentTable").remove() ;						
		
		//***GET COLORS***
		var _lineColor = "3px solid " + htmlObj.lineColor ;
		var _boxLinColor =  "3px solid " + htmlObj.lineColor ;		
		//***GET DESC***
		var _desc = htmlObj.desc + "<div style=margin-top:20px align=center></div>"
		
		//***SET ALL COLORS FOR BACK AND LINES**
		//$("#bzx_app_container").css("border", "2px solid " + htmlObj.lineColor) ;
		//alert(htmlObj.lineColor) ;
		$("#descBox").css("border", "3px solid " + htmlObj.lineColor) ;
		//$(".commentLine").css("border-bottom", "1px solid " + htmlObj.lineColor) ;
		//$("#bzx_app_btm").css("border-top", _lineColor) ;
		$("#bzx_app_btm").css("background-color", htmlObj.backColor) ;
		//$("#descBox").css("border", _boxLinColor) ;
		
		//***SET DESC HTML***
		$("div#bzx_app_desc").hide();
		document.getElementById('bzx_app_desc').innerHTML = unescape(_desc) ;								
		$("div#bzx_app_desc").show();
		//imgages_fitInDiv("#bzx_app_banner", 744, 168) ;
				
		//alert(type + unescape(_desc)) ;
		commentType = new Object();
		
		//$("#error").html(type);
		//document.getElementById('error').innerHTML =  type ;
		var _commentId ;
		if(type != "org"){
			//***SET USER TOURN***			
			//alert("here") ;
			adSwapper() ;
			
			$("#bzx_prizeRules").hide() ;
			tournData = htmlObj ;
			
			if(_action == "subDom"){
				window.document.title = orgData.orgName + " - " + tournData.tournTitle ;
				//alert(tournData.groupId) ;
				//if(tournData.groupId != "0")
					//***BZX APP COMMENTS RENDER***
					//bzx_app.render_flash('comments') ;
			}	
			 
			if(htmlObj.prizeActive){				
				//***IF PRIZE ACTIVE SHOW MENU***
				$("#rulePrizeBack").html("") ;
				var strRulePrize = "<div align=center class=rulePrizeBack>" +
									"<a class=rulesPrize  href=javascript:viewPrizeRules('prize');>Prize(s)</a> | " +
									"<a class=rulesPrize href=javascript:viewPrizeRules('rules');>Rules</a></div>" ;
				//$("#bzx_prizeRules").show() ;				
				//$("div#prize_menu").show() ;
				//$("div#rulePrizeBack").append(strRulePrize) ;
			}	
			currentTitle = htmlObj.tournTitle ;
			var _htmlInfo = htmlObj.numUsers + " Users <span style=color:#fff>|</span> " + htmlObj.numRounds + " Round(s)" ;
			document.getElementById('bzx_app_titleInfo').innerHTML = _htmlInfo ;
			document.getElementById('bzx_app_title').innerHTML = "<h1>" + htmlObj.tournTitle  + "</h1>" ;			
			commentType.objId = htmlObj.comment_objId ;
			commentType.commentType = "1" ;
			commentTypeId = "1" ;
			bzx_app.commentId = "bzx_user_" + htmlObj.comment_objId ;
			
			_commentId = "bzx_tourn_" + htmlObj.comment_objId ;
			renderFaceBookComment(_commentId, 'bzxFb_comments', 'tourn', currentTitle) ;
			//_action = "subDom"
			//***GET TOURN COMMENTS***
			//alert(isFaceBook + ":" + _action)
			/*
			if((isFaceBook==true) || (_action=="subDom")){
				getFlexApp('bzx_comments').getComments() ;
			}else{
				//***BZX APP COMMENTS RENDER***
				bzx_app.render_flash('comments') ;
			}	
			*/
			//************************
			//$("#bzx_app_title").html("<h1>" + htmlObj.tournTitle  + "</h1>");
			//$("#bzx_app_titleInfo").html(_htmlInfo);
			//$("#bzx_app_title").html("<h1>" + htmlObj.tournTitle  + "</h1>");
		}else{
			//***SET COMMENTID TO ORG***
			bzx_app.commentId = "bzx_org_" + orgId ;		
			commentType.objId = orgId ; 
			commentType.commentType = "0" ;
			orgUrl = htmlObj.orgUrl ;
			_commentId = "bzx_org_" + orgId ;
			renderFaceBookComment(_commentId, 'bzxFb_comments', 'org', orgData.orgName) ;
			//alert(htmlObj.orgUrl) ;
			//alert(htmlObj.comment_objId) ;
			//commentType = "0" ;
			/*
			if(orgCode == "YBT" && tournUserId != "0"){	
				//***TOURN USER COMMENTS ELSE SHOW ORG***
				commentType.objId = tournUserId ;
				commentType.commentType = "1" ;
				bzx_app.commentId = "bzx_user_" + tournUserId ;
				//commentType = "1" ;
			}	
			*/
			//alert(tournUserId) ;
		}
		//alert(tournUserId + ":" + htmlObj.comment_objId + ":" + commentType.objId) ;
		//getTournType() ;
		
		//***RE-SIZE ALL IMAGES PORPTIONAL***				
		
		//***RESIZE HEADER**
		setTimeout ("imgages_fitInDiv('#bzx_header', 744,500)", 1000 );
		//***RESIZE DESC***
		setTimeout ("imgages_fitInDiv('#bzx_app_desc', 327,500)", 500 );
		 
	}	

function shareApp(){
	
	//$("#bzx_info").toggle("slow");
	//$("#bzx_info").height(500) ;	
	reOpenDiv = true ;
	
}

var adIndex = 0 ;
function adSwapper(){
	//***SWAP ALL ADS***
	var div_bannerFrame = document.getElementById("adHeader") ;
	var div_250_main = document.getElementById("ad_main_250") ;
	//var div_250_btm = document.getElementById("ad_btm_250") ;
	var arrBanner=new Array(); // regular array (add an optional integer
	arrBanner[0]="http://www.battlezonex.com/includes/ads/banner_0.aspx" ;
	arrBanner[1]="http://www.battlezonex.com/includes/ads/banner_1.aspx" ;
	
	var arr250_ad=new Array(); // regular array (add an optional integer
	arr250_ad[0]="http://www.battlezonex.com/includes/ads/250_0.aspx" ;
	arr250_ad[1]="http://www.battlezonex.com/includes/ads/250_1.aspx" ;
	//alert('here') ;
	var strAdUrl ;
	var str250 ;
	//***SET INDEX***
	(adIndex == 0) ? adIndex=1 : adIndex=0 ;
	//***SET BANNER***
	(adIndex == 0) ? strAdUrl=arrBanner[0] : strAdUrl=arrBanner[1] ;
	//***SET 250 AD***
	(adIndex == 0) ? str250=arr250_ad[0] : str250=arr250_ad[1] ;	
	
	div_bannerFrame.src = strAdUrl ;
	div_250_main.src = str250 ;
	//div_250_btm.src = str250 ;
}

function renderMatchCreator(_type){

	
	$("#bzx_btnCreate").toggle();
	$("#bzx_share").hide();
	$("#bzx_info").hide();
	$("#bzx_hidden_holder").hide() ;
	$("#bzx_app_widget").hide() ;
	//$("#bzx_hidden_holder").hide();
	if(_type == "open"){
		
		
		$("#bzx_app").fadeOut("slow", function() {
    			// Animation complete.				
				$("#bzx_create_holder").show("slow");	
				viewMatchList() ;
  		});	
		
	}else{
		//document.getElementById('error').innerHTML = "here & gone" ;
		$("#bzx_create_holder").hide("fast");
		$("#bzx_app").fadeIn("slow");	
			
	}
	
}

function viewMatchList(){
//*******BZX YOUTUBE ADMIN**************
	//alert(tournUserId) ;
	var flashvars = {
		serverName:_serverName ,
		groupId:"" ,			
		userId:tournUserId,	
		orgId: orgId
	};
	var params = {
		menu: "false",
		allowScriptAccess: "always",
		wmode:"transparent" ,
		scale: "noscale"
	};
	var attributes = {};
	
//*******************************
	swfobject.embedSWF(_serverName + "bzx_app/bin-debug/ibj_listUserMatchups.swf", "bzx_matchupList", "694", "225", "9.0.0", "_assets/swf/expressInstall.swf", flashvars, params, attributes);
}

function viewMatchCreator(battleInfo){
	//adminBattle/ybtTournSetUp.aspx
	//
	//var _url = "../../adminBattle/ybtTournSetUp.aspx?orgId=&action=" + battleInfo.action + "&groupId=" + battleInfo.groupId + "&isUserTournament=True&userId=" + battleInfo.userId;
	var flashvars = {
		serverName: _serverName ,
		groupId:battleInfo.groupId ,			
		action:battleInfo.action ,			
		userId:battleInfo.userId ,	
		orgId: orgId
	};
	var params = {
		menu: "false",
		allowScriptAccess: "always",
		wmode:"transparent" ,
		scale: "noscale"
	};
	var attributes = {};
	var strLoc = _serverName + "bzx_app/bin-debug/ibj_createMatchup.swf" ;
	swfobject.embedSWF(strLoc, "bzx_creation", "586", "392", "9.0.0", "_assets/swf/expressInstall.swf", flashvars, params, attributes);
	SWFID = "bzx_creation" ;
		//alert(_url) ;
		
}

function viewWidget(){
	//width=554;height=457
	//adminBattle/bzxTournSetup.aspx?action=uTube&groupId=35&orgId=5 ;
	if(tournData.groupId != "0"){
		//***ONLY WIDGET IF TOURN SELECTED***
		var _swfLocation = _serverName + "bzx_app/bin-debug/bzx_appBattleWdgt.swf" ;;
		var strVars = "serverName=" + _serverName ;
				strVars += "&build=" + tournData.build ;
				strVars += "&battleId=" ;
				strVars += "&isFaceBook=false" ;
				strVars += "&orgId=" + orgId ;
				strVars += "&orgCode=" + orgCode ;
				strVars += "&tournUserId=" + tournData.tournUserId ;
				strVars += "&groupId=" + tournData.groupId ;
				strVars += "&action=html" ;
		
		//strVars = "serverName=http://thebighomie/battleZoneX/&build=USR&battleId=&isFaceBook=false&orgId=6&orgCode=YBT&tournUserId=138&groupId=252&action=html" ;
		//strVars = "serverName=http://thebighomie/battleZoneX/&build=USR&battleId=&isFaceBook=false&orgId=6&orgCode=YBT&tournUserId=138&groupId=242&action=html" ;
		var strSwf ;
			if(!window.DOMParser){
				strSwf += '<EMBED src="' + _swfLocation + '" ' ;
					strSwf += 'FlashVars="' + strVars + '" ' ;
					strSwf += 'wmode="transparent" WIDTH=320 HEIGHT=260 ' ;
					strSwf += 'TYPE="application/x-shockwave-flash">' ;
				strSwf += '</EMBED>' ;	
			}else{	
				strSwf = '<object height="260" width="320" type="application/x-shockwave-flash"' ;
				strSwf += 'data="' + _swfLocation + '"' ;
				strSwf += 'id="profilePlayer" style="visibility: visible;">' ;
					strSwf += '<param name="menu" value="false">' ;
					strSwf += '<param name="allowScriptAccess" value="always">';
					strSwf += '<param name="wmode" value="transparent">';
					strSwf += '<param name="scale" value="noscale">';
					strSwf += '<param name="flashvars" value="' + strVars +  '">' ;
				strSwf += '</object>' ;						
			}
		var _strHtml = "<div id=app_widgetHolder align=center><div>" + strSwf + "</div>";	
			_strHtml += "<div style=margin-top:5px;>Select <strong>'Get Html'</strong> button to get widget code...<button type='button' onclick='closeWidget()'>Close</button></div></div>";	
		//$("#bzx_hidden_holder").height(253) ;			
		$("#bzx_info").hide() ;
		$("#bzx_app_regSych").hide() ;
		$("#bzx_hidden_holder").show() ;
		$("#bzx_hidden_holder").height(303) ;
		$("#bzx_app_widget").show() ;
		//alert(_strHtml) ;
		//$("div#bzx_app_widget").html(_strHtml) ;
		document.getElementById('bzx_app_widget').innerHTML = _strHtml ;
		
		//alert(strVars) ;
		/*
			Shadowbox.open({
		        player:     'html',
		        title:      "Widget",
		        content:    _strHtml,
		        height:     320,
		        width:      400
		    });	
			*/
		}else{
			//alert("Please select Battle/Tournamnet then get 'Widget'") ;
			genAlert("Please select a Match-Up/Tournamnet to view 'Widget'") ;
		}

}

function closeWidget(){
	$("#bzx_hidden_holder").hide("slow") ;
	$("#bzx_app_widget").hide() ;
}

function reloadTournList(){
	//***CLOSE EDITOR PASS ACTOIN AND MISC TO EMAILER**
	alert('Your Battle has been Set & Started...') ;
	viewMatchList() ;
	//swfobject.embedSWF("bin-debug/ibj_listUserMatchups.swf", "bzx_matchupList", "694", "253", "9.0.0", "_assets/swf/expressInstall.swf", flashvars, params, attributes);
	//***CLOSE MATCHUP ADMIN**8
	//document.getElementById('bzx_creation').innerHTML = "" ;
	//parent.window.location.reload(false);
}
function renderHiddenDivs(){
	
	
		$(divInfoName).toggle() ;
		if(reOpenDiv == true)
			$("#bzx_hidden_holder").toggle("slow");
	
	//alert('here') ;
	
}
function menuHandler(_type){
	//***CREATE APP MAIN***
	$("#bzx_hidden_holder").height(202) ;
	$("#bzx_app_regSych").hide() ;
	$("#bzx_app_widget").hide() ;
	//alert(divInfoName + '== ' + _type ) ;
	reOpenDiv = true ;
	if(menuState == _type){
		reOpenDiv = false ;
		//alert('same clicked') ;
	}
	switch(_type){
		case "info":
			//$("#bzx_create").hide();
			$("#bzx_share").hide();
			divInfoName = "#bzx_info" ;
			$("#bzx_hidden_holder").height(260) ;
			bzx_app.render_flash('twitter')
			//$("#bzx_info").toggle();		  							
		  	break;
			
		case "create":
			$("#bzx_info").hide();
			$("#bzx_share").hide();
			divInfoName = "#bzx_create" ;
			//$("#bzx_create").toggle();		  	
			break ;	
			
		case "share":
			$("#bzx_info").hide();
				
			if(isFaceBook){			
				//$("#bzx_hidden_holder").height(640) ;
				//genAlert("Please select a Match-Up/Tournamnet to view 'Widget'") ;
				/*				
				divInfoName = "#bzx_share" ;
				renderShareForm() ;
				*/
			}else{
				pre_MsSteam() ;				
			}
			//$("#bzx_hidden_holder").slideUp("slow",renderHiddenDivs);	
		break ;
	}	
	menuState = _type ;
	
	$("#bzx_hidden_holder").slideUp("slow",renderHiddenDivs);

	//bzx_app.render_flash('join') ;	
	//$("#bzx_join_holder").css("background-color", "#000");	
	
}

function closeInfo(){
	
	$('#close_info').hide();
	$('#bzx_hidden_holder').hide('slow');
}

function openJoin(){
	//***CREATE APP MAIN***
	menuState = "join" ;
	$("#bzx_share").hide();
	$("#bzx_info").hide();
	$("#bzx_create").hide();
	$("#bzx_hidden_holder").height(202) ;
	$("#bzx_hidden_holder").toggle("slow");
	$("#bzx_app_regSych").toggle() ;
	bzx_app.render_flash('join') ;	
	//$("#bzx_join_holder").css("background-color", "#000");	
	
}

//alert(getSeverTime()) ; http://www.battlezonex.com/images/ybtOrg_Desc.gif
function joinDone(_userId){
	userId = _userId ;
	isLogged = true ;
	//alert(userId) ;
	$("#bzx_btnJoin").hide();
	$("#bzx_hidden_holder").hide("slow");
}

function setBannerBackground(){
	//alert('has banner') ;
	//***GET TOURN COMMENTS***
	getFlexApp('bzx_app_banner').setBanner(strBannerUrl) ;
}

function resetBannerBackground(){
	//***GET TOURN COMMENTS***
	getFlexApp('bzx_app_banner').resetBanner() ;
	//alert('no banner') ;
}



function hideMainAd(){
	$("#bzx_app_ad").hide("fast"); 
}

function showMainAd(){
	$("#bzx_app_ad").show("slow");
}


function gotoOrg(){
	var strUrl = "http://" + orgUrl + "/" ;
	//alert(strUrl) ;
	//if(serverType != "dev")
		//document.location = strUrl ;
}

function setOrgHeader(){

	//var strHeaderMain = "<a href='#' onClick='gotoOrg()'><img src=" + _serverName + "/orgs/" + orgId + "/header_main.jpg border=0></a>" ;
	var strHeaderMain = "<img src=" + _serverName + "/orgs/" + orgId + "/header_main.jpg border=0>" ;
	//alert(strHeaderMain) ;
	//document.getElementById('bzx_header').innerHTML = strHeaderMain ;
	$('#bzx_header').append(strHeaderMain)  ;
	$('#bzx_header').hide() ;
	

}

function resetBannner(){
	alert("reset") ;
	var divBannerHtml = $("div#bzx_app_banner").html() ;
	//alert(divBannerHtml + "=" + strBanner) ;
	//if(strBanner != divBannerHtml){				
		$("#bzx_app_banner").hide() ;
		$("#bzx_app_banner").html(strBanner) ;	
		$("#bzx_app_banner").fadeIn("slow") ;
	//}	
}

function newBanner(){
	var _img = "<img src=" + strBannerUrl + ">" ;
	$("#bzx_app_banner").hide() ;	
	$("#bzx_app_banner").html(_img) ;	
	//alert(strBannerUrl) ;
	$("#bzx_app_banner").fadeIn("slow") ;
}

function setBanner(){
	//alert("banner") ;
	$("#bzx_app_banner").hide() ;
	strBanner = '<img id=bannerImg src="' + _serverName + '/orgs/' + orgId + '/header.jpg" border="0">' ;
	//$("#error").append("<br>here now") ;
	$("#bzx_app_banner").html(strBanner) ;	
	$("#bzx_app_banner").fadeIn("slow") ;
	
}

function checkBannerBackground(_tournImgs){
	//***SET BANNER & BACKGROUND FOR TOURNAMENT***
	strBannerUrl = _tournImgs.banner ;
	var strBackground = _tournImgs.background ;
	$("#bannerImg").hide() ;	
	//alert( $("#bannerImg").length ) ;						
	var _hasBackground = true ;
	var imgBanner = new Image();
	alert(_tournImgs.banner) ;
	//***CHECK IF BACKGROUND EXIST FOR TOURN***
	$(imgBanner).load(function () {
		//$(this).css('display','none'); // since .hide() failed in safari
		//$(this).fadeIn(); ;
		//alert('TOURNbackground: ' + strBackground) ;
		//***LOAD IMG &CHECK IF BANNER EXISTS***
		
		$("#bannerImg").attr("src",_tournImgs.banner);	
		$("#bannerImg").fadeIn() ;
	}).error(function () {
		//***IMG NOT FOUND***
		$("#bannerImg").attr("src", orgData.orgBanner);	
		$("#bannerImg").fadeIn() ;
	}).attr('src', _tournImgs.banner);
	
	
	if(_action == "subDom"){
		var img = new Image();
		//***CHECK IF BACKGROUND EXIST FOR TOURN***
		$(img).load(function () {
			//$(this).css('display','none'); // since .hide() failed in safari
			//$(curr).removeClass('loading').append(this);
			//$(this).fadeIn();
			//alert('workking') ;
			//alert('TOURNbackground: ' + strBackground) ;
			$("#outer_container").css('background','#000 url(' + strBackground + ') no-repeat fixed center top'); 
		}).error(function () {
			//alert('not load:') ;
			_hasBackground = false ;
			//alert('ORGbackground: ' + orgData.background) ;
			$("#outer_container").css('background','#000 url(' + orgData.background + ') no-repeat fixed center top'); 
		}).attr('src', _tournImgs.background);
	}	
	
	

}

function userSocialStream(obj_stream){
	//alert('steam it') ;

		//alert('here') ;
	bzx_app.streamPublish(obj_stream) ;
	
}

function setOrgMapping(_orgId){
	//***ORG FOUND RENDER APP***
	//alert('here') ;
	orgId = _orgId ;
	setOrgHeader() ;
	bzx_app.getBzxUserSynch() ;
}

function reloadApp(_userId){		
	location.reload(true) ;
}

function gotoAgreement(){
	var strUrl = 'http://www.battlezonex.com/includes_main/terms-user-agmnt.htm' ;
	
	if(orgCode != "YBT"){
		strUrl = 'http://www.battlezonex.com/includes_main/user_agmnt_bzx.htm' ;		
	}
	//var strUrl = "includes/lmhAgree.pdf" ;
	var winName = "ibj" ;
	//alert(strUrl) ;
	window.open(strUrl, winName, '') ;
	//document.location = strUrl ;
}

function gotoVotes(){
	var strUrl = 'http://www.battlezonex.com/includes_main/vote_rules.aspx' ;
	var winName = "bzx" ;
	//alert(strUrl) ;
	window.open(strUrl, winName, '') ;
}

function gotoPrivacy(){
	var strUrl = 'http://www.battlezonex.com/includes_main/privacy_ibj.htm' ;
	
	if(orgCode != "YBT"){
		strUrl = 'http://www.battlezonex.com/includes_main/privacy_bzx.htm' ;
		
	}
	var winName = "bzx" ;
	//alert(strUrl) ;
	window.open(strUrl, winName, '') ;
	//document.location = strUrl ;
}

function viewPrizeRules(_type){
	//'prize','rules'
	if(_type == "rules"){
		//***SHOW RULES***
		$("#prizeRules_txt").html("") ;
		bzx_app.getPrizeRules() ;
	}else{
		//alert(tournData.prizeValue + ":" + tournData.prizeDesc);
		var strPrize = "<div><img src=../images/prizeHeader.gif></div>" +
						"<div class=prize_value>Value: " + tournData.prizeValue + "</div>" +
						"<div>" + unescape(tournData.prizeDesc) + "</div>" ;
		showPrizeRules(true, strPrize) ;
						
						
	}
}

function showPrizeRules(showTxt, _txt){
	if(showTxt){
		$("#app_container").hide("fast") ;
		$("#bzx_prizeRules").height(700) ;		
		$("#prizeRules_txt").show() ;
		$("#prizeRules_txt").html(_txt) ;
		$("#closeRules").show() ;		
	}else{				
		$("#bzx_prizeRules").height(30) ;
		$("#app_container").show("fast") ;				
		$("#prizeRules_txt").html("") ;
		$("#prizeRules_txt").hide("") ;
		$("#closeRules").hide() ;
	}
}

function setInfoTxt(){
	var strInfoTxt = "For the ultimate <span style=color:#FF8FC3>YouTube&#0153;</span> experience we're hosting <span style=color:#F6FF8F>'VERSUS'</span> battles using videos straight from" ;
		strInfoTxt += "<span style=color:#FF8FC3>YouTube&#0153;</span>.  And, it's easy to Set-up your very own battle...any type of <span style=color:#F6FF8F>'VERSUS'</span> battle.  You be the creator! Register to vote.<br>" ;
		strInfoTxt += "<li id=info_liTxt>JOIN!!</li>" ;
		strInfoTxt += "<li id=info_liTxt>CREATE MATCH-UP</li>" ;
		strInfoTxt += "<li id=info_liTxt>VOTE & DECIDE</li>" ;
		
	if(orgCode != "YBT"){
		//$("div#bzx_info_vs").css("background:url(../images/vsBzxInfo.png) no-repeat 7px 2px;"); 
		$("#bzx_info_vs").css('background-image','url(http://www.battlezonex.com/images/vsBzxInfo.png)'); 
		//$("div.bzx_info_box").addClass("#bzx_info_vsBzx"); 
		strInfoTxt = "For the ultimate online <span style=color:#FF8FC3>'BATTLES'</span>. Hosted by battleZoneX&#0153;." ;
		strInfoTxt += "<li id=info_liTxt>JOIN!!</li>" ;
		strInfoTxt += "<li id=info_liTxt>VOTE & DECIDE</li>" ;
		//document.getElementById('bzx_byName').innerHTML = "<a target='_blank' class=bzx_topName href='http://www.battlezonex.com/'>Powered by BattleZoneX</a>" ;
		
	}	
		document.getElementById('info_left').innerHTML = strInfoTxt ;
		
		//alert(strInfoTxt) ;
}

function imgages_fitInDiv(_divName, maxWidth, maxHeight){
//***RE-SIZE ALL IMAGES TO FIT IN BOX***
	//alert(_divName) ;
		var divImgs = _divName + " img" ;
		$(divImgs).each(function() {
		    //var maxWidth = 327; // Max width for the image
		    //var maxHeight = 500;    // Max height for the image
		    var ratio = 0;  // Used for aspect ratio
		    var width = $(this).width();    // Current image width
		    var height = $(this).height();  // Current image height
		
		    //***Check if the current width is larger than the max
		    if(width > maxWidth){
		        ratio = maxWidth / width;   // get ratio for scaling image
		        $(this).css("width", maxWidth); // Set new width
		        $(this).css("height", height * ratio);  // Scale height based on ratio
		        height = height * ratio;    // Reset height to match scaled image
		    }
		
		    //***Check if current height is larger than max
		    if(height > maxHeight){
		        ratio = maxHeight / height; // get ratio for scaling image
		        $(this).css("height", maxHeight);   // Set new height
		        $(this).css("width", width * ratio);    // Scale width based on ratio
		        width = width * ratio;    // Reset width to match scaled image
		    }
		});
		//***********END RE-SIZE IMG*************
		$('#bzx_header').show() ;
}	

function genAlert(_msg){
	//alert('here');
	//$('#alertBox').html(_msg);
	//$('#alertBox').dialog('open');
	return false;
}

function getCommentType(){
			//alert(commentTypeId) ;
			//commentType = getFlexApp('bzx_app').getTournType() ;	
			//var objId = commentType.objId ;
			//var commentType = commentType.commentType ;
			
			return commentTypeId ;
		}
/*
$(function(){	
	//***SET UI FUNCTIONS***			
	$("#alertBox").dialog({
		autoOpen: false,
		bgiframe: true,
		modal: true,
		buttons: {
			Ok: function() {
				$(this).dialog('close');
			}
		}
	});
	//hover states on the static widgets
	$('#alertBox,#dialog_link, ul#icons li').hover(
		function() { $(this).addClass('ui-state-hover'); }, 
		function() { $(this).removeClass('ui-state-hover'); }
	);
	
});
*/


$(document).ready(function(){
	//***ACTIVITY HANDLER CLOSE AND OPEN***
	//hide message li after the 5th
 	
	$("#activity_list_vote li:gt(3)").hide();

	
	$(".show_all_votes").click(function(){
		//alert('here') ;
		$(this).hide()
		//$(".show_recent_only").show()
		$("#activity_list_vote li:gt(3)").slideDown()
		
		return false;
	});
 	
 
});
