<!--
var win = null;
var smallwin  = null;
var mediumwin = null;
var largewin  = null;
var popupwin  = null;
var regwin    = null;
var tinywin   = null;

var s_swf_stub = "home";
/*
if(window.focus()){
 self.focus();
}
*/

initSitePage();

var imgpnl1_on = new Image();
imgpnl1_on.src = "/images/login/site_1.gif";

var imgpnl1_off = new Image();
imgpnl1_off.src = "/images/login/site.gif";

var imgpnl2_on = new Image();
imgpnl2_on.src = "/images/login/yacht_1.gif";
var imgpnl2_off = new Image();
imgpnl2_off.src = "/images/login/yacht.gif";

var imgpnl3_on = new Image();
imgpnl3_on.src = "/images/login/login_1.gif";

var imgpnl3_off = new Image();
imgpnl3_off.src = "/images/login/login.gif";

var imgpnl_home_on = new Image();
imgpnl_home_on.src = "/images/login/login_myhome_on.gif";

var imgpnl_home_off = new Image();
imgpnl_home_off.src = "/images/login/login_myhome_off.gif";

function initSitePage()
{

  if (parent.frames.length > 0) 
  {
    parent.location.href = location.href;
  }
  
  if ((navigator.appName == "Microsoft Internet Explorer") && 
      (navigator.appVersion.indexOf("Mac") != -1 ))
  { 
    var page = "/mac.html"
    location.replace(page);
    return;
  }

  // If the platform is Macintosh, use the Macintosh style sheet.
  if (navigator.platform.indexOf('Mac') != -1) 
  {
    document.write('<link rel="stylesheet" href="/res/css/bodymac.css">');
   // Otherwise, use the Windows style sheet.
  } 
  else
  {
    document.write('<link rel="stylesheet" href="/res/css/body.css">');
  }

}

function openWindow(mypage,myname,w,h,features) {
  var winl = (screen.width-w)/2;
  var wint = (screen.height-h)/2;
  if (winl < 0) winl = 0;
  if (wint < 0) wint = 0;
  var settings = 'height=' + h + ',';
  settings += 'width=' + w + ',';
  settings += 'top=' + wint + ',';
  settings += 'left=' + winl + ',';
  settings += features;
  win = window.open(mypage,myname,settings);
  win.window.focus();
}



//-->

///////////////////////////////////////////////////////////////////////


function openWin(iUrl, iWinName, iWidth, iHeight, iLeft, iStatus){

  if(!iWinName){
	  var url = "imgupload.aspx";
	  var width = 410;
	  var height = 300;
	  var winName = "SmallWindow";
	  
	  if(iUrl){
	    url = iUrl;
	  }
	  if(iWidth){
	    width  = iWidth;
	  }
	  if(iHeight){
	    height = iHeight;
	  }
	  
	  var winl = (screen.width-width)/2;
    var wint = (screen.height-height)/2;
    if (winl < 0) winl = 0;
    if (wint < 0) wint = 0;
	  
	  var left;
	  if(iLeft){
	    left = winl;
	  }
	  else{
	    left = 250;
	  }
	  var status;
	  if(iStatus){
	    status = iStatus;
	  }
	  else{
	    status = "no";
	  }
	  var attr = "directories=no,status="+status+",location=no,toolbar=no,scrollbars=yes,resizable=no,menubar=no,copyhistory=no,width=";
	  attr += width;
	  attr += ",height=";
	  attr += height+",dependent=1";
	  attr += ",top="+wint+",left="+left;
	  smallwin = window.open(url, winName, attr);
	  smallwin.focus();
  }
  else{
  
    smallwin.focus();
     
  }
}
function openMediumWin(iUrl, iWinName, iWidth, iHeight){

	var url = "linkmaker.aspx";
	if(iUrl){
	  url = iUrl;
	}
  if(!iWinName){
	  var width = 600;
	  var height = 360;
	  if(iWidth){
	    width  = iWidth;
	  }
	  if(iHeight){
	    height = iHeight;
	  }
	  var winl = (screen.width-width)/2;
    var wint = (screen.height-height)/2;
    if (winl < 0) winl = 0;
    if (wint < 0) wint = 0;
	  var winName = "MediumWindow";
	  var left;
	  left = 100;
	  var attr = "directories=no,status=no,location=no,toolbar=no,scrollbars=yes,resizable=no,menubar=no,copyhistory=no,width=";
	  attr += width;
	  attr += ",height=";
	  attr += height+",dependent=1";
	  attr += ",top="+wint+",left="+winl;
	  mediumwin = window.open(url, winName, attr);
	  mediumwin.focus();
	  
  }
  else{
  
    mediumwin.location.href = url;
    mediumwin.focus();
     
  }
  return mediumwin;
}

function openLargeWin(iUrl, iWinName, iWidth, iHeight){

	var url = "linkmaker.aspx";
	if(iUrl){
	  url = iUrl;
	}
  if(!iWinName){
	  var width = 675;
	  var height = 500;
	  if(iWidth){
	    width  = iWidth;
	  }
	  if(iHeight){
	    height = iHeight;
	  }
	  var winl = (screen.width-width)/2;
    var wint = (screen.height-height)/2;
    if (winl < 0) winl = 0;
    if (wint < 0) wint = 0;
	  var winName = "LargeWindow";
	  var left;
	  left = 100;
	  var attr = "directories=no,status=no,location=no,toolbar=no,scrollbars=yes,resizable=no,menubar=no,copyhistory=no,width=";
	  attr += width;
	  attr += ",height=";
	  attr += height+",dependent=1";
	  attr += ",top="+wint+",left="+left;
	  largewin = window.open(url, winName, attr);
	  largewin.focus();
	  
  }
  else{
  
    largewin.location.href = url;
    largewin.focus();
     
  }
}

function openPopupWin(iUrl, iWinName, iWidth, iHeight, iLeft){

  if(!iWinName){
	  var url = "/contact/popup.aspx";
	  var width = 300;
	  var height = 450;
	  if(iWidth){
	    width  = iWidth;
	  }
	  if(iHeight){
	    height = iHeight;
	  }
	  
	  var winl = (screen.width-width)/2;
    var wint = (screen.height-height)/2;
    if (winl < 0) winl = 0;
    if (wint < 0) wint = 0;

	  var winName = "PopupWindow";
	  if(iUrl){
	    url = iUrl;
	  }
	  var left;
	  if(iLeft){
	    left = iLeft;
	  }
	  else{
	    left = winl;
	  }
	  var attr = "directories=no,status=yes,location=no,toolbar=no,scrollbars=no,resizable=no,menubar=no,copyhistory=no,width=";
	  attr += width;
	  attr += ",height=";
	  attr += height+",dependent=1";
	  attr += ",top="+wint+",left="+left;
	  popupwin = window.open(url, winName, attr);
	  popupwin.focus();
  }
  else{
  
    popupwin.focus();
     
  }
}

function GetYacht(iDept)
{
  var yachtform = document.form1;
  
  var yachtid   = yachtform.lstyachtname.options[yachtform.lstyachtname.selectedIndex].value;
  
  if(yachtid>0)
  {
    
    var nexturl   = "/"+iDept+"/yachtdetail.aspx?id="+yachtid;
    document.location.href = nexturl;
  
  }

}    

function OpenContactForm(iType, iNum, iCat){

  openContactForm(iType, iNum, iCat);
  
}

function openContactForm(iType, iNum, iCat){

  openPopupWin("/inquirepopup.aspx?type="+iType+"&id="+iNum+"&cat="+iCat, "", 277, 360);

}
function OpenEmailPgForm(iType, iPage, iNum, iTitle, iCat){

  openPopupWin("/emailpg.aspx?type="+iType+"&page="+iPage+"&id="+iNum+"&title="+iTitle+"&cat="+iCat, "", 277, 370);

}

function openCrewRegForm(){

  openPopupWin("/crew/reg1.aspx", "regwin", 290, 390);

}

function OpenNews(iCat){
  openWin("/shownews.asp?dp="+iCat, "", 240, 500, 15, "yes");
}

function CheckSearch(iWhich){

  openWin("", "", 240, 500, 15, "yes");
  eval("document.srchform"+iWhich+".target = 'SmallWindow';");
  return true;

}

function GetYachtsByBuilder()
{
  var form = document.form1;
  
  if(form.lstcnbuilders.selectedIndex>0)
  {
    var bldid = form.lstcnbuilders.options[form.lstcnbuilders.selectedIndex].value;
    document.location.href = "/sales/yachts.aspx?bldid=" + bldid;
  }

}

function GetYachtsByType(i_dept)
{
  var form = document.form1;
  
  if(form.lstyachttype.selectedIndex>0)
  {
    var typid = form.lstyachttype.options[form.lstyachttype.selectedIndex].value;
    document.location.href = "/" + i_dept + "/yachts.aspx?type=" + typid;
  }

}

function GetYachtsBySize()
{
  var form = document.form1;
  
  if(form.lstyachtsize.selectedIndex>0)
  {
    var szid = form.lstyachtsize.options[form.lstyachtsize.selectedIndex].value;
    document.location.href = "/sales/yachts.aspx?sz=" + szid;
  }

}

function writePanel(which)
{
  var p_selection = which;

  highlightPanel(which);

  for(var i=1; i<4; i++)
  {
    
    if(p_selection==i)
    {
      
      eval("document.getElementById('trz" + i + "').style.display='';");
    }
    else
    {
      eval("document.getElementById('trz" + i + "').style.display='none';");
    }
  }


}


function highlightPanel(which)
{
  
  for(var i=1; i<4; i++)
  {
    var pimg = 'imgpnl' + i;

    if(i==which)
    {
      if(i==SEARCH_PANEL_OPTION_LOGIN )
      {
        if( is_logged_on == true )
        {
          eval("document.getElementById('imgpnl" + i + "').src=imgpnl_home_on.src;");
        }
        else
        {
          eval("document.getElementById('imgpnl" + i + "').src=imgpnl" + i + "_on.src;");
        }
      
      }
      else
      {
        eval("document.getElementById('imgpnl" + i + "').src=imgpnl" + i + "_on.src;");
      }
    }
    else
    {
      if(i==SEARCH_PANEL_OPTION_LOGIN )
      {
        
        if( is_logged_on == true )
        {
          eval("document.getElementById('imgpnl" + i + "').src=imgpnl_home_off.src;");
        }
        else
        {
          eval("document.getElementById('imgpnl" + i + "').src=imgpnl" + i + "_off.src;");
        }
      
      }
      else
      {
        eval("document.getElementById('imgpnl" + i + "').src=imgpnl" + i + "_off.src;");
      }
    }
  }

}

function doResize()
{

  show2ndTierRow(window.current_selection);
  writeSrchPanel(window.currentSrchID);

}
/*
function doFaqResize()
{
  show2ndTierRow(window.current_selection);
  writeSrchPanel(window.currentSrchID);
  showFaq(window.currentFaqSelection);
}

function showFaq(i_which)
{
  var p_answer = "";
  
  window.currentFaqSelection = i_which;
  
  /*
  var browser_width = 0, browser_height = 0;

  if( typeof( window.innerWidth ) == 'number' ) 
  {
    //Non-IE
    browser_width  = window.innerWidth;
    browser_height = window.innerHeight;
  } 
  else if( document.documentElement &&
      ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) 
 {
    //IE 6+ in 'standards compliant mode'
    browser_width  = document.documentElement.clientWidth;
    browser_height = document.documentElement.clientHeight;
  } 
  else if( document.body && 
      ( document.body.clientWidth || document.body.clientHeight ) ) 
  {
    //IE 4 compatible
    browser_width  = document.body.clientWidth;
    browser_height = document.body.clientHeight;
  }

  var bodywidth = 760;

  var faq_left = 0;
  var faq_top  = 118 + BRANDING_MARGIN;

  if(bodywidth<browser_width)
  {
    faq_left = ((browser_width - bodywidth) / 2) + 261;
  }
  else
  {
    faq_left = 261;
  }
  */
  /*
  for(var i=0; i<faq_array.length; i++)
  {
    var p = faq_array[i];
    var div = "divfaq" + p;
    var diva = "divfaqanswer" + p;
    var pstylobj = getStyleObject(div);
    
    //alert("checking faq " + p.faqid + "\nquestion: " + p.question + "\n" + "answer: " + p.answer);
    
    if(p==i_which)
    {
      //alert(p + " = " + i_which);
      //alert("showing " +i);

      pstylobj.fontSize = "10px";
      pstylobj.lineHeight = "14px";
      pstylobj.color = "#676767";
      pstylobj.padding = "0px 10px 0px 0px";
      pstylobj.fontWeight = "bold";      
      //changeObjectVisibility(diva, 'visible');
      //moveObject(diva, faq_left, faq_top);
    }
    else
    {
    
      //pstylobj.className = "textpage10";
      pstylobj.fontSize = "10px";
      pstylobj.lineHeight = "13px";
      pstylobj.color = "#707070";
      pstylobj.padding = "0px 10px 0px 0px";
      pstylobj.fontWeight = "normal";      
      //changeObjectVisibility(diva, 'hidden');
      
    }
    
  }
}
*/
function retrieveCharterYachtDetails(sel)
{
  var url = "/charter/yachtdetail.aspx?id=";
  
  var id = sel.options[sel.selectedIndex].value;
  
  if(id==0)
  {
    sel.selectedIndex = 0;
    return;
  }
  
  url += id;
  
  document.location.href = url;
}

function retrieveSalesYachtDetails(sel)
{
  var url = "/sales/yachtdetail.aspx?id=";
  
  var id = sel.options[sel.selectedIndex].value;
  
  if(id==0)
  {
    sel.selectedIndex = 0;
    return;
  }
  
  url += id;
  
  document.location.href = url;
}

function retrieveCharterMgmtYachtDetails(sel)
{
  var url = "/mgmt/charter/yachtdetail.aspx?id=";
  
  var id = sel.options[sel.selectedIndex].value;
  
  if(id==0)
  {
    sel.selectedIndex = 0;
    return;
  }
  
  url += id;
  
  document.location.href = url;
}

function openViewer(type, id)
{
  
  var url    = "gallery.aspx?type="+type+"&id="+id;
  
  var atr    = "resizable=yes,scrollbars=auto,status=no," +
               "menubar=no,toolbar=no,location=no,directories=no";
  
  var width  = '1050';
  
  var height = '775';
  
  openWindow(url, 'viewer', width, height, atr);

}

function openVrViewer(id)
{
  
  var url    = "gallery2.aspx?id="+id;
  
  var atr    = "resizable=yes,scrollbars=auto,status=no," +
               "menubar=no,toolbar=no,location=no,directories=no";
  
  var width  = '1050';
  
  var height = '775';
  
  openWindow(url, 'viewer', width, height, atr);

}

function openVidViewer(id)
{
  
//  var url    = "movie/swfplayer.aspx?id=" + id;
//  
//  var atr    = "resizable=yes,scrollbars=auto,status=no," +
//               "menubar=no,toolbar=no,location=no,directories=no";
//  
//  var width  = '825';
//  
//  var height = '555';
//  
//  openWindow(url, 'viewer', width, height, atr);

  var url    = "/charter/movie/swfplayer.aspx?id=" + id;
  
  //var url = "/charter/movie/index.html";
  
  var atr    = "resizable=yes,scrollbars=auto,status=no," +
               "menubar=no,toolbar=no,location=no,directories=no";
  
  var width  = '620';
  
  var height = '505';
  
  openWindow(url, 'viewer', width, height, atr);

}


function PageQuery(q) 
{
  if(q.length > 1) 
  {
    this.q = q.substring(1, q.length);
  }
  else 
  {
    this.q = null;
  }

  this.keyValuePairs = new Array();

  if(q) 
  {
    for(var i=0; i < this.q.split("&").length; i++) 
    {
      this.keyValuePairs[i] = this.q.split("&")[i];
    }
  }
  
  this.getKeyValuePairs = function() 
  { 
    return this.keyValuePairs; 
  }
  
  this.getValue = function(s) 
  {
  
    for(var j=0; j < this.keyValuePairs.length; j++) 
    {
      if(this.keyValuePairs[j].split("=")[0] == s)
      {
        return this.keyValuePairs[j].split("=")[1];
      }
    }
    //return false;
    return "";
  }

  this.getParameters = function() 
  { 
    var a = new Array(this.getLength());
    for(var j=0; j < this.keyValuePairs.length; j++) 
    {
      a[j] = this.keyValuePairs[j].split("=")[0];
    }
    return a;
  }

  this.getLength = function() 
  { 
    return this.keyValuePairs.length; 
  } 
}

function queryString(key)
{
  var page = new PageQuery(window.location.search); 
  return unescape(page.getValue(key)); 
}

function displayItem(key)
{
  if(queryString(key)=='false') 
  {
    document.write("you didn't enter a ?name=value querystring item.");
  }
  else
  {
    document.write(queryString(key));
  }
}

function closeSiteSearch()
{

  var page    = new PageQuery(window.location.search);
  var pfrom   = page.getValue("from");
  var pgo     = page.getValue("go");
  var pflt    = page.getValue("flt");
  var pid     = page.getValue("id");
  var newsid  = page.getValue("newsid");
     
  var purl = new String(document.location.pathname);
  
  purl += "?unst=1&flt=" + pflt + "&from=" + pfrom + "&go=" + pgo + "&id=" + pid + "&newsid=" + newsid;
  
  document.location.href = purl;
  
  return;

}

function closeYachtSearch()
{

  var page    = new PageQuery(window.location.search);
  var pfrom   = page.getValue("from");
  var pgo     = page.getValue("go");
  var pflt    = page.getValue("flt");
  var pid     = page.getValue("id");
  var newsid  = page.getValue("newsid");
     
  var purl = new String(document.location.pathname);
  
  purl += "?unyt=1&flt=" + pflt + "&from=" + pfrom + "&go=" + pgo + "&id=" + pid + "&newsid=" + newsid;
  
  document.location.href = purl;
  
  return;
 

}

function showPicInViewer(which)
{
  eval("document.all['imgmain'].src=image"+which+".src;");
}

function sendPassword()
{
    var email = document.form1.txtlogin.value;
    if(email.length==0)
    {
      alert("Please enter your account email address.");
      document.form1.txtlogin.focus();
      return;
    }
	  var url    = "/home/sendpasswd.aspx?email="+email;
	  var width  = 200;
	  var height = 150;

	  var winl = (screen.width-width)/2;
    var wint = (screen.height-height)/2;
    if (winl < 0) winl = 0;
    if (wint < 0) wint = 0;
	  var attr = "directories=no,status=yes,location=no,toolbar=no,scrollbars=no,resizable=no,menubar=no,copyhistory=no,width=";
	  attr += width;
	  attr += ",height=";
	  attr += height+",dependent=1";
	  attr += ",top="+wint+",left="+winl;
	  if(!tinywin)
	  {
	    tinywin = "tinywin";
	  }
	  window.open(url, tinywin, attr);
}

function register()
{

	  var url    = "/newuser.aspx";
	  var width  = 320;
	  var height = 450;
    //var left   = 250;
	  var winl = (screen.width-width)/2;
    var wint = (screen.height-height)/2;
    if (winl < 0) winl = 0;
    if (wint < 0) wint = 0;
	  var attr = "directories=no,status=yes,location=no,toolbar=no,scrollbars=yes,resizable=no,menubar=no,copyhistory=no,width=";
	  attr += width;
	  attr += ",height=";
	  attr += height+",dependent=1";
	  attr += ",top="+wint+",left="+winl;
	  if(!regwin)
	  {
	    regwin = "regwin";
	  }
	  window.open(url, regwin, attr);

}

// Tree Search Builder.
function SwitchMenu(obj){
  //alert("finding " + obj);
	if(document.getElementById){
	var el = document.getElementById(obj);
	var ar = document.getElementById("cont").getElementsByTagName("DIV");
		if(el.style.display == "none"){
			for (var i=0; i<ar.length; i++){
				ar[i].style.display = "none";
			}
			el.style.display = "block";
		}else{
			el.style.display = "none";
		}
	}
}

function ChangeClass(menu, newClass) { 
	 if (document.getElementById) { 
	 	document.getElementById(menu).className = newClass;
	 } 
} 

document.onselectstart = new Function("return true");
//-->



