var gAutoPrint = true; 
var rerel = new RegExp('<link(?:.|\\s)*?>','i');
var restyle = new RegExp('<style(?:.|\\s)*?</style>','i');

function SaveFunction()
{  
    var disp_setting="toolbar=yes,location=no,directories=yes,menubar=yes,"; 
    disp_setting+="scrollbars=yes,width=700, height=600, left=100, top=25"; 
		  
    var html = "<HTML>\n<HEAD>\n";

   if(!printReadyElemId)
   {
	alert("Could not find the printReady section in the HTML");
	return;
   }

	
    if (document.getElementById != null)
	{
		var html = '<HTML>\n<HEAD>\n';
				
		if (document.getElementsByTagName != null)
		{
			var headTags = document.getElementsByTagName("head");
			if (headTags.length > 0)
			{
				var h = headTags[0].innerHTML;

				while(h.match(rerel)) {
					var m = h.match(rerel);
					html += m;
					h = h.replace(m,'');
				}
				
				while(h.match(restyle)) {
					var m = h.match(restyle);
					html += m;
					h = h.replace(m,'');
				}

			}
		}

		html += "<style>.pagetools { display:none; }</style>";
	
    		html += '\n</HEAD>\n<BODY textsize=1>\n';
		html += '<div style=\"font-size:2pt;width:650px;word-wrap:break-word;\">';
			

		var printReadyElem = document.getElementById(printReadyElemId);
		if (printReadyElem != null) {
			var content = printReadyElem.innerHTML;
			content = content.replace(/width="100%"/gi,'');
			html += content;
		}
		else {
			alert("Could not find the printReady section in the HTML");
			return;
		} 
				
		html += '</div>';
		html += '\n</BODY>\n</HTML>';

		var win = window.open("","printhtml",disp_setting);
		var doc = win.document;
		doc.open("text/html", "replace");
		doc.write(html);
		doc.close();
		win.focus();
			
				
		if (gAutoPrint) {  
			win.print();
		} else	{
			alert("Sorry, the print ready feature is only available in modern browsers.");
		}
	}
}

$(document).ready(function() 
{
   $('#ctahomediv a[href][title]').qtip({
      content: {
        text: false
      },
      position: {
        corner: {
         target: 'bottomMiddle',
         tooltip: 'topLeft'
        }
   	  },
      style: {
		border: {
			width:2,
			radius:2,
			color:'#FFEC70'
        },
        color:'#666666',
        background:'#FFFAD7',
        padding: 5, 
        tip: true,
        name: 'cream'
       }
   });
});



