﻿function IsNumeric(strString)   
{
  var strValidChars = "0123456789";
  var strChar;
  var blnResult = true;
  if (strString.length == 0) return false;
  for (i = 0; i < strString.length && blnResult == true; i++)
  {
     strChar = strString.charAt(i);
     if (strValidChars.indexOf(strChar) == -1)
     {
        blnResult = false;
     }
  }
  return blnResult;
}
//Open popup
function openWindow(filename, winname, width, height, feature) {
 var features, top, left;
 var reOpera = /opera/i ;
 var winnameRequired = ((navigator.appName == "Netscape" && parseInt(navigator.appVersion) == 4) || reOpera.test(navigator.userAgent));

 left = (window.screen.width - width) / 2;
 top = (window.screen.height - height) / 2;
 if(feature == '')
 features = "width=" + width + ",height=" + height + ",top=" + top + ",left=" + left + ",location=0";
 else
 features = "width=" + width + ",height=" + height + ",top=" + top + ",left=" + left + "," + feature;
// if(! winnameRequired) winname = "";
 newwindow = window.open(filename, winname, features);
 newwindow.focus();
}

function PopUp(songInfo, obj) {   
    if (IsNumeric(songInfo)) {
        if (window.ActiveXObject) {
            openWindow("/PlaySong.aspx/?SID=" + songInfo, "popupsong", 500, 500, "");
        } else {
            openWindow("/PlaySong.aspx/?SID=" + songInfo, "popupsong", 500, 500, "");
        }   
        if (obj) {
            obj.name = "playsong";
            obj.href = location.href.replace("#" + obj.name, "") + "#" + obj.name;
        } else {
            return false;
        }   
    }
    return false;
}