var lastLi1=null; 
var timeOutVar1=null; 
$(function(){
$(document.body).prepend(
	"<div id=\"showLayers\" style=\"display:none;\"><div id=\"ShowContentTitle\">内容读取中</div>"
	+"<img src=\"/ajax/ajax/reading.gif\" border=\"0\" id=\"ShowContentImg\" alt=\"读取中\" />"
	+"<div id=\"ShowConfig\"></div></div>"
						 ).prepend("<div id=\"showPrice\" style=\"display:none;\"></div>");

	prolistbind();
	peijlistbind();
    shoplistbind();	
//$("a[name='prolist']>div>img").click( function () {window.open('/products' + this.name + '/');});

$("a[name='A-showtext']").hover(function(e){
	if($(this).attr("data") =="") return false;
	
	if(lastLi1!=null){
			$(lastLi1).hide();
			clearTimeout(timeOutVar1);
			}
	var offsetX=0,offsetY=0;
	var offset = $(this).offset();
	if($(this).find(".a_xianhuoaspan").length>0){offset=$(this).find(".a_xianhuoaspan").offset();}
	var this_H=$(this).height();
	var width="";
	if($(this).attr("data").length>20)
	width="250px";
	$("#showtext").html($(this).attr("data")).css({ "top": (offset.top +offsetY+this_H) + "px", "left": (offset.left +offsetX) + "px" ,"width":width}).show();
	lastLi1=$("#showtext");		  
										  }
,function(){timeOutVar1=setTimeout("$(lastLi1).hide();",500);});
$("#showtext").mouseout(function(){ 
    clearTimeout(timeOutVar1); 
   timeOutVar1=setTimeout("$(lastLi1).hide();",500);
}).mouseover(function(){ 
    if(timeOutVar1!=null)clearTimeout(timeOutVar1); 
   timeOutVar1=null; 
   });

//
	price_oumousebind();
});

function prolistbind(){
	$("a[name='prolist']").hover(function(e){
	$("#showLayers").html("<div id=\"ShowContentTitle\">内容读取中</div>"
	+"<img src=\"/ajax/ajax/reading.gif\" border=\"0\" id=\"ShowContentImg\" alt=\"读取中!\" />"
	+"<div id=\"ShowConfig\"></div>").show();
	//alert($(this).attr("pid"))
$.getJSON('Ajax.Asp?Proimg=ac&ti='+$(this).attr("pid")+'&id=?',function(data){    
	$("#showLayers").html("<div id=\"ShowContentTitle\">"+data.Tname+"</div>"
	+"<img src=\""+data.Tpic+"\" border=\"0\" id=\"ShowContentImg\"/ height=\"280\">"
	+"<div id=\"ShowConfig\">"+data.Tkxbb+"</div>");

   });   
										  }
,function(){
	$("#showLayers").hide();
										  }						  
										  )
.mousemove(function(evt){
	var x,y;
  var offsetX=10,offsetY=20;
  var scrollTop = $(window).scrollTop();
  var scrollLeft = $(window).scrollLeft();
  x=evt.clientX +scrollLeft;
  y=evt.clientY ;
  if (x-scrollLeft+ $("#showLayers").outerWidth()+offsetX> $(window).width()) {
  	x = x - $("#showLayers").outerWidth() - 2 * offsetX;
  }
  
  if ((y+$("#showLayers").outerHeight()+offsetY)>$(window).height()) {
	y = $(window).height()-$("#showLayers").outerHeight()-offsetY;
  }
	x=x+offsetX;
	y=y+offsetY;
	$("#showLayers").css({ "top": (y +scrollTop) + "px", "left": x + "px" });
					});
}
/////////////////
function peijlistbind(){
	$("a[name='peijlist']").hover(function(e){
	$("#showLayers").html("<div id=\"ShowContentTitle\">内容读取中</div>"
	+"<img src=\"/ajax/ajax/reading.gif\" border=\"0\" id=\"ShowContentImg\" alt=\"读取中!\" />"
	+"<div id=\"ShowConfig\"></div>").show();
	//alert($(this).attr("pid"))
$.getJSON('Ajax.Asp?peijimg=ac&ti='+$(this).attr("pid")+'&id=?',function(data){    
	$("#showLayers").html("<div id=\"ShowContentTitle\">"+data.Tname+"</div>"
	+"<img src=\""+data.Tpic+"\" border=\"0\" id=\"ShowContentImg\"/ width=\"230\">"
	+"<div id=\"ShowConfig\"></div>");

   });   
										  }
,function(){
	$("#showLayers").hide();
										  }						  
										  )
.mousemove(function(evt){
	var x,y;
  var offsetX=10,offsetY=20;
  var scrollTop = $(window).scrollTop();
  var scrollLeft = $(window).scrollLeft();
  x=evt.clientX +scrollLeft;
  y=evt.clientY ;
  if (x-scrollLeft+ $("#showLayers").outerWidth()+offsetX> $(window).width()) {
  	x = x - $("#showLayers").outerWidth() - 2 * offsetX;
  }
  
  if ((y+$("#showLayers").outerHeight()+offsetY)>$(window).height()) {
	y = $(window).height()-$("#showLayers").outerHeight()-offsetY;
  }
	x=x+offsetX;
	y=y+offsetY;
	$("#showLayers").css({ "top": (y +scrollTop) + "px", "left": x + "px" });
					});
}
////////////
function shoplistbind(){
	$("a[name='shoplist']").hover(function(e){
	$("#showLayers").html("<div id=\"ShowContentTitle\">内容读取中</div>"
	+"<img src=\"/ajax/ajax/reading.gif\" border=\"0\" id=\"ShowContentImg\" alt=\"读取中!\" />"
	+"<div id=\"ShowConfig\"></div>").show();
	//alert($(this).attr("pid"))
$.getJSON('Ajax.Asp?shopimg=ac&ti='+$(this).attr("pid")+'&id=?',function(data){    
	$("#showLayers").html("<div id=\"ShowContentTitle\">"+data.Tname+"</div>"
	+"<img src=\""+data.Tpic+"\" border=\"0\" id=\"ShowContentImg\"/ width=\"230\">"
	+"<div id=\"ShowConfig\"></div>");

   });   
										  }
,function(){
	$("#showLayers").hide();
										  }						  
										  )
.mousemove(function(evt){
	var x,y;
  var offsetX=10,offsetY=20;
  var scrollTop = $(window).scrollTop();
  var scrollLeft = $(window).scrollLeft();
  x=evt.clientX +scrollLeft;
  y=evt.clientY ;
  if (x-scrollLeft+ $("#showLayers").outerWidth()+offsetX> $(window).width()) {
  	x = x - $("#showLayers").outerWidth() - 2 * offsetX;
  }
  
  if ((y+$("#showLayers").outerHeight()+offsetY)>$(window).height()) {
	y = $(window).height()-$("#showLayers").outerHeight()-offsetY;
  }
	x=x+offsetX;
	y=y+offsetY;
	$("#showLayers").css({ "top": (y +scrollTop) + "px", "left": x + "px" });
					});
}
/////////////
function price_oumousebind(){
	$(".price_oumouse").hover(function(e){
	var inhtml="<div class=\"price_top\"></div>";
      	inhtml+="<div class=\"price_content\"><ul>";
		var vback=$(this).attr("data").split("|");
		for(i=0;i<vback.length;i++)
		{
			var vback_t=vback[i].split(",");
			inhtml+=" <li><p>" + vback_t[0] + "<em>￥" + vback_t[1] + "</em></p></li>";
		}
	 inhtml+="</ul></div>";
	 inhtml+="<div class=\"price_bottom\"></div>";
	 var offsetX=5,offsetY=8;
	var offset = $(this).offset();
	 $("#showPrice").html(inhtml);
	 var this_H=$("#showPrice").height();
	 $("#showPrice").css({ "top": (offset.top +offsetY-this_H) + "px", "left": (offset.left +offsetX) + "px"}).show();
										  }
,function(){
	$("#showPrice").hide();
										  })
}
