﻿


//function PrintShipmentLabels(checkBox)
//{
//    //alert('PrintShipmentLabels');
//    window.open('PrintShipmentLabels.aspx', 'PRINT');
//    alert(Checkbox);
//    checkBox.checked = false;
//}

// Used for printing the labels of the receipt
function TrackAndConfirm(trackingNumber) 
{
    var newWindowName = 'TrackAndConfirm.aspx?View=' + trackingNumber;
    var objWindow = window.open(newWindowName, 'TrackContainer', 'status=0, toolbar=0, location=0, menubar=0, resizable=1, scrollbars=0');
} 


// Used for printing the labels of the receipt
function ClientSidePrint(idDiv) 
{ 
    //alert('ClientSidePrint');
    var w = 1;
    var h = 1;
  
    var l = 1;//(window.screen.availWidth - w)/2;
    var t = 1;//(window.screen.availHeight - h)/2;

    var sOption="toolbar=no,location=no,directories=no,menubar=no,scrollbars=yes,width=" + w + ",height=" + h + ",left=" + l + ",top=" + t; 
    // Get the HTML content of the div
    var sDivText = window.document.getElementById(idDiv).innerHTML;
    // Open a new window
    var objWindow = window.open("", "Print", sOption);
    // Write the div element to the window
    objWindow.document.write(sDivText);
    objWindow.document.close(); 
    // Print the window            
    objWindow.print();
    // Close the window
    objWindow.close();            
} 

// Used for printing the labels of the receipt
function ClientSidePrintMe(windowName) 
{
    //alert('ClientSidePrintMe');
    var objWindow = window.open('PrintShipmentLabels.aspx', windowName);
    // Print the window            
    //objWindow.print();
    // Close the window
    //objWindow.close();            
} 

// Used for printing the labels of the receipt
function ClientSideReceiptLabelPrint(windowName) 
{
    //alert('ClientSideReceiptLabelPrint');
    var objWindow = window.open('../PrintReceiptLabels.aspx', windowName);

    // Print the window            
    //objWindow.print();
} 

function ClientSitePrintGridData(params)
{
    var searchObj=document.getElementById('Main_ContentPlaceHolder_ASD_txtSearch');
    if(searchObj!=null)
    {
        params=params+searchObj.value;
    }
    
    var hidSortExpression=document.getElementById('Main_ContentPlaceHolder_ASD_cntrlPager_SortExpressionHiddenField');
    if(hidSortExpression!=null)
    {
        params=params + '&SortExpression='+ hidSortExpression.value;
    }
	var hidSortDirection=document.getElementById('Main_ContentPlaceHolder_ASD_cntrlPager_SortDirectionHiddenField');
	if(hidSortDirection!=null)
    {
        params=params + '&SortDirection='+ hidSortDirection.value;
    }
	 
    //alert(params);
    var url='../PrintGridData.aspx?'+params;
    var win=window.open(url,'Print');
    // Print the window            
    win.print();
}

function ClientSiteDownloadGridData(params)
{
    var searchObj=document.getElementById('Main_ContentPlaceHolder_ASD_txtSearch');
    if(searchObj!=null)
    {
        params=params+searchObj.value;
    }
    //alert(params);
    var url='../PrintGridData.aspx?'+params;
    var win=window.open(url,'Download');
}

function OpenSupportWindow()
{
    var win = window.open('Support/SupportViewer.aspx', 'Support','status=0, toolbar=0, location=0, menubar=0, resizable=1, scrollbars=1'); 
}


// Expands and collapses elements
function expandCollapse(source, targetID)
{
//alert(targetID);
	if (document.getElementById(targetID))
	{
		var target = document.getElementById(targetID);
		    if (target.style.display == "none")
		    {
			    target.style.display = "block";
			    source.className = "Expanded";
		    }
		    else
		    {
			    target.style.display = "none";
			    source.className = "Collapsed";
		    }

		    return true;

	}
	else
	{
		return false;
	}
}

// Toggles the visibility of elements
function hideShow(targetID)
{
	var target = document.getElementById(targetID);
	
	if (target.style.display == "block")
	{
		target.style.display = "none";
	}
	else
	{
		target.style.display = "block";
	}
}

// Prompts the user to delete the given item
function confirmDelete(item)
{
	return confirm("Are you sure you want to delete " + item + "?");
}

// Copies the value of a source element to a target element
function copyContents(source, target)
{
	target.value = source.value;
}

// Called by the ExtGridView control any time a row gets expanded or collapsed. Used to reposition elements properly.
function ExtGridView_TglRow_Hook()
{
	var footer = document.getElementById("Main_Footer");
	footer.style.bottom = "1";
	footer.style.bottom = "0";
}



function SetRadComboBoxDisabled()
{
    try
    {
        if(Telerik.Web.UI.RadComboBox.ComboBoxes)
        {  
            for(var i=0; i<Telerik.Web.UI.RadComboBox.ComboBoxes.length; i++) 
            { 
            
                var combo = Telerik.Web.UI.RadComboBox.ComboBoxes[i];  
                if(combo._skin=="EWMS_DISABLED" || combo._skin=="EWMS_UOM_DISABLED")
                {           
                    combo.set_enabled(false);  
                    combo.disableEvents(); 
	            }
	            else if (combo._skin=="EWMS" || combo._skin =="EWMS_UOM")
	            {
	                combo.get_items();
	            }
//	            if(combo._skin=="EWMS_DISABLED_ACTIVE")
//	            {
//	                combo.set_enabled(false); 
//	                
//	            }
            }
        }
    }
    catch(err)
    {

    }
}


function DropDownOpening(sender, eventArgs) {
    eventArgs.set_cancel(true);
}

function LoadClientSideComboList() {
    try {
        if (Telerik.Web.UI.RadComboBox.ComboBoxes) {
            for (var i = 0; i < Telerik.Web.UI.RadComboBox.ComboBoxes.length; i++) 
            {
                var combo = Telerik.Web.UI.RadComboBox.ComboBoxes[i];
                combo.get_items();
            }
        }
    }
    catch (err) {

    }
}
