
var preEl ;
var orgBColor;
var orgTColor;
function HighLightTR(backColor,textColor){
  if(typeof(preEl)!='undefined') {
     preEl.bgColor=orgBColor;
     try{ChangeTextColor(preEl,orgTColor);}catch(e){;}
     }
  var el = event.srcElement;
  el = el.parentElement;
  orgBColor = el.bgColor;
  orgTColor = el.style.color;
  el.bgColor=backColor;

  try{ChangeTextColor(el,textColor);}catch(e){;}
  preEl = el;
  }

function ChangeTextColor(a_obj,a_color){  ;
   for (i=0;i<a_obj.cells.length;i++)
    a_obj.cells(i).style.color=a_color;
    }

///////////////////////////







///Validation functions

function IsEmpty(avalue) {
   if ((avalue.length==0) ||
   (avalue==null)) {
      return true;
   }
   else { return false; }
}	


//////////////////////////




///dhtml window////////////////

var dragapproved=false
var minrestore=0
var initialwidth,initialheight
var ie5=document.all&&document.getElementById
var ns6=document.getElementById&&!document.all

function iecompattest(){
return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function drag_drop(e){
if (ie5&&dragapproved&&event.button==1){
document.getElementById("dwindow").style.left=tempx+event.clientX-offsetx+"px"
document.getElementById("dwindow").style.top=tempy+event.clientY-offsety+"px"
}
else if (ns6&&dragapproved){
document.getElementById("dwindow").style.left=tempx+e.clientX-offsetx+"px"
document.getElementById("dwindow").style.top=tempy+e.clientY-offsety+"px"
}
}

function initializedrag(e){
offsetx=ie5? event.clientX : e.clientX
offsety=ie5? event.clientY : e.clientY
//document.getElementById("dwindowcontent").style.display="none" //extra
tempx=parseInt(document.getElementById("dwindow").style.left)
tempy=parseInt(document.getElementById("dwindow").style.top)

dragapproved=true
document.getElementById("dwindow").onmousemove=drag_drop
}

function loadwindow(url,width,height){
if (!ie5&&!ns6)
window.open(url,"","width=width,height=height,scrollbars=1")
else{
document.getElementById("dwindow").style.display='none'
document.getElementById("dwindow").style.width=initialwidth=width+"px"
document.getElementById("dwindow").style.height=initialheight=height+"px"
//document.getElementById("dwindow").style.left="190px"
//document.getElementById("dwindow").style.top="195px"
document.getElementById("cframe").src=url
document.getElementById("dwindow").style.display=''
document.getElementById("publisherdiv_content").style.display='none'
}
}

function maximize(){
if (minrestore==0){
minrestore=1 //maximize window
document.getElementById("maxname").setAttribute("src","images/icons/restore.gif")
document.getElementById("dwindow").style.width=ns6? window.innerWidth-20+"px" : iecompattest().clientWidth+"px"
document.getElementById("dwindow").style.height=ns6? window.innerHeight-20+"px" : iecompattest().clientHeight+"px"
}
else{
minrestore=0 //restore window
document.getElementById("maxname").setAttribute("src","images/icons/max.gif")
document.getElementById("dwindow").style.width=initialwidth
document.getElementById("dwindow").style.height=initialheight
}
document.getElementById("dwindow").style.left=ns6? window.pageXOffset+"px" : iecompattest().scrollLeft+"px"
document.getElementById("dwindow").style.top=ns6? window.pageYOffset+"px" : iecompattest().scrollTop+"px"
}

function closeit(){
document.getElementById("cframe").src="/mypepsicopublisher/jsp/wait.jsp";
document.getElementById("dwindow").style.display="none"
document.getElementById("publisherdiv_content").style.display=''
}

function stopdrag(){
dragapproved=false;
document.getElementById("dwindow").onmousemove=null;
document.getElementById("dwindowcontent").style.display="" //extra
}



//////////////////////////////

function openDialog(url,w,h) {
	var url = url;
	var myname = 'SMT';
	//var w = 500;
	//var h = 400;
	var scroll = 'yes'; 
	var resize = 'yes'; 
	var location = 'no'; 
	var toolbar = 'no'; 
	var statusbar = 'yes'; 
			
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	var props = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',status='+statusbar+',resizable='+resize+',toolbar='+toolbar+',location='+location;
	
	try{
	popupWin = window.open(url, myname, props);
	}
	catch(e)
	{ 
		alert("A popup blocker is preventing SmarTennis from opening a new window.\nPlease disable your popup blocker to enable this feature to function properly");
	}

	popupWin.focus();
	
}




function toggleBox(szDivID, iState) // 1 visible, 0 hidden
{
    if(document.layers)	   //NN4+
    {
       document.layers[szDivID].visibility = iState ? "show" : "hide";
    }
    else if(document.getElementById)	  //gecko(NN6) + IE 5+
    {
        var obj = document.getElementById(szDivID);
        obj.style.visibility = iState ? "visible" : "hidden";
        obj.style.display= iState ? "block" : "none";
    }
    else if(document.all)	// IE 4
    {
        document.all[szDivID].style.visibility = iState ? "visible" : "hidden";
    }
}



	
	 function getResponse(targetRequestURL) 
	 {
	
		//  document.getElementById('loadingdiv').style.display = 'block';
	
	
	      var myAjax = new Ajax.Request( targetRequestURL, 
						{
							method: 'get', 
							onComplete: showResponse
						});
	  }
	
	  function showResponse(originalRequest) {
	     $('ajaxmaindiv').innerHTML = originalRequest.responseText;
	  }
	  

		









