
// CODIGO DE ROLLOVER DE COLOR DE CELDAS

function cOvr(src) {
if (!src.contains(event.fromElement)) {
src.style.cursor = 'hand';
}
}

function cOut(src) {
if (!src.contains(event.toElement)) {
src.style.cursor = 'default';
}
}

function mOvr(src,clrOver) {
if (!src.contains(event.fromElement)) {
src.style.cursor = 'hand';
src.bgColor = clrOver;
}
}

function mOut(src,clrIn) {
if (!src.contains(event.toElement)) {
src.style.cursor = 'default';
src.bgColor = clrIn;
}
}

function mClk(src) {
if(event.srcElement.tagName=='TD'){
src.children.tags('A')[0].click();
}
}
// FIN DE ROLLOVER CELDAS
function buscaren() {
	var sel=false
	var formb= document.forms["b"]
	var query= escape (formb.query.value)
	for (var i=0;i < formb.b.length ; i++ )
	{
		if (formb.b[i].checked)	{ 
			sel= true
			break	}
	}
	if (sel)
	{
			openwin (formb.b[i].value + query, "600", "400", 1)
	}

}

//drag drop function for IE 4+//////
/////////////////////////////////
var dragapproved=false
var layername
var lastbox

function initializedragie(layername){
iex=event.clientX;
iey=event.clientY;
tempx=layername.style.pixelLeft;
tempy=layername.style.pixelTop;

dragapproved=true;
// metodo ejecutado onmousemove 
document.onmousemove=function (){
if (dragapproved){
	layername.style.pixelLeft=tempx+event.clientX-iex;
	layername.style.pixelTop=tempy+event.clientY-iey;

//     ^  Now works with multiple windows
 return false;
	}
}
}

if (document.all){
document.onmouseup=new Function("dragapproved=false")
}

////drag drop functions end here//////

function hidebox(layername){
if (document.all)
layername.style.visibility="hidden"
else if (document.layers)
document.eval("layername").visibility="hide"
}
function showbox(layername){
// closes the last window before opening the next
if (lastbox){
	hidebox(lastbox)
	}
	lastbox=layername;
	//end of closing, now open the next window
if (document.all)
layername.style.visibility="visible"
else if (document.layers)
document.eval("layername").visibility="visible"
}

//// end of drag drop ////

//drag drop function for NS 4////
/////////////////////////////////
var dragswitch=0
var nsx
var nsy
var nstemp

function drag_dropns(layername){
temp=eval(name)
temp.captureEvents(Event.MOUSEDOWN | Event.MOUSEUP)
temp.onmousedown=gons
temp.onmousemove=dragns
temp.onmouseup=stopns
}

function gons(e){
temp.captureEvents(Event.MOUSEMOVE)
nsx=e.x
nsy=e.y
}
function dragns(e){
if (dragswitch==1){
temp.moveBy(e.x-nsx,e.y-nsy)
return false
}
}

function stopns(){
temp.releaseEvents(Event.MOUSEMOVE)
}
  
// Open a centered window  ////////
////////////////////////////////
function openScrollwin(url,w,h,scroll)
{
scrwidth=screen.width;scrheight=screen.height;
leftmargin = (scrwidth - w)/2;topmargin = (scrheight - h)/2;
props = "left=" + leftmargin + ",";props = props + "top=" + topmargin + ",";props = props + "width=" + w+ ",";props = props + "height=" + h+ ",";
var windowprops= "left=" + leftmargin +",top=" + topmargin +",width="+w+",height="+h+",resizable=0,location=no,scrollbars=1";
popup=window.open(url,'pop',windowprops);
popup.focus();
}

function openwin(url,w,h,scroll)
{
scrwidth=screen.width;scrheight=screen.height;
leftmargin = (scrwidth - w)/2;topmargin = (scrheight - h)/2;
props = "left=" + leftmargin + ",";props = props + "top=" + topmargin + ",";props = props + "width=" + w+ ",";props = props + "height=" + h+ ",";
var windowprops= "left=" + leftmargin +",top=" + topmargin +",width="+w+",height="+h+",resizable=0,location=no,scrollbars="+ scroll;
popup=window.open(url,'pop',windowprops);
popup.focus();
}

function openwin2(url,w,h,scroll)
{
scrwidth=screen.width;scrheight=screen.height;
leftmargin = (scrwidth - w)/2;topmargin = (scrheight - h)/2;
props = "left=" + leftmargin + ",";props = props + "top=" + topmargin + ",";props = props + "width=" + w+ ",";props = props + "height=" + h+ ",";
var windowprops= "left=" + leftmargin +",top=" + topmargin +",width="+w+",height="+h+",resizable=0,location=no,scrollbars="+ scroll;
popup=window.open(url,'pop2',windowprops);
popup.focus();
}

function getSelectedRadio(buttonGroup) {
   // returns the array number of the selected radio button or -1 if no button is selected
   if (buttonGroup[0]) { // if the button group is an array (one button is not an array)
      for (var i=0; i<buttonGroup.length; i++) {
         if (buttonGroup[i].checked) {
            return i
         }
      }
   } else {
      if (buttonGroup.checked) { return 0; } // if the one button is checked, return zero
   }
   // if we get to this point, no radio button is selected
   return -1;
} // Ends the "getSelectedRadio" function

function getSelectedCheckbox(buttonGroup) {
   // Go through all the check boxes. return an array of all the ones
   // that are selected (their position numbers). if no boxes were checked,
   // returned array will be empty (length will be zero)
   var retArr = new Array();
   var lastElement = 0;
   if (buttonGroup[0]) { // if the button group is an array (one check box is not an array)
      for (var i=0; i<buttonGroup.length; i++) {
         if (buttonGroup[i].checked) {
            retArr.length = lastElement;
            retArr[lastElement] = i;
            lastElement++;
         }
      }
   } else { // There is only one check box (it's not an array)
      if (buttonGroup.checked) { // if the one check box is checked
         retArr.length = lastElement;
         retArr[lastElement] = 0; // return zero as the only array value
      }
   }
   return retArr;
} // Ends the "getSelectedCheckbox" function
