﻿	var now = new Date()
	var hrs = now.getHours()
	var min = now.getMinutes()
	var user = -(now.getTimezoneOffset() / 60)

	var day = new Date();
	var currentTimeZoneOffsetInHours = - day.getTimezoneOffset()/60;

	var ClockId = null;
	var ClockRunning = false;

	function TOfunc(){
		var elm1 = document.getElementsByName("cityname")[0];
		var elm2 = document.getElementById('ctl00_ContentPlaceHolder2_city');
		
		var timezone = elm1[document.getElementsByName("cityname")[0].selectedIndex].value;
		var today = new Date();
		var hours = today.getHours();
		var minutes = today.getMinutes();
		var secs = today.getSeconds();
		hours += parseInt(timezone) - currentTimeZoneOffsetInHours;
		today.setHours(hours);
		ST = today.toString();
		if(navigator.appName=="Netscape"){
			ST = ST.substring(4,10) + "." + ST.substring(11,15) + "." + ST.substring(16,24);
		}else if(navigator.appName=="Opera"){
			ST = ST.substring(8,11) + " " +ST.substring(5,7)+ "." + ST.substring(12,16) + "." + ST.substring(17,25);
		}else{
			ST = ST.substring(4,10) + "." + ST.substring(28,34) + "." + ST.substring(10,19);
		}
//		alert(ST);
//		alert(elm2);
		elm2.value = ST;
		ClockId = window.setTimeout( "TOfunc()", 1000 );
		ClockRunning = true;
	}

	function stopClock(){
		if(ClockRunning) clearTimeOut(ClockId); ClockRunning = false;
	}

	function citytime(){
		stopClock;
		TOfunc();
	}
function NewsNoticeChange(first,second,firstimg,secondimg)
{   document.getElementById(first).style.display='none';
    document.getElementById(second).style.display='none';
    document.getElementById(first).style.display='';   
    document.getElementById('newsImg').src=firstimg;
    document.getElementById('noticeImg').src=secondimg;   
    //alert(this);
///images/contact2_news_menu1.gif
}

function Init()
{   
    TOfunc();
}
function CheckNo()
{
    if(event.keyCode==13)
    {
        OpenTrack();
        return false;        
    }
}
function OpenTrack()
{
    if(document.getElementById('TrackNo').value==null||document.getElementById('TrackNo').value=="")
    {
        alert('please input No.');
        return;
    }
    var hblno="";
    var cno="";
    if(document.getElementById('TrackSelect').value=='1')
    {
        hblno=document.getElementById('TrackNo').value;
    }
    else
    {
        cno=document.getElementById('TrackNo').value;
    }
        var sw,sh,w,h;
        sh=window.document.body.clientHeight;        
        h=(sh-400)*0.5;       
        sw=window.document.body.clientWidth;
        w=(sw-690)*0.5;
        url='cargotrack/viewtracking.aspx?'+'hblno='+hblno+'&cno='+cno+'&pono=';
        window.open(url,'_blank','toolbar=no,scrollbars=yes,resizable=yes,menubar=no,width=690px,height=400px,top='+h+',left='+w);
    }

function launchFull(url) {
    var str = "left=0,screenX=0,top=0,screenY=0";

    if (window.screen) {
        var ah = screen.availHeight - 30;
        var aw = screen.availWidth - 10;
        str += ",height=" + ah;
        str += ",innerHeight=" + ah;
        str += ",width=" + aw;
        str += ",innerWidth=" + aw;
    }

    str += ",resizable=1,scrollbars=1";
    return window.open(url, "", str);
}

function getQuery(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
    var r = window.location.search.substr(1).match(reg);
    if (r != null) return unescape(r[2]);
    return null;
}
function isDelete() {
    var message = "确认要删除吗?";

    return confirm(message);
}

function replaceSpace(str) {
    return str.replace(/\s/g, '');
}

function OpenComment(fatherid, fathertype) {
    var sw, sh, w, h;
    sh = window.document.body.clientHeight;
    h = (sh - 500) * 0.5;
    sw = window.document.body.clientWidth;
    w = (sw - 250) * 0.5;
    url = 'comment_add.aspx?' + 'fatherid=' + fatherid + '&fathertype=' + fathertype;
    window.open(url, '_blank', 'toolbar=no,scrollbars=yes,resizable=yes,menubar=no,width=500px,height=250px,top=' + h + ',left=' + w);
    return false;
}
function OpenTreeWindow(url, hd) {
    var sw, sh, w, h;
    sh = window.document.body.clientHeight;
    // alert(sh);       
    h = (sh - 300) * 0.5;
    sw = window.document.body.clientWidth;
    w = (sw - 400) * 0.5;
    url = url + '?deptid=' + hd.value;
    window.open(url, '_blank', 'toolbar=no,scrollbars=yes,resizable=yes,menubar=no,width=400px,height=300px,top=' + h + ',left=' + w);
}
function OpenPersonWindow(url, hd) {
    var sw, sh, w, h;
    sh = window.document.body.clientHeight;
    // alert(sh);       
    h = (sh - 400) * 0.5;
    sw = window.document.body.clientWidth;
    w = (sw - 450) * 0.5;
    url = url + '?deptid=' + hd.value;
    window.open(url, '_blank', 'toolbar=no,scrollbars=yes,resizable=yes,menubar=no,width=450px,height=400px,top=' + h + ',left=' + w);
}
function pageNews(no) {
    document.getElementById('ctl00_ContentPlaceHolder1_HFCurrentPage').value = no;
    //document.getElementById('').click();   
    var btnSearch = document.getElementById('ctl00$ContentPlaceHolder1$BtnSearch');
    if (btnSearch != null) {
        btnSearch.click();
    }
    //    var RadContentType=document.getElementById('ctl00_ContentPlaceHolder1_RadContentType_0');
    //    var RadContentType1=document.getElementById('ctl00_ContentPlaceHolder1_RadContentType_1');
    //    if(RadContentType!=null&&RadContentType1!=null)
    //    {
    //        document.getElementById('aspnetForm').submit();    
    //    }
}
function page(no) {
    document.getElementById('HFCurrentPage').value = no;
    document.getElementById('ImageButton1').click();
    //alert(no);
}
function backup(url) {
    window.open(url, '_parent');
}
window.onscroll = function(e) {
    //alert('ddd');
    var divb = document.getElementById('DivBottom');
    if (divb == null) {
        return;
    }
    // divb.style = "height:18px; background:#003300; color:#FFFFFF;";
    divb.style.position = '';
    divb.style.marginTop = "0px";
    //$get("DivBottom").style.top = $get("div_Content").style.top + $get("div_Content").style.height;
}

