// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

function playGolf()
{
    var myWin;
    if(!myWin || myWin.closed)
	{
	    myWin = window.open('/flash/gamerevision4.html','playgolf','width=800,height =600,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,top='+((screen.height/2)-(300))+',left='+((screen.width/2)-(400))+'');
	}
    else
	{
	    myWin.focus();
	};
    void(0);
}


function initFeaturedVideo() {

}

function writeMacVideoCode(url, target) {
        str = "<object classid=\"clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B\" codebase=\"http://www.apple.com/qtactivex/qtplugin.cab\"  height=\"256\" width=\"320\">";
	str +="<param name=\"src\" value=\"" + url + "\">";
	str +="<param name=\"autoplay\" value=\"true\">";
	str +="<param name=\"controller\" value=\"true\">";
	str +="<embed height=\"256\" width=\"320\" src=\"" + url + "\" pluginspage=\"http://www.apple.com/quicktime/download/\" type=\"video/quicktime\"  controller=\"true\" autoplay=\"true\">";
	str +="</object>";    

	if(target == null) {
	    document.write(str);
	}
	else {
	    document.getElementById(target).innerHTML = str;
	}
}

function writePCVideoCode(url,target) {
    str = "<object id=\"MediaPlayer\" width=320 height=286 classid=\"clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95\" standby=\"Loading Windows Media Player components...\" type=\"application/x-oleobject\" codebase=\"http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab\">";
    
    str +="<param name=\"filename\" value=\"" + url + "\">";
    str +="<param name=\"src\" value=\"" + url + "\">";
    str +="<param name=\"autoplay\" value=\"true\">";
    str +="<param name=\"showcontrols\" value=\"true\">";
    str +="<embed type=\"application/x-mplayer2\" src=\"" + url + "\" name=\"MediaPlayer\" width=320 height=286 showcontrols=\"true\" autoplay=\"true\"></embed>";
    str +="</object>";

    if(target == null) {
	document.write(str);
    }
    else {
	document.getElementById(target).innerHTML = str;
    }
}


function getMacVideoCode(url) {
        str = "<object classid=\"clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B\" codebase=\"http://www.apple.com/qtactivex/qtplugin.cab\"  height=\"256\" width=\"320\">";
	str +="<param name=\"src\" value=\"" + url + "\">";
	str +="<param name=\"autoplay\" value=\"true\">";
	str +="<param name=\"controller\" value=\"true\">";
	str +="<embed height=\"256\" width=\"320\" src=\"" + url + "\" pluginspage=\"http://www.apple.com/quicktime/download/\" type=\"video/quicktime\"  controller=\"true\" autoplay=\"true\">";
	str +="</object>";    

	return(str);
}

function getPCVideoCode(url) {
    str = "<object id=\"MediaPlayer\" width=320 height=286 classid=\"clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95\" standby=\"Loading Windows Media Player components...\" type=\"application/x-oleobject\" codebase=\"http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab\">";
    
    str +="<param name=\"filename\" value=\"" + url + "\">";
    str +="<param name=\"src\" value=\"" + url + "\">";
    str +="<param name=\"autoplay\" value=\"true\">";
    str +="<param name=\"showcontrols\" value=\"true\">";
    str +="<embed type=\"application/x-mplayer2\" src=\"" + url + "\" name=\"MediaPlayer\" width=320 height=286 showcontrols=\"true\" autoplay=\"true\"></embed>";
    str +="</object>";
    return(str);
}






function imgstrip_scroll_left(sid){
  imgstrip_scroll(sid, 1);
}

function imgstrip_scroll_right(sid){
  imgstrip_scroll(sid, -1);
}

function imgstrip_scroll(sid,amount){
     
  var strip = $(sid);
  var curleft = parseInt(strip.style.left) || 0;
  var width=130;
  var curpos = -curleft/width;

  if(curleft%width != 0) return; // do not move when already moving

  if(amount>0 && curpos<=0) return;             // do not scroll lefter than most left

   
  var imgcount = $$("ul#"+strip.id+" li").length;
  if(amount<0 && curpos>=(imgcount-4)) return;  // do not scroll righter than most right

//  strip.style.left = curleft + amount*width;

  new Effect.Move (strip,{ x: amount*width, y: 0, mode: 'relative', duration: 0.5 });

  var status_tag = $(strip.id+"_status");

  curpos=curpos-amount+1;
  status_tag.innerHTML="Viewing "+curpos+"-"+(curpos+3)+" of "+imgcount+" images";
   
}

 