//##########################################################################//
// Image functions
//##########################################################################//
var _activeobj = null;
var currentActiveRef = null;
var currentActiveImage = null;
var submenuvalid = false;
var menutimer = null;
var messageTimerId;
if (window!=top){top.location.href=location.href;}
function Init()
{}
function TurnImageEmployerAdmin(ptr, newsrc) {
  var image = eval("document.images.imgrefemployeradmin" + ptr);
     if (image.filters && image.style) {
	  eval('try {image.filters[0].Apply();} catch (e) {}');
	 }
     image.src = newsrc;
     if (image.filters && image.style) {
      eval('try {image.filters[0].Play();} catch (e) {}');
     }
     ShowSubNavEmployer(ptr, newsrc);
}
function rowhilite(obj)
{
if (_activeobj != null) _activeobj.className = "calendar";
	obj.className = "calendarMD";
	_activeobj = obj;

}
function rowunhilite(obj)
{
if (_activeobj != null) _activeobj.className = "calendarMD";
	obj.className = "calendar";
	_activeobj = obj;

}
function reportrowhilite(obj)
{
 if (_activeobj != null) _activeobj.className = "reportresulttrstyle2";
 obj.className = "reportresulttrstyle1";
 _activeobj = obj;
}
function reportrowunhilite(obj)
{
  if (_activeobj != null) _activeobj.className = "reportresulttrstyle2";
 obj.className = "reportresulttrstyle1";
 _activeobj = obj;
}
function SearchForIt(obj)
{
 if (obj.criteria.value == "")
   return false;
}
function SearchIt(obj)
{
 if (obj.criteria.value == "")
   return false;
}
function LocateIt(obj)
{
 if (obj.state.value == "")
   return false;
}
function Logout(obj)
{
  logmeout.NCSFLogout.value='Y'
  logmeout.submit();
}
function sendEvent(swf,typ,prm) { 
  try {
   thisMovie(swf).sendEvent(typ,prm); 
  }
  catch(e){}
}
function getUpdate(typ,pr1,pr2,swf) {}
function thisMovie(swf) {
  if(navigator.appName.indexOf("Microsoft") != -1 || navigator.appName.indexOf("Opera") != -1 || navigator.appName.indexOf("Netscape") != -1) {
    return window[swf];
  } else {
    return document[swf];
  }
}
function OpenVideo(movie)
{
 DisplayObj = "<div style='width:410px;height: 16px; background: url(/media/images/misc/videotop.png)'>&nbsp;</div>";
 DisplayObj +="<div style='background-color:#f1f1f1;padding-top:9px; padding-bottom:9px;padding-left:7px;padding-right:7px;'>";
 DisplayObj +="<div  style='position:absolute;top:7;right:7;'><a href='javascript:CloseVideo()' onclick='CloseVideo()' title='Close Video'><img src='/media/images/misc/closediv.png' width='39' height='14' border='0' alt='Close Video'></a></div>";
 DisplayObj +="<center>";
 DisplayObj +="<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' type='application/x-shockwave-flash' id='playerdiv' height='300' width='375' data='http://www.ncsf.org/media/flash/player/mediaplayer.swf'>";
 DisplayObj +="<param name='allowfullscreen' value='true' />";
 DisplayObj +="<param name='allowscriptaccess' value='always' />";
 DisplayObj +="<param name='menu' value='false' />";
 DisplayObj +="<param name='movie' value='http://www.ncsf.org/media/flash/player/mediaplayer.swf' />";
 DisplayObj +="<param name='flashvars' value='file=http://www.ncsf.org/media/flash/"+ movie + "&height=300&width=375&screencolor=0x525776&frontcolor=0xF1f1f1&backcolor=0x00418E&lightcolor=0xFF9339&autostart=true&allowfullscreen=true&overstretch=false&bufferlength=10&logo=http://www.ncsf.org/media/images/header/NCSF-logoVideo.png&javascriptid=playerdiv&enablejs=true' />";
 DisplayObj +="<embed type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'"; 
 DisplayObj +="  src='/media/flash/player/mediaplayer.swf'";
 DisplayObj +="  width='375'";
 DisplayObj +="  height='300'";
 DisplayObj +="  menu='true'";
 DisplayObj +="  allowfullscreen='true'";
 DisplayObj +="  allowscriptaccess='always'";
 DisplayObj +="  id='playerdiv'";
 DisplayObj +="  flashvars='file=http://www.ncsf.org/media/flash/"+ movie + "&height=300&width=375&screencolor=0x525776&frontcolor=0xF1f1f1&backcolor=0x00418E&lightcolor=0xFF9339&autostart=true&allowfullscreen=true&overstretch=false&bufferlength=10&logo=http://www.ncsf.org/media/images/header/NCSF-logoVideo.png&javascriptid=playerdiv&enablejs=true'/>";
 DisplayObj +="</object>";
 DisplayObj +="</center>";
 DisplayObj +="</div>";
 DisplayObj +="<div style=\"width:410px;height: 16px; background: url(/media/images/misc/videobottom.png)\">&nbsp</div>";
 var videodiv = document.getElementById("videodisplay");
 var pagediv = document.getElementById("pagebody");
 if (videodiv != null){
  videodiv.innerHTML = DisplayObj;
  var xpos = 0;
  var ypos = 0;
  if (pagediv.offsetLeft != null)
 	xpos = pagediv.offsetLeft + 90;
  else
	xpos = pagediv.x + 90;
  var currentheight;	
  if (window.pageYOffset != null) 
    currentheight = window.pageYOffset;
   else
     currentheight = document.body.scrollTop;
   ypos = currentheight + 190;
   if (videodiv.style) {
     videodiv.style.left = xpos;
     videodiv.style.top = ypos;
     videodiv.style.display = 'block';
   }
   else {
    videodiv.left = xpos;
	videodiv.top = ypos;
	videodiv.display = 'block';
   }
  } 
}
function CloseVideo(movie)
{
  if(navigator.appName.indexOf("Microsoft") != -1)
    sendEvent('playerdiv','stop');
  var videodiv = document.getElementById("videodisplay");
  if (videodiv.style) {
	 videodiv.style.display = 'none';
  }
  else {
	videodiv.display = 'none';
  }
}
function OpenFlash(movie, width,height)
{
 DisplayObj = "<div style='width:"+(width*1+20)+"px;height: 16px; background: url(/media/images/misc/flashtop.png)'>&nbsp;</div>";
 DisplayObj +="<div style='background-color:#f1f1f1;padding-top:9px; padding-bottom:11px;padding-left:7px;padding-right:7px;'>";
 DisplayObj +="<div  style='position:absolute;top:7;right:7;'><a href='javascript:CloseVideo()' onclick='CloseVideo()' title='Close Video'><img src='/media/images/misc/closediv.png' width='39' height='14' border='0' alt='Close Video'></a></div>";
 DisplayObj +="<center>";
 DisplayObj +="<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' type='application/x-shockwave-flash' height='"+height+"' width='"+width+"' data='http://www.ncsf.org/media/flash/" + movie +"'>";
 DisplayObj +="<param name='allowfullscreen' value='true' />";
 DisplayObj +="<param name='allowscriptaccess' value='always' />";
 DisplayObj +="<param name='menu' value='false' />";
 DisplayObj +="<param name='movie' value='http://www.ncsf.org/media/flash/"+ movie +"' />";
 DisplayObj +="<embed type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'"; 
 DisplayObj +="  src='/media/flash/"+ movie+"'";
 DisplayObj +="  width='"+width+"'";
 DisplayObj +="  height='"+height+"'";
 DisplayObj +="  menu='false'";
 DisplayObj +="  allowfullscreen='true'";
 DisplayObj +="</object>";
 DisplayObj +="</center>";
 DisplayObj +="</div>";
 DisplayObj +="<div style='width:595px;height: 16px; background: url(/media/images/misc/flashbottom.png)'>&nbsp;</div>";
 var videodiv = document.getElementById("videodisplay");
 var pagediv = document.getElementById("pagebody");
 if (videodiv != null){
  videodiv.innerHTML = DisplayObj;
  var xpos = 0;
  var ypos = 0;
  if (pagediv.offsetLeft != null)
 	xpos = pagediv.offsetLeft-5;
  else
	xpos = pagediv.x-5;
  var currentheight;	
  if (window.pageYOffset != null) 
    currentheight = window.pageYOffset;
   else
     currentheight = document.body.scrollTop;
   ypos = currentheight + 190;
   if (videodiv.style) {
     videodiv.style.left = xpos;
     videodiv.style.top = ypos;
     videodiv.style.display = 'block';
   }
   else {
    videodiv.left = xpos;
	videodiv.top = ypos;
	videodiv.display = 'block';
   }
  } 
}
function OpenAudio(playlist,audioimage) {
 DisplayObj = "<div style='width:600px;height: 16px; background: url(/media/images/misc/audiotop.png)'>&nbsp;</div>";
 DisplayObj +="<div style='background-color:#f1f1f1;padding-top:9px; padding-bottom:9px;padding-left:7px;padding-right:7px;'>";
 DisplayObj +="<div  style='position:absolute;top:7;right:7;'><a href='javascript:CloseAudio()' onclick='CloseAudio()' title='Close Audio'><img src='/media/images/misc/closediv.png' width='39' height='14' border='0' alt='Close Audio'></a></div>";
 DisplayObj +="<center>";
 DisplayObj +="<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' type='application/x-shockwave-flash' id='audioplayer' height='220' width='580' data='http://www.ncsf.org/media/flash/player/mediaplayer.swf'>";
 DisplayObj +="<param name='allowfullscreen' value='true' />";
 DisplayObj +="<param name='allowscriptaccess' value='always' />";
 DisplayObj +="<param name='menu' value='false' />";
 DisplayObj +="<param name='movie' value='http://www.ncsf.org/media/flash/player/mediaplayer.swf' />";
 DisplayObj +="<param name='flashvars' value='file=http://www.ncsf.org/media/audio/"+ playlist + "&image=http://www.ncsf.org/media/images/"+audioimage+"&height=220&width=580&displaywidth=300&screencolor=0x00418e&frontcolor=0xF1f1f1&backcolor=0x00418E&lightcolor=0xFF9339&autostart=true&allowfullscreen=true&searchbar=false;overstretch=false&bufferlength=10&autoscroll=true&thumbsinplaylist=true&javascriptid=audioplayer&enablejs=true&repeat=list&shuffle=false' />";
 DisplayObj +="<embed type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'"; 
 DisplayObj +="  src='/media/flash/player/mediaplayer.swf'";
 DisplayObj +="  width='580'";
 DisplayObj +="  height='220'";
 DisplayObj +="  menu='false'";
 DisplayObj +="  allowfullscreen='true'";
 DisplayObj +="  allowscriptaccess='always'";
 DisplayObj +="  id='audioplayer'";
 DisplayObj +="  flashvars='file=http://www.ncsf.org/media/audio/"+ playlist + "&image=http://www.ncsf.org/media/images/"+audioimage+"&height=220&width=580&displaywidth=300&screencolor=0x00418e&frontcolor=0xF1f1f1&backcolor=0x00418E&lightcolor=0xFF9339&autostart=true&allowfullscreen=true&searchbar=false;overstretch=false&bufferlength=10&autoscroll=true&thumbsinplaylist=true&javascriptid=audioplayer&enablejs=true&repeat=list&shuffle=false'/>";
 DisplayObj +="</object>";
 DisplayObj +="</center>";
 DisplayObj +="</div>";
 DisplayObj +="<div style=\"width:600px;height: 16px; background: url(/media/images/misc/audiobottom.png)\">&nbsp;</div>";
 var audiodiv = document.getElementById("audiodisplay");
 var pagediv = document.getElementById("pagebody");
 if (audiodiv != null){
  audiodiv.innerHTML = DisplayObj;
  //setTimeout("thisMovie('audioplayer').sendEvent('playitem',0)", 500);
  var xpos = 0;
  var ypos = 0;
  if (pagediv.offsetLeft != null)
 	xpos = pagediv.offsetLeft + -10;
  else
	xpos = pagediv.x + -10;
  var currentheight;	
  if (window.pageYOffset != null) 
    currentheight = window.pageYOffset;
   else
     currentheight = document.body.scrollTop;
   ypos = currentheight + 210;
   if (audiodiv.style) {
     audiodiv.style.left = xpos;
     audiodiv.style.top = ypos;
     audiodiv.style.display = 'block';
   }
   else {
    audiodiv.left = xpos;
	audiodiv.top = ypos;
	audiodiv.display = 'block';
   }
  } 
}
function CloseAudio()
{
  if(navigator.appName.indexOf("Microsoft") != -1)
   sendEvent('audioplayer','stop');
  var audiodiv = document.getElementById("audiodisplay");
  if (audiodiv.style) {
	 audiodiv.style.display = 'none';
  }
  else {
	audiodiv.display = 'none';
  }
}
function OpenItem(url) {
 var productwindow = window.open(url,'NCSFItem','toolbar=no,status=yes,scrollbars=yes,location=no,menubar=no,directories=no,width=700,height=830')
 if (window.focus)
   productwindow.focus(); 
 
}
function OpenChatWindow(url) {
 var chatwindow = window.open(url,'NCSFChat','toolbar=no,status=yes,scrollbars=yes,location=no,menubar=no,directories=no,width=460,height=420')
 if (window.focus)
   chatwindow.focus(); 
}
// Message Control Timer
function StartMessageRefreshTimer()
{
     messageTimerId  = setTimeout('refreshMessages()', 3000);
}
function StopMessageRefreshTimer()
{
  clearTimeout (messageTimerId ); 
}
function ResetMessageRefreshTimer()
{
  clearTimeout (messageTimerId); 
  StartMessageRefreshTimer();
}
function refreshMessages()
{
  RefreshChatMessages();
  if ($("LastMessageIdCtrl").val() == "-1"){
    $("MessageSubmitCtrl").attr("disabled", "true");
    StopMessageRefreshTimer();
  }  
  else  
    ResetMessageRefreshTimer();
}
//window.onload = Init; 
