﻿// JScript File

/***********************************************
* AnyLink Drop Down Menu- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

var home=new Array()
home[0]='<a href="downloads/EnidRates.pdf" target="_blank">Special Enid Program Rates</a>'
home[1]='<a href="bull_pen_mag.aspx" target="_self"><i>Bull Pen</i> Magazine</a>'
home[2]='<a href="bb_seminar.aspx">Bucking Bull Seminar</a>'
home[3]='<a href="downloads/Rules.pdf" target="_blank">Rules & Regulations</a>'
home[4]='<a href="ab_trust.aspx">American Breeder\'s Trust</a>'
home[5]='<a href="wild_card_results.aspx">Wild Card Results</a>'
home[6]='<a href="bionic_bull_results.aspx">Bionic Bull Futurity Results</a>'
home[7]='<a href="abbi_classic_results_1.aspx">ABBI Classic Finals Results</a>'

var registration=new Array()
registration[0]='<a href="registration.aspx">General Info</a>'
registration[1]='<a href="forms.aspx">Registration Forms</a>'

var events=new Array()
events[0]='<a href="default.asp">Top Stories</a>'
events[1]='<a href="landingpage.asp">X Spots</a>'
events[2]='<a href="landingpage.asp">Xtras</a>'
events[3]='<a href="advertising.asp">Advertising</a>'
events[4]='<a href="subscribe.asp">Subscribe Now</a>'

var finals=new Array()
finals[0]='<a href="default.asp">Top Stories</a>'
finals[1]='<a href="landingpage.asp">X Spots</a>'
finals[2]='<a href="landingpage.asp">Xtras</a>'
finals[3]='<a href="advertising.asp">Advertising</a>'
finals[4]='<a href="subscribe.asp">Subscribe Now</a>'

var heritage=new Array()
heritage[0]='<a href="default.asp">Top Stories</a>'
heritage[1]='<a href="landingpage.asp">X Spots</a>'
heritage[2]='<a href="landingpage.asp">Xtras</a>'
heritage[3]='<a href="advertising.asp">Advertising</a>'
heritage[4]='<a href="subscribe.asp">Subscribe Now</a>'

var menuwidth='195px'
var menubgcolor='#662200' 
var disappeardelay=250  
var hidemenu_onclick="yes" 

var ie4=document.all
var ns6=document.getElementById&&!document.all

if (ie4||ns6)
document.write('<div id="dropmenudiv" style="visibility:hidden;width:'+menuwidth+';background-color:'+menubgcolor+'" onmouseover="clearhidemenu()" onmouseout="dynamichide(event)"></div>')

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}


function showhide(obj, e, visible, hidden, menuwidth){
if (ie4||ns6)
dropmenuobj.style.left=dropmenuobj.style.top="-500px"
if (menuwidth!=""){
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=menuwidth
}
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=50
if (whichedge=="rightedge"){
var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move up?
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
}

function populatemenu(what){
if (ie4||ns6)
dropmenuobj.innerHTML=what.join("")
}


function dropdownmenu(obj, e, menucontents, menuwidth){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidemenu()
dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
populatemenu(menucontents)

if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
}
return clickreturnvalue()
}


function clickreturnvalue(){
if (ie4||ns6) return false
else return true
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function dynamichide(e){
if (ie4&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function hidemenu(e){
if (typeof dropmenuobj!="undefined"){
if (ie4||ns6)
dropmenuobj.style.visibility="hidden"
}
}

function delayhidemenu(){
if (ie4||ns6)
delayhide=setTimeout("hidemenu()",disappeardelay)
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}

if (hidemenu_onclick=="yes")
document.onclick=hidemenu

function popupCC() {
	var popupWin = window.open("/members/CreditCard.htm","cardcode","height=330,width=400,scrollbars=yes,menubar=yes,resizable=yes");
	popupWin.focus();
}



/*Timeout script*/
// redirect after session timed out
timedouturl = "../Members/Logout.aspx?message=Your session has timed out. Please login again.";
confirmBoxID = 'timerid';

/**** variables to use with DHTML objects ****/
	var isDOM = (document.getElementById ? true : false); 
	var isIE4 = ((document.all && !isDOM) ? true : false);
	var isNS4 = (document.layers ? true : false);

	function getRef(id) {
		if (isDOM) return document.getElementById(id);
		if (isIE4) return document.all[id];
		if (isNS4) return document.layers[id];
	}
	function getSty(id) {
		return (isNS4 ? getRef(id) : getRef(id).style);
	} 
//------------------------------------------------------------------------------------------------------------------------------------------------------------


/**** window dimensions ****/
function winWidth() {
	if (window.innerWidth) { return window.innerWidth; }
	else if (window.outerWidth) { return window.outerWidth; }
	else if (window.width) { return window.width; }
	else { return 790 } // older browser, assume they are in 800 x 600 resolution
}
function winHeight() {
	if (window.innerHeight) { return window.innerHeight; }
	else if (window.outerHeight) { return window.outerHeight; }
	else if (window.height) { return window.height; }
	else { return 580 } // older browser, assume they are in 800 x 600 resolution
}

function timeIt() {
	min = 20;
	sec = 0;
	Down();
}

function Minutes(data) {
	for (var i = 0; i < data.length; i++) {
		if (data.substring(i, i + 1) == ":") { break; }
	}
	return (data.substring(0, i));
}
function Seconds(data) {
	for (var i = 0; i < data.length; i++) {
		if (data.substring(i, i + 1) == ":") { break; }
	}
	return (data.substring(i + 1, data.length));
}
function Display(min, sec) {
	var disp;
	if (min <= 9) { disp = " 0"; }
	else { disp = " "; }

	disp += min + ":";
	
	if (sec <= 9) { disp += "0" + sec; }
	else { disp += sec; }
	return (disp);
}
function Down() { 
	sec--;      
	if (sec == -1) { sec = 59; min--; }
	document.getElementById('clock').value = Display(min, sec);
	window.status = "Session will time out in: " + Display(min, sec);
	if (min <= 4 && getSty(confirmBoxID).visibility != 'visible') {
		getSty(confirmBoxID).visibility = 'visible';
	}
	
	if (min == 0 && sec <= 0) { window.location.href = timedouturl; }
	else { down = setTimeout("Down()", 1000); }
}

function writeConfirmBox() {
	var boxWidth = 260;
	var winX,winY,thisStyle;
		winX = Math.round( (winWidth() - boxWidth)/2 );
		if (screen.availHeight > 500) {
			winY = 150;
		}
		else { winY = Math.round( (winHeight/2) - 50 ); }
		
	var str = '<div class="timeout" style="width:'+boxWidth+'px;left:450px;top:250px" align="center" id="'+confirmBoxID+'">'+
		'<div class="timeoutTitle">'+
		'<form name="timerform">Your have been idle for 20 min.<br>Your session will end in<input type="text" id="clock" name="clock" size="5" class="clock">min.<br>'+
		'Do you wish to stay logged in?</form>'+
		'</div>'+
		'<div style="padding:10px"><input type="button" name="ok" value="OK" onclick="window.location.href=window.location.href;" class="but_bg">&nbsp;'+
		'<input type="button" name="no" value="LOG OFF" onclick="window.location.href=\''+timedouturl+'\';" class="but_bg"></div>'+
		'</div>';
		document.write(str);

		getSty(confirmBoxID).visibility = 'hidden';
		
}
/**** place this in onload event ****/
/**** OnLoad="timeIt()" ****/
/*End of timeout script*/