function pausecomp()

{

                var today=new Date();

                var now=today.getSeconds();

                var today2; now2;

 

                while (1)

                {

                today2=new Date();

                var now2=today2.getSeconds();

                if (now2<now) {now2+=60;}

                if (now2-now>=2) {break;}

                }

}



function PrintReport()
{
    var result;
    var gAutoPrint = true; // Flag for whether or not to automatically call the print function

	if (document.getElementById != null)
	{
		var html = '<HTML>\n<HE' + + 'AD>\n';

		if (document.getElementsByTagName != null)
		{
			var headTags = document.getElementsByTagName("head");
			if (headTags.length > 0)
				html += headTags[0].innerHTML;
		}
		
		html += '\n</HE' + 'AD>\n<BODY>\n';
		
		var printReadyElem = document.getElementById("printReady");
		
		if (printReadyElem != null)
		{
				html += printReadyElem.innerHTML;
		}
		else
		{
			alert("Could not find the printReady section in the HTML");
			return;
		}
		//html += '<script language=javascript>\n' + 'alert("Close this print window when done printing.")</sc' + 'ript>';
		html += '\n</BO' + 'DY>\n</HT' + 'ML>';
		
		var printWin = window.open("","printSpecial");
		printWin.document.open();
		printWin.document.write(html);
		printWin.document.close();
		if (gAutoPrint)
			printWin.print();
			pausecomp();
			printWin.close();
			
	}
	else
	{
		alert("Sorry, the print ready feature is only available in modern browsers.");
	}


    return result;
}





function ValidateRequired()
{
var AltName = '';
if (document.forms.length > 0)
{
	var fobj = null;
	for (var i = 0; i< document.forms.length; i++) 
		{
		fobj = document.forms[i]
		
		for (a=0; a < fobj.length; a++) 
			{
			AltName = fobj[a].requiredAltName;
			if (AltName==null||AltName=='')
			    {
			    AltName = fobj[a].name
			    }
			if (fobj[a].required == "true")
				{
				if (fobj[a].value == '')
					{
					alert('The required field "' + AltName + '" must be filled out to continue processing.')
					fobj[a].focus();
					return false
					}
				}
			}
		}
}		
return true
}

function CheckEmailType()
{
	try
	{
	document.all('Email_Body_HTML').value = document.all('EmailBodySpan').innerHTML
	} catch(err)
	{}
	return true;
}

function SearchProducts()
{  
    if (document.all('SearchValue').value != null)
    {
		if (document.all('SearchValue').value == '')
			{
			alert('You must enter a value to seach on.')
			document.all('SearchValue').focus();
			return false;
			}
	        
		window.location.href= jsURL + '/shopcart/ProductLayouts/ProductsSearch.asp?Search=' + escape(document.all('SearchValue').value)
	}
}

var objExtWindow
function OpenExternalWindow(sURL ,lWinHeight, lWinWidth, sOptions)
{
	if (lWinHeight=='')
		{lWinHeight='100%'}
	if (lWinWidth=='')
		{lWinWidth='100%'}
		
if (lWinHeight.indexOf('%',0)==-1)
	{
	if (isNaN(lWinHeight)==true)
		{lWinHeight='100%'}
	}

if (lWinWidth.indexOf('%',0)==-1)
	{
	if (isNaN(lWinWidth)==true)
		{lWinWidth='100%'}
	}	
	
    if (document.all)
        var xMax = screen.width, yMax = screen.height;
    else
        if (document.layers)
            var xMax = window.outerWidth, yMax = window.outerHeight;
        else
            var xMax = 800, yMax=600;

	//handle offset if page is percentage
	if (lWinHeight.indexOf('%',0)>=0)
		{
		var tHeight = yMax * (lWinHeight.replace('%','') / 100)
		var yOffset = (yMax-tHeight)/2;
		} else {
		//not percentage so use normal offsets
		var tHeight = lWinHeight
		var yOffset = (yMax - lWinHeight)/2;
		}
		
	if (lWinWidth.indexOf('%',0)>=0)
		{
		var tWidth = xMax * (lWinWidth.replace('%','') / 100)
		var xOffset = (xMax-tWidth)/2;
		} else {
		var tWidth = lWinWidth
		var xOffset = (xMax - lWinWidth)/2
		}
	
    //alert(sOptions + 'width=' + lWinWidth + ',height=' + lWinHeight + ',screenX='+xOffset+',screenY='+yOffset+',top='+yOffset+',left='+xOffset+'')
    var objExtWindow = window.open(sURL,'ExtWindow', sOptions + 'width=' + tWidth + ',height=' + tHeight + ',screenX='+xOffset+',screenY='+yOffset+',top='+yOffset+',left='+xOffset+'');
    objExtWindow.focus();
    return false;
}

function PrintWindow()
{
	window.print();
}

var mac= /mac/i.test(navigator.platform);
var win= /win/i.test(navigator.platform);
var unix= /lin|unix|x11/i.test(navigator.platform);
