﻿$(document).ready(function(){
	$("a").bind("focus",function(){
		if(this.blur){ //如果支持 this.blur
			this.blur(); 
		}
	});
	//导航栏使用
    $('#nbar > li:not(".space")').each(function(){
        var objli = $(this);
        var obja = objli.find('.navflag');
        if(obja.attr('href').toLowerCase() == window.location.href.toLowerCase()){
            objli.addClass('on cur');
        };
        objli.hover(function(){
            $(this).addClass('on');
        },function(){
            if(!$(this).hasClass('cur')){
                $(this).removeClass('on');
            }
        });
    });
	//搜索控件使用
	if(typeof keyword != 'undefined' )
	{
		if(keyword!='') $("#keyword1").val(keyword);
	}
	var sk = $('#searchkey').text().split('|');
	var skLinks = "";
	$.each(sk,function(i,n){
	    skLinks += "<a href='http://www.gps008.com/search-k_" + n + ".html'>" + n + "</a> | ";
	});
	$('#searchkey').replaceWith(skLinks);
	
	$("#keyword1").focus(function(){
		if($("#keyword1").val()=="E路航E-V5"){
		    $("#keyword1").val('');
		}
	});
	$("#keyword1").blur(function(){
		if($("#keyword1").attr("value")=="")
		{
			$("#keyword1").val("E路航E-V5");
		}
	});
	$('#keyword1').keydown(function(event){
        if(event.keyCode == 13){
            $('#btnsearch').click();
        };
    });
	$("#btnsearch").click(function(){
		if($("#keyword1").val()=="")
		{
			alert("请输入关键字");
			return false;
		}
		window.location="http://www.gps008.com/search-k_" + ($("#keyword1").val() == '关键字' ? '' : escape($("#keyword1").val())) +"-c_" + $('#select1').val() + "-b_0-m_,-p_-1-2-1.html";
	});
	$('#btnAdvSearch').click(function(){window.location.href="http://www.gps008.com/search.html";});
});
hs.graphicsDir = 'http://www.gps008.com/inc/productImgShow/graphics/';
hs.outlineType = 'rounded-white';
function addtocart(pid)
{
	if('<%=config.ShopStop%>' == 'True')
	{
		temp=window.open('http://www.gps008.com/ShoppingCart.aspx?pid='+pid+'&ts='+Math.random(),'shopcat','scrollbars=yes,top=0,left=0,resizable=yes');
		temp.focus();
	}
	else
	{
		alert('<%=config.ShopStopWords%>');
		return false;
	}
}
function checkForm()
{
	var form=document.getElementById("loginForm");
	if (form.memberName.value=="")
	{	alert('请填写会员号');
		form.memberName.focus();
		return false;
	}
	if (form.memberPass.value=="")
	{	alert('请填写密码');
		form.memberPass.focus();
		return false;
	}
	if (form.logincode.value=="")
	{	alert('请填写验证码');
		form.logincode.focus();
		return false;
	}
	return true;
}