// Popup Window Code
function popup(winname,winurl,winwidth,winheight,options){
  // Center the popup window
  var top   = (screen.availHeight - winheight - 29) / 2;
  var left  = (screen.availWidth - winwidth - 10) / 2;
  var urlPrefix = "";
  var winopt    = "width=" + winwidth + ",height=" + winheight + "," + options + ",toolbar=0,location=0,directories=0,status=0,left="+left+",top="+top;
  newwin    = window.open(winurl,winname,winopt);
}


function openPopupPlayer() {
	//console.log(jQuery.browser.mobile);
	if (!jQuery.browser.mobile) {
		var link = 'http://www.wfmt.com/main.taf?p=4,5,24';
		var options = "'toolbar=no,location=no,status=no,menubar=no,scrollbars=no," + "resizable=yes,left=0,top=0,width=582,height=470";
		var newWindow = window.open(link, "popup_player", options);
		if (newWindow.focus) {
			newWindow.focus();
		}
		return false;
	}
} 

function popUpTerms(URL) {
  day = new Date();
  id = day.getTime();
  eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=582,height=470,left = 406,top = 263.5');");
}

/*
function popupWindow(winname,winurl,winwidth,winheight,options){
  // Center the popup window
  var top = (screen.availHeight - winheight - 29) / 2;
  var left = (screen.availWidth - winwidth - 10) / 2;

  var urlPrefix = "";
  var winopt = "width=" + winwidth + ",height=" + winheight + "," + options + ",toolbar=0,location=0,directories=0,status=0,left="+left+",top="+top;
  newwin = window.open(winurl,winname,winopt);
}

function popup_withtoolbar(winname,winurl,winwidth,winheight,options){
  // Center the popup window
  var top   = (screen.availHeight - winheight - 29) / 2;
  var left  = (screen.availWidth - winwidth - 10) / 2;
  var urlPrefix = "";
  var winopt    = "width=" + winwidth + ",height=" + winheight + "," + options + ",toolbar=1,location=0,directories=0,status=0,left="+left+",top="+top;
	  newwin    = window.open(winurl,winname,winopt);
}
        
function popupEncrypt(winname,winurl,encvar,encvarval,winwidth,winheight,options) {      
  // Center the popup window
  var top = (screen.availHeight - winheight - 29) / 2;
  var left = (screen.availWidth - winwidth - 10) / 2;  
  var winurl = winurl+"&"+encvar+"="+encvarval;	  
  var urlPrefix = "";	
  var winopt = "width=" + winwidth + ",height=" + winheight + "," + options + ",toolbar=0,location=0,directories=0,status=0,left="+left+",top="+top;
  newwin = window.open(winurl,winname,winopt);
}

function popUpTerms(URL) {
  day = new Date();
  id = day.getTime();
  eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=468,height=433,left = 406,top = 263.5');");
}


function openNewWindow(theURL) {
  window.open(theURL,'openNewWindow','HEIGHT=360, WIDTH=360,scrollbars=no,toolbar=no,status=no,menubar=no,location=no,resizable=no');
}

// Button Rollover Code
function rollOver(imgID,ImgName) {
  if ((navigator.appName == "Netscape" && parseInt(navigator.appVersion) >= 3) || 
     (navigator.appName != "Netscape" && parseInt(navigator.appVersion) >= 4))
  document.images[imgID].src = "img/" + ImgName;
}


// copyright 1999 Idocs, Inc. http://www.idocs.com
// Distribute this script freely but keep this notice in place
function numbersonly(myfield, e, dec) {
  var key;
  var keychar;

  if (window.event)
    key = window.event.keyCode;
  else if (e)
    key = e.which;
  else
    return true;
  keychar = String.fromCharCode(key);

  // control keys
  if ((key==null) || (key==0) || (key==8) ||
     (key==9) || (key==13) || (key==27) )
    return true;
  // numbers
  else if ((("0123456789.").indexOf(keychar) > -1))
    return true;
  else
    return false;
}


function limitArea(_textArea,_lengthLimit,_warningText) {
  if(!_lengthLimit)
    _lengthLimit=255;if(!_warningText)  
    _warningText="This text area has a limit of "+_lengthLimit+" characters."; 
    var currentString=new String(_textArea.value);
  if(currentString.length>_lengthLimit) {
    alert(_warningText);
    _textArea.value=currentString.substr(0,_lengthLimit);
  }
}

function textCounter(field,cntfield,maxlimit) {
  if (field.value.length > maxlimit) // if too long...trim it!
    field.value = field.value.substring(0, maxlimit);
  // otherwise, update 'characters left' counter
  else
    cntfield.value = field.value.length;
}
*/
