if (($.browser.msie)&&($.browser.version == "6.0")){
	try { document.execCommand('BackgroundImageCache', false, true); } catch(e) {}
}/**Solve ie6 background images not cache ie6背景不缓存，为 jquery验证ie6**/
$(function(){
	$("body").click(function() {
		 if ($("#search_selected").css("display") == "block") {
		         $("#search_selected").hide();
		     }
		 }); 
	$("#search_selected li").hover(function(){
			    $(this).css({"color":"#fff",'background-color':'#3399FF'});
			  },function(){
				  $(this).css({"color":"black",'background-color':'#fff'});
				  })
		$("#search_selected li").click(function(){
		        $("#conditions").text($(this).text());
		      })
		$("#conditions").click(function(){
		  if ($("#search_selected").css("display") == "block") {
		         $("#search_selected").hide();
		     }else{
		           $("#search_selected").show();return false;
		         }
		     })
	$("#m_center").hover(function(){
			$("#m_list").show();
					},function(){
						$("#m_list").hide();
			})
			$("#net_navlist").hover(function(){
					$("#net_list").show();
					},function(){
					$("#net_list").hide();
					})// headline 头部js效果
			$('#logo .condition span').click(function(){
		                $(this).addClass('current').siblings().removeClass('current').removeClass('current2');
		            })
		    $('#logo .condition .company').click(function(){
		            $(this).addClass('current2').siblings().removeClass('current');
		            })// 前台搜索js效果
		            $('#logo .condition span').click(function(){
				$(this).addClass('current').siblings().removeClass('current').removeClass('current2');
			})
			$('#logo .condition .company').click(function(){
			$(this).addClass('current2').siblings().removeClass('current');
			})
			$("#qsearch .sell").each(function(index,dom){
			$(dom).click(function(){
				if($("#qsearch .showcont").eq(index).css('display')=='none'){
						$("#qsearch .showcont").eq(index).show();
						return false;
				}else{
					$("#qsearch .showcont").eq(index).hide();
					return false;
					}
				})
			})
			
})
function bgallbackshow(id){
	var width=$("body").width();
	var widthid=width/2-$(id).width()/2;
	var height=$("body").height();
	var heightid=document.documentElement.scrollTop+document.documentElement.clientHeight/2-$(id).height()/2;
	var idciv1=$("<div id='bgdiv' style='width:"+width+"px;height:"+height+"px;background-color:#000;position:absolute;left:0;top:0;z-index:9997;filter:Alpha(opacity=10);-moz-opacity:.1;opacity:0.1;'></div>")
	var idciv=$("<iframe id='bgiframe' style='width:"+width+"px;height:"+height+"px;position:absolute;left:0;top:0;z-index:9997;filter:Alpha(opacity=10);-moz-opacity:.1;opacity:0.1;'></iframe>")
	$(id).css({"left":widthid+"px","top":heightid+"px"}).fadeIn('slow').after(idciv).after(idciv1);
}
function bgallbackhide(id){
		$(id).hide();
		$("#bgiframe").remove();
		$("#bgdiv").remove();
	}/**隐藏div背景消失**/
function resizeImage(image, width, height) {
    var widthRat = image.width / width;
    var heightRat = image.height / height;
    var widthHeightRat = image.width / image.height;

    if (heightRat > widthRat) {
        if (image.height > height) {
            image.height = height;
            image.width = image.height * widthHeightRat;
        }
    } else {
        if (image.width > width) {
            image.width = width;
            image.height = image.width / widthHeightRat;
        }
    }
    image.style.margin = 0;
    image.textAlign = 'center';
    image.style.visibility = 'visible';
    image.style.marginLeft = (width - image.width) / 2;
    image.style.marginTop = (height - image.height) / 2;
}
function setHomepage() {
    if (document.all) {
        document.body.style.behavior = 'url(#default#homepage)';
        document.body.setHomePage('http://www.1chengsou.com')
    } else if (window.sidebar) {
        if (window.netscape) {
            try {
                netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
            }
            catch (e) {
                window.sidebar.addPanel('1城搜', 'http://www.1chengsou.com', "");
            }
        }
        var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
        prefs.setCharPref('browser.startup.homepage', 'http://www.1chengsou.com');
    }

}
//@Daniel add to handle IE Only
function addToFavorite() {
    if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) {
        external.AddFavorite(location.href, document.title)
    }
    else {
        alert("对不起，你使用的浏览器不是IE。请使用浏览器的设书签功能添加此网页。");
    }
    // 其他浏览器的侦测，见：http://www.javascriptkit.com/javatutors/navigator.shtml
}
