//Old  Printer friendly function for Survey Schedule 
//See below for new version, function CallPrint
function openNewPrinterFriendlyVersion() {
try { 
 	alert("Ensure your Browser settings are set to Print Background colours and images...."); 
 var sArray;

$printableText = new Array();

	var i = 0;
	var j = 0;
	var byteCount = 0;
	var printableHead;
	 
	var newHead;
	var newText1;
	var newText2;
	var newText3;
	var arrid = 1
	
	if((bName() == 2 && bVer() >= 5) || (bName() == 1)) 
	{				
			 for (var i=0; i < document.all.length; i++)
					   {
					   
							switch (document.all(i).id.substr(0,12))
							{
								case "printableid_" :
								{
								
									//var idAttribute = document.all(i).id.split('_');
									//var arrid = idAttribute[1];
									//for (var j=0; i <document.all(i).childNodes.length; j++)
									//{
									//window.alert('found' );
									//}
									//window.alert('test alert ' + document.all(i).childNodes.count);
									
									var idAttribute = document.all(i).id.split('_');
											
											
											$printableText[arrid] = document.all(i).innerHTML + "</BR>"  ;
											arrid = arrid + 1;
											break;
									//$printableText[arrid] = document.getElementById("printableid_" + (idAttribute[1]));		
								}	
					   		}
					   	}
		
		
		
 
		var win = window.open("", "win", "toolbar=1,location=0,directories=0,status=0,menubar=1,scrollbars=1,resizable=1,width=600,height=300"); // a window object			
		if (win && win.top)
		{
		
			win.document.open("text/html", "replace");
			win.document.write( "<HTML><body><style> .TableHeader {FONT-SIZE: 9pt; COLOR: #d7eceb; FONT-FAMILY: Arial; BACKGROUND-COLOR: #144b48} .bodyHeader { FONT-WEIGHT: bold; FONT-SIZE: 12pt; COLOR: #005150; FONT-FAMILY: arial,sans-serif; TEXT-DECORATION: none } .bodyText {FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: arial,sans-serif; TEXT-DECORATION: none} .lightGreenLinks {FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: arial,sans-serif; TEXT-DECORATION: none} .logo {FONT-WEIGHT: bold; FONT-SIZE: 12pt; COLOR: #005150; FONT-FAMILY: arial,sans-serif; TEXT-DECORATION: none} .boldBlackHeader { FONT-WEIGHT: bold; FONT-SIZE: 10pt; COLOR: #000000; FONT-FAMILY: arial,sans-serif; TEXT-DECORATION: none } </style><DIV ID='newHead'></DIV><DIV ID='newText1'></DIV><font></body></HTML>");
			
			//loop through the array to populate the Div	
			var y;
			
			for (y = 1; y <($printableText.length); y++)
				{
					win.document.getElementById("newText1" ).innerHTML += $printableText[y];
		
				}
			
			win.document.close();
		}
		else
		{
			alert("Pop-ups are blocked for this site. Please allow pop-ups to view the printer-friendly version of the schedule.");
		}
	}
	else	{
				throw "Error 1"
	
			}
	}

catch(er)	
			{
			if(er == "Error 1") 
			 	alert("Browser upgrade required for print functionality. Use landscape printing.");
		 
			} 


}

//New  Printer friendly function for Survey Schedule 19 June 2008
function CallPrint(elementID)
{
	try 
	{ 
		alert("Ensure your Browser settings are set to Print Background colours and images...."); 
		var printContent = document.getElementById(elementID);
		var WinPrint = window.open('','','left=0,top=0,width=600,height=400,resizable=1,menubar=1,toolbar=1,scrollbars=1,status=1');      
		if (WinPrint && WinPrint.top)
		{
			WinPrint.document.write('<html>');
			WinPrint.document.write('<head><link rel="stylesheet" type="text/css" href="/CmsWeb/css/SurveySchedule.css"/>');
			WinPrint.document.write('<body>');
			WinPrint.document.write('<div id="divPrint" >');
			WinPrint.document.write(printContent.innerHTML);
			WinPrint.document.write('</div>');
			WinPrint.document.write('</body>');
			WinPrint.document.write('</html>');
			WinPrint.document.close();
			WinPrint.focus();
			//WinPrint.print();
		}
		else
		{
			alert("Pop-ups are blocked for this site. Please allow pop-ups to view the printer-friendly version of the schedule.");
		}
	}
	catch(er)
	{
	}
}
