jQuery.noConflict();

//alert(langs);

jQuery(document).ready(function() {
  var sub = jQuery(".submenu");
  var subcontent = jQuery("#content .subcontent");
  //var fix = jQuery("#content .fix");
              /*jQuery("li.holder", sub).remove("br");
if (jQuery.browser.msie)
  {

}*/

	jQuery("li.holder", sub).hide();
	jQuery("a.menu", sub).click(function(){ jQuery(this).parent().next().slideToggle();
	});
  jQuery("a.lnk, .fixlink, .gallery", sub).not(jQuery(".holder", sub)).mouseover(function() { jQuery(this).css("color", "#f6d471") });
  jQuery("a.lnk, .fixlink, .gallery", sub).not(jQuery(".holder", sub)).bind('mouseout', mout)

  function mout() { jQuery(this).css("color", "#d1caa8"); }

  var x = 0;
  jQuery("a.fixlink", sub).click(function(){
    jQuery("#content .fix").css("display", "block");
    jQuery("#content .subcontent").css("display", "none");
    if (x == 1) {
      old.css("font-weight", "100");
      old.css("color", "#d1caa8");
      old.bind('mouseout', mout);
    }
    jQuery(this).css("font-weight", "bold");
    jQuery(this).css("color", "#f6d471");
    jQuery(this).unbind('mouseout', mout);
    old = jQuery(this);
    x = 1;
    return false;
  });
  jQuery("a.lnk", sub).click(function(){
    jQuery("#content .subcontent").css("display", "block");
    jQuery("#content .fix").css("display", "none");
    if (x == 1) {
      old.css("font-weight", "100");
      old.css("color", "#d1caa8");
      old.bind('mouseout', mout);
    }
    jQuery(this).css("font-weight", "bold");
    jQuery(this).css("color", "#f6d471");
    jQuery(this).unbind('mouseout', mout);
    old = jQuery(this);
    x = 1;
    //jQuery(old).css("font-weight", "100");
    jQuery("#content .subcontent").empty();
    var subcontent = jQuery(this).attr("class");
    //alert(subcontent);
    jQuery.ajax( {type: "POST", url: "contentajax.php", data: "subcontent="+subcontent+"&langs="+langs, dataType: "json",  success: content});

      function content(j){
        if (j)
        {
           jQuery("#content .subcontent").html(j);
        }


      }
    return false;
  });
  jQuery("a.gallery", sub).click(function(){
    if (x == 1) {
      old.css("font-weight", "100");
      old.css("color", "#d1caa8");
      old.bind('mouseout', mout);
    }
    jQuery(this).css("font-weight", "bold");
    jQuery(this).css("color", "#f6d471");
    jQuery(this).unbind('mouseout', mout);
    old = jQuery(this);
    x = 1;
    //jQuery(old).css("font-weight", "100");
   jQuery("#content .subcontent").empty();
   dir = jQuery(this).attr('href').match(/=([^=]*)$/)[1];
    //alert(dir);

    //var dir = jQuery(this).html().toLowerCase();
    dir = dir.toLowerCase();
    dir = dir.replace(' ','_');
    //alert(dir);
    jQuery.ajax( {type: "POST", url: "gallery.php", data: "dir="+dir+"&langs="+langs, dataType: "json",  success: content});

      function content(j){
        if (j)
        {
           jQuery("#content .subcontent").html(j);
           jQuery("#content .subcontent").ready(function() {
             //initLightbox();
             myLightbox.updateImageList();
           });
        }


      }
    return false;
  });

   var opt = {
    url: "regajax.php",
    dataType: 'json',
    success: function(data) {
      if (!data)
        {
        //alert('Thank you for your registration!');
        jQuery("input#name").removeClass();
        jQuery("input#email").removeClass();
        jQuery('#contactform label[@for="name"]').removeClass();
        jQuery('#contactform label[@for="email"]').removeClass();
		jQuery("form#contactform").attr("style", "display:none");
		jQuery("div#thanx_spacer").html("<h4>K\u00F6sz\u00F6nj\u00FCk regisztr\u00E1ci\u00F3j\u00E1t! Mostant\u00F3l \u00D6n a Mandala Member Club tagja!</h4><br><h4>Thank you for your registration! Now you are a member of the Mandala Member Club!</h4>");
      }
      else {
      	if(data['class']['email2']=='error') {
      		/*
      		Á \u00C1 á \u00E1
É \u00C9 é \u00E9
Í \u00CD í \u00ED
Ó \u00D3 ó \u00F3
Ö \u00D6 ö \u00F6
Õ \u0150 õ \u0151
Ú \u00DA ú \u00FA
Ü \u00DC ü \u00FC
Û \u00DB û \u00FB
      		*/
      		var hibacska="Ezzel az email c\u00EDmmel m\u00E1r feliratkoztak!\n";
      	}
      	else {
      		var hibacska="";
      	}
        jQuery("input#name").attr("class", data['class']['name']);
        jQuery("input#email").attr("class", data['class']['email']);
        jQuery('#contactform label[@for="name"]').attr("class", data['class']['name']);
        jQuery('#contactform label[@for="email"]').attr("class", data['class']['email']);
        alert(hibacska+'Please correct the red colored field(s)!');
      }
       // 'data' is an object representing the the evaluated json data
    }
};
//jQuery('#contactform').ajaxSubmit(opt);
jQuery('#contactform').submit(function() { jQuery(this).ajaxSubmit(opt); return false; });
});

