/* DROPDOWN MENU */

function mainmenu(){
$(" #nav ul ").css({display: "none"});
$(" #nav li").hover(function(){
	$(this).find('ul:first:hidden').css({visibility: "visible",display: "none"}).fadeIn(400);
	},function(){
		$(this).find('ul:first').fadeOut(400);
	});
}
$(document).ready(function(){
	mainmenu();
});

/* MOSTRAR Y OCULTAR CONTACTO */

$(document).ready(function(){
	
	$(".cerrarcontacto, .darken").click(function(event){
		event.preventDefault();
		$(".contacto, .contactogracias, .darken").fadeOut("fast");
	});
	$(".mostrarcontacto").click(function(event){
		event.preventDefault();
		$(".contacto, .darken").fadeIn("slow");
	});
	
});

/* VALIDACIÓN DE FORMULARIO */

function MM_validateForm() {
	if (document.getElementById){
    var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
    for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);
      if (val) { nm=val.name; if ((val=val.value)!="") {
        if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
          if (p<1 || p==(val.length-1)) errors+='- "'+nm+'" debe contener una direcciÃ³n de email vÃ¡lida.\n';
        } else if (test!='R') { num = parseFloat(val);
          if (isNaN(val)) errors+='- "'+nm+'" debe contener un nÃºmero.\n';
          if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
            min=test.substring(8,p); max=test.substring(p+1);
            if (num<min || max<num) errors+='- "'+nm+'" debe contener un nÃºmero entre '+min+' y '+max+'.\n';
      } } } else if (test.charAt(0) == 'R') errors += '- El campo "'+nm+'" es requerido.\n'; }
    } if (errors) alert('Por favor revise este mensaje:\n\n'+errors);
    document.MM_returnValue = (errors == '');
}}

/* GOOGLE MAPS API */

function initialize() {
  var myLatlng = new google.maps.LatLng(-34.665888,-58.529129);
  var myOptions = {
    zoom: 14,
    center: myLatlng,
    mapTypeId: google.maps.MapTypeId.ROADMAP
  }
  var map = new google.maps.Map(document.getElementById("mapa"), myOptions);

 var image = new google.maps.MarkerImage('img/pointer.png',
      // This marker is 20 pixels wide by 32 pixels tall.
      new google.maps.Size(152, 83),
      // The origin for this image is 0,0.
      new google.maps.Point(0,0),
      // The anchor for this image is the base of the flagpole at 0,32.
      new google.maps.Point(32, 81));
	  var myLatLng = new google.maps.LatLng(-34.665888,-58.529129);
  var beachMarker = new google.maps.Marker({
      position: myLatLng,
      map: map,
      icon: image
  });
}

/* SLIDESHOWS */

$(document).ready(function() {
    $('.slide').cycle({
		fx: 'fade'
	});
});

/* ANCLAS CON SCROLL ANIMADO (USADO EN PRODUCTOS) */

;(function($){var m=$.scrollTo=function(b,h,f){$(window).scrollTo(b,h,f)};m.defaults={axis:'xy',duration:parseFloat($.fn.jquery)>=1.3?0:1};m.window=function(b){return $(window).scrollable()};$.fn.scrollable=function(){return this.map(function(){var b=this,h=!b.nodeName||$.inArray(b.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!h)return b;var f=(b.contentWindow||b).document||b.ownerDocument||b;return $.browser.safari||f.compatMode=='BackCompat'?f.body:f.documentElement})};$.fn.scrollTo=function(l,j,a){if(typeof j=='object'){a=j;j=0}if(typeof a=='function')a={onAfter:a};if(l=='max')l=9e9;a=$.extend({},m.defaults,a);j=j||a.speed||a.duration;a.queue=a.queue&&a.axis.length>1;if(a.queue)j/=2;a.offset=n(a.offset);a.over=n(a.over);return this.scrollable().each(function(){var k=this,o=$(k),d=l,p,g={},q=o.is('html,body');switch(typeof d){case'number':case'string':if(/^([+-]=)?\d+(\.\d+)?(px)?$/.test(d)){d=n(d);break}d=$(d,this);case'object':if(d.is||d.style)p=(d=$(d)).offset()}$.each(a.axis.split(''),function(b,h){var f=h=='x'?'Left':'Top',i=f.toLowerCase(),c='scroll'+f,r=k[c],s=h=='x'?'Width':'Height';if(p){g[c]=p[i]+(q?0:r-o.offset()[i]);if(a.margin){g[c]-=parseInt(d.css('margin'+f))||0;g[c]-=parseInt(d.css('border'+f+'Width'))||0}g[c]+=a.offset[i]||0;if(a.over[i])g[c]+=d[s.toLowerCase()]()*a.over[i]}else g[c]=d[i];if(/^\d+$/.test(g[c]))g[c]=g[c]<=0?0:Math.min(g[c],u(s));if(!b&&a.queue){if(r!=g[c])t(a.onAfterFirst);delete g[c]}});t(a.onAfter);function t(b){o.animate(g,j,a.easing,b&&function(){b.call(this,l,a)})};function u(b){var h='scroll'+b;if(!q)return k[h];var f='client'+b,i=k.ownerDocument.documentElement,c=k.ownerDocument.body;return Math.max(i[h],c[h])-Math.min(i[f],c[f])}}).end()};function n(b){return typeof b=='object'?b:{top:b,left:b}}})(jQuery);
