﻿$(document).ready(function() {
    initinput('sitename', '如"g2core.com";可查询建站,推广');

    var strarr = new Array();

    $(function() {
        $('#nav li a').hover(
                  function() {
                      strarr = $(this).find('img').attr('src').split('.');
                      $(this).find('img').attr('src', strarr[0] + '_after.' + strarr[1]);
                  },
                  function() {
                      $(this).find('img').attr('src', $(this).find('img').attr('src').replace('_after', ''));
                  }
              )
    })
});

function initinput(name, value) {
    if ($('.' + name).length > 0) {
        if ($('.' + name).val() == '') {
            $('.' + name).val(value);
            $('.' + name).addClass("initinput");
        }
        $('.' + name).focus(function() {
            $(this).select();
        }).click(function() {
            if ($(this).val() == value) {
                $(this).val('');
                $('.' + name).removeClass("initinput");
            }
        }).blur(function() {
            if ($(this).val() == '') {
                $(this).val(value);
                $('.' + name).addClass("initinput");
            }
        });
    }
}

function this_vali(id, eid, match, str1, str2) {
    return this_valiall(id, eid, match, str1, true, str2, true);
}

function this_valiall(id, eid, match, str1, bool1, str2, bool2) {
    $(eid).show();
    var xion = new Xion();
    pass = xion.Xvali(id, eid, match, str2, bool2, str1, bool1);
    if (pass) {
        if ($(id).val() != '') {
            $(eid).html('');
            $(eid).show();
            $(eid).attr('class', 'pass');
        }
    }
    else {
        $(eid).attr('class', 'error');
    }

    return pass;
}


