<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- Written by Eric Pence to play videos -->
<html>
<head>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">
<title>Play video</title>
<link rel="shortcut icon" href="favicon.ico">
<link href="penceland.css" rel="stylesheet" type="text/css">

<!-- Determine the level of JavaScript supported by the browser. -->
<script type="text/javascript" language="JavaScript"> var jslevel = "1.0"</script>
<script type="text/javascript" language="JavaScript1.1"> jslevel = "1.1"</script>

<script type="text/javascript" language="JavaScript">
<!-- Hide the code from non-JavaScript-enabled browsers

// Preload button images
if (jslevel >= "1.1") {
backOn = new Image(100,20); backOn.src = "images/backi.gif";
backOff = new Image(100,20); backOff.src = "images/backo.gif";
topOn = new Image(100,20); topOn.src = "images/topi.gif";
topOff = new Image(100,20); topOff.src = "images/topo.gif";
}

// Switch On and Off button images
function imageSwap(imgID,imgName) {
if (jslevel >= "1.1") {
document.images[imgID].src = eval(imgName + ".src");
}
}

// Parse the URL; format = play_video.html?video=video-name.extension&title=title-text&comment=comment-text (title and comment optional)
function getVideo(url_string) {
var video = '';
var flash_msg = '';
// Determine type of video
var type_of_video = '';
if (url_string.indexOf('.flv') != -1) {
type_of_video = 'flv';
}
else if (url_string.indexOf('.mp4') != -1) {
type_of_video = 'mp4';
}
else if (url_string.indexOf('.wmv') != -1) {
type_of_video = 'wmv';
}
else if (url_string.indexOf('.wmx') != -1) {
type_of_video = 'wmv';
}
else if ((url_string.indexOf('.swf') != -1) || (url_string.indexOf('googleplayer.swf') != -1) || (url_string.indexOf('.swf|') != -1)) {
type_of_video = 'swf';
}
else if (url_string.indexOf('youtube.com') != -1) {
type_of_video = 'youtube';
var youtube_msg = '<br>- If YouTube overlays video with a popup ad click on <span style="font-family: Verdana">(x)</span> in the upper right corner to remove it. -';
document.getElementById('YouTube_message').innerHTML = youtube_msg;
}

// Unencode the URL, which was encoded to allow the url to contain spaces
url_string = unescape(url_string);

// Look for comment and strip from URL string
var spliturl = [];
  if (url_string.indexOf('&comment=') != -1) {
spliturl = url_string.split('&comment=');
var comment_text = '<p>' + spliturl[1];
document.getElementById('Comment').innerHTML = comment_text;
url_string = spliturl[0];
}

  // Look for title and strip from URL string
  if (url_string.indexOf('&title=') != -1) {
spliturl = url_string.split('&title=');
var title = spliturl[1];
document.getElementById('Title').innerHTML = title;
    document.title = title;
url_string = spliturl[0];
  }

// Extract video name from URL string
spliturl = url_string.split('?video=');
video = spliturl[1];
log_video(video);
// Replace some characters temporarily substituted in URL before calling this script
video = video.replace(/\|/, '?');
video = video.replace(/\`/, '&');
if (video) {
// Format various video type objects
var video_display = '';
if (type_of_video == 'flv'){
if (video.indexOf('http://') != 0) {
// If not remote append local video player to front of video
video = "./video/flvplayer.swf?file=" + video;
}
video_display = "<object " +
"type='application/x-shockwave-flash' " +
"width='640' " +
"height='480' " +
"wmode='transparent' data='" + video +
"&autostart='true'>" +
"<param name='movie' value='" + video +
"<param name='wmode' value='transparent' />" +
"</object>";
flash_msg = "<img src='images/clearspacer.gif' height='100'><br><span style='color: #878787'>(This video requires <i>Shockwave Flash Object</i> to be enabled.)</span>";
}
else if (type_of_video == 'mp4') {
if (video.indexOf('http://') != 0) {
// If local video append folder name to front of video
video = './video/' + video;
}
    video_display = "<object classid='clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B'" +
      "codebase='http://www.apple.com/qtactivex/qtplugin.cab' width='640' height='548' >" +
      "<param name='src' value='" + video + "' >" +
      "<param name='autoplay' value='true' >" +
      "<embed src='" + video + "' type='image/x-macpaint'" +
      "pluginspage='http://www.apple.com/quicktime/download' width='640' height='548' autoplay='true'></embed>" +
      "</object>";
}
else if (type_of_video == 'wmv') {
if (video.indexOf('http://') != 0) {
// If local video append folder name to front of video
video = './video/' + video;
}
    video_display = "<object id='MediaPlayerIE' width='640' height='548' classid='CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95' " +
    "codebase='http://activex.microsoft.com/activex/controls/ mplayer/en/nsmp2inf.cab#Version=5,1,52,701' " +
    "standby='Loading Microsoft® Windows® Media Player components...' type='application/x-oleobject'> " +
    "<param name='Filename' value='" + video + "'>" +
    "<param name='StretchToFit' value='true'>" +
    "<param name='ShowDisplay' value='false'>" +
    "<param name='AutoSize' value='false'>" +
    "<embed name='MediaPlayerFX'" +
    " src='" + video + "'" +
    " width='640'" +
    " height='548'" +
    " type='application/x-ms-wmp'" +
    " autosize='1'" +
    " autostart='1'" +
    " displaysize='4'" +
" stretchToFit='1'" +
    " showcontrols='1' />" +
    "</object>";
}
else if (type_of_video == 'swf') {
if (video.indexOf('http://') == -1) {
// If local video append folder name to front of video
video = './video/' + video;
}
video_display = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' " +
"codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0' " +
"width='640' " +
"height='480'>" +
"<param name='movie' value='" + video + "' />" +
"<param name='quality' value='high' />" +
"<param name='LOOP' value='false'>" +
"<param name='FlashVars' value='autoplay=true'>" +
"<embed flashVars='autoplay=true' " +
" src='" + video + "' " +
" width='640' " +
" height='480' " +
" loop='false' " +
" quality='high' " +
" pluginspage='http://www.macromedia.com/go/getflashplayer' " +
" type='application/x-shockwave-flash'>" +
"</embed>" +
"</object>";
flash_msg = "<img src='images/clearspacer.gif' height='100'><br><span style='color: #878787'>(This video requires <i>Shockwave Flash Object</i> to be enabled.)</span>";
}
else if (type_of_video == 'youtube') {
if (video.indexOf('http://') == -1) {
// If local video append folder name to front of video
video = './video/' + video;
}
video_display = "<object " +
"type='application/x-shockwave-flash' " +
"width='640' " +
"height='480' " +
"wmode='transparent' data='" + video +
"autostart='true'> " +
"<param name='movie' value='" + video +
"<param name='wmode' value='transparent' />" +
"</object>";
}

document.getElementById('Video').innerHTML = video_display;
document.getElementById('Flash_message').innerHTML = flash_msg;
}
}

// Update video_access log -----------------------------
function log_video(video) {
var penceland = /www\.penceland\.com/;
var on_webserver = penceland.exec(location.href);
if (on_webserver) {
update_video_log(video);
}
return;
}

// Use AJAX for perl call so webpage will not exit
function update_video_log(video) {
  var XMLHttpRequestObject = false;
  if (window.XMLHttpRequest) {
    XMLHttpRequestObject = new XMLHttpRequest();
  }
  else if (window.ActiveXObject) { // IE
    XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHTTP");
  }
if (XMLHttpRequestObject) {
var url = 'cgi-bin/log_video_visits.pl?video=' + video;
XMLHttpRequestObject.open('GET', url);
XMLHttpRequestObject.send(null);
}
}

// Stop hiding this script -->
</script>

</head>

<body onLoad="getVideo(location.href)">
<img src="images/grnbar1.gif" height="5" width="100%" vspace="2">
<table cellspacing="0" cellpadding="0" width="100%" height="20">
<tr valign="bottom">
<td width="33%">
<a href="javascript:history.go(-1)" onMouseDown ="imageSwap('back_btn','backOn')"
onMouseUp = "imageSwap('back_btn','backOff')"
onMouseOut = "imageSwap('back_btn','backOff')">
<img src="images/backo.gif" title="Back" name="back_btn" width="100" height="20" border="0" align=middle></a>
</td>
<td width="33%" align="center">
<a href="index.html"><img src="images/pentitle.gif" width="171" height="19" title="PENCELAND.com" align="middle" border="0"></a>
</td>
<td width="33%" align=right valign="middle">
<span class="date_block" title="Today's date">
<b>
<script type="text/javascript" language="JavaScript">
<!--
var today = new Date();
var yyyy = today.getYear();
if (yyyy < 1000) {
yyyy += 1900;
}
var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December")
var Month = montharray[today.getMonth()];
var dd = today.getDate();
document.write(Month + " " + dd + ", " + yyyy);
// -->
</script>
</b>
</span>
</td>
</tr>
</table>
<img src="images/grnbar1.gif" height="5" width="100%" vspace="2">
<img src="images/clearspacer.gif" height="20"><br>
<center>
<div id="Title" style="font-weight: bold; font-size: 20px; font-style: italic">
</div>
<img src="images/clearspacer.gif" height="5">
<div id="Video">
If the video doesn't start refresh the page.
</div>
<div id="Comment" style="font-weight: bold; font-size: 16px; font-style: italic">
</div>
<div id="YouTube_message">
</div>
<div id="Flash_message">
</div>
</center>

</body>
</html>