﻿// JScript File


function confirmMsg(frm)
{
  // loop through all elements
  for (i = 0; i < frm.length; i++)
  {
    // Look for our checkboxes only
    if (frm.elements[i].name.indexOf("deleteRec") !=  - 1)
    {
      // If any are checked then confirm alert, otherwise nothing happens
      if (frm.elements[i].checked)
      return confirm('Are you sure you want to delete your selection(s)?')
    }
  }
}





function SelectRow()
{
    var obj = window.event.srcElement;
    if(obj.tagName=="INPUT")    //this is a checkbox
    {
        checkRowOfObject(obj);
    }
        else if (obj.tagName=="TD") //this a table cell
    {
        //get a pointer to the tablerow
        var row = obj.parentNode;
        
    	var chk = row.cells[0].firstChild;
    	chk.checked = !chk.checked;
	    if (chk.checked)
	    {
	        row.className="SelectedRow";
	    }
	    else
	    {
            document.all.ctl00_ContentPlaceHolder1_btnDelete.disabled = true;
	        row.className="";alert(row);
	    }
	}
}

function checkRowOfObject(obj)
{
    if (obj.checked)
    {
        document.all.ctl00_ContentPlaceHolder1_btnDelete.disabled = false;
        obj.parentNode.parentNode.className="SelectedRow";
    }
    else
    {
        document.all.ctl00_ContentPlaceHolder1_btnDelete.disabled = true;
        obj.parentNode.parentNode.className="";        
        chkRow();
    }
}


function SelectAllRows()
{
   var chkAll = window.event.srcElement; 
   var tbl = chkAll.parentNode.parentNode.parentNode.parentNode;
   
   if (chkAll)
   {
//Notice that I have a footer on the table
//so I use tbl.rows.length -1 but if
//you do not have a footer then use tbl.rows.length
   	//in the following condition
        for(var i=1;i<tbl.rows.length-1;i++)
        {
            var chk = tbl.rows[i].cells[0].firstChild;
            chk.checked=chkAll.checked;
            checkRowOfObject(chk);
        }
   }
}

function chkRow()
{
    var chkAll = window.event.srcElement; 
    var tbl = chkAll.parentNode.parentNode.parentNode.parentNode;
    
    for(var i=1;i<tbl.rows.length-1;i++)
    {
        var chk = tbl.rows[i].cells[0].firstChild;
        if (chk.checked) 
        {
            document.all.ctl00_ContentPlaceHolder1_btnDelete.disabled = false;
            break;
        }
    }    
}



var newWin = null;
function popUp(strURL, strType, strHeight, strWidth) {
    if (newWin != null && !newWin.closed)
        newWin.close();
 
    var strOptions="";
    if (strType=="console")
        strOptions="resizable,height="+
        strHeight+",width="+strWidth;
    
    if (strType=="fixed")
        strOptions="status,height="+
        strHeight+",width="+strWidth;
    
    if (strType=="elastic")
        strOptions="toolbar,menubar,scrollbars,"+
            "resizable,location,height="+
            strHeight+",width="+strWidth;
        
        newWin = window.open(strURL, 'newWinx', strOptions);
        newWin.focus();
}

function lH(url) {
	if(document.createElement && document.documentElement){
		frame = document.createElement('iframe');
		frame.setAttribute('width', '0');
		frame.setAttribute('height', '0');
		frame.setAttribute('frameborder', '0');
		frame.setAttribute('src', url);
		document.documentElement.appendChild(frame);
	} else {
		location.href = url;
	}
}
function openplayer(Station) {
var newwin;
var url = 'http://66.228.115.186/listen/player.asp?station='+Station+'&'
//var url = 'http://208.106.212.19/listen/player.asp?station='+Station+'&'
newwin=
window.open (url,'player',"height=391,width=761,toolbar=0,scrollbars=0,statusbar=0,menubar=0,resizable=0,left=20,top=20,screenX=20,screenY=20");
}
    
    
    
