<!--
	/*
		filename: EADCouponTools.js
		project: www.townmoneysaver.com 				COUPONS
		dependencies: ajax.js, js variable strRootURL
	*/
	var lngLastAdvVisible = 0;
	var objAdvTimer;
	
	//Coupon Preview
	function COUPON_Preview( lngID )
	{
		if ( objT = document.getElementById( 'couPreviewTitleBar' + lngID ) )
		{
			if ( objT.style.visibility == 'hidden' )
			{
				objT.style.visibility = 'visible';
			}
			else
			{
				objT.style.visibility = 'hidden';
			}
		}
		if ( objCou = document.getElementById( 'couListPreview' + lngID ) )
		{
			if ( objCou.style.visibility == 'hidden' )
			{
				objCou.style.visibility = 'visible';
			}
			else
			{
				objCou.style.visibility = 'hidden';
			}
		}
		return;
	}
	
	//Coupon Clip
	function COUPON_Clip( lngID, lngClip )
	{
		var xmlHttp = AJAX_GetXMLHttp();
		if ( xmlHttp == null )
		{
			alert( "Error: Could not instantiate XmlHttp object." );
			return;
		}
		xmlHttp.open( 'GET', 'couponBasketClipDo.asp?cscID=' + lngID + '&cscClip=' + lngClip, true );
		xmlHttp.send( 'cscID=' + lngID + '&cscClip=' + lngClip );
		xmlHttp.onreadystatechange = function()
		{
			if ( xmlHttp.readyState == 4 && xmlHttp.status == 200 )
			{
				//Title Bar
				var objT = document.getElementById( 'couTitleBar' + lngID );
				//Preview Title Bar
				var objTP = document.getElementById( 'couPreviewTitleBar' + lngID );
				//List Box
				var objB = document.getElementById( 'couListBox' + lngID );
				//Clip On
				var objC = document.getElementById( 'couClipOn' + lngID );
				//Clip On Preview
				var objCP = document.getElementById( 'couClipLabel' + lngID );
				//Clip Off
				var objU = document.getElementById( 'couClipOff' + lngID );
				//Clip Off Preview
				var objUP = document.getElementById( 'couClipLabelOff' + lngID );
				if ( lngClip == 1 )
				{
					objT.className = 'couTitleBarSel';
					objTP.className = 'couPreviewTitleBarSel';
					objB.className = 'couListBoxSel';
					objC.style.display = 'none';
					objCP.style.display = 'none';
					objU.style.display = 'block';
					objUP.style.display = 'block';
				}
				if ( lngClip == 0 )
				{
					objT.className = 'couTitleBar';
					objTP.className = 'couPreviewTitleBar';
					objB.className = 'couListBox';
					objU.style.display = 'none';
					objUP.style.display = 'none';
					objC.style.display = 'block';
					objCP.style.display = 'block';
				}
			}
		}
	}
	
	//Coupon Print
	function COUPON_Print( lngID, lngReprint )
	{
		if ( navigator.appName == 'Microsoft Internet Explorer' )
		{
			document.getElementById( 'TMSCouponPrinter' ).href = 'couponBasketPrint.asp?print=1&cscID=' + lngID + '&reprint' + lngReprint;
			window.print();
		}
		else if ( navigator.appName == 'Netscape' )
		{
			frames[ 'frameTMSCouponPrinter' ].location.href = 'couponBasketPrint.asp?print=1&cscID=' + lngID + '&reprint' + lngReprint;
		}
		else
		{
			window.open( 'couponBasketPrint.asp?print=1&cscID=' + lngID + '&reprint' + lngReprint, 'TMSCoupons' );
		}
		//Title Bar
		var objT = document.getElementById( 'couTitleBar' + lngID );
		//Title Bar Preview
		var objTP = document.getElementById( 'couPreviewTitleBar' + lngID );
		//List Box
		var objB = document.getElementById( 'couListBox' + lngID );
		//Print On
		var objP = document.getElementById( 'couPrintOn' + lngID );
		//Print Off
		var objU = document.getElementById( 'couPrintOff' + lngID );
		objT.className = 'couTitleBarSel';
		objTP.className = 'couPreviewTitleBarSel';
		objB.className = 'couListBoxSel';
		objP.style.display = 'none';
		objU.style.display = 'block';
		return;
	}
	
	//Coupon Print Basket
	function COUPON_PrintBasket( lngReprint )
	{
		if ( navigator.appName == 'Microsoft Internet Explorer' )
		{
			document.getElementById( 'TMSCouponPrinter' ).href = 'couponBasketPrint.asp?print=1&reprint=' + lngReprint;
			window.print();
		}
		else if ( navigator.appName == 'Netscape' )
		{
			frames[ 'frameTMSCouponPrinter' ].location.href = 'couponBasketPrint.asp?print=1&reprint=' + lngReprint;
		}
		else
		{
			window.open( 'couponBasketPrint.asp?print=1&reprint=' + lngReprint, 'TMSCoupons' );
		}
		return;
	}
	
	function COUPON_DisplayAdvertiser( lngID )
	{
		//hide the last advertiser
		if ( lngLastAdvVisible != lngID )
		{
			if ( objAdv = document.getElementById( 'couAdvInfoBlock' + lngLastAdvVisible ) )
			{
				objAdv.style.visibility = 'hidden';
			}
		}
		if ( objAdv = document.getElementById( 'couAdvInfoBlock' + lngID ) )
		{
			if ( objAdv.style.visibility == 'hidden' )
			{
				objAdv.style.visibility = 'visible';
				lngLastAdvVisible = lngID;
			}
			else
			{
				objAdv.style.visibility = 'hidden';
				lngLastAdvVisible = 0;
			}
		}
	}
	
//-->
