//替换图片地址
$(document).ready(function(){

						   });
function jump(count,url,doms)
{
   window.setTimeout(function(){   
	  count--;   
		if(count > 0) {   
			doms.attr('innerHTML', count);   
			jump(count,url,doms);   
	   } else {   
			location.href=url;   
		}   
	}, 1000);   
}
function makeiframeforpro(srcc)
{
	srcc=desrc(srcc);
	$('body').append("<iframe id='addmm'  style='height:1px;width:1px;' src='"+srcc+"'></iframe>");
}
function makepiclist()
{
							$('.procontent img').each(function(){
								if($(this).width()=='undefined')
								{
									$(this).remove();
								}
//								if($(this).width()>300)
//								{
//									$("#thumbs").append("<li><a href='"+this.src+"'><img src='"+this.src+"' /></a></li>");
//								}
//								else if($(this).height()>300)
//								{
//									$("#thumbs").append("<li><a href='"+this.src+"'><img src='"+this.src+"' /></a></li>");
//								}
							});
						
						autoSize($('#thumbs a img'),100,100)
                        $('#thumbs a').lightBox({
							overlayBgColor: '#FFF',
							txtImage: '图片',
							auto_resize:true
						   });

}
function autoSize(obj,wWidth,wHeight)
{
	if($.browser.msie && $.browser.version == 6.0)
  {

	obj.each(function(){
			// Check if we are in size
			// Lightbox can take up 4/5 of size
			var iWidth  = $(this).width();
			var iHeight = $(this).height();
				// We want to auto resize
				var maxWidth  = wWidth;
				var maxHeight = wHeight;
				
				var resizeRatio;
				while (  iHeight > maxHeight )
				{	// We need to resize

					if ( iHeight > maxHeight )
					{	// Resize height, then width proportionally
						resizeRatio = maxHeight/iHeight;
						iHeight = maxHeight;
						iWidth = Math.floor(iWidth*resizeRatio);
					}
				}
			$(this).css('height', iHeight); 
			$(this).css('width', iWidth);
				
	});
  }
}
function repic()
{
	$("img.r_e_p_l_a_c_e").each(function(i){

		if(this.resrc)
		{

			this.src = desrc(this.resrc);
		}
	 }); 
}
function relink()
{
	$("a.r_e_p_l_a_c_e").each(function(i){
		if(this.shref)
		{
			this.href = desrc(this.shref);
		}
	 }); 
}
function desrc(src){
	//替换.taobao.com
	//替换.taobaocdn.com
	src=src.replace("/tb.kangg.com/",".taobao.com");
	src=src.replace("/tbcdn.kangg.com/",".taobaocdn.com");
	if(src==''||src==undefined)
	{
		src='http://www.kangg.com';	
	}
	return src;
}
//产品页面的
function showproduct(url)
{
	//url=desrc(url);
	repic();relink();
	makepiclist(); 
}
//鼠标指向之后的效果
function setFin()
{
	$("img.r_e_p_l_a_c_e").hover(
		function() {
		$(this).css({'z-index' : '10'});
		$(this).find('img').addClass("hover").stop()
			.animate({
				marginTop: '-110px', 
				marginLeft: '-110px', 
				top: '50%', 
				left: '50%', 
				width: '174px', 
				height: '174px',
				padding: '20px' 
			}, 200);
		
		} , function() {
		$(this).css({'z-index' : '0'});
		$(this).find('img').removeClass("hover").stop()
			.animate({
				marginTop: '0', 
				marginLeft: '0',
				top: '0', 
				left: '0', 
				width: '100px', 
				height: '100px', 
				padding: '5px'
			}, 400);
		});	
}
