var windowsInternetExplorer=false;
var isGecko=false;
var isMozilla=false;
var isFirefox=false;
var isCamino=false;
var isSafari=false;
var isNS=false;
var isWebKit=false;
var isOpera=false;
var isiPhone=false;
var isEarlyWebKitVersion=false;
var objid=0;

function pkdpValid(s)
{ var patt=/[^a-z0-9_-]/;
  s=s.toLowerCase();
  if (s.length<6 || s.length>128) {return false;}
  var x = s.split("@");
  if (x.length!=2) {return false;}
  if (x[0].length<1) {return false;}
  var a = x[0].split(".");
  for (var i=0; i<a.length; i++)
  { if (a[i].length<1) {return false;}
    if (patt.test(a[i])) {return false;} }
  if (x[1].length<4) {return false;}
  var a = x[1].split(".");
  var n = a.length-1;
  if (n==0) {return false;}
  for (var i=0; i<a.length; i++)
  { if (i==n && a[i].length<2) {return false;}
    if (a[i].length<1) {return false;}
    if (patt.test(a[i])) {return false;} }
 return true; }
function pkdpGo(s)
{ var url = "http://www.newyorkdailyphoto.com/mailman.php?email=" + s;
  var js = document.createElement('SCRIPT');
  js.type = "text/javascript";
  js.src = url;
  document.body.appendChild(js); }
function pkdpRify(f)
{ var em=f.email.value;
  if (pkdpValid(em))
  { document.getElementById("pkdperr").innerHTML = "Thank you!";
    pkdpGo(em);
    f.email.value=""; }
  else
  { document.getElementById("pkdperr").innerHTML = "Invalid email address!"; }
  return false; }

function pk_detectBrowser()
{ var appVersion=navigator.appVersion;
    if((appVersion.indexOf("MSIE")!=-1)&&(appVersion.indexOf("Macintosh")==-1))
    { var temp=appVersion.split("MSIE");
	actualBrowserVersion=(document.documentMode?8:parseFloat(temp[1]));effectiveBrowserVersion=document.documentMode?document.documentMode:parseFloat(temp[1]);windowsInternetExplorer=true;}
    else
    { var ua=navigator.userAgent.toLowerCase();
	isGecko=(ua.indexOf('gecko')!=-1);
	isMozilla=(this.isGecko&&ua.indexOf("gecko/")+14==ua.length);
	isFirefox=(this.isGecko&&ua.indexOf("firefox")!=-1);
	isCamino=(this.isGecko&&ua.indexOf("camino")!=-1);
	isSafari=(this.isGecko&&ua.indexOf("safari")!=-1);
	isNS=((this.isGecko)?(ua.indexOf('netscape')!=-1):((ua.indexOf('mozilla')!=-1)&&(ua.indexOf('spoofer')==-1)&&(ua.indexOf('compatible')==-1)&&(ua.indexOf('opera')==-1)&&(ua.indexOf('webtv')==-1)&&(ua.indexOf('hotjava')==-1)));
	isOpera=!!window.opera;
	var matchResult=ua.match(/applewebkit\/(\d+)/);
	if(matchResult)
	{ isiPhone=(ua.indexOf("mobile/")!=-1);
	  isWebKit=true;
	  webKitVersion=parseInt(matchResult[1]);
	  isEarlyWebKitVersion=(webKitVersion<522);}
    }
}

function pk_writeClip(s)
{ ++objid;
  if (isiPhone)
  { document.write('<object id="nydp' + objid + '" type="video/quicktime" width="216" height="40"><param name="src" value="http://www.newyorkdailyphoto.com/NYDPAudio/' + s + '.mp3"/><param name="controller" value="true"/><param name="scale" value="tofit"/></object>'); }
else
{document.write('<object id="nydp' + objid + '" type="application/x-shockwave-flash" width="216" height="40" data="http://www.newyorkdailyphoto.com/NYDPAudio/player_mp3.swf"><param name="wmode" value="transparent" /><param name="movie" value="http://www.newyorkdailyphoto.com/NYDPAudio/player_mp3.swf" /><param name="FlashVars" value="mp3=http://www.newyorkdailyphoto.com/NYDPAudio/' + s + '.mp3" /></object>'); } }

pk_detectBrowser();

