// URL
var win=(navigator.platform.indexOf('Win')!=-1)? true : false;
var ie= (typeof document.all!= 'undefined')? true : false;
var winie=(win && ie !=-1)? true : false;
var adresse='url(#default#homepage)' ;
var url=document.location;
var title=document.title;
//URL rewrite

/*
encodeURL = function(url) {
   var sid = '<%= session.getId() %>';
   var q = var q = url.indexOf('?');

   if(q != -1) {
      return url.substring(0, q) + ';jsessionid=' + sid + url.substring(q, url.length());
   }*/
  /* return url + ';jsessionid=' + sid; */
  /*
   return url + '?jsessionid=' + sid
}
*/

// Toggle Element
function toggle(id)
{
    var element = document.getElementById(id);
    with (element.style)
    {
         ( display == "none" )?  display = "":  display = "none";
    }
    var text = document.getElementById(id + "-switch").firstChild;
    (text.nodeValue == "[show]") ? text.nodeValue = "[hide]":   text.nodeValue = "[show]";

}

// HOME PAGE
function home(objet)
{ 
		if (winie)
		{
				objet.style.behavior='url(#default#homepage)';
				objet.setHomePage(url);
		}
		else if (ie)
		{
			 alert( msg_setfavori);
	}
	else
	{
 alert(msg_setfavori);
	}
}


// SET FAVORI
function favo()
{  
	if (win)
	{
		if (document.all)
		{
		window.external.AddFavorite(url,title);
		}
		else
		{
			alert('Press \'ctrl\' & \'d\'');
		}
	}
	else 
	{
		alert('Press "command" & "d"');
	}
}

function SwitchLang(bc , cc , lc)
{
//alert( "bc =" + bc + " - lc = " + lc + "cc= " + cc); 
   sep="?";
   
   var url=""+ document.location ;
   arrlocation= url.split('?');
   
   url=arrlocation[0];
   
   // Analyze parameter and replace value 
   if ( arrlocation.length < 2 )
   {
        var url  =url +  sep + 'BC=' + bc + '&LC=' + lc + '&CC=' + cc;

   }
   else
   {
   
      var arrparams = arrlocation[1].split("&") ;
      flagotherparams=false;
      para_lang = "";
	
      for (j=0 ; j < arrparams.length ; j++)
      {
	  
		 tempo = '' + arrparams[j] ;
         var arrval = tempo.split ("=");
          if ( arrval [0]=="BC") 
          {
              para_lang    += "&BC=" + bc ;
          }
          else       if ( arrval [0]=="LC") 
          {
              para_lang   += "&LC=" + lc ;
          }
            else       if ( arrval [0]=="CC") 
          {
              para_lang   += "&CC=" + cc ;
          }
          else
          {
               (url.lastIndexOf ('?') == -1)  ?      url += '?' + arrval[0] + "=" + arrval[1]  :   url += "&"+ arrval[0] + "="+ arrval[1];
           flagotherparams=true;
          }

          
      }
      (flagotherparams==false) ? sep="?" : sep="&" ;
      if (para_lang=="")
      {
           para_lang = "BC=" + bc + "&LC=" + lc + "&CC=" + cc;
      }
     	  url  += sep + para_lang ;

      
   }
   
			   document.location = url;
			   }
// New by month & faq
function ShowHide(DivID){
	var el = document.getElementById(DivID).style;
	if (el == null) return;
	el.display = (el.display == "none" ? "" : "none");
}
// end news
function HideAll(myTag) {
	var NbAnswers=(document.getElementsByTagName(myTag).length);
	for(var i=0;i<NbAnswers;i++){ 
		var	current=document.getElementsByTagName(myTag)[i]; 
		if(current.className == "answer"){current.style.display= "none";} 
   								}
						}
function ShowAll(myTag) {
	var NbAnswers=(document.getElementsByTagName(myTag).length);
	for(var i=0;i<NbAnswers;i++){ 
		var	current=document.getElementsByTagName(myTag)[i]; 
		if(current.className == "answer"){current.style.display= "" ; } 
   								}
						}
//end faq
function Navigate ( prefix, sorting, start , max, step , direction) 
    {
      var startcount=0;
      if ( (''+start) == 'END') 
      {
         startcount= max+0;
      }
      else if ( (''+start) =='START')
      {
        startcount=1;
      }
      else
      {
        startcount = start+0 ;
      }
     //alert ("before :" + startcount);
      // Next set or Previous
     ( direction == '+') ?      startcount = startcount + step+0 :         startcount = startcount - step+0;

	 if ( prefix !="search")
     {
       document.location = prefix + '/'+sorting + '/'+startcount ;
     }
     else
     {
     //alert ( direction  + " --> start :" + startcount + " --> step : " + step);
        document.forms[0].pager_start.value = ""+startcount;
		document.forms[0].action="/search.do";
		document.forms[0].submit();
     }
    }
    
    function search ()
{
 

  document.forms[0].action="/search.do";
  
  document.forms[0].submit();
}

    function mailtofriend()
    {
      var body = "Marine%20Power%20Europe%20Inc%20Website:%20\an interesting link :\n" + document.location ;
      var subject = "Marine%20Power%20Europe%20Website";
      window.open("mailto:?body="+ body+ "&subject=" + subject);
    }

function mailDecrypt ( name , domain )
{
	if (name !='' && domain != ''){
	  url = 'm'+'a'+'i'+'l'+'t'+'o:'+ name + '@' + domain;
	    window.open (url);
	}

}
function checkreg(){
window.open("http://extranet.brunswickmarineemea.com/ENG/templates/warranty_avail.cfm", "CheckRegistration" , ' top=10, left=10,width=400,height=300, scrollbars=yes,resizable=yes,toolbar=no'); }
// open vr win  
var popUpWin=0;
function popUpWindow(URLStr, left, top, width, height)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menub ar=no,scrollbar=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');

}

var ns4 = document.layers;
var ns6 = document.getElementById && !document.all;
var ie4 = document.all;
offsetX = 0;
offsetY = 20;
var toolTipSTYLE="";
function initToolTips()
{
  if(ns4||ns6||ie4)
  {
    if(ns4) toolTipSTYLE = document.toolTipLayer;
    else if(ns6) toolTipSTYLE = document.getElementById("toolTipLayer").style;
    else if(ie4) toolTipSTYLE = document.all.toolTipLayer.style;
    if(ns4) document.captureEvents(Event.MOUSEMOVE);
    else
    {
      toolTipSTYLE.visibility = "visible";
      toolTipSTYLE.display = "none";
    }
    document.onmousemove = moveToMouseLoc;
  }
}
function toolTip(msg)
{
  if(toolTip.arguments.length < 1) // hide
  {
    if(ns4) toolTipSTYLE.visibility = "hidden";
    else toolTipSTYLE.display = "none";
  }
  else // show
  {
   
    var content ='<table border="0" cellspacing="0" cellpadding="1"><td><table border="0" cellspacing="0" cellpadding="2"><td align="left"> <ol style=\'margin-top:0px, margin-bottom:0px\'><li>Select the panoramas (or pictures) from the Dropdown menu.</li><li>Click and drag the panorama to control its movement, <br/>or use the &quot;left&quot;, &quot;right&quot;, &quot;up&quot;, &quot;down&quot;<br/> and &quot;stop panorama&quot;&nbsp;buttons.</li><li>Use the \'zoom\' buttons (+ or -) to zoom in/out.</li></ol> </td></table></td></table>';
    if(ns4)
    {
      toolTipSTYLE.document.write(content);
      toolTipSTYLE.document.close();
      toolTipSTYLE.visibility = "visible";
    }
    if(ns6)
    {
      document.getElementById("toolTipLayer").innerHTML = content;
      toolTipSTYLE.display='block'
    }
    if(ie4)
    {
      document.all("toolTipLayer").innerHTML=content;
      toolTipSTYLE.display='block'
    }
  }
}
function moveToMouseLoc(e)
{
  if(ns4||ns6)
  {
    x = e.pageX;
    y = e.pageY;
  }
  else
  {
    x = event.x + document.body.scrollLeft;
    y = event.y + document.body.scrollTop;
  }
  toolTipSTYLE.left = x + offsetX;
  toolTipSTYLE.top = y + offsetY;
  return true;
}

		function printIt(){
		
((''+document.location).lastIndexOf ('?') == -1) ? extraurl= '?cocoon-view=print' : extraurl='&amp;cocoon-view=print';
     	window.open( document.location + extraurl);	

	/*{
		window.print();
		window.location.reload();
	}*/}
	/*
	{
	
		// TO USE WITH COCOON - must still be review
		
		//((''+document.location).lastIndexOf ('?') == -1) ? extraurl= '?cocoon-view=print' : extraurl='&amp;cocoon-view=print',
     	//window.open( document.location + extraurl);  document.location=location;
		
		
		// TEMPORARY
		if (navigator.appName == "Netscape") 
		{
			window.print();
		}
		else 
		{
			try 
			{
				var webBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"'+ '></OBJECT'+'>';
				document.body.insertAdjacentHTML('beforeEnd', webBrowser);
				WebBrowser1.ExecWB(6,2);
				//Use a 1 vs. a 2 for a prompting dialog box
				WebBrowser1.outerHTML = "";
			} 
			catch(e) 
			{
					window.print();
					window.location.reload();
					// Or the button will never work again!
					// This fixes a bug in IE5.x
			}
		}

	}
	*/
