﻿function OpenPort(url, hd, display, porttype) {
        var sw,sh,w,h;
        sh=window.document.body.clientHeight;   
       // alert(sh);       
        h=(sh-200)*0.5;       
        sw=window.document.body.clientWidth;
        w=(sw-260)*0.5;
    url=url+'?data='+hd.value+'&displayid='+display.id+'&hiddenid='+hd.id+'&porttype='+porttype;
    window.open(url,'_blank','toolbar=no,scrollbars=yes,resizable=yes,menubar=no,width=260px,height=200px,top='+h+',left='+w);
}
function OpenOrderWin(url)
{
    var sw,sh,w,h;
    sh=window.document.body.clientHeight;              
    h=(sh-800)*0.5; 
    sw=window.document.body.clientWidth;
    w=(sw-1000)*0.5;
    window.open(url, '_blank', 'top=0, left=0,toolbar=no, menubar=no, resizable=yes,width=1000px,height=800px,location=no,status=no,top='+h+',left='+w);
}
function chkPer() {
    var d = document.getElementsByName("chkpermissions");
    var f = "";
    for (var i = 0; i < d.length; i++) {
        if (d[i].checked) {            
            f+= d[i].value+'@';
        }
    }
    
    var p = document.getElementById("ctl00_ContentPlaceHolder1_TxtPermissions");
    if (p != null) {

        p.value = f;
        var _hfRole;
        for (var n = 0; n < 20; n++) {
            _hfRole = document.getElementById('ctl00_ContentPlaceHolder1_ASPxPageControl1_UserListGrid_DXPEForm_ef' + n + '_HFRole');
            if(_hfRole!=null)
            {
                _hfRole.value=f;
                break;
            }
        }
        
            //document.getElementById('ctl00_ContentPlaceHolder1_ASPxPageControl1_UserListGrid_DXPEForm_ef0_HFRole').value = f;        
    }
    
}
function CopyOrderWin(url)
{
    var sw,sh,w,h;
    sh=window.document.body.clientHeight;              
    h=(sh-800)*0.5; 
    sw=window.document.body.clientWidth;
    w=(sw-1000)*0.5;
    window.open(url, '_blank', 'top=0, left=0,toolbar=no, menubar=no, resizable=yes,width=1000px,height=800px,location=no,status=no,top='+h+',left='+w);
}
function openTrack(hbl,cno)
{
        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='ViewCargoTrack.aspx'+'?hblno='+hbl+'&cno='+cno;
        window.open(url,'_blank','toolbar=no,scrollbars=yes,resizable=yes,menubar=no,width=690px,height=400px,top='+h+',left='+w);
    }
    window.onscroll = function(e) {
        var divb = document.getElementById('DivBottom');
        if (divb == null) return;
        // divb.style = "height:18px; background:#003300; color:#FFFFFF;";
        divb.style.position = '';
        divb.style.marginTop = "0px";
    }

function customertalktosales(sender,receiver)
{

    var divIFTalk=document.getElementById("IframdTalk");
    //divIFTalk.ShowChatForm(receiver);
    window.frames["IframdTalk"].ShowChatForm(receiver);
    //var url='http://www.cityocean.com:2999/ChatPlugInPage.html?UserId='+sender+'&ReceiverId='+receiver;
    //alert(url);
    //divIFTalk.src=url;
}
function ViewHelp(url)
{    
    var sw,sh,w,h;
    sh=window.document.body.clientHeight;              
    h=(sh-800)*0.5; 
    sw=window.document.body.clientWidth;
    w=(sw-1000)*0.5;
    window.open(url,'_blank','toolbar=no,scrollbars=yes,resizable=yes,menubar=no,width=1000px,height=800px,top='+h+',left='+w);
}
function init()
{
        var sw,sh,w,h; 
        sh=document.body.clientHeight;
        Loading.style.posTop=(sh-Loading.style.posHeight)*0.5;
        sw= document.body.clientWidth;
        Loading.style.posLeft=(sw-Loading.style.posWidth)*0.5;
}

function pageNews(no)
{
    document.getElementById('HFCurrentPage').value=no;
    document.form1.submit();
    //alert(no);
}
function pageTracking(no)
{
    document.getElementById('HFCurrentPage').value=no;
    document.getElementById('BtnHidSearch').click();
    //alert(no);
}
function page(no)
{
    document.getElementById('HFCurrentPage').value=no;
    document.getElementById('ImageButton1').click();
    //alert(no);
}
function ConfirmDel()
{
    if(confirm('Delete All You Select Data?'))return true;
    return false;
}
function ConfirmUserDel()
{
    if(confirm('Delete All You Select Data?'))return true;
    return false;
}
function selecttab(id,tt,tabno)
{
	tabperiod.style.display='none';
	tabbillno.style.display='none';
	tabCNo.style.display='none';
	tabPo.style.display='none';
	id.style.display='';	
	t1.background='images/tab_45.gif';
	t2.background='images/tab_45.gif';
	t3.background='images/tab_45.gif';
    t4.background='images/tab_45.gif';
	tt.background='images/tab_45_blue.gif'	
	document.getElementById('TabNo').value=tabno;	
}
function selectprofile(id,tt,tabno)
{
	tabperiod.style.display='none';
	tabbillno.style.display='none';
	tabsetting.style.display='none';
	id.style.display='';	
	t1.background='images/tab_45.gif';
	t2.background='images/tab_45.gif';
	t3.background='images/tab_45.gif';
	tt.background='images/tab_45_blue.gif'	
	document.getElementById('TabNo').value=tabno;	
}
function SetValue(listboxid,portname)
{
    var listBox=document.getElementById(listboxid);
    var a=portname.split(';'); 
    for(var m=listBox.options.length;m>=0;m--)
    {
        listBox.options[m]=null;        
    }
    listBox.size=1;
    var n=0;
    for(var i=0;i<a.length;i++)
    {
        if(a[i]!=""&&a[i]!=null)
        {
            listBox.options[i]=new Option(a[i],'');
            if(n<5)n++;
        }
    }
    if(n>0)listBox.size=n;
}
function viewDemo(url) {
    window.open(url, '', 'menubar =no,status=no,scrollbars=no,resizable=no,toolbar=no,width=860,height=678');
}