
//换验证码
//换一张验证码
function changecode(id)
{
    $('#'+id).attr('src','code_'+Math.random().toString().substr(Math.random().toString().lastIndexOf(".")+1)+'.html');
}
//去flash的虚边框
function showFlash(d,u,w,h,p,r,v){
var o=document.getElementById(d);
p=(!p)?'Transparent':'Opaque';
r=(!r)?true:false;
v=(!v)?'':v;
if (o!=null)
{
o.innerHTML='<object 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+'"><param name="movie" value="'+u+'"><param name="wmode" value="'+p+'"><param name="menu" value="'+r+'"><param name="flashvars" value="'+v+'"><embed src="'+u+'" width="'+w+'" height="'+h+'" wmode="'+p+'" flashvars="'+v+'" menu="'+r+'" type="application/x-shockwave-flash"></embed></object>';
}
}

//设为主页
function SetHome(url){
    var obj=document.getElementById("indexpage");
    try{
        obj.style.behavior='url(#default#homepage)';obj.setHomePage(url);
    }
    catch(e){
        if(window.netscape) {
        try {
        netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
        }
        catch (e) {
        alert("此操作被浏览器拒绝！\n请在浏览器地址栏输入“about:config”并回车\n然后将 [signed.applets.codebase_principal_support]的值设置为'true',双击即可。");
        }
        var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
        prefs.setCharPref('browser.startup.homepage',url);
        }
    }
}
//添加到收藏夹
function AddFavorite(name,url)
{
    try
    {
        window.external.addFavorite(url, name);
    }
    catch (e)
    {
        try
        {
            window.sidebar.addPanel(name, url, "");
        }
        catch (e)
        {
            alert("加入收藏失败，请使用Ctrl+D进行添加");
        }
    }
}
function leftpro()
{
	var l_interval;
	var _time=20;
	var i=1;
	$('#list_pro li').clone().appendTo('#list_pro');
	$('#list_pro').hover(function(){
		clearInterval(l_interval);				   
	},function(){
		l_interval=setInterval(function(){
			if(-parseInt($('#list_pro').css('marginLeft').toString().substring(0,$('#list_pro').css('marginLeft').toString().length-2))>=928)
			{
				i=0;
			}
			$('#list_pro').css('marginLeft',-i++);
		},_time);
	}).trigger('mouseleave');
}
$(document).ready(function(){
	try{newsUp()}catch(e){}
	try{leftpro()}catch(e){}
	try{dongba()}catch(e){}
	try
	{
		var h=$('#main').height();
		if(h<500)
		{
			$('#main').css("height","500px");
		}
	}catch(e)
	{}		  
});
function sub(){
	document.getElementById("txtname").focus();
	}
function dongba()
{
	$('#dongba_go').find('dt').click(function(){
		if($(this).parents('dl').height()==34)
		{
			$(this).parents('dl').css('height','auto');	
		}else{
			$(this).parents('dl').css('height','34px');
		}
	});
}
