﻿function SetMiddle(objectID){

	//works for FF
	if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {

	
	var middle = (window.innerHeight/2)-80;

	var object = document.getElementById(objectID);
		object.style['top'] = getScrollY()+middle+"px";
		
	//works for FF
	}
	else {
	
	//works for IE
	
	var middle = (document.documentElement.clientHeight/2)-80;

	var object = document.getElementById(objectID);
		object.style['top'] = getScrollY()+middle+"px";
		
	//works for IE

	
	}
}

	
	
	function changecss(theClass,element,value) {
	//Last Updated on May 21, 2008
	//documentation for this script at
	//http://www.shawnolson.net/a/503/altering-css-class-attributes-with-javascript.html
	 var cssRules;
	 if (document.all) {
	  cssRules = 'rules';
	 }
	 else if (document.getElementById) {
	  cssRules = 'cssRules';
	 }
	 var added = false;
	 for (var S = 0; S < document.styleSheets.length; S++){
	  for (var R = 0; R < document.styleSheets[S][cssRules].length; R++) {
	   if (document.styleSheets[S][cssRules][R].selectorText == theClass) {
	    if(document.styleSheets[S][cssRules][R].style[element]){
	    document.styleSheets[S][cssRules][R].style[element] = value;
	    added=true;
		break;
	    }
	   }
	  }

	  if(!added){
	  if(document.styleSheets[S].insertRule){
			  document.styleSheets[S].insertRule(theClass+' { '+element+': '+value+'; }',document.styleSheets[S][cssRules].length);
			} else if (document.styleSheets[S].addRule) {
				document.styleSheets[S].addRule(theClass,element+': '+value+';');
			}
	  }
	 }
	}

function bookmark(url,title){
  if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) {
  window.external.AddFavorite(url,title);
  } else if (navigator.appName == "Netscape") {
    window.sidebar.addPanel(title,url,"");
  } else {
    alert("Press CTRL-D (Netscape) or CTRL-T (Opera) to bookmark");
  }
}



// AnyLink CSS Menu v2.0- (c) Dynamic Drive DHTML code library: http://www.dynamicdrive.com
// Script Download/ instructions page: http://www.dynamicdrive.com/dynamicindex1/anylinkcss.htm
// January 19', 2009: Script Creation date


var anylinkcssmenu={

menusmap: {},
effects: {delayhide: 200, shadow:{enabled:false, opacity:0.3, depth: [5, 5]}, fade:{enabled:true, duration:500}}, //customize menu effects

dimensions: {},

getoffset:function(what, offsettype){
	return (what.offsetParent)? what[offsettype]+this.getoffset(what.offsetParent, offsettype) : what[offsettype]
},

getoffsetof:function(el){
	el._offsets={left:this.getoffset(el, "offsetLeft"), top:this.getoffset(el, "offsetTop"), h: el.offsetHeight}
},

getdimensions:function(menu){
	this.dimensions={anchorw:menu.anchorobj.offsetWidth, anchorh:menu.anchorobj.offsetHeight,
		docwidth:(window.innerWidth ||this.standardbody.clientWidth)-20,
		docheight:(window.innerHeight ||this.standardbody.clientHeight)-15,
		docscrollx:window.pageXOffset || this.standardbody.scrollLeft,
		docscrolly:window.pageYOffset || this.standardbody.scrollTop
	}
	if (!this.dimensions.dropmenuw){
		this.dimensions.dropmenuw=menu.dropmenu.offsetWidth
		this.dimensions.dropmenuh=menu.dropmenu.offsetHeight
	}
},

isContained:function(m, e){
	var e=window.event || e
	var c=e.relatedTarget || ((e.type=="mouseover")? e.fromElement : e.toElement)
	while (c && c!=m)try {c=c.parentNode} catch(e){c=m}
	if (c==m)
		return true
	else
		return false
},

setopacity:function(el, value){
	el.style.opacity=value
	if (typeof el.style.opacity!="string"){ //if it's not a string (ie: number instead), it means property not supported
		el.style.MozOpacity=value
		if (el.filters){
			el.style.filter="progid:DXImageTransform.Microsoft.alpha(opacity="+ value*100 +")"
		}
	}
},

showmenu:function(menuid){
	var menu=anylinkcssmenu.menusmap[menuid]
	clearTimeout(menu.hidetimer)
	this.getoffsetof(menu.anchorobj)
	this.getdimensions(menu)
	var posx=menu.anchorobj._offsets.left + (menu.orientation=="lr"? this.dimensions.anchorw : 0) //base x pos
	var posy=menu.anchorobj._offsets.top+this.dimensions.anchorh - (menu.orientation=="lr"? this.dimensions.anchorh : 0)//base y pos
	if (posx+this.dimensions.dropmenuw+this.effects.shadow.depth[0]>this.dimensions.docscrollx+this.dimensions.docwidth){ //drop left instead?
		posx=posx-this.dimensions.dropmenuw + (menu.orientation=="lr"? -this.dimensions.anchorw : this.dimensions.anchorw)
	}
	if (posy+this.dimensions.dropmenuh>this.dimensions.docscrolly+this.dimensions.docheight){  //drop up instead?
		posy=Math.max(posy-this.dimensions.dropmenuh - (menu.orientation=="lr"? -this.dimensions.anchorh : this.dimensions.anchorh), this.dimensions.docscrolly) //position above anchor or window's top edge
	}
	if (this.effects.fade.enabled){
		this.setopacity(menu.dropmenu, 0) //set opacity to 0 so menu appears hidden initially
		if (this.effects.shadow.enabled)
			this.setopacity(menu.shadow, 0) //set opacity to 0 so shadow appears hidden initially
	}
	menu.dropmenu.setcss({left:posx+'px', top:posy+'px', display:'block'})
	if (this.effects.shadow.enabled)
		menu.shadow.setcss({left:posx+anylinkcssmenu.effects.shadow.depth[0]+'px', top:posy+anylinkcssmenu.effects.shadow.depth[1]+'px', display:'block'})
	if (this.effects.fade.enabled){
		clearInterval(menu.animatetimer)
		menu.curanimatedegree=0
		menu.starttime=new Date().getTime() //get time just before animation is run
		menu.animatetimer=setInterval(function(){anylinkcssmenu.revealmenu(menuid)}, 20)
	}
},

revealmenu:function(menuid){
	var menu=anylinkcssmenu.menusmap[menuid]
	var elapsed=new Date().getTime()-menu.starttime //get time animation has run
	if (elapsed<this.effects.fade.duration){
		this.setopacity(menu.dropmenu, menu.curanimatedegree)
		if (this.effects.shadow.enabled)
			this.setopacity(menu.shadow, menu.curanimatedegree*this.effects.shadow.opacity)
	}
	else{
		clearInterval(menu.animatetimer)
		this.setopacity(menu.dropmenu, 1)
		menu.dropmenu.style.filter=""
	}
	menu.curanimatedegree=(1-Math.cos((elapsed/this.effects.fade.duration)*Math.PI)) / 2
},

setcss:function(param){
	for (prop in param){
		this.style[prop]=param[prop]
	}
},

hidemenu:function(menuid){
	var menu=anylinkcssmenu.menusmap[menuid]
	clearInterval(menu.animatetimer)
	menu.dropmenu.setcss({display:'none', left:0, top:0})
	menu.shadow.setcss({display:'none', left:0, top:0})
},

getElementsByClass:function(targetclass){
	if (document.querySelectorAll)
		return document.querySelectorAll("."+targetclass)
	else{
		var classnameRE=new RegExp("(^|\\s+)"+targetclass+"($|\\s+)", "i") //regular expression to screen for classname
		var pieces=[]
		var alltags=document.all? document.all : document.getElementsByTagName("*")
		for (var i=0; i<alltags.length; i++){
			if (typeof alltags[i].className=="string" && alltags[i].className.search(classnameRE)!=-1)
				pieces[pieces.length]=alltags[i]
		}
		return pieces
	}
},

addEvent:function(targetarr, functionref, tasktype){
	if (targetarr.length>0){
		var target=targetarr.shift()
		if (target.addEventListener)
			target.addEventListener(tasktype, functionref, false)
		else if (target.attachEvent)
			target.attachEvent('on'+tasktype, function(){return functionref.call(target, window.event)})
		this.addEvent(targetarr, functionref, tasktype)
	}
},

setupmenu:function(targetclass, anchorobj, pos){
	this.standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body
	var relattr=anchorobj.getAttribute("rel")
	var dropmenuid=relattr.replace(/\[(\w+)\]/, '')
	var menu=this.menusmap[targetclass+pos]={
		id: targetclass+pos,
		anchorobj: anchorobj,	
		dropmenu: document.getElementById(dropmenuid),
		revealtype: (relattr.length!=dropmenuid.length && RegExp.$1=="click")? "click" : "mouseover",
		orientation: anchorobj.getAttribute("rev")=="lr"? "lr" : "ud",
		shadow: document.createElement("div")
	}
	menu.anchorobj._internalID=targetclass+pos
	menu.anchorobj._isanchor=true
	menu.dropmenu._internalID=targetclass+pos
	menu.shadow._internalID=targetclass+pos
	menu.shadow.className="anylinkshadow"
	document.body.appendChild(menu.dropmenu) //move drop down div to end of page
	document.body.appendChild(menu.shadow)
	menu.dropmenu.setcss=this.setcss
	menu.shadow.setcss=this.setcss
	menu.shadow.setcss({width: menu.dropmenu.offsetWidth+"px", height:menu.dropmenu.offsetHeight+"px"})
	this.setopacity(menu.shadow, this.effects.shadow.opacity)
	this.addEvent([menu.anchorobj, menu.dropmenu, menu.shadow], function(e){ //MOUSEOVER event for anchor, dropmenu, shadow
		var menu=anylinkcssmenu.menusmap[this._internalID]
		if (this._isanchor && menu.revealtype=="mouseover" && !anylinkcssmenu.isContained(this, e)){ //event for anchor
			anylinkcssmenu.showmenu(menu.id)
		}
		else if (typeof this._isanchor=="undefined"){ //event for drop down menu and shadow
			clearTimeout(menu.hidetimer)
		}
	}, "mouseover")
	this.addEvent([menu.anchorobj, menu.dropmenu, menu.shadow], function(e){ //MOUSEOUT event for anchor, dropmenu, shadow
		if (!anylinkcssmenu.isContained(this, e)){
			var menu=anylinkcssmenu.menusmap[this._internalID]
			menu.hidetimer=setTimeout(function(){anylinkcssmenu.hidemenu(menu.id)}, anylinkcssmenu.effects.delayhide)
		}
	}, "mouseout")
	this.addEvent([menu.anchorobj, menu.dropmenu], function(e){ //CLICK event for anchor, dropmenu
		var menu=anylinkcssmenu.menusmap[this._internalID]
		if ( this._isanchor && menu.revealtype=="click"){
			if (menu.dropmenu.style.display=="block")
				anylinkcssmenu.hidemenu(menu.id)
			else
				anylinkcssmenu.showmenu(menu.id)
			if (e.preventDefault)
				e.preventDefault()
			return false
		}
		else
			menu.hidetimer=setTimeout(function(){anylinkcssmenu.hidemenu(menu.id)}, anylinkcssmenu.effects.delayhide)
	}, "click")
},

init:function(targetclass){
	var anchors=this.getElementsByClass(targetclass)
	for (var i=0; i<anchors.length; i++){
		this.setupmenu(targetclass, anchors[i], i)
	}
}

}

function ShowAddReview(){
var object = document.getElementById("ajaxreturn");
object.innerHTML = "";

var showobject1 = document.getElementById("addreview");
showobject1.style['display'] = "block";

}

function HideAddReview(){
var showobject2 = document.getElementById("addreview");
showobject2.style['display'] = "none";

}
function ShowLoading(){
var showobject3 = document.getElementById("loading");
showobject3.style['display'] = "block";

}

function HideLoading(){
var showobject4 = document.getElementById("loading");
showobject4.style['display'] = "none";

}

function DismissMessage(){
var object = document.getElementById("ajaxreturn");
object.innerHTML = "";

}

/*
Form field Limiter script- By Dynamic Drive
For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
This credit MUST stay intact for use
*/

var ns6=document.getElementById&&!document.all

function restrictinput(maxlength,e,placeholder){
if (window.event&&event.srcElement.value.length>=maxlength)
return false
else if (e.target&&e.target==eval(placeholder)&&e.target.value.length>=maxlength){
var pressedkey=/[a-zA-Z0-9\.\,\/]/ //detect alphanumeric keys
if (pressedkey.test(String.fromCharCode(e.which)))
e.stopPropagation()
}
}

function countlimit(maxlength,e,placeholder){
var theform=eval(placeholder)
var lengthleft=maxlength-theform.value.length
var placeholderobj=document.all? document.all[placeholder] : document.getElementById(placeholder)
if (window.event||e.target&&e.target==eval(placeholder)){
if (lengthleft<0)
theform.value=theform.value.substring(0,maxlength)
placeholderobj.innerHTML=lengthleft
}
}


function displaylimit(thename, theid, thelimit){
var theform=theid!=""? document.getElementById(theid) : thename
var limit_text='<b><span id="'+theform.toString()+'">'+thelimit+'</span></b> characters remaining on your input limit'
if (document.all||ns6)
document.write(limit_text)
if (document.all){
eval(theform).onkeypress=function(){ return restrictinput(thelimit,event,theform)}
eval(theform).onkeyup=function(){ countlimit(thelimit,event,theform)}
}
else if (ns6){
document.body.addEventListener('keypress', function(event) { restrictinput(thelimit,event,theform) }, true); 
document.body.addEventListener('keyup', function(event) { countlimit(thelimit,event,theform) }, true); 
}
}

function fetchData(url,objectID){

var pageRequest = false;
if (window.XMLHttpRequest)pageRequest = new XMLHttpRequest();
else if (window.ActiveXObject) pageRequest = new ActiveXObject("Microsoft.XMLHTTP");
else return false;

pageRequest.onreadystatechange = function(){
if (pageRequest.readyState == 4 && pageRequest.status == 200){
var object = document.getElementById(objectID);
object.innerHTML = pageRequest.responseText;
}
else{
var object = document.getElementById(objectID);
object.innerHTML = "<div id='ajaxloading'><img alt='Please Wait: Loading....' src='../../images/progress_loading_bar_circle_150x150_trans.gif' /></div>";

}



}
pageRequest.open('GET',url,true);
pageRequest.send(null);


}

function formData(form){

var nameText = form.userID.value;

alert (nameText);


}

function AddFormationReview(form,objectID){
HideAddReview();

for (var i = 0; i < form.FormationRating.length; i++){
	if (form.FormationRating[i].checked){
	break;
	}
	}


var rating = form.FormationRating[i].value;
var user = form.UserID.value;
var formation = form.FormationID.value;
var text = form.comments.value;

var url = "../../php/add_review.php?userid="+user+"&formationid="+formation+"&rating="+rating+"&text="+text


var pageRequest = false;
if (window.XMLHttpRequest)pageRequest = new XMLHttpRequest();
else if (window.ActiveXObject) pageRequest = new ActiveXObject("Microsoft.XMLHTTP");
else return "<div id='failmsg'>fail</div>";

pageRequest.onreadystatechange = function(){
if (pageRequest.readyState == 4 && pageRequest.status == 200){
var object = document.getElementById(objectID);
object.innerHTML = pageRequest.responseText;
}
else if (pageRequest.readyState == 4 && pageRequest.status == 404){
var object = document.getElementById(objectID);
object.innerHTML = "page not found-404";
}



else{
var object = document.getElementById(objectID);
object.innerHTML = "<div id='loading'><img alt='Loading....' src='../../../images/progress_loading_bar_circle_150x150.gif' /></div>";
}



}

pageRequest.open('GET',url,true);
pageRequest.send(null);

}

function HideObject(objectID){

var object = document.getElementById("default");
object.style['display'] = "none";

var object = document.getElementById("pdf");
object.style['display'] = "none";

var object = document.getElementById("cd");
object.style['display'] = "none";

var object = document.getElementById("printed");
object.style['display'] = "none";


var object = document.getElementById(objectID);
object.style['display'] = "block";

}

function ShowObject(objectID){
var object = document.getElementById(objectID);
object.style['display'] = "none";

var object = document.getElementById("default");
object.style['display'] = "block";


}

function SwitchProductTabs(objectID){

var object = document.getElementById("info");
object.style['display'] = "none";

var object = document.getElementById("details");
object.style['display'] = "none";

var object = document.getElementById("features");
object.style['display'] = "none";


var object = document.getElementById(objectID);
object.style['display'] = "block";

switch (objectID){

case 'info':
var object = document.getElementById('infotab');
object.style['backgroundColor'] = "#3399FF";

var object = document.getElementById('detailtab');
object.style['backgroundColor'] = "#333333";

var object = document.getElementById('featuretab');
object.style['backgroundColor'] = "#333333";

break;

case 'details':
var object = document.getElementById('infotab');
object.style['backgroundColor'] = "#333333";

var object = document.getElementById('detailtab');
object.style['backgroundColor'] = "#3399FF";

var object = document.getElementById('featuretab');
object.style['backgroundColor'] = "#333333";

break;

case 'features':
var object = document.getElementById('infotab');
object.style['backgroundColor'] = "#333333";

var object = document.getElementById('detailtab');
object.style['backgroundColor'] = "#333333";

var object = document.getElementById('featuretab');
object.style['backgroundColor'] = "#3399FF";

break;



}

}

function ShowAjaxForm(objectID){

var object = document.getElementById(objectID);
object.style['display'] = "block";

}

function LoadGreyBox(){

window.onclick = window.scroll(0,0);

var screenHeight = document.body.clientHeight;
var screenWidth = document.body.clientWidth;

var object = document.getElementById('trans');
object.style['display'] = "block";
object.style['height'] = screenHeight;
object.style['width'] = screenWidth;
object.style['opacity'] = .75;


var object = document.getElementById('cartwindow');
object.style['display'] = "block";








}

function HideGreyBox(id){
document.window.location.replace("http://www.football-plays.com/products/beginner-i-formation-playbook-download.php?"+id);

var object = document.getElementById('trans');
object.style['display'] = "none";

var object = document.getElementById('cartwindow');
object.style['display'] = "none";
}

function AddtoCart(productid,form,sessionid,fid,refer){

//LoadGreyBox()

var object = document.getElementById('cartwindow');
object.style['display'] = "block";
//SetMiddle('cartwindow');

var object = document.getElementById('trans');
object.style['display'] = "block";
object.style['opacity'] = .75;



var qty = form.ItemQty.value;

var sessionTest = sessionid.length;

if (sessionTest > 127){
var url = "http://www.football-plays.com/secure/cart/ajax/add_to_cart.php?productid="+productid+"&qty="+qty+"&uid="+sessionid+"&fid="+fid+"&refer="+refer;
}
else{
var url = "http://www.football-plays.com/secure/cart/ajax/add_to_cart.php?productid="+productid+"&qty="+qty;

}

var object = document.getElementById('cartwindow');
object.innerHTML = "<img alt='Loading....' src='../../images/progress_loading_bar_circle_150x150.gif' />";



fetchData(url,'cartwindow')

}



function ShowCartPreview(){

var object = document.getElementById('cartpreview');
object.style['display'] = "block";



}
function HideCartPreview(){

var object = document.getElementById('cartpreview');
object.style['display'] = "none";



}

function ShowEmailBox(){
window.onclick = window.scroll(0,0);

var screenHeight = document.body.clientHeight;
var screenWidth = document.body.clientWidth;

var object = document.getElementById('trans');
object.style['display'] = "block";
//object.style['height'] = screenHeight;
//object.style['width'] = screenWidth;
object.style['opacity'] = .75;


var object = document.getElementById('emailwindow');
object.style['display'] = "block";
//SetMiddle('emailwindow');
//object.innerHTML = "<div id='ajaxloading'><img alt='Loading....' src='../../images/progress_loading_bar_circle_150x150.gif' /></div>";

}
function HideEmailBox(){

var object = document.getElementById('trans');
object.style['display'] = "none";

var object = document.getElementById('emailwindow');
object.style['display'] = "none";
}

function MailtoFriend(form){

var from_name = form.FromName.value;
var from_address = form.FromEmail.value;
var to_name = form.ToName.value;
var to_address = form.ToEmail.value;
var msg = form.EmailMessage.value;
var page = document.getElementById('url').value;
//alert(page);
var url = "http://www.football-plays.com/php/mail_to_friend.php?from_name="+from_name+"&from_address="+from_address+"&to_name="+to_name+"&to_address="+to_address+"&msg="+msg+"&page="+page;

fetchData(url,'emailwindow')


}

function SubFeedBurner(){
window.onclick = window.scroll(0,0);

var screenHeight = document.body.clientHeight;
var screenWidth = document.body.clientWidth;

var object = document.getElementById('trans');
object.style['display'] = "block";
object.style['height'] = screenHeight;
object.style['width'] = screenWidth;
object.style['opacity'] = .75;

var object = document.getElementById('emailwindow');
object.style['display'] = "block";
SetMiddle(object);


}

function SendtoFeedBurner(form){
var email = form.email.value;
var url = "http://feedburner.google.com/fb/a/mailverify?uri=YouthBasketballCoachingBlog&email="+email;

fetchData(url,'emailwindow')

}
function ShowFBForm(){

var object = document.getElementById('featureiconwrapper');
object.style['display'] = "none";

var object = document.getElementById('feedburnerform');
object.style['display'] = "block";

}

function HideFBForm(){

var object = document.getElementById('featureiconwrapper');
object.style['display'] = "block";

var object = document.getElementById('feedburnerform');
object.style['display'] = "none";

}


function ShowAjaxLinks(){
changecss(".ajaxarticlelink","display","block");
}


function ShowEntireBlog(id,uid,fid){

var object = document.getElementById('iconbarfooter');
object.style['display'] = "none";

var object = document.getElementById('footeradspace');
object.style['display'] = "block";



var object = "article"+id;

var url ="http://www.football-plays.com/php/getblog.php?id="+id+"&uid="+uid+"&fid="+fid;
fetchData(url,object);
}

function ShortBlog(uid,fid){

var object = document.getElementById('iconbarfooter');
object.style['display'] = "block";

var object = document.getElementById('footeradspace');
object.style['display'] = "none";



var url = "http://www.football-plays.com/php/getshortblog.php?&uid="+uid+"&fid="+fid;
fetchData(url,'articles');


}

function AddBlogTag(form){
var id =		form.ArticleID.value;
var name =	form.TagName.value;

var url = "http://www.football-plays.com/php/addtag.php?id="+id+"&name="+name;

fetchData(url,'addtag')


}

function ShowAddTag(){

var object = document.getElementById('addtag');
object.style['display'] = "block";

}

function LoadWindow(){
// This function does not set the h/w of the trans box, the SetTransSize handles that on page load.
//This function only displays the trans box.

window.onclick = window.scroll(0,0);

var object = document.getElementById('trans');
object.style['display'] = "block";
object.style['opacity'] = .75;


var object = document.getElementById('window');
object.style['display'] = "block";


}

function CloseWindow(){
// This function does not set the h/w of the trans box, the SetTransSize handles that on page load.
//This function only displays the trans box.

window.onclick = window.scroll(0,0);

var object = document.getElementById('trans');
object.style['display'] = "none";


var object = document.getElementById('window');
object.style['display'] = "none";

}


function SetTransSize(){
	if (window.innerHeight && window.scrollMaxY) {// Firefox
		yWithScroll = window.innerHeight + window.scrollMaxY;
		xWithScroll = window.innerWidth + window.scrollMaxX;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		yWithScroll = document.body.scrollHeight;
		xWithScroll = document.body.scrollWidth;
	} else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
		yWithScroll = document.body.offsetHeight+40;
		xWithScroll = document.body.offsetWidth+40;
  	}
	arrayPageSizeWithScroll = new Array(xWithScroll,yWithScroll);
	//alert( 'The height is ' + yWithScroll + ' and the width is ' + xWithScroll );
	//return arrayPageSizeWithScroll;
	
var object = document.getElementById('trans');

object.style['height'] = yWithScroll+"px";
object.style['width'] = xWithScroll+"px";
object.style['top'] = "-20px";
object.style['left'] = "-20px";

var object2 = document.getElementById("cartwindow");
object2.style['top'] = (yWithScroll/4)+getScrollY()+"px";

var object2 = document.getElementById("emailwindow");
object2.style['top'] = (yWithScroll/4)+getScrollY()+"px";


}

function getScrollY() {
  var scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    //scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
   // scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
   // scrOfX = document.documentElement.scrollLeft;
  }
  return scrOfY;
}


//function ProcessAddComment(form){

//var name = form.FirstName.value;
//var email = form.EmailAddress.value;
//var id = form.ArticleID.value;
//var return_url = form.ReturnUrl.value;
//var text = form.CommentText.value;
//var uid = form.uid.value;
 //alert (uid);

//var object = document.getElementById('blogcommentsarea');
//object.style['display'] = "none";

//var object = document.getElementById('processreturn');
//object.style['display'] = "block";


 
//var url = "http://www.football-plays.com/php/processcomment.php?uid="+uid+"&name="+name+"&email="+email+"&article="+id+"&return="+return_url+"&text="+text;

//fetchData(url,'blogcommentsarea');
//}

function CommentsCreateAccount(form){
var id = form.ArticleID.value;
var return_url = form.ReturnUrl.value;
var uid = form.uid.value;
var fid = form.fid.value;

var url = "http://www.football-plays.com/php/commentsadduser.php?uid="+uid+"&article="+id+"&return="+return_url+"&fid="+fid;
fetchData(url,'blogcommentsarea');


}

function CheckPassword(form){

var password1 = form.Password1.value;
var password2 = form.Password2.value;
var passwordlength1 = form.Password1.value.length;
var passwordlength2 = form.Password1.value.length;


//alert (length1);

if(password1===password2 & passwordlength1 > 0){
//alert ("passwords match");
var object = document.getElementById('checkmark1');
object.style['display'] = "block";

var object = document.getElementById('checkmark2');
object.style['display'] = "block";


var object = document.getElementById('pass1');
object.style.backgroundColor = "#CAFFCA";


var object = document.getElementById('pass2');
object.style.backgroundColor = "#CAFFCA";


}
else{
//alert ("passwords do not match");
var object = document.getElementById('checkmark1');
object.style['display'] = "none";

var object = document.getElementById('pass1');
object.style.backgroundColor = "#FFC1C1";



var object = document.getElementById('checkmark2');
object.style['display'] = "none";

var object = document.getElementById('pass2');
object.style.backgroundColor = "#FFC1C1";

}

}
function CheckLastName(form){
var lastname = form.LastName.value.length;

if(lastname > 1){
var object = document.getElementById('Last');
object.style.backgroundColor = "#CAFFCA";

}
else{
var object = document.getElementById('Last');
object.style.backgroundColor = "#FFC1C1";

}
}

function CheckFirstName(form){
var firstname = form.FirstName.value.length;

if(firstname > 1){
var object = document.getElementById('First');
object.style.backgroundColor = "#CAFFCA";

}
else{
var object = document.getElementById('First');
object.style.backgroundColor = "#FFC1C1";

}
}

function CheckScreenName(form){
var screenname = form.ScreenName.value.length;

if(screenname > 4){
var object = document.getElementById('Screen');
object.style.backgroundColor = "#CAFFCA";

//var url="http://www.football-plays.com/php/checkscreenname.php?name="+screenname;

//fetchData(url,'screencheck');
}
else{
var object = document.getElementById('Screen');
object.style.backgroundColor = "#FFC1C1";

}
}


function CheckEmail(form){
var email = form.EmailAddress.value.length;

if(email > 5){
var object = document.getElementById('Email');
object.style.backgroundColor = "#CAFFCA";

}
else{
var object = document.getElementById('Email');
object.style.backgroundColor = "#FFC1C1";

}
}

function CheckText(form){
var object = document.getElementById('Text');
var text = object.value.length;

if(text == 0){
var object = document.getElementById('Text');
object.style.backgroundColor = "#FFC1C1";

}
else if(text >300){
var object = document.getElementById('Text');
object.style.backgroundColor = "#FFC1C1";

}
else{
var object = document.getElementById('Text');
object.style.backgroundColor = "#CAFFCA";

}
}





function ValidateNewUser(form){

//CheckFirstName(form);
//CheckLastName(form);

//CheckEmail(form);
//CheckScreenName(form);
//CheckPassword(form);
//CheckTextName(form);



var password1 = form.Password1.value;
var password2 = form.Password2.value;
var firstname = form.FirstName.value;
var lastname = form.LastName.value;
var displayname = form.ScreenName.value;
var email = form.EmailAddress.value;
var id = form.ArticleID.value;
var return_url = form.ReturnUrl.value;
var uid = form.uid.value;
var fid = form.fid.value;
var question = form.SecurityQuestion.value;
var answer = form.SecurityAnswer.value;

var url = "http://www.football-plays.com/php/commentsverifyuser.php?uid="+uid+"&firstname="+firstname+"&lastname="+lastname+"&email="+email+"&displayname="+displayname+"&password1="+password1+"&password2="+password2+"&article="+id+"&return="+return_url+"&fid="+fid+"&question="+question+"&answer="+answer;
fetchData(url,'blogcommentsarea');

}

function CommentsLogin(form){

var email = form.EmailAddress.value;
var password = form.Password.value;
var uid = form.uid.value;
var fid = form.fid.value;
var id = form.ArticleID.value;
var return_url = form.ReturnUrl.value;

var url = "http://www.football-plays.com/php/postcomments_verifylogin.php?uid="+uid+"&email="+email+"&password="+password+"&article="+id+"&return="+return_url+"&fid="+fid;
fetchData(url,'blogcommentsarea');

}

function ProcessAddComment(form){

var id = form.ArticleID.value;
var text = form.CommentText.value;
var uid = form.uid.value;
var fid = form.fid.value;
var returnurl = form.ReturnUrl.value;



var url = "http://www.football-plays.com/php/addcomments.php?uid="+uid+"&article="+id+"&return="+returnurl+"&fid="+fid+"&text="+text;

var pageRequest = false;
if (window.XMLHttpRequest)pageRequest = new XMLHttpRequest();
else if (window.ActiveXObject) pageRequest = new ActiveXObject("Microsoft.XMLHTTP");
else return false;

pageRequest.onreadystatechange = function(){
if (pageRequest.readyState == 4 && pageRequest.status == 200){
var object = document.getElementById('blogcommentsarea');

var msg = pageRequest.responseText;


	if(msg ==1){
	LoadWindow();
	LoadCommentWindow(uid,fid,returnurl)
	object.innerHTML = "Comment Added";
	}
	else{
	object.innerHTML = pageRequest.responseText;
	}
	
}
else{
var object = document.getElementById('blogcommentsarea');
object.innerHTML = "<div id='ajaxloading'><img alt='Loading....' src='../../images/progress_loading_bar_circle_150x150_trans.gif' /></div>";

}



}
pageRequest.open('GET',url,true);
pageRequest.send(null);




}
function LoadCommentWindow(uid,fid,return_url){


var url = "http://www.football-plays.com/php/commentwindow.php?uid="+uid+"&fid="+fid+"&return="+return_url;

fetchData(url,'window');
}

function DisplayComments(article,count){


var url = "http://www.football-plays.com/php/displaycomments.php?article="+article+"&count="+count;

fetchData(url,'commentbox');
}

function ShowVoteBox(){
var object = document.getElementById('formationvote');
object.style.display = "block";
}


//start function
function ProcessVote(vote,formation){

//alert("formation: "+formation);

var url = "http://www.football-plays.com/php/processvote.php?vote="+vote+"&formation="+formation;

var pageRequest = false;
if (window.XMLHttpRequest)pageRequest = new XMLHttpRequest();
else if (window.ActiveXObject) pageRequest = new ActiveXObject("Microsoft.XMLHTTP");
else return false;

pageRequest.onreadystatechange = function(){
if (pageRequest.readyState == 4 && pageRequest.status == 200){
var object = document.getElementById('formationvote');

var msg = pageRequest.responseText;

object.innerHTML = "<div class='votemsg'>"+msg+"</div>";

}
	
else{
var object = document.getElementById('formationvote');
object.innerHTML = "<div class='votemsg'><img alt='Loading....' src='../../images/progress_loading_bar_circle_150x150_trans.gif' width='100' height='100' /></div>";

}



}
pageRequest.open('GET',url,true);
pageRequest.send(null);





}


//end function


//start function
function AddReply(ticket,from){

var txt = document.getElementById('addreply').value;

var url = "addreply.php?ticket="+ticket+"&from="+from+"&txt="+txt;

////////////////////////////////////////////////////////////////////////
function HideObject(object){

var hide = document.getElementById(object);
hide.style['display'] = "none";
}

function SwitchDisplay(displayobj,hideobj){

var object = document.getElementById(displayobj);
object.style['display'] = "block";

var object = document.getElementById(hideobj);
object.style['display'] = "none";


}
//////////////////////////////////////////////////////////////////////////////


SwitchDisplay('replytrans','replybox');

//////////ajax
var pageRequest = false;
if (window.XMLHttpRequest)pageRequest = new XMLHttpRequest();
else if (window.ActiveXObject) pageRequest = new ActiveXObject("Microsoft.XMLHTTP");
else return false;



pageRequest.onreadystatechange = function(){
	if (pageRequest.readyState == 4 && pageRequest.status == 200){

	//return data and error/success msg handling
	var ajaxreturn = pageRequest.responseText;
	
		
	if(ajaxreturn==0){
	
	
	returnobject = document.getElementById('replysuccess')
	returnobject.style['display'] = "block";
	returnobject.innerHTML = "Your reply has been posted and we will review your ticket.";
	SwitchDisplay('replybox','replytrans')

	
	
	
	}
	else{
	returnobject = document.getElementById('replyerror')
	returnobject.style['display'] = "block";
	returnobject.innerHTML = "There has been an error please try again.";
	SwitchDisplay('replybox','replytrans')

	}
		
		
	}
	else{
	//loading msg
	}



}
pageRequest.open('GET',url,true);
pageRequest.send(null);


//////////ajax

}

//start function