$(document).ready(function() {
    $("a.gallery").fancybox({});
});

/*window.onload = function () {
        
        if(navigator.appName.indexOf("Microsoft") != -1) {
                window.myvideobox.playNewVideo(119768);
        } else {
                alert(typeof window.document.myvideobox.name);
                window.document.myvideobox.playNewVideo(119768);
        }
}
*/

function s (e,field){
        //alert(e);
        e = e ? e.which : window.event.keyCode;
        query = field.value;
        //alert(e);
        if( e == 13)
        {
                //nquery = Url.encode(query);
                //alert(nquery);        
                document.forms[0].action = document.forms[0].action + query + '/';
                document.forms[0].submit;


        }
        return true;
}


function submit_instructions(pform, obj_year)
{
        url = '/installation-instructions/' + obj_year.options[obj_year.selectedIndex].value + '/';
        pform.action = url;
        pform.submit();

}


var pb_vids = new Array();
var curr_vid = 1;
function videoEnd()
{
        var myId = "myvideobox";
        var video;
        /*if(document.getElementById)
                video = document.getElementById(myId);
        else if(document.all)
                video = document.all[myId];*/

	video = getFlashMovieObject( myId );

        video.playNewVideo(pb_vids[curr_vid]);
        if( curr_vid >= (pb_vids.length-1) )
                curr_vid = 0;
        else
                curr_vid++;
}

/*function getFlashMovieObject(movieName)
{
  if (navigator.appName.indexOf("Microsoft") != -1) {
     return window[movieName];
   }
   else {
         if(document[movieName].length != undefined){
              return document[movieName][1];
         }
     return document[movieName];
   }	
}*/

function getFlashMovieObject(movieName)
{
  if (window.document[movieName]) 
  {
      return window.document[movieName];
  }
  if (navigator.appName.indexOf("Microsoft Internet")==-1)
  {
    if (document.embeds && document.embeds[movieName])
      return document.embeds[movieName]; 
  }
  else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
  {
    return document.getElementById(movieName);
  } 	
}

