// On Page Load Items

Cufon.replace('h2', {textShadow: '#e2e2e2 2px 2px', fontWeight: 'bold'}); // Grey on white
Cufon.replace('h3:not(.no_shadow)', {textShadow: '#e2e2e2 2px 2px', fontWeight: 'normal'}); // Grey on white
Cufon.replace('.replace, .content_tabs li a, .case_studies li, #top_navigation li a, #footer .abs_link', {fontWeight: 'normal'});	
Cufon.replace('.bold_replace, .standard_details h3:not(.case_study_block h3)', {fontWeight: 'bold'});	  
Cufon.replace('#feature_wrap h2', {textShadow: '#b53f37 2px 2px', fontWeight: 'bold'}); // Grey on red 
Cufon.replace('#feature_wrap h3', {textShadow: '#b53f37 2px 2px', fontWeight: 'normal'}); // Grey on red
Cufon.replace('.sst_blue #feature_wrap h2', {textShadow: '#546ea7 2px 2px', fontWeight: 'bold'}); // Grey on blue
Cufon.replace('.sst_blue #feature_wrap h3', {textShadow: '#546ea7 2px 2px', fontWeight: 'normal'}); // Grey on blue

$(document).ready(function(){
	
	// Auto wrap additional layout divs
	$('.rounded_content_wrap', $('#content')).not('.fixed').wrapInner('<div class="rounded_content_inner auto_inserted"><div class="rounded_content_bottom auto_inserted"></div></div>').addClass('fixed');
	
	/*
	// Hide on page load
	$('div.nav_slide_inner',$('#sectors_block')).hide();
	$('div.nav_slide_inner',$('#ranges_block')).hide();
	$('div.nav_slide_inner',$('#information_block')).hide();
	
	// Menu Sliders
	$('.slide_activator').click(function(){
	
		var active_nav = $(this).parent().attr('id');
		createCookie('active_nav', active_nav, 7);
		
		$('.nav_slide_inner')
			.not( $(this).parents('.nav_parent').find('.nav_slide_inner').slideDown('fast') )
			.slideUp('slow');
		
		return false;
		
	});
	
	// If there is an active menu item, show that one.
	if( $('.active',$('#navigation')).length > 0 ) {
		var activeParent = $('.active',$('#navigation')).parents('div.nav_slide_inner');
		activeParent.show();
	}else{
		// Nothing active, open one based on cookie (or sectors_block by default)
		var open_nav = (readCookie('active_nav')) ? readCookie('active_nav') : "sectors_block" ;
		$('#' + open_nav).find('.nav_slide_inner').show();		
	}
	*/

	$('.red_inline_list li:first-child').addClass('first');
	
	// Disabling right-click
	/*	
	$(document).bind("contextmenu",function(){
		return false;
	});
	*/
	
	// Bookmarking Page
	if(window.opera){
		if ($("#bookmark_page").attr("rel") != ""){
			$("#bookmark_page").attr("rel","sidebar");
		}
	}
	
	$("#bookmark_page").click(function(event){
	
		event.preventDefault();
		
		if (window.sidebar){
			window.sidebar.addPanel("Call Systems Technology", this.href, "");
		} else if(window.external) {
			window.external.AddFavorite("Call Systems Technology", this.title);
		} else if(window.opera) {
			return false;
		}else{
			alert('Please bookmark this page manually.');
		}
	
	});
	
	// Top Site / Product Search Bars

	$('input',$('#header')).bind("focus blur",function(e) {
		
		// Blur
		if(($(this).val() == "") && e.type == "blur") {
			$(this).val($(this).data('defaultValue'));
		}
		
		// Focus
		if($(this).val() == $(this).data('defaultValue') && e.type == "focus") {
			$(this).val('');
		}			
		
	});		

	$('input',$('#header')).each(function(){
		$(this).data('defaultValue', $(this).val());
	});
	
	// PDF Download Access Restrictions

	$('a[href$=.pdf]').not('.no_link_rewrite').each(function(){	
		// Remove HREF, place it in data to make it less visible to users (but still accessible from search engines)
		$(this).data('brochure_link',$(this).attr('href'));
		$(this).attr('href', '/downloads/download.pdf');
	}).click(function() {
			
		$.capture($(this));
		return false;
		
	});		
	
});