﻿
$( document ).ready( function () 
{
	// if javascript is supported, we hide the submit button and show a link instead
	$( "input:submit" ).hide();
	$( "#formloading" ).hide();
	$( "#formsubmit" ).show();
	$( "#formsubmit" ).click( function () 
														{
															$( "input:submit" ).click();
															$( "#formsubmit" ).hide();
															$( "#formloading" ).show();
														});
	
	$('A[rel="720x610"]').click( function() 
	{
  	window.open( $(this).attr('href'), this, 'width=720,height=610' );
    return false;
  });
	
	$('A[rel="474x590"]').click( function() 
	{
  	window.open( $(this).attr('href'), this, 'width=474,height=590' );
    return false;
  });
	
	/*
	var position = $('.left').offset();
	$('.helpBox').css( 'position', 'absolute' );
	$('.helpBox').css( 'top', position.top );
	$('.helpBox').css( 'left', $('body').offset().left +$('body').width() -$('.helpBox').width() );
	*/
	
	// format the item links
	__formatLinks ();
	
	// inject balloons
	__setBT();
});



function highlightInputError () 
{
	$( "#f_search" ).btOn();
	$( "#f_search" ).addClass( "error" );	
}


function __setBT () 
{
	// init some balloons
	$( ".listitem" ).bt({
		hoverIntentOpts: {
    	interval: 1000,
    	timeout: 2000
  	},
		showTip: function(box){
    	$(box).fadeIn(300);
  	},
		cssStyles: {
    	fontSize: '11px',
    	fontFamily: 'arial,helvetica,sans-serif',
			color: '#143b64'
  	},
		fill: '#f4f5f9',
    cornerRadius: 4,
		strokeStyle: '#143b64', 
		strokeWidth: 1,
    shadow: true,
    shadowOffsetX: 3,
    shadowOffsetY: 3,
    shadowBlur: 8,
    shadowColor: '#000',
    shadowOverlap: false,
    noShadowOpts: {strokeStyle: '#143b64', strokeWidth: 1},
		trigger: ['mouseover','mouseout'],
    positions: ['top','bottom']								
										 });
	
	$( ".balloon" ).bt( {
		hoverIntentOpts: {
    	interval: 500,
    	timeout: 2000
  	},
		showTip: function(box){
    	$(box).fadeIn(300);
  	},
  	hideTip: function(box, callback){
    	$(box).animate({opacity: 0}, 500, callback);
  	},
		cssStyles: {
    	fontSize: '11px',
    	fontFamily: 'arial,helvetica,sans-serif',
			color: '#143b64'
  	},
		fill: '#f4f5f9',
    cornerRadius: 4,
		strokeStyle: '#143b64', 
		strokeWidth: 1,
    shadow: true,
    shadowOffsetX: 3,
    shadowOffsetY: 3,
    shadowBlur: 8,
    shadowColor: '#000',
    shadowOverlap: false,
    noShadowOpts: {strokeStyle: '#143b64', strokeWidth: 1},
    positions: ['bottom', 'top']
										 });


	$( "#f_search" ).bt( {
		//trigger: ['none',],
		hoverIntentOpts: {
    	interval: 500,
    	timeout: 5000
  	},
		showTip: function(box){
    	$(box).fadeIn(300);
  	},
  	hideTip: function(box, callback){
    	$(box).animate({opacity: 0}, 500, callback);
  	},
		cssStyles: {
    	fontSize: '11px',
    	fontFamily: 'arial,helvetica,sans-serif',
			color: '#143b64'
  	},
		fill: '#f4f5f9',
    cornerRadius: 4,
		strokeStyle: '#143b64', 
		strokeWidth: 1,
    shadow: true,
    shadowOffsetX: 3,
    shadowOffsetY: 3,
    shadowBlur: 8,
    shadowColor: '#000',
    shadowOverlap: false,
    noShadowOpts: {strokeStyle: '#143b64', strokeWidth: 1},
    positions: ['bottom', 'top']
										 });
}


function __formatLinks () 
{	
		
		$( ".listitem" ).hover(
			function () 
			{
				$( this ).addClass( "listitemover" );

      }, 
      function () 
			{
        $( this ).removeClass( "listitemover" );
      }
		);
}