var nav = window.Event ? true : false;
if (nav) {
   window.captureEvents(Event.KEYDOWN);
   window.onkeydown = NetscapeEventHandler_KeyDown;
} else {
   document.onkeydown = MicrosoftEventHandler_KeyDown;
}

function NetscapeEventHandler_KeyDown(e) {
  if (e.which == 13 && e.target.type != 'textarea' && e.target.type != 'submit') { return false; }
  return true;
}

function MicrosoftEventHandler_KeyDown() {
  if (event.keyCode == 13 && event.srcElement.type != 'textarea' && event.srcElement.type != 'submit')
    return false;
  return true;
}

// document.domain
var g_sBaseUrl = 'http://'+window.location.hostname+'/gallery.php';//location.href.substring(0, location.href.lastIndexOf('.php')+4)
function playVideo(p_iVideoID, p_sVideoFileName) {
	scroll(0,0);
	var sUrl = 'http://'+window.location.hostname+'/gallery.php'+'?s=ajaxGetVideoInfo&id='+p_iVideoID;
    //var sUrl = g_sBaseUrl+'?s=ajaxGetVideoInfo&id='+p_iVideoID;
    //alert(g_sBaseUrl+' ==> '+p_iVideoID+' - '+p_sVideoFileName);
    //alert(sUrl);
	document.getElementById('wrpVideoDetails').style.display = 'none';
	setAjaxLoading();
	SendDataToFlashMovie('/content/video/'+p_sVideoFileName);
	makeRequestThreaded(sUrl,'execPopulateVideoDetails');
}
function execPopulateVideoDetails(rawdata) {
	if ( rawdata != undefined ) {
		//alert(rawdata);
		clearAjaxLoading();
		if ( document.getElementById( 'wrpVideoDetails' ) ) {
			document.getElementById('wrpVideoDetails').style.display = 'block';
			document.getElementById( 'wrpVideoDetails' ).innerHTML = rawdata;
		}
	}
}

function setAjaxLoading() {
	if ( document.getElementById( 'wrpAjaxLoading' ) )
		document.getElementById( 'wrpAjaxLoading' ).innerHTML = '<img id="ajax" name="ajax" src="/images/ajax.gif" width="10" height="10"  hspace="10" border="0">';
}

function clearAjaxLoading() {
	if ( document.getElementById( 'wrpAjaxLoading' ) )
		document.getElementById( 'wrpAjaxLoading' ).innerHTML = '';
}

var undefined;
function isUndefined(property) {
  return (typeof property == 'undefined');
}
