/****** Bookmaker Javascript Framework *******
//////////////////  AUG 20 2007 /////////////*/
//////////////////////////////////////////////////////////// TOOLS

var BrowserDetect = {
	init: function (){
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data){
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString){
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};
BrowserDetect.init();
////////////////////////////////////////////////////////////////////////////////////


////////////////////////////////////////COOKIES////////////////////////////////////////
function RememberCookies(){
	var ca=GetCookie("usrinfo");
	var ps=GetCookie("passinfo"); // TODO: this should be encripted!!!
	var rm=GetCookie("reminfo");
	var usernameTextField = document.getElementById("account");
	var passwordTextField = document.getElementById("password");
	var rememberCheckField = document.getElementById("remeber");
	if ((ca != "" && ps != "") && (ca != null && ps != null)){
		usernameTextField.value = ca;
		passwordTextField.value = ps;
		rememberCheckField.checked = true;
	}
	else{
		usernameTextField.value = "";
		passwordTextField.value = "";
		rememberCheckField.checked = false;
	}
}

function getCookieVal(offset){
	var endstr = document.cookie.indexOf (";", offset);
	if (endstr == -1) endstr = document.cookie.length;
	return unescape (document.cookie.substring(offset, endstr));
}

function GetCookie(name){
	var arg = name+"=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	while (i < clen){
	  var j = i + alen;
	  if (document.cookie.substring(i, j) == arg) return getCookieVal(j);
	  i = document.cookie.indexOf(" ", i) + 1;
	  if (i == 0) break;
	}
	return null;
}

function remember(){
	var expires = new Date ();
	var usernameTextField = document.getElementById("account");
	var passwordTextField = document.getElementById("password");
	var rememberCheckField = document.getElementById("remeber");
	if(rememberCheckField.checked == true){
		expires.setTime (expires.getTime() + (1000 * 60 * 60 * 24 * 31));
		document.cookie = "usrinfo= "+usernameTextField.value+"; expires=" + expires.toGMTString() +"; path=/";
		document.cookie = "passinfo="+passwordTextField.value+"; expires=" + expires.toGMTString() +"; path=/";
		document.cookie = "reminfo="+rememberCheckField.checked+"; expires=" + expires.toGMTString() +"; path=/";
	}else{
		delete_cookie("usrinfo","/");
		delete_cookie("passinfo","/");
		delete_cookie("reminfo","/");
	}
}

function delete_cookie (name, path){
	// Build expiration date string:
	var expiration_date = new Date ();
	expiration_date.setYear (expiration_date.getYear()- 1);
	expiration_date = expiration_date.toGMTString();

	// Build set-cookie string:
	var cookie_string = escape (name) + "=; expires=" + expiration_date;
	if (path != null){ cookie_string += "; path=" + path; }

	// Delete the cookie:
	document.cookie = cookie_string;
}

function Set_cookie_value(tab_name){
	document.cookie = "tabname="+tab_name+"; path=/";
}

function GetTab2(){
	var tn=GetCookie("tabname");
	if (tn!=null){
		tab_name = tn;
		return tab_name;
	}
	else
		return null;
}
////////////////////////////////////////////////////////////////////////////////////


////////////////////////////////////////FLASH////////////////////////////////////////
function addFlash(dir, idFlash, width, height, version, bgColor, divName){
    var varFlash = new SWFObject(dir, idFlash, width, height, version, bgColor);
    varFlash.write(divName);
}

function flashButton(buttonDivId, divName, dir, width, height, color){
	$("#"+buttonDivId).click(function(evt){
	    addFlash(dir, buttonDivId+"_show_sysvar", width, height, "8", color, divName);
		return noAction(evt);
	});
}

/**********Livescores APP**********/
function liveScoresSetup(){
    $("#livescores_stats").css("background","#fff").html('<div class="closeButton" onclick="liveScoresHideStatsFrame()"> </div><iframe id="pelis"  height="780" width="622" scrolling="auto" marginheight="0" marginwidth="0" frameborder="0" > loading.... </iframe> ').hide();
}

function liveScoresSetStatsFrame(paramURL){
    $("#livescores_stats").hide();
    $("#pelis").attr("src", paramURL);
}

function liveScoresHideStatsFrame(){
    $("#livescores_stats").hide();
    $("#pelis").attr("src", "");
}
////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////FORMS////////////////////////////////////////
function input_watermark(findId){
	/*selects an input field and assigns a watermark
	  use the name attribute to get the class name
	  by CSD AG/19/2007 */
	var object = $("#"+findId);
	// pick actual values
	var actual_class = object.attr("class");
	var counter = object.attr("value").length;
	/// set default values
	if(object.attr("value")!= "" || counter>0 )
		object.attr("class", "textfield2");
	else
		object.attr("class", object.attr("name")+"_2default");
	//// events
	object.focus(function(){
		actual_class = object.attr("class");
		object.attr("class", "textfield2");
	});
	object.blur(function(){
		if(object.attr("value") == "" || counter<0)
			object.attr("class", object.attr("name")+"_2default");
	});
}
////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////RESIZE OBJECTS TO CURRENT CLIENT HEIGHT////////////////////////////////////////
function GetIfBetSize(){
    if($(".descGlobal.ifbetBox").length > 0)
        $ifBetBox = $(".descGlobal.ifbetBox").get(0).clientHeight;
}						

function resizeIframe(){
	var size = 0;
	if ($GlobalSizeIFrame != null)
		size = $GlobalSizeIFrame;
	else
		size = 120;
	$("iframe.scrolledIFrame").css("height",(getHeight() - size) + "px");
}		
	
function resizeDivIfBetInIFrame(){
	var size = 0;
	if ($GlobalSizeIfBet != null)
		size = $GlobalSizeIfBet;
	else
		size = 90;
	$("div.scrolledAddedGames").css("height","auto");
	GetIfBetSize();
	if ($ifBetBox >= ((getHeight() * 20)/100)){
	    $("div.scrolledAddedGames").css("height",((getHeight() * 20)/100) + "px");
	}
	GetIfBetSize();
	$GlobalSize = size + $ifBetBox;
	resizeDivInIFrame();
}
	
function resizeDivInIFrame(){
	var size = 0;
	if ($GlobalSize != null)
		size = $GlobalSize;
	else
		size = 85;
	$("div.scrolled").css("height",(getHeight() - size) + "px");
}
////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////TABS MANAGEMENT////////////////////////////////////////
function subMenu(TAB_NAME, SUB_TAB_NAME, keep){
	// highlighting //
	$("#"+TAB_NAME).removeClass("unselected").addClass("selectedbtn").addClass("selected");
	$("#"+TAB_NAME+"_data").show();

	/// downlighting
	if(typeof tab_selected != "undefined" && TAB_NAME != tab_selected){
		/*** HOT feature ***/
		if (keep == "hot" )
			recordar_tab = TAB_NAME ;
		if(typeof recordar_tab != "undefined" && tab_selected == recordar_tab){
			remember = "";
			$("#"+tab_selected).attr("class", "hotfeature");
		}
		else
		    $("#"+tab_selected).removeClass("selectedbtn").removeClass("selected").addClass("unselected");
		$("#"+tab_selected+"_data").hide();
	}
	///remember this tab!
	tab_selected =  TAB_NAME;
	show_next_mp(SUB_TAB_NAME);
	//return false	
}

function show_next(TAB_NAME , keep){
	// highlighting //
	$("#"+TAB_NAME).removeClass("unselected").addClass("selectedbtn").addClass("selected");
	$("#"+TAB_NAME+"_data").show();
	
	/// downlighting
	if(typeof tab_selected != "undefined" && TAB_NAME != tab_selected){
		/*** HOT feature ***/
		if (keep == "hot" )
			recordar_tab = TAB_NAME ;
		if(typeof recordar_tab != "undefined" && tab_selected == recordar_tab){
			remember = "";
			$("#"+tab_selected).attr("class", "hotfeature");
		}
		else
		    $("#"+tab_selected).removeClass("selectedbtn").removeClass("selected").addClass("unselected");
		$("#"+tab_selected+"_data").hide();
	}
	///remember this tab!
	tab_selected =  TAB_NAME;
	//return false
	
	$(".descGlobal").scrollTop();
}

function show_next_mp(TAB_NAME , keep){
	// same function as show_next() but different var names
	// highlighting //
	$("#"+TAB_NAME).removeClass("unselected").addClass("selectedbtn").addClass("selected");
	$("#"+TAB_NAME+"_data").show();

	/// downlighting
	if(typeof tab_selected2 != "undefined" && TAB_NAME != tab_selected2){
		/*** HOT feature ***/
		if (keep == "hot" )
			recordar_tab = TAB_NAME ;
		if(typeof recordar_tab != "undefined" && tab_selected2 == recordar_tab){
			remember = "";
			$("#"+tab_selected2).attr("class", "hotfeature");
		}
		else
		    $("#"+tab_selected2).removeClass("selectedbtn").removeClass("selected").addClass("unselected");
		$("#"+tab_selected2+"_data").hide();
	}
	///remember this tab!
	tab_selected2 =  TAB_NAME;
	//return false
}
////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////TOGGLE MANAGEMENT////////////////////////////////////////
function toggle_tab(obj){
	/* Toggles the next DD of a DL  - DOM based */
	switchStyle(obj.attr("id"),"a-m-t","a-m-t-expand")
	obj.next().slideToggle("normal");
}

function toggle_ContextInfo(classname){
	/* DOM LEVEL 0 */
	$("."+classname).bind("mouseenter",function(){
	    $(this).next().show();
	}).bind("mouseleave",function(){
	    $(this).next().hide();
	});
}

function toggle_AddGameButton(classname){
	/* DOM LEVEL 0 */
	$("."+classname).show();
}

function toggle_BrowserInfo(classname){
	/* DOM LEVEL 0 */
	$("div." + classname + " a").bind("mouseenter", function(){
	    newClass = $(this).attr("class").replace("Img","");
	    $("div." + newClass).show();
	}).bind("mouseleave", function(){
	    newClass = $(this).attr("class").replace("Img","");
	    $("div." + newClass).hide();
	});
}

function toggle_nextSibling(classname, $tagname){
	/* DOM LEVEL 0 */
	$("."+classname).click(function(){
	    if ($(this).next().css("display") == "block"){
	        $(this).attr("class", "linesSubhead jsUnslctTxt");
	        $(this).next().hide();
	    }
	    else{
	        $(this).attr("class", "linesSubhead jsSlctTxt");
	        $(this).next().show();
	    }
	}).bind("mouseenter", function(){
	    if ($(this).next().css("display") == "block")
	        $(this).attr("class", "linesSubhead jsSlctTxt");
	    else
	        $(this).attr("class", "linesSubhead jsUnderlineTxt");
	}).bind("mouseleave", function(){
	    if ($(this).next().css("display") == "block")
	        $(this).attr("class", "linesSubhead jsSlctTxt");
	    else
	        $(this).attr("class", "linesSubhead jsNolineTxt");
	});
}

function toggle_previousSibling(tagid, tagname){
	/* DOM LEVEL 0 */
	if ($("#"+tagid).length > 0){
	    $("#"+tagid).attr("class", "jsSlctTable");
	    var prevDIV = $("#"+tagid).parent();
	    if (prevDIV.attr("class") == "linesContentIn"){
	        if ((prevDIV.css("display") == "none") || (prevDIV.css("display") == "")){
	            prevDIV.show().prev().attr("class", "linesSubhead jsSlctTxt");
	            var parentprevDIV = prevDIV.parent();
	            if ((parentprevDIV.css("display") == "none") || (parentprevDIV.css("display") == "")){
					parentprevDIV.show().prev().attr("class", "linesSubhead jsSlctTxt");
				}
	        }
	    }
	    else if (prevDIV.attr("class") == "linesContent"){
	        if ((prevDIV.css("display") == "none") || (prevDIV.css("display") == ""))
	            prevDIV.show().prev().attr("class", "linesSubhead jsSlctTxt");
	    }
	}
}

function ToggleHistory(divHist){
	var hist = document.getElementById(divHist);
	if($("#"+divHist).css("display") == 'block')
		$("#"+divHist).hide();
	else 
		$("#"+divHist).show();
}

function ShowMenu(menuId, actuatorId){
	/* Get the menu object (where the checkboxes are) */
    menu = $("#" + menuId);
	/* Get the "actuator" (the button with the sport name) */
    actuator = $("#" + actuatorId);
	/* Return if either is null */
    if (menu.length < 1 || actuator.length < 1) return;
    /* Show or hide the menu */
    menu.css("display", ((menu.css("display") == "block") ? "none" : "block"));
}
////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////CLASES////////////////////////////////////////
function switchStyle(target,firstClass,secondClass){
	var selectedDiv = $("#" + target);
	if(selectedDiv.hasClass(firstClass)){
	    selectedDiv.removeClass(firstClass);
	    selectedDiv.addClass(secondClass);
	}
	else if(selectedDiv.hasClass(secondClass)){
	    selectedDiv.removeClass(secondClass);
	    selectedDiv.addClass(firstClass);
	}
}

function switchVisible(target, from){
	var selectedDiv = $("#" + target);
	if(selectedDiv.css("display") == "block" || selectedDiv.css("display") == "table" || selectedDiv.css("display") == ""){
		selectedDiv.hide();
		switchStyle(from, 'btnHideBlock', 'btnShowBlock');
	}
	else{
		//selectedDiv.css("display",switchDisplay);
		selectedDiv.show();
		switchStyle(from, 'btnHideBlock', 'btnShowBlock');
	}
}

function getElementsByClassName(strClass, strTag, objContElm){
    strTag = strTag || "*";
	objContElm = objContElm || document;
	var objColl = objContElm.getElementsByTagName(strTag);
	if (!objColl.length &&  strTag == "*" &&  objContElm.all) objColl = objContElm.all;
	var arr = new Array();
	var delim = strClass.indexOf('|') != -1  ? '|' : ' ';
	var arrClass = strClass.split(delim);
	for (var i = 0, j = objColl.length; i < j; i++){
		var arrObjClass = objColl[i].className.split(' ');
		if (delim == ' ' && arrClass.length > arrObjClass.length) continue;
		var c = 0;
		comparisonLoop:
		for (var k = 0, l = arrObjClass.length; k < l; k++){
			for (var m = 0, n = arrClass.length; m < n; m++){
				if (arrClass[m] == arrObjClass[k]) c++;
				if (( delim == '|' && c == 1) || (delim == ' ' && c == arrClass.length)){
					arr.push(objColl[i]);
					break comparisonLoop;
				}
			}
		}
	}
	return arr;
}
////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////OTHER////////////////////////////////////////
/* Function ChangeFontSize */
/* Fabian 04/29/2008 */
function changeFontSize(size, classSized){
    $(".matchupBox").attr("class", "matchupBox fontsize"+size);
    $("#"+classSized).attr("class", "fontsize"+size+" selected");
    if(typeof t_selected != "undefined" && classSized != t_selected)
        $("#"+t_selected).removeClass("selected");
	t_selected =  classSized;
	
	document.cookie = 'fontSize='+ size +';expires=Thu, 2 Aug 2020 20:47:11 UTC; path=/';
	document.cookie = 'fontSizeID='+ classSized +';expires=Thu, 2 Aug 2020 20:47:11 UTC; path=/';
	try{
		if ($GlobalSizeIfBet != undefined && $GlobalSizeIfBet > 0)
			resizeDivIfBetInIFrame();
	}
	catch(err){
	}
}

function readCookie(name, dvalue){
	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 dvalue;
}

function getHeight(){
	var myHeight = 0;
	if (typeof (window.innerHeight) == 'number') {
		myHeight = window.innerHeight;											//Non-IE
		if (myHeight == 0) myHeight = document.documentElement.clientHeight;	//Safari
	}
	else if(document.documentElement && document.documentElement.clientHeight)
		myHeight = document.documentElement.clientHeight;						//IE 6+ in 'standards compliant mode'
	else if(document.body && document.body.clientHeight)
		myHeight = document.body.clientHeight;									//IE 4 compatible
	return myHeight;
}

function getWidth() {
    var myWidth = 0;
    if (typeof (window.innerWidth) == 'number') {
        myWidth = window.innerWidth; 										//Non-IE
        if (myWidth == 0) myWidth = document.documentElement.clientWidth; //Safari
    }
    else if (document.documentElement && document.documentElement.clientWidth)
        myWidth = document.documentElement.clientWidth; 					//IE 6+ in 'standards compliant mode'
    else if (document.body && document.body.clientWidth)
        myWidth = document.body.clientWidth; 								//IE 4 compatible
    return myWidth;
}


function testevent(evt){
	var e_out;
	var ie_var = "srcElement";
	var moz_var = "target";
	var prop_var = "myflag";
	// "target" for Mozilla, Netscape, Firefox et al. ; "srcElement" for IE
	evt[moz_var] ? e_out = evt[moz_var][prop_var] : e_out = evt[ie_var][prop_var];
	alert(e_out);
	prop_var = "mydata";
	evt[moz_var] ? e_out = evt[moz_var][prop_var] : e_out = evt[ie_var][prop_var];
	alert(e_out);				
}

function count_selections(counter, container, wagertype, step){
	/* DOM LEVEL 0
	 * Cuenta la cantidad de selecciones
	 * Fabian JAN-29-2008 */
    
	var lastCounter = 0;
	var base_select = document.getElementsByTagName("input");
			
	if (counter == 0){
	    counter = $("input:checkbox:checked").parent().addClass("selectedPick").length;
	    $("input:checkbox:not(:checked)").parent().removeClass("selectedPick");
		if (counter != 0)
		    $("#" + container).html($("#" + container).html() + "<small>(Current Selections: " + counter + ")</small>");
    }
    $("input:checkbox").unbind("click");
	$("input:checkbox").bind("click", function(){
	    $(".errorGlobal").hide();
	    if($(this).attr("checked")){
	        counter++;
    		lastCounter = counter - 1;
    		$(this).parent().addClass("selectedPick");
	    }
	    else{
	        counter--;	
    		lastCounter = counter + 1;
    		$(this).parent().removeClass("selectedPick");
	    }
	    var text = ""
	    if (counter != 0){
			var srt = $("#"+container).html();
			if (BrowserDetect.browser == "Explorer" || BrowserDetect.browser == "Opera")
				text = "<SMALL>(Current Selections: " + lastCounter + ")</SMALL>";
			else
				text = "<small>(Current Selections: " + lastCounter + ")</small>";
			srt = srt.replace(text,"");									
			$("#"+container).html(srt + "<small>(Current Selections: " + counter + ")</small>");
		}
		else{
			if (BrowserDetect.browser == "Explorer" || BrowserDetect.browser == "Opera")
				text = "<SMALL>(Current Selections: " + lastCounter + ")</SMALL>";
			else
				text = "<small>(Current Selections: " + lastCounter + ")</small>";									
			var srt = $("#"+container).html();
			srt = srt.replace(text, "");
			$("#"+container).html(srt);
		}
	});
}

///////////////// For Racebook and Virtual Racebook
function SubmitWager_Event(evt){
	var key = (document.all) ? evt.keyCode : evt.which;
	if ((key == 13) || (key == 13)){
		//document.getElementById("SubmitWager" ).onclick.apply(document.getElementById("SubmitWager"));
		$("#SubmitWager").click();
		return false;
	}
	else
		return ((key >= 48 && key <= 57) || key == 8 || key == 127);
}

///////////Office Pool /////////////////////////////////////
function confirmlink(){
	if(confirm("You are buying a square.\nTo confirm your purchase, click OK\nor click CANCEL to abort."))
		return true;
	else
		return false;
}


////////////////////////////////////////SET WAGER AMOUNTS FUNCTIONALITY////////////////////////////////////////
/**************************************************/
function syncAmounts(firstBoxValue){
/**************************************************
	Author : Alex Gamez, 4/Jul/2006
	Summary: Syncronizes the wager amount on all wagers to match the amount used on the first wager.
	Params : The First Amount.
	Returns: Nothing.
**************************************************/
    jQuery('.enterAmount').each(function(){
		if ((jQuery(this).attr("name").match(/^amt_.*/)) && (jQuery(this).attr("value") == ""))
		{
			jQuery(this).attr("value",firstBoxValue);
		}
	});
    //$('input[value=""]').filter(function(){
        //return $(this).attr("name").match(/^amt_.*/);
    //}).attr("value",firstBoxValue);
}

/**************************************************/
function useFreePlay(fPlayCheckbox){
/**************************************************
	Author : Alex Gamez, 3/Oct/2006
	Summary: Hides/Shows the `To Risk`/`To Win` SELECTs based on whether the `Use Freeplay` checkbox
			is checked. In its place, the function appends a text note defined by the tmpNoteXXX vars.
	Params : The freeplay checkbox.
	Returns: Nothing.
**************************************************/
    
	var tmpNoteClass = "tmpNoteFreePlay";
	var tmpNoteId    = "tmpNoteFreePlay";
	var tmpNoteTag   = "div";
	var tmpNoteText  = "Freeplays Would Risk Only";

    $("select").filter(function(){
        return $(this).attr("id").match(/^AmtType_.*/);
    }).each(function(){
        if (fPlayCheckbox.checked==true){
            $(this).hide();
            var realNode = $(this).parent().append($(document.createElement(tmpNoteTag)).attr("id", tmpNoteId).attr("class", tmpNoteClass).html(tmpNoteText));
            if (document.all)
                realNode.css({float:"left",position:"relative",left:"1%",width:"98%",top:"-2px",color:"#D92600","letter-spacing":"-1px","line-height":"9px",clear:"both","padding-bottom":"2px"});
            else
                realNode.css({float:"left",position:"relative",left:"1%",width:"98%",top:"-2px",color:"#D92600","letter-spacing":"-1px","line-height":"9px",clear:"both","padding-bottom":"4px"});
        }
        else{
            $(this).parent().find(tmpNoteTag+"."+tmpNoteClass).remove();
            $(this).show();
        }
    })
}
	
// -------------------------------
// METHOD:   toggleFreeplayBox
// -------------------------------
// Desc:   Shows or Hides the "Use Freeplay" Option if mode =0
//         otherwise it resets its display property.
// Input:  0 to hide the FP option, anything else to show it
// Author: Alex G 04/29/2008
// -------------------------------
function toggleFreeplayBox(mode){
	var freePlayLabel =  document.getElementById("chkFreeplay").parentNode;
	var ShowHideFP =  document.getElementById("ShowHideFP");
	var display ="";
	if (mode == 0)
		display ="none";
	for (var x=0; x<freePlayLabel.childNodes.length;x++){
		var obj = freePlayLabel.childNodes[x];
		try{		
			obj.style.display=display;
			obj.checked=false;
		}
		catch(err){}
	}
	ShowHideFP.value = mode;
}

// -------------------------------
// METHOD:   reloadFreeplayBox
// -------------------------------
// Desc:   Runs toggleFreeplayBox with the value of ShowHideFP
//         as argument for when user reloads the page (eg: back button)
// Author: Alex G 04/29/2008
// -------------------------------
function reloadFreeplayBox(){
	var ShowHideFP =  document.getElementById("ShowHideFP").value;
	if (ShowHideFP != "") toggleFreeplayBox(ShowHideFP);
}
////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////FEEDBACK////////////////////////////////////////
// -------------------------------
// METHOD:   showRate
// -------------------------------
// Desc:   Shows and Hides the rate question on the Feedback page
//         depending on the selection of the previous question
// Author: Daniel A 04/30/2008
// -------------------------------
function showRate(){
    $("input:radio[value=\"Yes\"]").bind("click",function(){
        if($(this).get(0).checked)
            $("#rate").show();
        else
            $("#rate").hide();
    });
    $("input:radio[value=\"No\"]").bind("click",function(){
        if($(this).get(0).checked){
            $("#rate").hide();
            $("input:radio[name=amountImprove]").each(function(){
                $(this).get(0).checked = false;
            });
        }
        else
            $("#rate").show();
    });
}

// -------------------------------
// METHOD:   validateFeedback
// -------------------------------
// Desc:   	Makes validations on Feedback page.
//         	Validates that one option is selected on the first question.
//			Validates that if "Yes" is selected on the first question then 
//			an option must be selected on the second question.
// Author: 	Daniel A 05/02/2008
// -------------------------------
function validateFeedback(){
	var selected = false;
	var yesSelected = false;
	var amountSelected = false;
	
	$("input:checkbox:checked")
	if ($("input:radio[value=\"Yes\"]:checked").length > 0){
	    selected = true;
		yesSelected = true;
	}
	if ($("input:radio[value=\"No\"]:checked").length > 0)
	    selected = true;
	if (!selected){
		alert("Please tell us if you think that the new wagering section is an improvement");
		amountSelected = true;
	}
	else{
		if (yesSelected){
		    if ($("input:radio[name=amountImprove]:checked").length > 0)
		        amountSelected = true;
		}
		else
			amountSelected = true;
	}
	if (!amountSelected)
		alert("Please tell us how much we improved");
	return selected & amountSelected;
}
////////////////////////////////////////////////////////////////////////////////////

// -------------------------------
// METHOD:   checksOnClick
// -------------------------------
// Desc:   	Change class to selected picks on ifBets.
//         	Thanks to this class change we can change the 
//			background color to selected picks through CSS 
// Author: 	Daniel A 11/06/2008
// -------------------------------
function checksOnClick(){
    $(".rmvBtn").each(function(){
        var idArray = ($(this).children()[0]).id.split("_");
        $(".btnAddGame").each(function(){
            var idLongArray = $(this).attr("id").split("_");
            if (idArray[1] == idLongArray[1] && idArray[2] == idLongArray[3])
				$(this).parent().addClass("selectedPick");
        })
    })
}

// -------------------------------
// METHOD:   createLoaderDiv
// -------------------------------
// Desc:   	Creates a new div tag and shows a loading image
//         	while the page loads all information on the
//			wagering section. It calls the "removeLoaderDiv"
//			function to remove the created div two seconds after
//			load the page.
// Author: 	Daniel A 13/06/2008
// -------------------------------
function createLoaderDiv() {
	var newSpan = $(document.createElement("span")).attr("id", "spanLoader").attr("class", "tempLoader").html("&nbsp;");
	var newDiv = $(document.createElement("div")).attr("id", "loader").attr("class", "tempLoader");	
	resizeDivLoader(newDiv);
	$(window).bind("resize", function(){resizeDivLoader(newDiv)});
	$(".contentDetail").append(newSpan);
	$(".contentDetail").append(newDiv);
    $(window).bind("load", function(){setTimeout(removeLoaderDiv, 500)});
} 

// -------------------------------
// METHOD:   removeLoaderDiv
// -------------------------------
// Desc:   	Removes the created div tag with the loading image
//         	and change styles to all dropdown and select controls
//			to be shown after the page load.
// Author: 	Daniel A 13/06/2008
// -------------------------------
function removeLoaderDiv() {
	$("#spanLoader").remove();
	$("#loader").remove();
	
	/*Display hiden selects*/
	$("#ddLineStyle").css("display", "block");
	$(".selectControl").css("display", "inline");
}

// -------------------------------
// METHOD:   resizeDivLoader
// -------------------------------
// Desc:   	Resize the height of the loader div
//         	when the main window is resized.
// Params : The loader div.
// Author: 	Daniel A 17/06/2008
// -------------------------------
function resizeDivLoader(newDiv){
		newDiv.css("height", getHeight() + "px");
}

function noAction(evt){
    if (evt.preventDefault) 
        evt.preventDefault();
    return false;
}


////////////////////////////////////////SET FUNCTIONS TO OBJECTS////////////////////////////////////////
function popupNews(url, width, height){
settings="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width="+width+",height="+height;
winpops=window.open(url,"",settings)
}

function winOpen(winName) {
window.open(winName, 'popup', 'status,height=' + (window.screen.height - 80) + ',width=' + (window.screen.width - 100) + ',resizable=yes,left=0,top=0,screenX=0,screenY=0,scrollbars=yes,statusbar=yes,titlebar=no,topbar=no');
}

function popupNews2(url, width, height){
settings="toolbar=yes,location=no,directories=no,status=no,menubar=yes,scrollbars=yes,resizable=yes,width="+width+",height="+height;
winpops=window.open(url,"",settings)
}

function otherbrowser(url,width,height){
   if(navigator.appName != 'Microsoft Internet Explorer'){
		popupNews2(url,758,700);
   }
   else{
   if(navigator.appVersion < 6){
		popupNews2(url,width,height);
	}
   }
}
////////////////////////////////////////////////////////////////////////////////////