//<!--

$(document).ready( function()
{
	// PNG image fix for IE6
	
	/*// Toggle feedback boxes
	$('.feedback_box').click(function(event)
	{
		event.preventDefault();
		event.stopImmediatePropagation();
		$(this).toggle();
		return false;
	});*/
	
	// Print page and record analytics hit
//	$('.print_click').click(function(event)
//	{
//		event.preventDefault();
//		event.stopImmediatePropagation();
//		
//		record_page_hit( $(this).attr('rel') );
//		window.print();
//		
//		return false;
//	});
	
	// Print page and record analytics hit
//	$('.analytics_click').click(function(event)
//	{
//		record_page_hit( $(this).attr('rel') );
//		return true;
//	});
//	
//	$('a.inline').fancybox({'hideOnContentClick': true, 'overlayOpacity': 0.3, 'padding': 0});
//	
//	// Setup modal window
//	if ( $('.iframe_opt_in').length > 0 )
//	{
//		$('.iframe_opt_in').fancybox({ 
//			'frameWidth': 408
//			, 'frameHeight': 300
//			, 'overlayOpacity': 0.3
//			, 'padding': 0
//			, 'hideOnContentClick': false
//			, 'centerOnScroll': false
//			//, 'callbackOnClose': function () { $('#fancy_frame').remove(); }
//		});
//	}
//	
//	if ( $('.iframe_sign_in').length > 0 )
//	{
//		$('.iframe_sign_in').fancybox({ 
//			'frameWidth': 408
//			, 'frameHeight': 270
//			, 'overlayOpacity': 0.3
//			, 'padding': 0
//			, 'hideOnContentClick': false
//			, 'centerOnScroll': false
//			//, 'callbackOnClose': function () { $('#fancy_frame').remove(); }
//		});
//	}
//	
//	if ( $('.iframe_sign_up').length > 0 )
//	{
//		$('.iframe_sign_up').fancybox({ 
//			'frameWidth': 408
//			, 'frameHeight': 270
//			, 'overlayOpacity': 0.3
//			, 'padding': 0
//			, 'hideOnContentClick': false
//			, 'centerOnScroll': false
//			//, 'callbackOnClose': function () { $('#fancy_frame').remove(); }
//		});
//	}
//	
//	if ( $('.iframe_forward').length > 0 )
//	{
//		$('.iframe_forward').fancybox({ 
//			'frameWidth': 408
//			, 'frameHeight': 333
//			, 'overlayOpacity': 0.3
//			, 'padding': 0
//			, 'hideOnContentClick': false
//			, 'centerOnScroll': false
//			//, 'callbackOnClose': function () { $('#fancy_frame').remove(); }
//		});
//	}
	
});

/** 
* 
*/
function record_page_hit( page )
{
	if ( page.length > 0 )
	{
		// Change iframe src to make a faux page hit with some relevance
		$('#iframe_analytics').attr('src', base_url +'home/analytics/'+ page);
	}
}

/**
*
*/
function limitText( limitField, limitCount, limitNum, doNotLimit )
{
	if ( limitField.value.length > limitNum && doNotLimit == true )
	{
		limitField.value = limitField.value.substring(0, limitNum);
	}
	else
	{
		$('#'+ limitCount).html(limitNum - limitField.value.length);
	}
}

/** 
* 
*/
function toggle_clickHandler( event, element_id )
{
	if (event) event.preventDefault();
	$(element_id).slideToggle('fast');
	return false;
}

/** 
* 
*/
function updateSiteEmailFields()
{
	// Populate e-mail fields
	var email = $.cookies.get('email');
	if (email != 'undefined' && email != 'null' && email != null && email != '')
	{
		$('input[name=email]').each(function(index){
			$(this).val( email );
		});
	}
}

function printDiv()
{
  var divToPrint=document.getElementById('DivIdToPrint');
  var newWin=window.open('','Print-Window','width=100,height=100');
  newWin.document.open();
  newWin.document.write('<html><body onload="window.print()">'+divToPrint.innerHTML+'</body></html>');
  newWin.document.close();
  setTimeout(function(){newWin.close();},10);
}
function printPg()
{

	if(document.all.tags("div").item("print"))
	{
		if(document.all.tags("div").item("print").length)
		{
			for(var i=0; i<document.all.tags("div").item("print").length; i++)
			{
				document.all.tags("div").item("print")[i].style.visibility = "hidden"
			}
			window.print()
			for(var i=0; i<document.all.tags("div").item("print").length; i++)
			{
				document.all.tags("div").item("print")[i].style.visibility = "visible"
			}
		}
		else
		{
			document.all.tags("div").item("print").style.visibility = "hidden"
			window.print()
			document.all.tags("div").item("print").style.visibility = "visible";
		}
	}
	else
	{
		window.print()
	}
}



//-->
