function newssl()
{
	$("#newsbn").attr("src","/Images/newsslbn.gif");
	$("#hangbn").attr("src","/Images/hangbn.gif");
	$("#news").show();
	$("#dongtai").hide();
}
function hangsl()
{
	$("#hangbn").attr("src","/Images/hangslbn.gif");
	$("#newsbn").attr("src","/Images/newsbn.gif");
	$("#dongtai").show();
	$("#news").hide();
}
function size(index)
{
	for (var i = 0; i < 4; i++) {
		$("#class" + i).stop();
	}
	for (var i = 0; i < 4; i++) {
		if (i == index) {
			$("#class" + index).animate({width:"152px"});
			$("#pic" + index).attr("src","/Images/class/class2_" + index + ".jpg");
		} else {
			$("#class" + i).animate({width:"60px"});
			$("#pic" + i).attr("src","/Images/class/class1_" + i + ".jpg");
		} 
	}
}
function addfavorite()
{
   var tt = document.getElementsByTagName("title")[0].innerHTML;
   if (document.all)
   {
      window.external.addFavorite(location.href,tt);
      return false;
   }
   else if (window.sidebar)
   {
      window.sidebar.addPanel(tt, location.href, "");
      return false;
   }
}

function setSelected(){
	aTag=document.getElementsByTagName("a");
	if (location.href.split("/")[3] == "") { $("#list0").addClass("currlist");return; }
	if (location.href.split("/")[3] == "?list-736.html") { $("#list6").addClass("currlist");return; }
	if (location.href.split("/")[3] == "?list-740.html") { $("#list6").addClass("currlist");return; }
	if (location.href.split("/")[3] == "?list-698.html") { $("#list1").addClass("currlist");return; }
	if (location.href.split("/")[3] == "?list-699.html") { $("#list1").addClass("currlist");return; }
	if (location.href.split("/")[3] == "?list-700.html") { $("#list1").addClass("currlist");return; }
	if (location.href.split("/")[3] == "?list-701.html") { $("#list1").addClass("currlist");return; }
	if (location.href.split("/")[3] == "?list-696.html") { $("#list1").addClass("currlist");return; }
	if (location.href.split("/")[3] == "?list-697.html") { $("#list1").addClass("currlist");return; }
	for(var i=0;i<aTag.length;i++) {
		if (aTag[i].href.indexOf(location.href.split("/")[3]) != -1) {
			for(var n=0;n<$("#lists").children().length;n++) {
				if (aTag[i].parentNode.id == "list" + n || aTag[i].parentNode.parentNode.parentNode.id == "list" + n) {
					$("#list" + n).addClass("currlist");
					return;
				}
			}
		}
	}
}

function getShops(id,title) {
	$("#addtitle").html(title + "销售网点");
	$.ajax({ url: "/plus/Ajaxgetshop.asp", data: { ProdID: id }, beforeSend: function(XMLHttpRequest){
		$("#shops").html("<span><img src='/images/loading.gif' align='absmiddle'>正在加载数据...</span>"); 
	}, success: function(data){
		$("#shops").html(data); 
	}});
}

function checkform(form) {
	if (form.KS_Name.value == "") {
		alert("请留下您的真实姓名，以便联系！");
		form.KS_Name.focus();
		return false;
	}
	if (form.KS_Phone.value == "") {
		alert("请留下联系电话，以便联系！");
		form.KS_Phone.focus();
		return false;
	}
	return true;
}

function ScaleImage(source,m_width,m_height) {
	var url = source.src;
	var img1 = new Image();
	img1.src = url;
	if (img1.width > m_width || img1.height > m_height) {
		_w = img1.width / m_width;
		_h = img1.height / m_height;

		if (_h > _w) {
			_w = _h;
		}
		img1.width = img1.width / _w;
		img1.height = img1.height / _w;
		source.width = img1.width;
		source.height = img1.height;
	}
	if(img1.height < m_height) {
		source.style.margin = (m_height - img1.height)/2 + "px 0px 0px 0px"; 
	}
	delete img1;
}

$(document).ready(function() {
setSelected();
});

$(function(){
	var btn_list_li = $("#lists > li");
	btn_list_li.hover(function(){
		$(this).find("ul:not(:animated)").slideDown("fast");
	},function(){
		$(this).find("ul").slideUp("fast");
	});
});
