// JavaScript Document
function addloadevent(thefunc){
var oldfunc=window.onload;
if (typeof oldfunc!='function'){
window.onload=thefunc;
}
else{
window.onload=function(){
	oldfunc();
	thefunc();
}
}
}

function createxmlhttp()
{
xmlhttpobj = false;
try{
xmlhttpobj = new XMLHttpRequest;
}catch(e){
try{
xmlhttpobj=new ActiveXObject("MSXML2.XMLHTTP");
}catch(e2){
try{
xmlhttpobj=new ActiveXObject("Microsoft.XMLHTTP");
}catch(e3){
xmlhttpobj = false;
}
}
}
return xmlhttpobj;
} 


function addtofav(infoid,merchant,thetype){
var xmlhttpobj=createxmlhttp();
var url="http://www.365ebuy.com/365include/user/addtofav.asp?id="+infoid+"&thetype="+thetype+"&merchant="+merchant+"&time="+new Date().getTime();
xmlhttpobj.onreadystatechange=addmct;
function addmct(){
addit(infoid);
}
xmlhttpobj.open("get",url,"true");
xmlhttpobj.send(null);
}
function addit(infoid){
if(xmlhttpobj.readyState==4){
	if(xmlhttpobj.status==200){
		var backtxt=xmlhttpobj.responseText;
		var theid="si"+infoid
		var saveicon=document.getElementById(theid);
		if (backtxt=="exist already"){
			backtxt='<a href=http://www.365ebuy.com/user/mysave.asp>已保存过,查看[我的收藏]</a>';
			}
		else if(backtxt=="error occur"){
			backtxt='保存未成功，请刷新重试';
			}
		else if(backtxt=="done"){
			backtxt='<a href=http://www.365ebuy.com/user/mysave.asp>保存成功，查看[我的收藏]</a>';
			}
		else if(backtxt=="unlogged"){
			backtxt='您尚未登陆,请登陆后操作';
		}
		saveicon.innerHTML=backtxt;
		}
	}
}

function showit(){
var thelist=document.getElementById("mlists");
var mdivs=thelist.getElementsByTagName("div");
for(i=0;i<mdivs.length;i++){
	var obj=mdivs[i];
	obj.onmouseover=function(){
		var objid=this.getAttribute("id");
		var fid='f'+objid
		var fidobj=document.getElementById(fid);
		fidobj.style.display='block';
		
	}
	obj.onmouseout=function(){
		var objid=this.getAttribute("id");
		var fid='f'+objid
		var fidobj=document.getElementById(fid);
		fidobj.style.display='none';
	}
	}
}
addloadevent(showit);
