function setHomepage()
{
if (document.all)

 { 

   document.body.style.behavior='url(#default#homepage)';

   document.body.setHomePage('http://www.ezone.hk');
 }
 else if (window.sidebar) 
 { 

    if(window.netscape)
    {

     try

     { 
       netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); 

     }
     catch(e) 
     {
       alert("this action was aviod by your browser，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.ezone.hk');
  }
}

function getDate(){
    var today = new Date();
    var hours = today.getHours();
    var minute = today.getMinutes();
    var pmOram = "AM";
    if (hours > 12) {
        hours = hours-12;
        pmOram = "PM";
    }
    
    //document.getElementById('show_hour_minute').innerHTML = hours+":"+addZero(minute)+" "+pmOram;
    setTimeout('getDate()',500);
}

function addZero(i){
    if (i < 10) {
        i = '0' + i;
    }
    return i;
}

function goUrl(lang){
    var url = document.location.href;
    var query = window.location.search.substring(1);
    var urls = url.split("?");
    var vars = query.split("&");
    var query = "";
    for (var i=0;i<vars.length;i++) {
        var pair = vars[i].split("=");
        if (pair[0] != "charset" && pair[0] != "") {
            query = query + pair[0] + "=" + pair[1] + "&";
        }
    }
    query = query + "charset=" + lang;
    location.href = urls[0]+"?"+query;
}

function showattachment(path, atttype) {
	var x;
	x=window.open(path.replace('../', ''),'Show'+ atttype,'toolbar=1,location=0,dependent=1,directories=0,status=0,menubar=1,titlebar=0,scrollbars=1,resizable=1,width=800,height=400,top=100,left=50');
}

function performSearch() {
	return true;
//	alert("搜尋系統正在優化中，暫時無法使用。");
//	return false;	
}

var hostname= "http://"+document.location.host+"/";

//var http_host = document.location.href.substring(0,document.location.href.indexOf(window.document.location.pathname)) + document.location.pathname.substring(0,document.location.pathname.lastIndexOf("/")+1);

$.noConflict();

jQuery(document).ready(function(){
	jQuery.ajaxSetup ({
		cache: false
	});
	jQuery('#weather-box').load(hostname+'load_cache.php', {section:'weather'});
	jQuery('#search-box').load(hostname+'load_cache.php', {section:'tips'});
/*
	jQuery('#hot-rank').load(hostname+'load_cache.php', {section:'hotrank'});//熱讚排行榜
	jQuery('#hot-list1').load(hostname+'load_cache.php', {section:'hotlist1'});//全城話題
	jQuery('#fresh-list').load(hostname+'load_cache.php', {section:'freshlist'});//最熱知識
	jQuery('#hot_video').load(hostname+'load_cache.php', {section:'hotvideo'});//最熱影片
	jQuery('#forumhot-list').load(hostname+'load_cache.php', {section:'forumhotlist'});//熱門題目
	jQuery('#hot-rank2').load(hostname+'load_cache.php', {section:'hotrank2'});//激新熱讚
	jQuery('#hot-list').load(hostname+'load_cache.php', {section:'hotlist'});//最熱回應
	jQuery('#fresh-rank').load(hostname+'load_cache.php', {section:'freshrank'});//最新討論
*/
});
