var msg = "";
$(function(){ // This is used when document is loaded
        try{
        $(".ajax-fc-container").captcha(); /* in this line note that ajax-fc-container is a class and we reference it with .(dot), if you want to change class to id, don't forget to replace the dot with # sign and also to describe it in css file. */
      }catch(ab){;}
        $(".clsFContain").css("width", $(".clsBlock:first").width() * $(".clsBlock").length);
         if(!$.browser.msie)
          $(".Navigate").css({backgroundPosition: "340px -115px"});
         else
          $(".Navigate").css({backgroundPosition: "350px -115px"});        
          $(".clsInnerRight").css("height" , $(".clsLeftC").height() > $(".clsRightC").height() ? $(".clsLeftC").height() - 30 : $(".clsRightC").height()-30 );

      $("#nav > li").hover(function(){
        $(this).removeClass('Imghover')
        $(this).addClass('Imghover1')
      },function(){
        $(this).removeClass('Imghover1')
        $(this).addClass('Imghover')
      });

      //Customer wants       
      if($(".clsTopLogos").height() > $(".clsLogo").height())
      {
        $(".clsLogo").css("padding-top", eval(($(".clsTopLogos").height() - $(".clsLogo").height()) / 2));
      } 
      if($(".clsTopLogos").height() > $(".clsCrowded").height())
      {
        $(".clsCrowded").css("padding-top", eval(($(".clsTopLogos").height() - $(".clsCrowded").height()) / 2));
      }
      $(".clsGetUpdate").click(function(){
        $(this).addClass("clsSelect");
        $(".boxSubscribe").css('height','160px');
        $(".clsUpdateList").animate({top:'0'},1000,function(){
          $("#txtSubscribe").focus();
        });
      });
      $("#cmdSubscriptionCancel").click(function() {
        
        $(".clsGetUpdate").removeClass("clsSelect");
        $(".clsUpdateList").animate({top:'-160'},1000,function(){
          $(".boxSubscribe").css('height','0px');
        });
      });

});
    
    function slideCorner(i)
    {
      var val; 
      if(!$.browser.msie)
      val = 340 + (94 * i);
      else
      val = 350 + (95 * i);
      var currSlideIndex = i ;
      $("#nav > li").removeClass('activeLI')
      .filter('li:eq('+currSlideIndex+')').addClass('activeLI');
      $("#nav > li").removeClass('Active')
      .filter('li:eq('+currSlideIndex+')').addClass('Active');
      
      $(".Navigate").animate({backgroundPosition:  val + "px -115px"}, 1000);
      
      $(".clsFContain").animate({marginLeft: ($(".clsBlock:first").width() * i * -1 ) + 'px'},1000);
      return false;
    }

function subscribe()
{
  if($("#txtSubscribeEmail").val() == "")
  {
    Sexy.error("Please enter email address");
    return false;
  }
  if($("#txtSubscribeName").val() == "")
  {
    Sexy.error("Please enter your name");
    return false;
  }
  if(!isValidEmail($("#txtSubscribeEmail").val()))
  {
    Sexy.error("Enter Valid email address");
    return false;
  }
  
  $(".clsGetUpdate").removeClass("clsSelect");
  $.post(basePath + "subscribe.php",{'txtSubscribeName': $("#txtSubscribeName").val() , 'txtSubscribeEmail': $("#txtSubscribeEmail").val() , "txtblogid":  $("#txtblogid").val()},function(data){    
    Sexy.info(data);
    $(".boxSubscribe .clsUpdateList").animate({top:'-160px'},1000,function(){
     $(".boxSubscribe").css('height','0px');
    });
    
  });
  return false;
}
function isValidEmail(str) {
      var reg1str = "(@.*@)|(\\.\\.)|(@\\.)|(\\.@)|(^\\.)";
      var reg2str = "^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\
\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$";
      var reg1 = new RegExp(reg1str);
      var reg2 = new RegExp(reg2str);
      if (!reg1.test(str) && reg2.test(str)) return true;
      return false;
}

