function fod(obj,name)
{
	var p = obj.parentNode.getElementsByTagName("li");
	var p1 = utils.$(name).getElementsByTagName("div");
	for(i=0;i<p1.length;i++)
	{
		if(obj==p[i])
		{
			p[i].className  = "onBg";
			p1[i].className = "dis";
		}
		else
		{
			if(p[i])
			{
				p[i].className = "";
				p1[i].className = "undis";
			}
		}
	}
}

function pressCaptcha(obj)
{
	obj.value = obj.value.toUpperCase();
}


var flag=false;
function drawImage(ImgD)
{
	var image=new Image();
	var FitWidth=ImgD.width; //图片要显示的宽
	var FitHeight=ImgD.height; //图片要显示的高
	image.src=ImgD.src;
	if(image.width>0 && image.height>0)
	{
		flag=true;
		if(image.width/image.height>= FitWidth/FitHeight)
		{
			if(image.width>FitWidth)
			{
				ImgD.width=FitWidth;
				ImgD.height=(image.height*FitWidth)/image.width;
			}
			else
			{
				ImgD.width=image.width;
				ImgD.height=image.height;
			}
			ImgD.alt="原图片大小("+image.width+"×"+image.height+")";
		}
		else
		{
			if(image.height>FitHeight)
			{
				ImgD.height=FitHeight;
				ImgD.width=(image.width*FitHeight)/image.height;
			}
			else
			{
				ImgD.width=image.width;
				ImgD.height=image.height;
			}
			ImgD.alt="原图片大小("+image.width+"×"+image.height+")";
		}
	}
}

function drawImage2(ImgD,ImgWidth,ImgHeight)
{
	var image=new Image();
	var FitWidth=ImgWidth; //图片要显示的宽
	var FitHeight=ImgHeight; //图片要显示的高
	image.src=ImgD.src;
	if(image.width>0 && image.height>0)
	{
		flag=true;
		if(image.width/image.height>= FitWidth/FitHeight)
		{
			if(image.width>FitWidth)
			{
				ImgD.width=FitWidth;
				ImgD.height=(image.height*FitWidth)/image.width;
			}
			else
			{
				ImgD.width=image.width;
				ImgD.height=image.height;
			}
		}
		else
		{
			if(image.height>FitHeight)
			{
				ImgD.height=FitHeight;
				ImgD.width=(image.width*FitHeight)/image.height;
			}
			else
			{
				ImgD.width=image.width;
				ImgD.height=image.height;
			}
		}
	}
}

function insertFlash(elm, url, w, h,pic,link,text,textheight) 
{
	if (!utils.$(elm)) return;
	if(arguments.length>4)
	{
		var fh = h - textheight;
	}
	var str = '';
	str += '<object ID="focus_flash" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+ w +'" height="'+ h +'">';
	str += '<param name="allowScriptAccess" value="sameDomain"><param name="movie" value="'+url+'"><param name="quality" value="high"><param name="bgcolor" value="#FFFFFF">';
	str += '<param name="menu" value="false"><param name=wmode value="opaque">';
	if(arguments.length>4)
	{
		str += '<param name="FlashVars" value="pics='+pic+'&links='+link+'&texts='+text+'&borderwidth='+w+'&borderheight='+fh+'&textheight='+textheight+'">';
		str += '<embed ID="focus_flash" src="'+url+'" wmode="opaque" FlashVars="pics='+pic+'&links='+link+'&texts='+text+'&borderwidth='+w+'&borderheight='+fh+'&textheight='+textheight+'" menu="false" bgcolor="#C5C5C5" quality="high" width="'+ w +'" height="'+ h +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';	
	}
	else
	{
		str += '<embed src="'+url+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+w+'" height="'+h+'"></embed>'
	}
	utils.$(elm).innerHTML = str;
}


function searchSubmit(thisForm)
{
	cate=thisForm.cate.value;
	if(cate=="打折产品") thisForm.action="/productList.php";
	if(cate=="优惠券") thisForm.action="/cardList.php";
	if(cate=="促销活动") thisForm.action="/discountList.php";
	if(cate=="商家") thisForm.action="/shopList.php";
	if(cate=="资讯") thisForm.action="/newsSearch.php";
	if(cate=="所有产品") thisForm.action="/productsList.php";
	thisForm.submit();
	return true;
}


function showChangeCity()
{
	document.getElementById("MoreCityWrapper").style.display= "block";
}
function hiddenChangeCity() 
{
	document.getElementById("MoreCityWrapper").style.display = "none";
}


function addBookmark(title) 
{
	var url=parent.location.href;
	if (window.sidebar)
	{
		window.sidebar.addPanel(title, url,""); 
	}
	else if( document.all ) 
	{
		window.external.AddFavorite( url, title);
	} 
		else if( window.opera && window.print ) 
	{
		return true;
	}
}

function SetHome(obj,vrl)
{
	try
	{
		obj.style.behavior='url(#default#homepage)';obj.setHomePage(vrl);
	}
	catch(e)
	{
		if(window.netscape) 
		{
			try 
			{
					netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");  
			}  
			catch (e) 
			{ 
					alert("抱歉！您的浏览器不支持直接设为首页。请在浏览器地址栏输入“about:config”并回车然后将[signed.applets.codebase_principal_support]设置为“true”，点击“加入收藏”后忽略安全提示，即可设置成功。");  
			}
			var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
			prefs.setCharPref('browser.startup.homepage',vrl);
		}
	}
}