<!--
//===================================
//  Rollover Effect
//===================================

function imageholderclass(){
	this.over=new Array();
	this.down=new Array();
	this.src=new Array();
	this.store=store;
	
	function store(src, down, over){
		var AL=this.src.length;
		this.src[AL]=new Image(); this.src[AL].src=src;
		this.over[AL]=new Image(); this.over[AL].src=over;
		this.down[AL]=new Image(); this.down[AL].src=down;
	}
}

var ih = new imageholderclass();
var mouseisdown=0;

function preloader(t){
	for(i=0;i<t.length;i++){
		if(t[i].getAttribute('srcover')||t[i].getAttribute('srcdown')){
			
			storeimages(t[i]);
			var checker='';
			checker=(t[i].getAttribute('srcover'))?checker+'A':checker+'';
			checker=(t[i].getAttribute('srcdown'))?checker+'B':checker+'';
			
			switch(checker){
			case 'A' : mouseover(t[i]);mouseout(t[i]); break;
			case 'B' : mousedown(t[i]); mouseup2(t[i]); break;
			case 'AB' : mouseover(t[i]);mouseout(t[i]); mousedown(t[i]); mouseup(t[i]); break;
			default : return;			
			}
			
			if(t[i].src){t[i].setAttribute("oldsrc",t[i].src);}
		}
	}
}
function mouseup(t){
	var newmouseup;
	if(t.onmouseup){
		t.oldmouseup=t.onmouseup;
		newmouseup=function(){mouseisdown=0;this.src=this.getAttribute("srcover");this.oldmouseup();}

	}
	else{newmouseup=function(){mouseisdown=0;this.src=this.getAttribute("srcover");}}
	t.onmouseup=newmouseup;
}

function mouseup2(t){
	var newmouseup;
	if(t.onmouseup){
		t.oldmouseup=t.onmouseup;
		newmouseup=function(){mouseisdown=0;this.src=this.getAttribute("oldsrc");this.oldmouseup();}
		}
	else{newmouseup=function(){mouseisdown=0;this.src=this.getAttribute("oldsrc");}}
	t.onmouseup = newmouseup;
}

function mousedown(t){
	var newmousedown;
	if(t.onmousedown){
		t.oldmousedown=t.onmousedown;
		newmousedown=function(){if(mouseisdown==0){this.src=this.getAttribute("srcdown");this.oldmousedown();}}
	}
	else{newmousedown=function(){if(mouseisdown==0){this.src=this.getAttribute("srcdown");}}}
	t.onmousedown=newmousedown;
}

function mouseover(t){
	var newmouseover;
	if(t.onmouseover){
		t.oldmouseover=t.onmouseover;
		newmouseover=function(){this.src=this.getAttribute("srcover");this.oldmouseover();}
	}
	else{newmouseover=function(){this.src=this.getAttribute("srcover");}}
	t.onmouseover=newmouseover;
}

function mouseout(t){
	var newmouseout;
	if(t.onmouseout){
		t.oldmouseout=t.onmouseout;
		newmouseout=function(){this.src=this.getAttribute("oldsrc");this.oldmouseout();}
	}
	else{newmouseout=function(){this.src=this.getAttribute("oldsrc");}}
	t.onmouseout=newmouseout;
}

function storeimages(t){
	var s=(t.getAttribute('src'))?t.getAttribute('src'):'';
	var d=(t.getAttribute('srcdown'))?t.getAttribute('srcdown'):'';
	var o=(t.getAttribute('srcover'))?t.getAttribute('srcover'):'';
	ih.store(s,d,o);
}

function preloadimgsrc(){
	if(!document.getElementById) return;
	var it=document.getElementsByTagName('IMG');
	var it2=document.getElementsByTagName('INPUT');
	preloader(it);
	preloader(it2);
}

if(window.addEventListener){window.addEventListener("load", preloadimgsrc, false);} 
else{
	if(window.attachEvent){window.attachEvent("onload", preloadimgsrc);}
	else{if(document.getElementById){window.onload=preloadimgsrc;}}
}




function FP_swapImg() {//v1.0

 var doc=document,args=arguments,elm,n; doc.$imgSwaps=new Array(); for(n=2; n<args.length;

 n+=2) { elm=FP_getObjectByID(args[n]); if(elm) { doc.$imgSwaps[doc.$imgSwaps.length]=elm;

 elm.$src=elm.src; elm.src=args[n+1]; } }

}



function FP_preloadImgs() {//v1.0

 var d=document,a=arguments; if(!d.FP_imgs) d.FP_imgs=new Array();

 for(var i=0; i<a.length; i++) { d.FP_imgs[i]=new Image; d.FP_imgs[i].src=a[i]; }

}



function FP_getObjectByID(id,o) {//v1.0

 var c,el,els,f,m,n; if(!o)o=document; if(o.getElementById) el=o.getElementById(id);

 else if(o.layers) c=o.layers; else if(o.all) el=o.all[id]; if(el) return el;

 if(o.id==id || o.name==id) return o; if(o.childNodes) c=o.childNodes; if(c)

 for(n=0; n<c.length; n++) { el=FP_getObjectByID(id,c[n]); if(el) return el; }

 f=o.forms; if(f) for(n=0; n<f.length; n++) { els=f[n].elements;

 for(m=0; m<els.length; m++){ el=FP_getObjectByID(id,els[n]); if(el) return el; } }

 return null;

}



function FP_swapImgRestore() {//v1.0

 var doc=document,i; if(doc.$imgSwaps) { for(i=0;i<doc.$imgSwaps.length;i++) {

  var elm=doc.$imgSwaps[i]; if(elm) { elm.src=elm.$src; elm.$src=null; } } 

  doc.$imgSwaps=null; }

}



function vote(id,side,it){

if(Validate(document.Poll_left) == true){

var XMLHttp = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("MSXML2.XMLHTTP.3.0");

var checkedvalue = getCheckedValue(document.forms['Poll_' + side].elements['answer_'+ side]);

document.getElementById('polls_' + side).innerHTML = "Loading...";

XMLHttp.open('GET', 'poll/vote.php?checked=' + checkedvalue + '&id=' + id, true);

XMLHttp.onreadystatechange = function() {

if(XMLHttp.readyState == 4) {

if(XMLHttp.status == 200) {

document.getElementById('polls_' + side).innerHTML = XMLHttp.responseText;

}

}

};

XMLHttp.send(null);

}

}

function showresults(id,side){

var XMLHttp = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("MSXML2.XMLHTTP.3.0");

XMLHttp.open('GET', 'http://www.mightyhawk.net/poll/showvote.php?id=' + id, true);

XMLHttp.onreadystatechange = function() {

if(XMLHttp.readyState == 4) {

if(XMLHttp.status == 200) {

document.getElementById('polls_'+side).innerHTML = XMLHttp.responseText;

}

}

};

XMLHttp.send(null);

}



function ShowGame(id){

var XMLHttp = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("MSXML2.XMLHTTP.3.0");

document.getElementById('upcoming_games_area').innerHTML = "Loading...";

XMLHttp.open('GET', 'http://www.mightyhawk.net/upcoming_games/show.php?id=' + id, true);

XMLHttp.onreadystatechange = function() {

if(XMLHttp.readyState == 4) {

if(XMLHttp.status == 200) {

document.getElementById('upcoming_games_area').innerHTML = XMLHttp.responseText;

}

}

};

XMLHttp.send(null);

}





function getCheckedValue(radioObj) {

	if(!radioObj)

		return "";

	var radioLength = radioObj.length;

	if(radioLength == undefined)

		if(radioObj.checked)

			return radioObj.value;

		else

			return "";

	for(var i = 0; i < radioLength; i++) {

		if(radioObj[i].checked) {

			return radioObj[i].value;

		}

	}

	return "";

}

/*

THE FOLLOWING CODE HANDLES THE GRAPHICAL CHANGES FOR RADIO BUTTONS AND CHECKBOXES

*/

//global variables that can be used by ALL the function son this page. 

var inputs; 

var imgCheckboxFalse = 'images/checkbox.png'; 

var imgCheckboxTrue = 'images/checkbox_checked.png'; 

var imgCheckboxFalseDisabled = 'images/checkbox_unchecked_disabled.gif'; 

var imgCheckboxTrueDisabled = 'images/checkbox_checked_disabled.gif'; 

var imgRadioFalse = 'images/radio_button.gif'; 

var imgRadioTrue = 'images/radio_button_checked.gif'; 

var imgRadioFalseDisabled = 'images/radio_unchecked_disabled.gif'; 

var imgRadioTrueDisabled = 'images/radio_checked_disabled.gif'; 



//this function runs when the page is loaded, put all your other onload stuff in here too. 

function init() { 

replaceRadios();

replaceChecks();

} 



function replaceChecks() { 



    //get all the input fields on the page 

    inputs = document.getElementsByTagName('input'); 



    //cycle trough the input fields 

    for(var i=0; i < inputs.length; i++) { 



	//check if the input is a checkbox 

	if(inputs[i].getAttribute('type') == 'checkbox') { 



	    //create a new image 

	    var img = document.createElement('img'); 



	    //check if the checkbox is checked 

	    if(inputs[i].checked) { 

				if(inputs[i].disabled)

				{

					img.src = imgCheckboxTrueDisabled; 

				} else {

					img.src = imgCheckboxTrue; 

				}

	    } else { 

		if(inputs[i].disabled)

				{

					img.src = imgCheckboxFalseDisabled; 

				} else {

					img.src = imgCheckboxFalse; 

				}

	    } 



	    //set image ID and onclick action 

	    img.id = 'checkImage'+i; 

	    //set image 

	    if(!inputs[i].disabled) img.onclick = new Function('checkChange('+i+')'); 

	    //place image in front of the checkbox 

	    inputs[i].parentNode.insertBefore(img, inputs[i]); 



	    //hide the checkbox 

	    inputs[i].style.display='none'; 

	} 

    } 

} 



function replaceRadios() { 



    //get all the input fields on the page 

    inputs = document.getElementsByTagName('input'); 



    //cycle trough the input fields 

    for(var i=0; i < inputs.length; i++) { 



	//check if the input is a checkbox 

	if(inputs[i].getAttribute('type') == 'radio') { 



	    //create a new image 

	    var img = document.createElement('img'); 



	    //check if the checkbox is checked 

	    if(inputs[i].checked) { 

				if(inputs[i].disabled)

				{

					img.src = imgRadioTrueDisabled; 

				} else {

					img.src = imgRadioTrue; 

				}

	    } else { 

		if(inputs[i].disabled)

				{

					img.src = imgRadioFalseDisabled; 

				} else {

					img.src = imgRadioFalse; 

				}

	    } 



	    //set image ID and onclick action 

	    img.id = 'radioImage'+inputs[i].id; 



	    //set image click event if button not disabled

	    if(!inputs[i].disabled) img.onclick = new Function('radioChange('+i+')'); 

	    //place image in front of the checkbox 

	    inputs[i].parentNode.insertBefore(img, inputs[i]); 



	    //hide the checkbox 

	    inputs[i].style.display='none'; 

	} 

    } 

} 



//change the checkbox status and the replacement image 

function checkChange(i) { 



    if(inputs[i].checked) { 

	inputs[i].checked = ''; 

	document.getElementById('checkImage'+i).src=imgCheckboxFalse; 

    } else { 

	inputs[i].checked = 'checked'; 

	document.getElementById('checkImage'+i).src=imgCheckboxTrue; 

    } 

} 



//change the checkbox status and the replacement image of checked and all in same group

function radioChange(i) { 

	var radios=new Array();

	var tmpradios;



	// load all the inputs into tmp array

	tmpradios = document.getElementsByTagName('input'); 



	for(var j=0; j < tmpradios.length; j++) { 

		// Add only the radios in this group to the array

		if(tmpradios[j].getAttribute('name') == inputs[i].getAttribute('name'))

		{

			radios.push(tmpradios[j]);

		}

	}



    if(inputs[i].checked) { 

		// already checked so do nothing as radio does not uncheck like a checkbox

    } else { 

		// make all other group items unchecked

	for(var j=0; j < radios.length; j++) { 

			document.getElementById('radioImage'+radios[j].id).src=imgRadioFalse; 

			document.getElementById('radioImage'+radios[j].id).checked=''; 

		}

		// make the selected item checked

	inputs[i].checked = 'checked'; 

	document.getElementById('radioImage'+inputs[i].id).src = imgRadioTrue;       

    } 

} 

function validate(objForm) {

if(Validate(objForm) == true){

objForm.submit();

}

}



function Validate(objForm) {

	var arrValidated=new Array();

	for (var i=0; i<objForm.elements.length; i++) {

		var element=objForm.elements[i];

		var elName=element.name;

		if ((!elName)||(elName.length == 0)||(arrValidated[elName]))

			continue;

		arrValidated[elName] = true;

		var validationType = element.getAttribute("validate");

		if ((!validationType)||(validationType.length == 0))

			continue;

		var strMessages=element.getAttribute("msg");

		if (!strMessages)

			strMessages = "";

		var arrMessages = strMessages.split("|");

		var arrValidationTypes = validationType.split("|");			

		for (var j=0; j<arrValidationTypes.length; j++) {

			var curValidationType = arrValidationTypes[j];

			var blnValid=true;

			switch (curValidationType) {

				case "match":

					blnValid = ValidateMatch(objForm.password,objForm.confirmpassword);

					break;

				case "not_empty":

					blnValid = ValidateNotEmpty(element);

					break;

				case "integer":

					blnValid = ValidateInteger(element);

					break;

				case "number":

					blnValid = ValidateNumber(element);

					break;

				case "email":

					blnValid = ValidateEmail(element);

					break;

				default:

					try {

						blnValid = eval(curValidationType+"(element)");

					}

					catch (ex) {

						blnValid = true;

					}

			}

			if (blnValid == false) {

				var message="Invalid Value Entered in '"+element.name + "'";

				if ((j < arrMessages.length)&&(arrMessages[j].length> 0))

					message = arrMessages[j];

				InsertError(element, message);

				if ((typeof element.focus == "function")||(element.focus) && element.type != "textarea") {

					element.focus();

				}

				return false;

			}

			else

				ClearError(element);

		}

		}

	return true;

}



function validate(f)

{

if(Validate(f) == false)

{

}

else

{

f.submit();

}

}



function ValidateNotEmpty(objElement) {

	var strValue = GetElementValue(objElement);

	return (strValue.length> 0);

}



function ValidateMatch(objElement,objElement2) {

	var strValue = GetElementValue(objElement);

	var strValue2 = GetElementValue(objElement2);

	return (strValue == strValue2);

}



function ValidateInteger(objElement) {

	var strValue = GetElementValue(objElement);

	return (!isNaN(parseInt(strValue)));

}



function ValidateNumber(objElement) {

	var strValue = GetElementValue(objElement);

	return (!isNaN(parseFloat(strValue)));

}



function ValidateEmail(objElement) {

	var strValue = GetElementValue(objElement);

	if (strValue.length < 5)

		return false;

	var arrTemp=strValue.split("@");

	if (arrTemp.length != 2)

		return false;

	var strLeftPart = arrTemp[0];

	var strRightPart = arrTemp[1];

	if ((strLeftPart.length == 0)||(strRightPart.length == 0))

		return false;

	arrTemp = strRightPart.split(".");

	if (arrTemp.length < 2)

		return false;

	for (var i=0; i<arrTemp.length; i++) {

		if (arrTemp[i].length == 0)

			return false;

	}

	return true;

}



function GetElementValue(objElement) {

	var result="";

	switch (objElement.type) {

		case "text":

		case "hidden":

		case "textarea":

		case "password":

			result = objElement.value;

			break;

		case "select-one":

		case "select":

			if (objElement.selectedIndex>= 0)

				result = objElement.options[objElement.selectedIndex].value;

			break;

		case "radio":

		case "checkbox":

			for (var i=0; i<objElement.form.elements.length; i++) {

				if (objElement.form.elements[i].name == objElement.name) {

					if (objElement.form.elements[i].checked)

						result += objElement.form.elements[i].value+",";

				}

			}

			break;

	}

	return result;

}



function InsertError(element, strMessage) {

	if ((element.form.getAttribute("show_alert")) && (element.form.getAttribute("show_alert") != "0")) {

		alert(strMessage);

		return;

	}

	var strSpanID = element.name+"_val_error";

	var objSpan = document.getElementById(strSpanID);

	if (!objSpan) {

		if ((element.type == "radio")||(element.type == "checkbox")) {

			for (var i=0; i<element.form.elements.length; i++) {

				if (element.form.elements[i].name == element.name) {

					element = element.form.elements[i];

				}

			}

		}

		objSpan = document.createElement("span");

		objSpan.id = strSpanID;

		objSpan.className = "validation_error";

		var nodeAfter=0;

		var nodeParent = element.parentNode;

		for (var i=0; i<nodeParent.childNodes.length; i++) {

			if (nodeParent.childNodes[i] == element) {

				if (i < (nodeParent.childNodes.length-1))

					nodeAfter = nodeParent.childNodes[i+1];

				break;

			}

		}

		if ((!nodeAfter)&&(nodeParent.parentNode)) {

			nodeParent = nodeParent.parentNode;

			for (var i=0; i<nodeParent.childNodes.length; i++) {

				if (nodeParent.childNodes[i] == element.parentNode) {

					if (i < (nodeParent.childNodes.length-1))

						nodeAfter = nodeParent.childNodes[i+1];

					break;

				}

			}

		}

		if (nodeAfter)

			nodeParent.insertBefore(objSpan, nodeAfter);

		else

			document.body.appendChild(objSpan);

	}

	objSpan.innerHTML = strMessage;

}



function ClearError(element) {

	var strSpanID = element.name+"_val_error";

	var objSpan = document.getElementById(strSpanID);

	if (objSpan) {

		objSpan.innerHTML = "";

	}

}

/*************************************************************************

  This code is from Dynamic Web Coding at dyn-web.com

  Copyright 2001-5 by Sharon Paine 

  See Terms of Use at www.dyn-web.com/bus/terms.html

  regarding conditions under which you may use this code.

  This notice must be retained in the code as is!

*************************************************************************/



/* 

    dw_scrollObj.js  version date: March 2005

    GeckoTableBugFix algorithm revised, and now excludes Safari and Konqueror.

    

    dw_scrollObj.js contains constructor and basic methods for scrolling layers.

    Use with dw_hoverscroll.js and/or dw_glidescroll.js,

    and for scrollbars: dw_scroll-aux.js and dw_slidebar.js

*/



dw_scrollObjs = {};

dw_scrollObj.speed = 60; // default speed for mouseover scrolling

//  constructor arguments: id of layer containing scrolling layers (clipped layer), id of layer to scroll, 

//	id of table or other element that scrolling content is nested in. 

//	ns6+/moz need that extra container to get width for horizontal scrolling.

//	(not needed for vertical scrolling)

function dw_scrollObj(wnId, lyrId, cntId) {

    this.id = wnId; dw_scrollObjs[this.id] = this;

    this.animString = "dw_scrollObjs." + this.id;

    this.load(lyrId, cntId);

}



dw_scrollObj.loadLayer = function(wnId, id, cntId) {

    if ( dw_scrollObjs[wnId] ) dw_scrollObjs[wnId].load(id, cntId);

}



dw_scrollObj.prototype.load = function(lyrId, cntId) {

    if (!document.getElementById) return;

    var wndo, lyr;

    if (this.lyrId) {

        lyr = document.getElementById(this.lyrId);

        lyr.style.visibility = "hidden";

    }

    lyr = document.getElementById(lyrId);

    wndo = document.getElementById(this.id);

    lyr.style.top = this.y = 0; lyr.style.left = this.x = 0;

    this.maxY = (lyr.offsetHeight - wndo.offsetHeight > 0)? lyr.offsetHeight - wndo.offsetHeight: 0;

    this.wd = cntId? document.getElementById(cntId).offsetWidth: lyr.offsetWidth;

    this.maxX = (this.wd - wndo.offsetWidth > 0)? this.wd - wndo.offsetWidth: 0;

    this.lyrId = lyrId; // hold id of currently visible layer

    lyr.style.visibility = "visible";

    this.on_load(); this.ready = true;

}



dw_scrollObj.prototype.on_load = function() {}  



dw_scrollObj.prototype.shiftTo = function(lyr, x, y) {

    lyr.style.left = (this.x = x) + "px"; 

    lyr.style.top = (this.y = y) + "px";

}



// remove layers from table for ns6+/mozilla (needed for scrolling inside tables)

// recent versions of ns/moz (ns7.2 and moz 1.73) don't need it (ns 7.1 and moz 1.5 do)

dw_scrollObj.GeckoTableBugFix = function() {

    var ua = navigator.userAgent;

    if ( ua.indexOf("Gecko") > -1 && ua.indexOf("Firefox") == -1 

        && ua.indexOf("Safari") == -1 && ua.indexOf("Konqueror") == -1 ) {

        dw_scrollObj.hold = []; // holds id's of wndo and its container

        for (var i=0; arguments[i]; i++) {

            if ( dw_scrollObjs[ arguments[i] ] ) {

                var wndo = document.getElementById( arguments[i] );

                var holderId = wndo.parentNode.id;

                var holder = document.getElementById(holderId);

                document.body.appendChild( holder.removeChild(wndo) );

                wndo.style.zIndex = 1000;

                var pos = getPageOffsets(holder);

                wndo.style.left = pos.x + "px"; wndo.style.top = pos.y + "px";

                dw_scrollObj.hold[i] = [ arguments[i], holderId ];

            }

        }

        window.addEventListener("resize", dw_scrollObj.rePositionGecko, true);

    }

}



// ns6+/mozilla need to reposition layers onresize when scrolling inside tables.

dw_scrollObj.rePositionGecko = function() {

    if (dw_scrollObj.hold) {

        for (var i=0; dw_scrollObj.hold[i]; i++) {

            var wndo = document.getElementById( dw_scrollObj.hold[i][0] );

            var holder = document.getElementById( dw_scrollObj.hold[i][1] );

            var pos = getPageOffsets(holder);

            wndo.style.left = pos.x + "px"; wndo.style.top = pos.y + "px";

        }

    }

}



function getPageOffsets(el) {

    var left = el.offsetLeft;

    var top = el.offsetTop;

    if ( el.offsetParent && el.offsetParent.clientLeft || el.offsetParent.clientTop ) {

        left += el.offsetParent.clientLeft;

        top += el.offsetParent.clientTop;

    }

    while ( el = el.offsetParent ) {

        left += el.offsetLeft;

        top += el.offsetTop;

    }

    return { x:left, y:top };

}

/*************************************************************************

  This code is from Dynamic Web Coding at www.dyn-web.com

  Copyright 2001-4 by Sharon Paine 

  See Terms of Use at www.dyn-web.com/bus/terms.html

  regarding conditions under which you may use this code.

  This notice must be retained in the code as is!

*************************************************************************/



/* dw_hoverscroll.js  version date: June 2004 

   mouseover scrolling for dw_scrollObj (in dw_scrollObj.js)  */



dw_scrollObj.stopScroll = function(wnId) {

  if ( dw_scrollObjs[wnId] ) dw_scrollObjs[wnId].endScroll();

}



// increase speed onmousedown of scroll links

dw_scrollObj.doubleSpeed = function(wnId) {

  if ( dw_scrollObjs[wnId] ) dw_scrollObjs[wnId].speed *= 2;

}



dw_scrollObj.resetSpeed = function(wnId) {

  if ( dw_scrollObjs[wnId] ) dw_scrollObjs[wnId].speed /= 2;

}



// algorithms for time-based scrolling and scrolling onmouseover at any angle adapted from youngpup.net

dw_scrollObj.initScroll = function(wnId, deg, sp) {

  if ( dw_scrollObjs[wnId] ) {

    var cosine, sine;

    if (typeof deg == "string") {

      switch (deg) {

        case "up"    : deg = 90;  break;

        case "down"  : deg = 270; break;

        case "left"  : deg = 180; break;

        case "right" : deg = 0;   break;

        default: 

          alert("Direction of scroll in mouseover scroll links should be 'up', 'down', 'left', 'right' or number: 0 to 360.");

       }

    } 

    deg = deg % 360;

    if (deg % 90 == 0) {

      cosine = (deg == 0)? -1: (deg == 180)? 1: 0;

      sine = (deg == 90)? 1: (deg == 270)? -1: 0;

    } else {

      var angle = deg * Math.PI/180;

      cosine = -Math.cos(angle); sine = Math.sin(angle);

    }

    dw_scrollObjs[wnId].fx = cosine / ( Math.abs(cosine) + Math.abs(sine) );

    dw_scrollObjs[wnId].fy = sine / ( Math.abs(cosine) + Math.abs(sine) );

    dw_scrollObjs[wnId].endX = (deg == 90 || deg == 270)? dw_scrollObjs[wnId].x:

      (deg < 90 || deg > 270)? -dw_scrollObjs[wnId].maxX: 0; 

    dw_scrollObjs[wnId].endY = (deg == 0 || deg == 180)? dw_scrollObjs[wnId].y: 

      (deg < 180)? 0: -dw_scrollObjs[wnId].maxY;

    dw_scrollObjs[wnId].startScroll(sp);

  }

}



// speed (optional) to override default speed (set in dw_scrollObj.speed)

dw_scrollObj.prototype.startScroll = function(speed) {

  if (!this.ready) return; if (this.timerId) clearInterval(this.timerId);

  this.speed = speed || dw_scrollObj.speed;

  this.lyr = document.getElementById(this.lyrId);

  this.lastTime = ( new Date() ).getTime();

  this.on_scroll_start();  

  this.timerId = setInterval(this.animString + ".scroll()", 10); 

}



dw_scrollObj.prototype.scroll = function() {

  var now = ( new Date() ).getTime();

  var d = (now - this.lastTime)/1000 * this.speed;

  if (d > 0) {

    var x = this.x + this.fx * d; var y = this.y + this.fy * d;

    if (this.fx == 0 || this.fy == 0) { // for horizontal or vertical scrolling

      if ( ( this.fx == -1 && x > -this.maxX ) || ( this.fx == 1 && x < 0 ) || 

        ( this.fy == -1 && y > -this.maxY ) || ( this.fy == 1 && y < 0 ) ) {

        this.lastTime = now;

        this.shiftTo(this.lyr, x, y);

        this.on_scroll(x, y);

      } else {

        clearInterval(this.timerId); this.timerId = 0;

        this.shiftTo(this.lyr, this.endX, this.endY);

        this.on_scroll_end(this.endX, this.endY);

      }

    } else { // for scrolling at an angle (stop when reach end on one axis)

      if ( ( this.fx < 0 && x >= -this.maxX && this.fy < 0 && y >= -this.maxY ) ||

        ( this.fx > 0 && x <= 0 && this.fy > 0 && y <= 0 ) ||

        ( this.fx < 0 && x >= -this.maxX && this.fy > 0 && y <= 0 ) ||

        ( this.fx > 0 && x <= 0 && this.fy < 0 && y >= -this.maxY ) ) {

        this.lastTime = now;

        this.shiftTo(this.lyr, x, y);

        this.on_scroll(x, y);

      } else {

        clearInterval(this.timerId); this.timerId = 0;

        this.on_scroll_end(this.x, this.y);

      }

    }

  }

}



dw_scrollObj.prototype.endScroll = function() {

  if (!this.ready) return;

  if (this.timerId) clearInterval(this.timerId);

  this.timerId = 0;  this.lyr = null;

}



dw_scrollObj.prototype.on_scroll = function() {}

dw_scrollObj.prototype.on_scroll_start = function() {}

dw_scrollObj.prototype.on_scroll_end = function() {}

  

/*************************************************************************

  This code is from Dynamic Web Coding at www.dyn-web.com

  Copyright 2001-4 by Sharon Paine 

  See Terms of Use at www.dyn-web.com/bus/terms.html

  regarding conditions under which you may use this code.

  This notice must be retained in the code as is!

*************************************************************************/



function initScrollLayer() {

  // arguments: id of layer containing scrolling layers (clipped layer), id of layer to scroll, 

  // if horizontal scrolling, id of element containing scrolling content (table?)

  var wndo = new dw_scrollObj('wn', 'lyr1', 't1');

  

  // pass id's of any wndo's that scroll inside tables

  // i.e., if you have 3 (with id's wn1, wn2, wn3): dw_scrollObj.GeckoTableBugFix('wn1', 'wn2', 'wn3');

  dw_scrollObj.GeckoTableBugFix('wn'); 

}

// -->