var $jezik=1;
var $putanja='';

var lnkPlus="http://www.yacht-base.com/images/list_plus.gif";
var lnkMinus="http://www.yacht-base.com/images/list_minus.gif";
var imgPlus=new Image();
imgPlus.src= lnkPlus;
var imgMinus=new Image();
imgMinus.src= lnkMinus;

		function toggle(row) {
			var el=document.getElementById(row);
			if (el) {
				var imel=document.images[row+"Plus"];
				if (el.style.display.length==0) {
					el.style.display="none";
					if (imel) imel.src=lnkPlus;
				}
				else {
					el.style.display="";
					if (imel) imel.src=lnkMinus;
				}
			}

		}




function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function wl_add_en(wl)
{
	var name = "wl";

        wl_x=readCookie(name);

        if( wl_x!=null )
          {
             lista=wl_x.split(',')

             g=0
             nasao=0
             while(g<lista.length)
             {
                if(lista[g]==wl)
                  {
                    nasao=1
                    alert('This boat is already is on your Wish List')
                  }

                g++
             }

             if( nasao==0 )
               {
                 x=wl_x+wl+","
                 alert('Boat added to your Wish List');
               }
          } else {
             x=wl+","
             alert('Boat added to your Wish List');
          }

	createCookie(name,x,7);

}

function wl_del_en(wl)
{

	var name = "wl";

        wl_x=readCookie(name);

        if( wl_x!=null )
          {
             lista=wl_x.split(',')

             g=0
             nasao=0
             while(g<lista.length)
             {
                if(lista[g]==wl)
                  {
                    nasao=1
                  }

                g++
             }

             if( nasao==0 )
               {
                 alert('Boat is not on your wish list!');
               } else {
                 z=confirm('Remove boat from your wish list ?');

                 if (z)
                     {
                       zs=wl+','
                       x=wl_x.replace(zs,'')
                       createCookie(name,x,7);

                       if( x=='' )
                         {
                           window.location="http://www.yacht-base.com/index.php";
                         } else {
                           window.location="http://www.yacht-base.com/wishlist.php";
                         }


                     }

               }
          }

}

function wl_list_en()
{
	var name = "wl";

        wl_x=readCookie(name);

        if( wl_x!=null )
          {
             window.location="http://www.yacht-base.com/wishlist.php";
          } else {
             alert('Your Wish List is empty. Please choose boats.');
          }

}


function luke_check_en()
{
  boat_in.luke_c.value=1;
}

function boat_in_check_en()
{
    x=0;

    if (boat_in.from.value=='')
    {
       alert('PERIOD is requested data!');
       boat_in.from.focus();
       x=1;
    }

    if (boat_in.to.value=='' && x==0)
    {
       alert('PERIOD is requested data!');
       boat_in.to.focus();
       x=1;
    }

    if (boat_in.name.value=='' && x==0)
    {
       alert('NAME is requested data!');
       boat_in.name.focus();
       x=1;
    }

    if (boat_in.email.value=='' && x==0)
    {
       alert('EMAIL is requested data!');
       boat_in.email.focus();
       x=1;
    }

    var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
    if(!filter.test(boat_in.email.value) && x==0 )
      {
         alert('This is not a valid EMAIL address!');
         boat_in.email.value="";
         boat_in.email.focus();
         x=1;
      }

    if (x==0)
    {
       boat_in.submit();
    }
}

function wl_check_en()
{

    x=0;

    if (wl.from.value=='')
    {
       alert('PERIOD is requested data!');
       wl.from.focus();
       x=1;
    }

    if (wl.to.value=='' && x==0)
    {
       alert('PERIOD is requested data!');
       wl.to.focus();
       x=1;
    }

    if (wl.name.value=='' && x==0)
    {
       alert('NAME is requested data!');
       wl.name.focus();
       x=1;
    }

    if (wl.email.value=='' && x==0)
    {
       alert('EMAIL is requested data!');
       wl.email.focus();
       x=1;
    }

    var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
    if(!filter.test(wl.email.value) && x==0 )
      {
         alert('This is not a valid EMAIL address!');
         wl.email.value="";
         wl.email.focus();
         x=1;
      }

    if (x==0)
    {
       wl.submit();
    }
}

function gene_in_check_en()
{
    x=0;

    if (gene_in.name.value=='' && x==0)
    {
       alert('NAME is requested data!');
       gene_in.name.focus();
       x=1;
    }

    if (gene_in.email.value=='' && x==0)
    {
       alert('EMAIL is requested data!');
       gene_in.email.focus();
       x=1;
    }

    var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
    if(!filter.test(gene_in.email.value) && x==0 )
      {
         alert('This is not a valid EMAIL address!');
         gene_in.email.value="";
         gene_in.email.focus();
         x=1;
      }


    if (x==0)
    {
       gene_in.submit();
    }
}

function addi_gen_check_en()
{
    x=0;

    if (x==0)
    {
       addi.submit();
    }
}

function tell_check_en()
{
    x=0;
    var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;

    if (tell.sender_name.value=='' && x==0)
    {
       alert('SENDER NAME is requested data!');
       tell.sender_name.focus();
       x=1;
    }

    if (tell.sender_mail.value=='' && x==0)
    {
       alert('SENDER EMAIL is requested data!');
       tell.sender_mail.focus();
       x=1;
    }

    if(!filter.test(tell.sender_mail.value) && x==0 )
      {
         alert('This is not a valid SENDER EMAIL address!');
         tell.sender_mail.value="";
         tell.sender_mail.focus();
         x=1;
      }

    if (tell.rec1_email.value=='' && tell.rec2_email.value=='' && tell.rec3_email.value=='' && x==0)
    {
       alert('At least one recipient must be specified!');
       tell.rec1_email.focus();
       x=1;
    }

    if (tell.security_code.value=='')
    {
       alert('SECURITY CODE is requested data!');
       tell.security_code.focus();
       x=1;
    }

    if (tell.rec1_email.value!='' && x==0)
    {
      if(!filter.test(tell.rec1_email.value) && x==0 )
        {
           alert('This is not a valid RECIPIENT1 EMAIL address!');
           tell.rec1_email.value="";
           tell.rec1_email.focus();
           x=1;
        }
    }

    if (tell.rec2_email.value!='' && x==0)
    {
      if(!filter.test(tell.rec2_email.value) && x==0 )
        {
           alert('This is not a valid RECIPIENT2 EMAIL address!');
           tell.rec2_email.value="";
           tell.rec2_email.focus();
           x=1;
        }
    }

    if (tell.rec3_email.value!='' && x==0)
    {
      if(!filter.test(tell.rec3_email.value) && x==0 )
        {
           alert('This is not a valid RECIPIENT3 EMAIL address!');
           tell.rec3_email.value="";
           tell.rec3_email.focus();
           x=1;
        }
    }

    if (x==0)
    {
       tell.submit();
    }
}

function wl_add_hr(wl)
{
	var name = "wl";

        wl_x=readCookie(name);

        if( wl_x!=null )
          {
             lista=wl_x.split(',')

             g=0
             nasao=0
             while(g<lista.length)
             {
                if(lista[g]==wl)
                  {
                    nasao=1
                    alert('This boat is already is on your Wish List')
                  }

                g++
             }

             if( nasao==0 )
               {
                 x=wl_x+wl+","
                 alert('Boat added to your Wish List');
               }
          } else {
             x=wl+","
             alert('Boat added to your Wish List');
          }

	createCookie(name,x,7);

}

function wl_del_hr(wl)
{

	var name = "wl";

        wl_x=readCookie(name);

        if( wl_x!=null )
          {
             lista=wl_x.split(',')

             g=0
             nasao=0
             while(g<lista.length)
             {
                if(lista[g]==wl)
                  {
                    nasao=1
                  }

                g++
             }

             if( nasao==0 )
               {
                 alert('Boat is not on your wish list!');
               } else {
                 z=confirm('Remove boat from your wish list ?');

                 if (z)
                     {
                       zs=wl+','
                       x=wl_x.replace(zs,'')
                       createCookie(name,x,7);

                       if( x=='' )
                         {
                           window.location="http://www.yacht-base.com/hr/index.php";
                         } else {
                           window.location="http://www.yacht-base.com/hr/wishlist.php";
                         }


                     }

               }
          }

}

function wl_list_hr()
{
	var name = "wl";

        wl_x=readCookie(name);

        if( wl_x!=null )
          {
             window.location="http://www.yacht-base.com/hr/wishlist.php";
          } else {
             alert('Your Wish List is empty. Please choose boats.');
          }

}


function luke_check_hr()
{
  boat_in.luke_c.value=1;
}

function boat_in_check_hr()
{
    x=0;

    if (boat_in.from.value=='')
    {
       alert('PERIOD is requested data!');
       boat_in.from.focus();
       x=1;
    }

    if (boat_in.to.value=='' && x==0)
    {
       alert('PERIOD is requested data!');
       boat_in.to.focus();
       x=1;
    }

    if (boat_in.name.value=='' && x==0)
    {
       alert('NAME is requested data!');
       boat_in.name.focus();
       x=1;
    }

    if (boat_in.email.value=='' && x==0)
    {
       alert('EMAIL is requested data!');
       boat_in.email.focus();
       x=1;
    }

    var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
    if(!filter.test(boat_in.email.value) && x==0 )
      {
         alert('This is not a valid EMAIL address!');
         boat_in.email.value="";
         boat_in.email.focus();
         x=1;
      }

    if (x==0)
    {
       boat_in.submit();
    }
}

function wl_check_hr()
{

    x=0;

    if (wl.from.value=='')
    {
       alert('PERIOD is requested data!');
       wl.from.focus();
       x=1;
    }

    if (wl.to.value=='' && x==0)
    {
       alert('PERIOD is requested data!');
       wl.to.focus();
       x=1;
    }

    if (wl.name.value=='' && x==0)
    {
       alert('NAME is requested data!');
       wl.name.focus();
       x=1;
    }

    if (wl.email.value=='' && x==0)
    {
       alert('EMAIL is requested data!');
       wl.email.focus();
       x=1;
    }

    var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
    if(!filter.test(wl.email.value) && x==0 )
      {
         alert('This is not a valid EMAIL address!');
         wl.email.value="";
         wl.email.focus();
         x=1;
      }

    if (x==0)
    {
       wl.submit();
    }
}

function gene_in_check_hr()
{
    x=0;

    if (gene_in.name.value=='' && x==0)
    {
       alert('NAME is requested data!');
       gene_in.name.focus();
       x=1;
    }

    if (gene_in.email.value=='' && x==0)
    {
       alert('EMAIL is requested data!');
       gene_in.email.focus();
       x=1;
    }

    var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
    if(!filter.test(gene_in.email.value) && x==0 )
      {
         alert('This is not a valid EMAIL address!');
         gene_in.email.value="";
         gene_in.email.focus();
         x=1;
      }


    if (x==0)
    {
       gene_in.submit();
    }
}

function addi_gen_check_hr()
{
    x=0;

    if (x==0)
    {
       addi.submit();
    }
}

function tell_check_hr()
{
    x=0;
    var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;

    if (tell.sender_name.value=='' && x==0)
    {
       alert('SENDER NAME is requested data!');
       tell.sender_name.focus();
       x=1;
    }

    if (tell.sender_mail.value=='' && x==0)
    {
       alert('SENDER EMAIL is requested data!');
       tell.sender_mail.focus();
       x=1;
    }

    if(!filter.test(tell.sender_mail.value) && x==0 )
      {
         alert('This is not a valid SENDER EMAIL address!');
         tell.sender_mail.value="";
         tell.sender_mail.focus();
         x=1;
      }

    if (tell.rec1_email.value=='' && tell.rec2_email.value=='' && tell.rec3_email.value=='' && x==0)
    {
       alert('At least one recipient must be specified!');
       tell.rec1_email.focus();
       x=1;
    }

    if (tell.security_code.value=='')
    {
       alert('SECURITY CODE is requested data!');
       tell.security_code.focus();
       x=1;
    }

    if (tell.rec1_email.value!='' && x==0)
    {
      if(!filter.test(tell.rec1_email.value) && x==0 )
        {
           alert('This is not a valid RECIPIENT1 EMAIL address!');
           tell.rec1_email.value="";
           tell.rec1_email.focus();
           x=1;
        }
    }

    if (tell.rec2_email.value!='' && x==0)
    {
      if(!filter.test(tell.rec2_email.value) && x==0 )
        {
           alert('This is not a valid RECIPIENT2 EMAIL address!');
           tell.rec2_email.value="";
           tell.rec2_email.focus();
           x=1;
        }
    }

    if (tell.rec3_email.value!='' && x==0)
    {
      if(!filter.test(tell.rec3_email.value) && x==0 )
        {
           alert('This is not a valid RECIPIENT3 EMAIL address!');
           tell.rec3_email.value="";
           tell.rec3_email.focus();
           x=1;
        }
    }

    if (x==0)
    {
       tell.submit();
    }
}






function gen_book_note()
{
   if( gene_in.prvi.value==1 )
     {
         gene_in.note.value="";
         gene_in.note.style.color = "black";

         gene_in.prvi.value=0;
     }
}



function bookmarksite(title,url){
if (window.sidebar) // firefox
	window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){ // opera
	var elem = document.createElement('a');
	elem.setAttribute('href',url);
	elem.setAttribute('title',title);
	elem.setAttribute('rel','sidebar');
	elem.click();
}
else if(document.all)// ie
	window.external.AddFavorite(url, title);
}

function addfav()
   {
   if (document.all)
      {
      window.external.AddFavorite
      ("http://www.yacht-base.com","YachtCharterCroatia")
      }
   }

function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}

<!--
function MM_showHideLayers() { //v9.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3)
  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
