/*
var config = {    
     sensitivity: 3, // number = sensitivity threshold (must be 1 or higher)    
     interval: 200, // number = milliseconds for onMouseOver polling interval    
     timeout: 500, // number = milliseconds delay before onMouseOut    
};
*/
var config = { sensitivity: 3, interval: 200, timeout: 500 };

$(function(){
    $('.navigation .secNav ul').makeacolumnlists({cols: 2, colWidth: 0, equalHeight: 'div', startN: 1});
    $('.secNav-1').css({width:'185px'});
    $('.secNav li').hoverIntent(
        // MouseOver
        function(){
            var offset = $(this).offset();                             
            $(this).find('ul').css({display:'block'});                                 
            $(this).find('.li_container').fadeIn(); 
            $(this).addClass('active');
        }, 
        // MouseOut
        function() {
            $(this).find('.li_container').fadeOut();
            $(this).removeClass('active');
        }
    );
    
    
    if($("#flashMessage").length){
        $("#flashMessage").animate({dummy:1},5000,function(){
            $(this).slideUp("fast");
        })
    }
    
    //$('.leftBar dl.menu dd').hide();
    
    $('.leftBar dl.menu dt a').addClass("active")
    
    $('.leftBar dl.menu dt').click(function(e){
        $(this).children().toggleClass('active');
        $(this).nextAll().toggle('slide');
        if($(this).parent().find("dd").length)
            e.preventDefault();
    });
    
    $('.scaleNav li a').hoverIntent(
        // MouseOver
        function(){
            var offset = $(this).offset();
            $('#tooltip .tContent').html($(this).text());
            $('#tooltip').css({top: offset.top+$(this).height(), left: offset.left-8}).fadeIn();
        }, 
        // MouseOut
        function() {
            $('#tooltip').hide();
        }
    );
    
    $('#mForm input').each(function(i, v){
        if($(v).val()=="") {
            $(v).css({'background': '#fedddc'});
        }
    });
    $('#mForm input').focus(function(e){
        $(e.target).css({'background': '#fff'});
    });
    $('#mForm input').blur(function(e){
        if($(e.target).val()=="") {
            $(e.target).css({'background': '#fedddc'});
        }
    });
    
    $('a.btnComment').click(function(){
        $.scrollTo('.btnComment', 800, {onAfter:function(){
            $('.commentForm').slideDown();
        }});
    });
    
    $('a.btnComment2').click(function(){
        $.scrollTo('.btnComment2', 800, {onAfter:function(){
            $('.commentForm2').slideDown();
        }});
    });
    
    /* topNav Fix   */
    
    $('.topNav li').each(function(){
        if(!$(this).hasClass("first")){
            $(this).html(" | "+$(this).html())
        }
    });
    
    
    /* Slider */
    $('.slide:first').find('.text').fadeIn();
    $('.slide:first').next().width(100).next().width(50);
    var play = setInterval(function(){
        
        // Event
        $('.slide:first').clone().removeClass('first').appendTo($('.slider .holder'));
        $('.slide:first').animate({width: '0px'}, function(){
            $(this).remove();
        }).next().animate({width: '600px'}, function(){
                $(this).find('.text').fadeIn();
        }).next().animate({width: '100px'}).next().animate({width: '50px'}).find('.text').hide();
        
    }, 7000);
  
    if($(".tabs").length)
        $(".tabs").tabs()
        
    $(".backtotop").click(function(e){
        e.preventDefault()
        $(document).scrollTo(".header",200);
    })
    
    
    /*  profile picture change */
    $(".picuploadinit").click(function(e){
        e.preventDefault()
        $(".picupload input").trigger("click")
    })
    
    $(".picupload input").change(function(e){
        $(".picupload input").parent().submit()
    })
    
    
    if(window.location.hash=='#subscription'){
            $(document).scrollTo("#subscribe",1000)
    }
    else if(window.location.hash=='#joinanonymous'){
        $(document).scrollTo("#anonymous",1000)
    }
    
    
    $(".trialClose").click(function(e){
        e.preventDefault()
        $(".trialBar").slideUp(500,function(){
            $(".wrapper").animate({paddingTop:55},200);
            setCookie("beta_mode",1,1);
        })
    })
	
    if(getCookie('beta_mode') != '1'){
        $(".wrapper").animate({paddingTop:90},200);
        $(".trialBar").slideDown(500);
    }
    
    
    /* pop up login/registration   */
    /*-----------Comment reporting popup
    */
    $('.cmntReport').fancybox(
        {
            'href':$(this).attr("href"),
            'titleShow'     : false,
            'transitionIn'    : 'elastic',
            'transitionOut'    : 'elastic',
        }
    );
    
    $(".forget_toggle,.pop_login,.pop_register,.register-now,.login,.conceptionBirth").fancybox(
        {
            'titleShow'     : false,
            'transitionIn'    : 'elastic',
            'transitionOut'    : 'elastic',
        }
    );                                                              
    
    if(getCookie('bijoya') != '1' || true){
        $(".pop_bijoya").fancybox(
            {
                onClosed    :   function() {
                    setCookie("bijoya",1,1);
                }
            }
        ).trigger('click');
        setTimeout('$.fancybox.close();', '60000');                                                                                
    }
    
    $(".popSocialBox .rpxnow").live("click",function(e){
        $(".topMiddle .rpxnow").trigger("click");
    })
    
    $(".register_toggle").live("click",function(e){
        e.preventDefault()
        //$.fancybox.close()
        $(".pop_register:first").trigger("click")
    })
    $(".login_toggle").live("click",function(e){
        e.preventDefault()
        //$.fancybox.close()
        $(".pop_login:first").trigger("click")
    })
    $(".forget_toggle").live("click",function(e){
        e.preventDefault()
        $.fancybox(
        {
            'href':$(this).attr("href"),
            'titleShow'     : false,
            'transitionIn'    : 'elastic',
            'transitionOut'    : 'elastic',
        }
    );
    
    })
    
    
    $(".popForm form").live("submit",function(e){
        e.preventDefault();
        $.post($(this).attr("action"),$(this).serialize(),function(data){
            if(data.message=="success"){
                window.location.reload(false);
            }
            else {
                $(".popForm .messageBox").text(data.message).slideDown(500,function(){
                    $(this).animate({dummy:1},2000,function(){
                        $(this).slideUp(500)    
                    })
                })
                $(".error-message").remove();
                if(typeof(data.validationErrors)=="object"){
                    var errors=data.validationErrors;
                    for(key in errors){
                        var selector="#Register"+ucfirst(key);
                        
                        if(key=="nick_name")    
                            selector="#RegisterNickName";
                        
                        $(selector).after("<div class='error-message'>"+errors[key]+"</div>");    
                    }
                }
            }
        },'json')
    })
    
    /* widget - baby development */
    
    widget_baby_development_init()
    
    
});

// call this function to init baby development slider widget
function widget_baby_development_init(){
    
    var main=function(){
        jQuery("#baby-development .x").fadeIn(100);
        jQuery("#baby-development .loader").hide(50);
        
        jQuery("#baby-development .view").live("click",function(e){
            e.preventDefault()
            jQuery("#baby-development .x").slideUp(500)
            jQuery("#baby-development .slideBox").slideDown(500,function(){
                jQuery(document).ready(function($){
                    /*$(".baby_development_slides").jGallery({
                            sliderContainer:".thumbslider",
                            nextClass:"nextslide",
                            prevClass:"prevslide",
                            showItems:4,
                            autoTransition:false,
                            transitionEvent:'click',
                            transitionSpeed:150
                        },{container:'ul',
                        item:'li'
                    });*/
                    
                    nextSlides=1;
                    prevSlides=1;
                    totalSlides = $('.thumbslider ul li').size();
                    slidePart = Math.ceil(totalSlides/4);
                    $('.baby_development_slides span').not('.baby_development_slides .slcted').css({display:"none"});
                    
                    $('.thumbslider a').click(function(){
                        activeSlide = $('.thumbslider a').index($('.activeslide'))+1;
                        $('.thumbslider a').removeClass('activeslide');
                        $(this).addClass('activeslide');
                        slideIndex = $('.thumbslider a').index($(this))+1;
                        if(activeSlide != slideIndex){
                            $('.baby_development_slides span:nth-child('+activeSlide+')').fadeOut(300,function(){
                                $('.baby_development_slides span:nth-child('+slideIndex+')').fadeIn(300);
                            });
                            
                        }
                    });
                    $('.prevslide').click(function(){
                        if(prevSlides-1 > 0){
                            nextSlides = prevSlides-1;
                            moveSlides();
                        }    
                    });
                    $('.nextslide').click(function(){
                        if(prevSlides+1 <= slidePart){
                            nextSlides = prevSlides+1;
                            moveSlides();
                        }    
                    });
                    
                    function moveSlides(){                 
                        slideHolder = $('#baby-development ul').css('left');
                        slideHolder = parseInt(slideHolder.replace('px',''));
                        if(nextSlides>prevSlides){
                            left = slideHolder-240;       
                            $('#baby-development ul').animate({left:left+'px'},500);
                        }else{
                            left = slideHolder+240;       
                            $('#baby-development ul').animate({left:left+'px'},500);
                        }
                        prevSlides = nextSlides;
                    }
                })        
            })
        })
    }
    
    
    if(typeof jQuery=="undefined"){
        alert("Widget:baby development is missing jQuery!");
    }
    else {
        if(jQuery("#baby-development").length){
            var imgcount=jQuery('#baby-development img').length;
            var complete=0;
            jQuery('#baby-development img').load(function(){
                complete++;
                if(complete==imgcount){
                    main();    
                }
            })
            // fix for cached img
            jQuery('#baby-development img').each(function(){
                if(this.complete)complete++;
                if(complete==imgcount){
                    main();    
                }
            })
        }
        
    }
    
}


function ucfirst (str) {
    str += '';
    var f = str.charAt(0).toUpperCase();
    return f + str.substr(1);
}

function setCookie(c_name,value,exdays){
	var exdate=new Date();
	exdate.setDate(exdate.getDate() + exdays);
	var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
	document.cookie=c_name + "=" + c_value;
}

function getCookie(c_name){
    var i,x,y,ARRcookies=document.cookie.split(";");
    for (i=0;i<ARRcookies.length;i++)
    {
      x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
      y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
      x=x.replace(/^\s+|\s+$/g,"");
      if (x==c_name)
        {
        return unescape(y);
        }
      }
}


/*  profile picture change callback functions */
function startCallback() {
    $(".picuploadinit").hide()
    $(".picloader").show()
    
    return true;
}

function completeCallback(response) {
    // make something useful after (onComplete)
    if(response.match("profile_images")){
        if($(".pPic img.profile_pic").length){
            $(".pPic img.profile_pic").attr("src",response)
            $(".avHolder img").attr("src",response)
        }
        else {
           $(".pPic").prepend('<img class="profile_pic" width="140" src="'+response+'" alt=""/>')
           $(".topMiddle").prepend('<div class="avHolder"><span></span><img src="'+response+'" alt="avatar"></div>')
        }
    }
    else alert(response)
    $(".picuploadinit").show()
    $(".picloader").hide()
    
}

var page = 1;
function loadMore() {
    $.post(BASE+'/ajax/local/more/',
    {page: page},
    function(data){
        if(data=='') {
            data = '<div class="end">No more content available</div>';
        }
        $('.items').append('<div class="clearfix cls" style="display:none" id="page'+page+'">'+data+'</div>');
        $('#page' + page).slideDown('slow');        
        page++;
    }, 
    "html");
}



/* Ovulation Box */
function ovulation() {
    $.post(BASE+'/ajax/widgets/ovulation', 
        {
            'data[day]':$('.ovulationBox .day:first').val(),
            'data[mon]':$('.ovulationBox .mon').val(),
            'data[yr]':$('.ovulationBox .yr').val(),
            'data[pr]':$('.ovulationBox .day:last').val()
        }, 
        function(data) {
            $('.ovulationBox .form').slideUp(function() {
                $('.ovulationBox .result').html(data).slideDown();
            });
        }
    );
}
function dueDate() {
    $.post(BASE+'/ajax/widgets/dueDate', 
        {
            'data[day]':$('.dueDateBox .day:first').val(),
            'data[mon]':$('.dueDateBox .mon').val(),
            'data[yr]':$('.dueDateBox .yr').val(),
            'data[adv]':$('.dueDateBox .chk:checked').val()
        }, 
        function(data) {
            $('.dueDateBox .form').slideUp(function() {
                $('.dueDateBox .result').html(data).slideDown();
            });
        }
    );
}

//BMI Calculator  
jQuery(document).ready(function(){
    $('.bmi_height_cm').change(function(){
        var inch = $(this).val()*0.3937;
        var feet = Math.floor(inch/12);
        var inch = Math.floor(inch%12);
        $('.bmi_height_feet').val(feet);
        $('.bmi_height_inch').val(inch);
    });
    $('.bmi_height_feet,.bmi_height_inch').change(function(){
        var inch = parseInt($('.bmi_height_inch').val());
        var inch = inch + parseInt($('.bmi_height_feet').val())*12;
        var cm = inch*2.54;
        $('.bmi_height_cm').val(cm);
    });
});
function bmiCalculator(){    
    if(!$('.bmi_weight').val()){
        alert("Please Enter Weight!")
        $('.bmi_weight').focus()}
    else if(!$('.bmi_height_cm').val()){
        alert("Please Enter Height!")
        $('.bmi_height_cm').focus()}
    else{
        var kg=parseInt($('.bmi_weight').val());
        if($('.bmi_w_unit').val()=="lbs"){kg=kg*0.45359237;}
        if(kg<10){alert("Weights should be heavier than 10 kilograms (22 pounds).");return false;}
        if(kg>200){alert("Weights should be lighter than 200 kilograms (441 pounds).");return false;}
        var ht=parseInt($('.bmi_height_cm').val());
        var htMeters;
        htMeters=ht/100;
        if(htMeters<0.33){alert("Heights should be taller than 33 centimeters (31.5 inches).");return false;}
        if(htMeters>2.41){alert("Heights should be shorter than 241 centimeters ( 7 feet, 11 inches).");return false;}
        $.post(
            BASE+'/ajax/widgets/bmiCalculator',{
                'data[weight]':$('.bmi_weight').val(),
                'data[height]':$('.bmi_height_cm').val(),
                'data[sex]':$('.bmi_sex').val(),
                'data[weight_unit]':$('.bmi_w_unit').val(),
                'data[height_unit]':'cm',
            },
            function(data){
                $('.bmiCalculator .form').slideUp(function(){
                    $('.bmiCalculator .result').html(data).slideDown();
                });
            });
    }
}
//BMI Calculator  
/* featured post slider */

jQuery(document).ready(function($){
    if($(".featuredThreads").length){
        $(".featuredThreads").cycle({
            timeout: 5000,
            delay:  -1000,
            pause:true,
            pager:".voiceSlidePagination"
        })
    }
    
    
    
    $(".wysiwyg-front").tinymce({
        // Location of TinyMCE script
        script_url : BASE+'/js/tiny_mce/tiny_mce.js',
        
        remove_script_host : false,
        convert_urls : false,

        // General options
        theme : "advanced",
        plugins : "inlinepopups,fullscreen,paste",

        // Theme options
        //theme_advanced_buttons1 : "bold,italic,underline,separator,strikethrough,justifyleft,justifycenter,justifyright,justifyfull,blockquote,bullist,numlist,undo,redo,link,unlink,mybutton,code,fullscreen",
        theme_advanced_buttons1 : "bold,italic,underline,separator,link,unlink,bullist,numlist",
        theme_advanced_buttons2 : "",
        theme_advanced_buttons3 : "",
        theme_advanced_blockformats : "",

        theme_advanced_toolbar_location : "top",
        theme_advanced_toolbar_align : "left",
        theme_advanced_statusbar_location : "bottom",
        theme_advanced_resizing : false,

        // Example content CSS (should be your site CSS)
        content_css : BASE+"/css/admin.tinymce.css",

        // Drop lists for link/image/media/template dialogs
        //template_external_list_url : "lists/template_list.js",
        //external_link_list_url : "lists/link_list.js",
        //external_image_list_url : "lists/image_list.js",
        //media_external_list_url : "lists/media_list.js",
    });
})


// for ajax pagination

var maya_has_post=true;
var maya_max=0;
var maya_lock=false;

function maya_get_posts(url){
    if(!maya_lock){
        maya_lock=true;
        $.post(url,{"data[dymmy]":1},function(data){
            var posts=data.split('[sep]')[0]
            var nextlink=data.split('[sep]')[1]
            $('.topics').append(posts);
            $('.pagination').html(nextlink)
            if(!nextlink.match('next_posts'))
                maya_has_post=false;
            
            maya_bind_pagination()
            maya_lock=false;
            $(document).ready(function(){
                $('.topics .new_post').slideDown(50)
                $('.next_posts').show()
            })
        })
    }
}

function maya_bind_pagination(){
    $('.next_posts').unbind('click').click(function(e){
        $(this).hide()
        e.preventDefault();
        maya_get_posts($(this).attr('href'))
    })
}  

$(document).ready(function(){
    if(!$('.next_posts').length)
        maya_has_post=false;
        maya_bind_pagination()
})



/* baby names */

$(document).ready(function(){
    //article image popup
    $('#article_img_popup,.enlrgDisImg').fancybox(
        {
            'titleShow'     : false,
            'transitionIn'    : 'elastic',
            'transitionOut'    : 'elastic',
        }
    );
    
    if($(".nameList a").length){
        $(".nameList a").click(function(e){
            e.preventDefault()
            var a=$(this)
            $(".nameList a").removeClass("selected");
            a.addClass("selected");
            $.post(BASE+'/ajax/names/details',
                {"data[Name][id]":$(this).attr("rel")},
                function(data){
                    var offset = a.offset();
                    var offset2 = $(".nameList").offset();
                    $(".nameDetails").html(data).css({left:offset2.left,top:offset.top+40}).show("fast")
                }
            )
        })
        
        $(".main").mouseleave(function(){
            $(".nameDetails").hide("fast")
            $(".nameList a").removeClass("selected");
        })
    }
    
    $("#gender").change(function(){
        search();
    })
    $("#type").change(function(){
        search();
    })
    $("#name-srch").submit(function(){
        search();
    })    
    $(".letters a").click(function(e){
        e.preventDefault()
        $("#letter").val($(this).text().toLowerCase())
        search();   
    })
    
    // CLick to see detail
    var nxtDD=prevDD='null';
    $('.nameTotalCont dd').click(function(e){
        e.preventDefault(e);         
        var elm = $(this);                          
        if(elm.find('.nameMeaning').css('display') != 'block'){       
            $('.nameTotalCont dd').not($(this)).find('.nameMeaning').slideUp('500');
            elm.find('.nameMeaning').slideDown('500');
            var nameId = elm.find('.nameId').html();
            $.post(BASE+'/ajax/names/visit',
                {"data[Name][id]":nameId},
                function(data){ 
                }
            )
        }else{
            elm.find('.nameMeaning').slideUp('500');
        }
    });                              
    //-------------------recommended button visibility
    $('.samComntList dd').hover(function(){
        if($('.recommendedBtn',this).length){
            $('.recommendedBtn',this).fadeIn('fast');
        }        
    },function(){
        if($('.recommendedBtn',this).length){
            $('.recommendedBtn',this).fadeOut('fast');
        }        
    }); 
    //-------------------Recommended button click
    $('.samComntList .recommendedBtn').click(function(e){
        e.preventDefault(e);         
        var elm = $(this);          
        
        // Recommended activate
        var commntId = $('.cmntId',this).html();
        var commntModel = $('.cmntModel',this).html();
        $.post(BASE+'/ajax/'+commntModel+'/recommended',
            {"data[Comment][id]":commntId},
            function(data){ 
                if(data == 'success'){
                    elm.parents().addClass('recommanded');                            
                    
                }else{
                    elm.parents().removeClass('recommanded');                         
                } 
            }
        )
        
    });
    //------------------Comment like
    $('.samComntList .cmntLike').click(function(e){
        e.preventDefault(e);         
        var elm = $(this);          
        
        // Like 1+
        var commntId = $(this).parents().find('.cmntId').html();
        var commntModel = $(this).parents().find('.cmntModel').html();  
        $.post(BASE+'/ajax/'+commntModel+'/like',
            {"data[Comment][id]":commntId},
            function(data){      
                if(data!="no")
                    elm.html(data);      
                else          
                    $.fancybox('<div style="width:200px;height:30px;border: 2px solid #DA292D;padding: 10px;"><strong>You already liked this comment</strong></div>');
            }
        )
        
    }); 
    //------------------Comment Delete
    $('.samComntList .cmntDelete').click(function(e){     
        var elm = $(this);
        // Like 1+
        var commntId = $(this).parents().find('.cmntId').html();
        var commntModel = $(this).parents().find('.cmntModel').html(); 
        var removeElm = elm.parent().parent().parent().parent();
        
        $.post(BASE+'/ajax/'+commntModel+'/delete',
            {"data[Comment][id]":commntId},
            function(data){       
                if(data == 'Success'){
                    removeElm.slideUp('slow',function(){
                        $(this).remove();
                    });
                }else{
                    alert('You are not authorize to delete this comment');
                }
            }
        )
        
    });
    //------------------Comment Edit
    $('.samComntList .cmntEdit').click(function(e){     
        var elm = $(this);
        // Like 1+
        var commntId = $(this).parents().find('.cmntId').html();
        var commntModel = $(this).parents().find('.modelName').html();  
        $("#"+commntModel+"Body").html(elm.parent().parent().find('.samMainCmnt').html());
        var inputField = '<input type="hidden" id="commentID" name="data['+commntModel+'][id]" value="'+commntId+'">';
        $('#CommentForm').prepend(inputField);
        $(document).scrollTo(".articleComments",500,{offset:{top:-100,left:0}});
        
    });
    //------------------Comment Reply
    $('.cmntReply').click(function(){         
        var contIndex = $('.samComntList dd').index($(this).parents().eq(3))+1;
        var thisCont = $('.samComntList dd:nth-child('+contIndex+')');
        if(!thisCont.find(".commentForm2").html()){ 
            thisCont.append('<div class="commentForm2" style="clear:both;padding-top:10px;"><div class="cmntForm">'+$('.commentBoxForm').html()+'</div></div>');
            thisCont.find(".commentForm2").slideDown('slow');
            var modelName = $('.modelName').html();
            thisCont.find('#'+modelName+'ParentId').val(thisCont.find('.cmntId').html());
            //Comment Previews    
            thisCont.find(".comntPreview").click(function(){
                thisCont.find(".saveText").attr({disabled:"disabled"}).css({color:"#000000"});
                thisCont.find(".cmntForm").addClass("preview");
                thisCont.find(".cmntForm").animate({width:"576px",marginLeft:'40px'},500);
                thisCont.find(".cmntForm textarea").animate({width:"566px"},500);
            });
            //Edit Comments
            thisCont.find(".comntEdit").click(function(){
                thisCont.find(".saveText").removeAttr("disabled").focus();
                thisCont.find(".cmntForm").removeClass("preview");            
                thisCont.find(".cmntForm").animate({width:"616px",marginLeft:'0px'},500);
                thisCont.find(".cmntForm textarea").animate({width:"606px"},500);
            });
            //Cancle Comments
            thisCont.find(".comntCancel").click(function(){
                thisCont.find(".saveText").removeAttr("disabled").focus();
                thisCont.find(".cmntForm").removeClass("preview");
                thisCont.find(".saveText").val("");            
                thisCont.find(".cmntForm").animate({width:"616px",marginLeft:'0px'},500);
                thisCont.find(".cmntForm textarea").animate({width:"606px"},500);
            });    
        }else{
            thisCont.find(".commentForm2").slideUp('slow',function(){
                $(this).remove();
            });
        }
        
    });
    //Comment Previews
    $(".comntPreview").click(function(){
        var thisCont = $(this).parents().eq(3); 
        thisCont.find(".saveText").attr({disabled:"disabled"}).css({color:"#000000"});
        thisCont.addClass("preview");
        thisCont.animate({width:"576px",marginLeft:'40px'},500);
        thisCont.find(" textarea").animate({width:"566px"},500);
    });
    //Edit Comments
    $(".comntEdit").click(function(){
        var thisCont = $(this).parents().eq(3);
        thisCont.find(".saveText").removeAttr("disabled").focus();
        thisCont.removeClass("preview");            
        thisCont.animate({width:"616px",marginLeft:'0px'},500);
        thisCont.find("textarea").animate({width:"606px"},500);
    });
    //Cancle Comments
    $(".comntCancel").click(function(){
        var thisCont = $(this).parents().eq(3);
        thisCont.find(".saveText").removeAttr("disabled").focus();
        thisCont.removeClass("preview");
        thisCont.find(".saveText").val("");            
        thisCont.animate({width:"616px",marginLeft:'0px'},500);
        thisCont.find("textarea").animate({width:"606px"},500);
    });
})

function search(){
    var str="";
    if($("#id").val())str+="/id:"+$("#id").val();
    if($("#keyword").val())str+="/keyword:"+$("#keyword").val();
    else if($("#letter").val())str+="/letter:"+$("#letter").val();
    if($("#gender").val())str+="/gender:"+$("#gender").val();
    if($("#type").val())str+="/type:"+$("#type").val();    
    window.location=BASE+"/baby-names/detail"+str;
}


