﻿function OnDescription( url )
{ 
	w = 700;
	h = 580;
	
	if (screen) {
		leftPos = screen.width/2-w/2
		topPos = screen.height/2-h/2
	}
	photoWin =  window.open( url, null, "width="+w+",height="+h+",top="+topPos+",left="+leftPos+",location=no,menubar=no,scrollbars=no,toolbar=no,resizable=yes", "true"); 
	photoWin.focus();	
}

function OnDescriptionServ( url )
{ 
	w = 700;
	h = 580;
	
	if (screen) {
		leftPos = screen.width/2-w/2
		topPos = screen.height/2-h/2
	}
	photoWin =  window.open( url, null, "width="+w+",height="+h+",top="+topPos+",left="+leftPos+",location=no,menubar=yes,scrollbars=yes,toolbar=no,resizable=yes", "true"); 
	photoWin.focus();	
}

function OnPreview( url )
{
	window.open( url, null, "width=700,height=600,location=no,menubar=no,scrollbars=yes,toolbar=no", "true");
}

function OnRepairPrint( id )
{
	//OnDescription("/Admin/Print/Print.aspx?Page=RepairPrint&IsHeader=0&ID=" + id);
	OnDescription("/Admin/Print/Print.aspx?Page=Repair2Print&IsHeader=0&ID=" + id);
}
function OnServices2Print( id )
{
	//OnDescription("/Admin/Print/Print.aspx?Page=RepairPrint&IsHeader=0&ID=" + id);
	OnDescription("/Admin/Print/Print.aspx?Page=Servises2Print&IsHeader=0&ID=" + id);
}

function OnServicesPrint()
{		
	OnDescriptionServ("/Admin/Print/InnerPages/ServicesPrint.aspx");
}
function OnDurationsServicesPrint()
{		
	OnDescriptionServ("/Admin/Print/InnerPages/DurationsServicesPrint.aspx");
}
function OnClientServicesPrint()
{		
	OnDescriptionServ("/Admin/Print/InnerPages/ClientServicesPrint.aspx");
}

function OnInvoicePrint( id )
{
	OnDescription("/Admin/Print/Print.aspx?Page=InvoicePrint&Archive=0&ID=" + id);
}

function OnArchiveInvoicePrint( id )
{
	OnDescription("/Admin/Print/Print.aspx?Page=InvoicePrint&Archive=1&ID=" + id);
}

function OnOwnDescriptionPrint( id )
{
	OnDescription("/Admin/Print/Print.aspx?Page=../../Components/Catalog/ItemDescription/Preview&ID=" + id );
}

function OnItemDescriptionPrint( provider, itemcode, itemPrice, partNumber, owndescription )
{
	OnDescription("/Admin/Print/Print.aspx?Page=DescriptionPrint&provider=" + provider +
	"&itemcode=" + itemcode +
	"&itemPrice=" + itemPrice +
	"&partNumber=" + partNumber +
	"&owndescription=" + owndescription + 
	"&BtnPrint=0" );
}

function doHelp()
{
	var key = "<%=qPageID%>";
	window.open('dialog.aspx?Page=HelpManager.ascx&sessionID=0&designerID=0&HelpsFile=HelpTree&Key=' + key, 'HelpAdmin', 'resizable=yes, width=830px, height=590px');
}

function OnParameters( url )
{
	var link = "/Admin/Components/Container.aspx?Scroll=no&ContainerTitle=Galerija&ItemID=" + url + "&Page=Catalog/ItemDescription/Main2";
	var result = window.showModalDialog( link, window, "status:no; center:yes; help:no; minimize:no; maximize:no; scroll:0; border:thin; statusbar:no; dialogWidth:620px; dialogHeight:700px");
}

//function OnParameters( code )
//{
	//window.open( "/admin/Components/Catalog/ItemDescription/Show.aspx?ID=" + code, "Parametrai", "width=480,height=500,location=no,menubar=no,scrollbars=yes,toolbar=no", "true");
//}

function OnCompatibility( code )
{
	window.open( "/Admin/Components/Catalog/Pupup/Compatibility.aspx?ID=" + code, null, "width=370,height=130,location=no,menubar=no,scrollbars=no,toolbar=no", "true");
}


function OnPriceChange( code )
{
	window.open( "/admin/Components/Catalog/Chart/PriceChange.aspx?itemcode=" + code, null, "width=780,height=400,location=no,menubar=no,scrollbars=no,toolbar=no", "true");
}


function OnPriceChangeByAccountCode( code )
{
	window.open( "/admin/Components/Catalog/Chart/PriceChangeByAccountCode.aspx?accountcode=" + code, null, "width=780,height=400,location=no,menubar=no,scrollbars=no,toolbar=no", "true");
}


function OnFormula( code )
{
	window.open( "/admin/Components/Catalog/ItemDescription/ShowFormula.aspx?ID=" + code, null, "width=480,height=500,location=no,menubar=no,scrollbars=yes,toolbar=no", "true");
}

function OnAccountCode( code )
{
	var link = "/Admin/Components/Container.aspx?ID=" + code + "&Page=AccountCode/AccountCode";
	var result = window.showModalDialog( link, window, "status:no; center:yes; help:no; minimize:no; maximize:no; scroll:no; border:thin; statusbar:no; dialogWidth:995px; dialogHeight:705px");
	if ( result != undefined )
	{
		document.location.reload();
	}
}

function OnItemNotify( itemid, price )
{
	var link = "/Admin/Components/Container.aspx?ID=" + itemid + "&Price=" + price + "&Page=Notify/ItemNotifyDialog";
	var result = window.showModalDialog( link, window, "status:no; center:yes; help:no; minimize:no; maximize:no; scroll:no; border:thin; statusbar:no; dialogWidth:500px; dialogHeight:160px");
	if ( result != undefined )
	{
		document.location.reload();
	}
}

function OnEdit( id, itemID )
{
	var link = "/Admin/Components/Container.aspx?Scroll=no&Page=Catalog/ItemUIs/Main2&ID=" + id + "&ItemID=" + itemID;
	var result = window.showModalDialog( link, window, "status:no; center:yes; help:no; minimize:no; maximize:no; scroll:no; border:thin; statusbar:no; dialogWidth:995px; dialogHeight:705px");
	if (result != null) document.location.reload();
}

	
function ShowChangesAlert()
{
	alert('Išfiltruotas rezultatas neatitinka filtravimo kriterijų!');
}

function OnPackage( id )
{
	var link = "/Admin/Components/Container.aspx?Page=Catalog/PackageItemsUI&ID=" + id;
	var result = window.showModalDialog( link, window, "status:no; center:yes; help:no; minimize:no; maximize:no; scroll:no; border:thin; statusbar:no; dialogWidth:995px; dialogHeight:705px");
	if (result == "OK") 
		document.location.reload();
}

function OnCartCurrentPrint( orderID, lang, currency ) {
	OnDescription("/Print/Print.aspx?Page=CartCurrentPrint&PrintMode=1&OrderID=" + orderID + "&L=" + lang + "&C=" + currency);
}
