// JavaScript Document

function gotoPage(url){
	document.location.href = url;
}

function imgPreview2(id, url, imgMaxWidth, imgMaxHeight){
	var newPreview = document.getElementById(id);
	newPreview.src = url;	
}

//#newPreview{filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale);   
//若无定义CSS，在预览时将出现脚本错误
function imgPreview(id, url, imgWidth, imgHeight){
	//不支持 IE7。   
	//var oldPreview = document.getElementById("oldPreview");   
	//oldPreview.innerHTML = "<img src=\"file:\\\\" + imgFile.value + "\" width=\"80\" height=\"60\" />";   
	//支持 IE6、IE7。 
	//加载的图片做为背景，若在页面ID包含<img>将被覆盖
	var newPreview = document.getElementById(id);	
	newPreview.filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src = url;   
	newPreview.style.width = imgWidth;   
	newPreview.style.height = imgHeight; 
	//alert(url);
}


function marquees(id, direction, timer, width, height){
	var marquee1 = new Marquee(id)
	marquee1.Direction = direction;			//marquee1.Direction = 1,2,3,4|left|right|top|down;
	marquee1.Step = 1;
	marquee1.Width = width;
	marquee1.Height = height;
	marquee1.Timer = timer;		//值不少于10，值越小滚动越快，CPU负荷越大
	marquee1.DelayTime = 0;
	marquee1.WaitTime = 0;
	marquee1.ScrollStep = 52;
	marquee1.Start();	
}


function setHomepage() 
{ 
	if (document.all) 
	{ 
		document.body.style.behavior='url(#default#homepage)'; 
		document.body.setHomePage('http://www.hndnxx.com'); 
		return false;
	} 
	else if (window.sidebar) 
	{ 
		if(window.netscape) 
		{ 
		try 
		{ 
		netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); 
		} 
		catch(e) 
		{ 
		alert("您的浏览器不支持，if you want to enable，please enter about:config in your address line,and change the value of signed.applets.codebase_principal_support to true"); 
		} 
		} 
		var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components. interfaces.nsIPrefBranch); 
		prefs.setCharPref('browser.startup.homepage','http://www.hndnxx.com'); 
	}
}

function addfavorite() 
{ 
   switch(getOs()) 
   { 
       case 1:window.external.addFavorite('http://www.hndnxx.com','华南电脑学校');break; 
       case 2:window.sidebar.addPanel('华南电脑学校', 'http://www.hndnxx.com/',"");break; 
       case 0:alert("未能识别的浏览器。");break; 
   } 
} 
function getOs() 
{ 
   if(navigator.userAgent.indexOf("MSIE")>0)return 1; 
   if(isFirefox=navigator.userAgent.indexOf("Firefox")>0)return 2; 
   if(isSafari=navigator.userAgent.indexOf("Safari")>0)return 3;    
   if(isCamino=navigator.userAgent.indexOf("Camino")>0)return 4; 
   if(isMozilla=navigator.userAgent.indexOf("Gecko/")>0)return 5; 
   return 0; 
} 
