jQuery.cookie=function(name,value,options){if(typeof value!='undefined'){options=options||{};if(value===null){value='';options.expires=-1}var expires='';if(options.expires&&(typeof options.expires=='number'||options.expires.toUTCString)){var date;if(typeof options.expires=='number'){date=new Date();date.setTime(date.getTime()+(options.expires*24*60*60*1000))}else{date=options.expires}expires='; expires='+date.toUTCString()}var path=options.path?'; path='+(options.path):'';var domain=options.domain?'; domain='+(options.domain):'';var secure=options.secure?'; secure':'';document.cookie=[name,'=',encodeURIComponent(value),expires,path,domain,secure].join('')}else{var cookieValue=null;if(document.cookie&&document.cookie!=''){var cookies=document.cookie.split(';');for(var i=0;i<cookies.length;i++){var cookie=jQuery.trim(cookies[i]);if(cookie.substring(0,name.length+1)==(name+'=')){cookieValue=decodeURIComponent(cookie.substring(name.length+1));break}}}return cookieValue}};
$(document).ready(function(){$("#featureCatelogry li").bind("mouseenter", function(){$(this).find("img").animate({"height":100}, 100).animate({"height":120}, 100).animate({"height":100}, 100).animate({"height":120}, 100).end().find("div.text").css("color","#333");}).bind("mouseleave",function(){$(this).find("div.text").css("color", "#999");});$("#mainLeft div.iBox span.more").bind("click", function(){$(this).parent().siblings("div").toggle();});});

function checkContactForm(obj, type){
    $flag = 0;
    $(obj).find(":input").each(function(){
        if($.trim($(this).val()).length == 0){
            $(this).css("backgroundColor", "#ffed92");
            $flag = $flag + 1;
        }else{
            $(this).css("backgroundColor", "transparent");
        }
    });
    if ($flag > 1) return false;
    if($flag <= 1){
        // checkAuthCode
        $.ajax({
            url: "/ajax/checkAuth.php",
            type:"post",
            data: "code="+$("#site_code").val(),
            success: function(text){
                if (text == "1"){
                    $("#site_code").css("backgroundColor", "transparent");
                    if (type != 'normal'){
                        thisT = $("#inquiry_type").text().replace(/^#/, "");
                        content = "";
                        $("#inquiry_list div").each(function(){
                            content+= $(this).html();
                        });
                    }else{
                        thisT = "normal";
                        content = "";
                    }
                    $.ajax({
                        url:"/ajax/sendContact.php",
                        type:"post",
                        data: $("form").serialize()+"&itype="+thisT+"&content="+escape(content),
                        success: function(txt){
                            if (txt == "1"){
                                alert("Success Send");
                                history.go(-1);
                            }else{
                                alert("Error!");
                            }
                        },
                        error: function(){
                        }
                    });
                    return false;
                }else{
                    $("#site_code").css("backgroundColor", "#e00");
                    return false;
                }
            },
            error: function(text){
                return false;
            }
        });
    }
    return false;
}

function contact(obj, type){
    $div = $(obj).parent().next("div");
    $selected = type+"^\n";
    $("ul li", $div).each(function(){
        $input = $("input:checked", $(this)); // + $("img", $(this)).attr("src") + "\t"
        if ($input.size()) $selected+= "\n" + $input.val() + "\t" + $input.siblings("a").attr("href") + "\t" + $input.siblings("a").text();
    });
    $(obj).attr("href", "/contact.htm#"+escape($selected));
}

function contactSell(obj, type){
    $div = $(obj).parent().next("div");
    $selected = type+"^\n";
    $("div.hbox", $div).each(function(){
        $input = $("input:checked", $(this)); // + $("img", $(this)).attr("src") + "\t"
        if ($input.size()) $selected+= "\n" + $input.val() + "\t" + $("h3 a", $(this)).attr("href") + "\t" + $("h3 a", $(this)).text();
    });
    $(obj).attr("href", "/contact.htm#"+escape($selected));
}

function searchNow(o){
    if ($("input[name=searchKey]").val().length < 4){
        alert("Search Keywods is too short!");
        $("input[name=searchKey]").css("backgroundColor", "#fcf072").eq(0).focus();
        return false;
    }else{
        $("input[name=searchKey]").css("backgroundColor", "#fff");
        $(o).attr("action", "srh_1_"+escape($("input[name=searchKey]").val())+".htm");
        return true;
    }
}