
/*This file created to add site js functions */
document.write('<script src="', '/Scripts/swfobject_2_1.js', '" type="text/JavaScript"><\/script>');
document.write('<script src="', '/Scripts/jquery-1.3.2.min.js', '" type="text/JavaScript"><\/script>');
document.write('<script src="', '/Scripts/addDiv.js', '" type="text/JavaScript"><\/script>');


function onloadListener(func)
{
	if(window.addEventListener)
	{
		window.addEventListener('load', func, false);
	}
	else if(window.attachEvent)
	{
		window.attachEvent('onload', func);
	}
}

onloadListener(function(){

try { document.execCommand('BackgroundImageCache', false, true);} catch(e) {}

});

function styleSizer(whichStyle)
{
	//reset all the images
		//then set the correct font
	if(whichStyle=="smallFont"){
		setActiveStyleSheet('Small Text'); 
		$('img[name=smallTextButton]').attr('src','/PublishingImages/common/utilityfontsmon.gif');
		$('img[name=mediumTextButton]').attr('src', '/PublishingImages/common/utilityfontmed.gif');
		$('img[name=largeTextButton]').attr('src', '/PublishingImages/common/utilityfontlg.gif');

	}else if(whichStyle=="mediumFont"){
		setActiveStyleSheet('Medium Text');
		$('img[name=smallTextButton]').attr('src', '/PublishingImages/common/utilityfontsm.gif');
		$('img[name=mediumTextButton]').attr('src', '/PublishingImages/common/utilityfontmedon.gif');
		$('img[name=largeTextButton]').attr('src', '/PublishingImages/common/utilityfontlg.gif');
	}else if(whichStyle=="largeFont"){
		setActiveStyleSheet('Large Text');
		$('img[name=smallTextButton]').attr('src', '/PublishingImages/common/utilityfontsm.gif');
		$('img[name=mediumTextButton]').attr('src', '/PublishingImages/common/utilityfontmed.gif');
		$('img[name=largeTextButton]').attr('src', '/PublishingImages/common/utilityfontlgon.gif');
	}
}


function writeImages(){
	 var cookie = readCookie("style");
 	 var title = cookie ? cookie : getPreferredStyleSheet();
 	 //alert(title);
	//regularFont, largerFont, largestFont
	if(title==null || title=='Small Text'){
		return('<a href="#" onClick="javascript:styleSizer(\'smallFont\');"><img src="/PublishingImages/common/utilityfontsmon.gif" alt="Small text" name="smallTextButton" /></a><a href="#" onClick="javascript:styleSizer(\'mediumFont\');"><img src="/PublishingImages/common/utilityfontmed.gif" alt="Medium text" name="mediumTextButton" /></a><a href="#" onClick="javascript:styleSizer(\'largeFont\');"><img src="/PublishingImages/common/utilityfontlg.gif" alt="Large text" name="largeTextButton" /></a>');
	}else if(title=='Medium Text'){
		return('<a href="#" onClick="javascript:styleSizer(\'smallFont\');"><img src="/PublishingImages/common/utilityfontsm.gif" alt="Small text" name="smallTextButton" /></a><a href="#" onClick="javascript:styleSizer(\'mediumFont\');"><img src="/PublishingImages/common/utilityfontmedon.gif" alt="Medium text" name="mediumTextButton" /></a><a href="#" onClick="javascript:styleSizer(\'largeFont\');"><img src="/PublishingImages/common/utilityfontlg.gif" alt="Large text" name="largeTextButton" /></a>');
	}else if(title=='Large Text'){
		return('<a href="#" onClick="javascript:styleSizer(\'smallFont\');"><img src="/PublishingImages/common/utilityfontsm.gif" alt="Small text" name="smallTextButton" /></a><a href="#" onClick="javascript:styleSizer(\'mediumFont\');"><img src="/PublishingImages/common/utilityfontmed.gif" alt="Medium text" name="mediumTextButton" /></a><a href="#" onClick="javascript:styleSizer(\'largeFont\');"><img src="/PublishingImages/common/utilityfontlgon.gif" alt="Large text" name="largeTextButton" /></a>');
	}else{
		return('<a href="#" onClick="javascript:styleSizer(\'smallFont\');"><img src="/PublishingImages/common/utilityfontsmon.gif" alt="Small text" name="smallTextButton" /></a><a href="#" onClick="javascript:styleSizer(\'mediumFont\');"><img src="/PublishingImages/common/utilityfontmed.gif" alt="Medium text" name="mediumTextButton" /></a><a href="#" onClick="javascript:styleSizer(\'largeFont\');"><img src="/PublishingImages/common/utilityfontlg.gif" alt="Large text" name="largeTextButton" /></a>');
	}
}





function printerFriendly(siteStyle)
{ 
  var display_setting="toolbar=yes,location=no,directories=yes,menubar=yes,resizable=yes,"; 
      display_setting+="scrollbars=yes,width=650, height=600, left=100, top=25"; 
      
  var docprint=window.open("","",display_setting); 
   docprint.document.open(); 
   docprint.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">');
   docprint.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">');
   docprint.document.write('<html><head><title>' + document.title + '</title>'); 
   docprint.document.writeln('<link rel="stylesheet" type="text/css" href="/Styles/bpv3.css"/>');
   docprint.document.writeln('<link type="text/javascript" href="' + siteStyle + 'common.css"/>');
   docprint.document.writeln('<link media="screen" rel="stylesheet" type="text/css" href="/Styles/print.css"/>');
   docprint.document.writeln('<link media="print" rel="stylesheet" type="text/css" href="/Styles/print.css"/>');
   docprint.document.write('</head><body onLoad="self.print()">');          
   docprint.document.write('<table width=\"100%\" border=\"0\">');
   docprint.document.write('<tr><td>');
   docprint.document.write('<div id=\"container\">');
   docprint.document.write('<table width=\"770px\" border=\"0\">');
   docprint.document.write('<tr><td>');
   docprint.document.write('<div id=\"printHeader\">');
   docprint.document.write(document.getElementById('displayLogoPrintPage').innerHTML);  
   docprint.document.write('</div>');
   docprint.document.write('</tr></td>');
   docprint.document.write('<tr><td>');
   docprint.document.write('<div id=\"printContent\" >');
   docprint.document.write(document.getElementById('pageContent').innerHTML);  
   docprint.document.write('</div>');        
   docprint.document.write('</tr></td>');
   docprint.document.write('<tr><td>');
   docprint.document.write('<div id="printFooter">');
   docprint.document.write(document.getElementById('footerWrapper').innerHTML);    
   docprint.document.write('</div>');        
   docprint.document.write('</tr></td>');
   docprint.document.write('<tr><td>');
   docprint.document.write('<div id="printFooter2">');
   docprint.document.write(document.getElementById('links').innerHTML);    
   docprint.document.write('</div>');        
   docprint.document.write('</tr></td>');
   docprint.document.write('<tr><td>');
   docprint.document.write('<div id="printFooter3">');
   docprint.document.write(document.getElementById('globalLinks').innerHTML);    
   docprint.document.write('</div>');        
   docprint.document.write('</tr></td>');
   docprint.document.write('</table>');
   docprint.document.write('</div>');  
   docprint.document.write('</tr></td>');
   docprint.document.write('</table>');
   docprint.document.write('</body></html>'); 
   docprint.document.close(); 
   docprint.focus();
}


/*=============================================
--  Start of Printer Friendly
===============================================*/


function printPage() {
	var finalURL;
	var append = document.URL;
	if(append!=''){
	var urlSearchPage=window.location.pathname;
	urlSearchPage = urlSearchPage.toLowerCase();
	if(urlSearchPage.indexOf('results.aspx')!=-1)
	{
	finalURL=append + "&?type=print";			
	}
	else
	{
	finalURL=append + "?type=print";			
	}	
	window.open(finalURL, "mywindow", "toolbar=yes, location=no,directories=yes,menubar=yes,resizable=yes,status=1,scrollbars=1, width=650, height=600, left=100, top=25");
	}
}




/*===========================================================
-- Function acting in the page for opening the print window
===============================================================*/



function pageType() {
	
	
  var str = document.URL;
	
  
  point = str.lastIndexOf("?");
  var suffix = (str.substring(point+1,str.length));

  if ( (suffix == "type=print") || (str.indexOf("printerFriendly.html") > 0 ) ) {
	
	document.write('<link rel="stylesheet" type="text/css" href="/Styles/print.css" />');
		
this.window.print();

  }


}

/*======================
-- End of Function
=======================*/

/*=============================================
--  End of Printer Friendly
===============================================*/




