﻿function viewPhoto(strPath)	{
	window.open('assets/viewphoto.aspx?strPath=' + strPath, 'Viewver', 'width=780, height=500, scrollbars=yes, status=yes, resizable=yes')
}

function ResizePhotoViewer(window) {
	var img = document.getElementById('imgPhoto')
	var x = img.width + 50;
	var y = img.height + 175;
	
	if (screen.availWidth<x) { 
		x = screen.availWidth - 28; 
	}
	
	window.resizeTo(x,y);
}

function showEmail(strName, strDomain, strLinkText) {
	var strEmail = strName + '@' + strDomain;
	if (!strLinkText) {strLinkText = strEmail;}
	
	document.write('<a class="email" href="mailto:' + strEmail + '">' + strLinkText + '</a>');
}

function PlayFlash(src, cssclass)	{
	document.write("<object class=\"" + cssclass + "\" type=\"application/x-shockwave-flash\" data=\"" + src + "\">")
	document.write("<param name=\"movie\" value=\"" + src + "\" />")
	document.write("</object>") 
}

function HidePhoto()	{
	document.getElementById('largeimage').style.display='none';
}

function Enlarge(photoId)	{
	if (document.getElementById('largeimage').style.display=='block')	{
		document.getElementById('largeimage').style.display='none';
	}
	else	{
		document.getElementById('imglarge').src='assets/dbphoto.aspx?tablename=CE_News&ColNameData=FileData&ColNameSize=FileSize&ColNameId=cntNewsId&id=' + photoId + '&width=500';
		document.getElementById('largeimage').style.display='block';
	}
}

function Toggle(obj)	{
	if (document.getElementById(obj).style.display=='block')	{
		document.getElementById(obj).style.display='none';
	}
	else	{
		document.getElementById(obj).style.display='none';
		document.getElementById(obj).style.display='block';
	}
}

function PrintQuotation(root, itemId) {
    var winLeft = (screen.availWidth - 700) / 2;
    var winTop = (screen.availHeight - 800) / 2;

    window.open(root + 'clientfiles/assets/print/quotation.aspx?itemId=' + itemId, 'Quotation' + itemId, 'width=700, height=800, status=yes, scrollbars=yes, toolbar=yes, left=' + winLeft + ', top=' + winTop);
}

function PrintOrder(root, itemId) {
    var winLeft = (screen.availWidth - 700) / 2;
    var winTop = (screen.availHeight - 800) / 2;

    window.open(root + 'clientfiles/assets/print/order.aspx?itemId=' + itemId, 'Order' + itemId, 'width=700, height=800, status=yes, scrollbars=yes, toolbar=yes, left=' + winLeft + ', top=' + winTop);
}

function PrintServiceOrder(root, itemId) {
    var winLeft = (screen.availWidth - 700) / 2;
    var winTop = (screen.availHeight - 800) / 2;

    window.open(root + 'clientfiles/assets/print/serviceorder.aspx?itemId=' + itemId, 'ServiceOrder' + itemId, 'width=700, height=800, status=yes, scrollbars=yes, toolbar=yes, left=' + winLeft + ', top=' + winTop);
}
