// JavaScript Document
	
	$(document).ready(function(){
						
		//if (!($.browser.msie)) { }
		
		/* $('#slide_show_container').innerfade({ 
			speed: 'normal', 
			timeout: 6000, 
			type: 'sequence', 
			containerheight: '435px'
		});
		
		
		$('#prod_image a').lightBox();
		$('#v_image a').lightBox();
		$('a#tImg').lightBox();
		$('a#oslImg').lightBox();
		//$('a#galImg').lightBox();
		
		for (i=0;i<1000;i++) { $('a#bdyImg' + i + '').lightBox(); } */
		
		function ipmSwap() 
		{
			var parent = '#publication_issue';
				thumb  = parent + ' .ipm_thumb li a';
			
			$(thumb).click(function(){
					
				hrefImage = $(this).attr('href');
				hrefUrl   = $(this).attr('ref');
				imgHref   = parent + ' .ipm_image a';
				imgSrc    = imgHref + ' img';
				
				$(imgHref).removeAttr('href'); $(imgHref).attr('href', hrefUrl);
				$(imgSrc).removeAttr('src');   $(imgSrc).attr('src', hrefImage);
				
				return false;
			});
			
		}	ipmSwap();
		
		
		$('#tabHeader ul').tabify();
		$('#stories #tabHeader').remove();
		
		$('.appnitro ul .buttons input').hoverFX(.8, 50);
		$('.appnitro ul .buttons #saveForm').css('padding', '3px 10px')
											.css('font-weight', 'bold')
											.val('SEND');
		
		function testiAlignContent(type) 
		{
			$('.testi_content:' + type + ' .testi_img').css('float', 'right');
			$('.testi_content:' + type + ' .testi_text').css('float', 'left');
			$('.testi_content:' + type + ' .testi_text .testi_info').css('float', 'right')
																	.css('text-align', 'right');
		
		}	//testiAlignContent('odd');
		
		
		$('ol.bullet_list_num li').wrapInner('<span />');
		//$('ul.bullet-list li ').css('color', '#c00');
		
		function onlyLastChild()
		{
			tagName = [
				'.rc_content p, blockquote p', 
				'.list_info, #body_wrapper p', 
				'#dir_content .rc_wrap .rc_content .rc_guts #dir_info_right ul li', 
				'#dir_content .rc_wrap .rc_content .rc_guts #dir_info_left p' 
			]
			
			for (i=0;i<tagName.length;i++)
			{
				$('' + tagName[i] + ':only-child, ' + tagName[i] + ':last-child').css('margin', '0');
			}
			
		}	//onlyLastChild();
		
		
		function youTubeVideo() 
		{
			var flashVars = "?rel=0&autoplay=1";
			var currentHeight = 322;
			
			$('#video_thumb a').each(function(){
				var mov = $(this).attr('href');
				
				$(this).click(function(){
					$('#video_thumb a').removeAttr('rel');
					$(this).attr('rel', 'vCurrent');
					
					if (mov != '#Undefine')
					{
						url = $(this).attr('href') + flashVars;
						$('#player iframe').removeAttr('src');
						$('#player iframe').attr('src', url);
					}
					else
					{
						$('#player iframe').remove();
						$('#player').html('<p class="vidErrMsg">No video found.</p>');
					}
					
					return false;
				});
			});
			
			$('#player').hover(
				function(){
					$(this).animate({height: currentHeight + 27}, 'fast');
				}, 
				function(){
					$(this).animate({height: currentHeight}, 'fast');
				}
			);
			
		}	youTubeVideo();
		
		
		$('#search_form').bind('click', function(){
		
			$('#search_form').removeAttr('style');
			$(this).css('border', '2px solid #1986AF');
		
		});
		
		
		function publicFeature()
		{
			num = 2;
			bordrSize = num * 2;
			
			// console.log(bordrSize);			
			
			widthNum = $('.page_image li a .img_container').width();
			borderWidth = (!($.browser.msie)) ? (widthNum - bordrSize) : widthNum;
			
			nameHeight = $('.page_image li a .txt_container').height();
			
			heightNum = $('.page_image li a .img_container').height();
			borderHeight = (!($.browser.msie)) ? (heightNum - bordrSize) : heightNum;
			
			$('.page_image li a .pub_border')
							.css('width', borderWidth + 'px')
							.css('height', borderHeight + 'px')
							.css('border-width', num + 'px');
			
			$('.page_image li a').hover(
				function(){ 
					$(this).stop().animate({bottom:'0'}, 'fast')
							.find('.txt_container').stop().animate({bottom:'-' + (nameHeight * num) + 'px'}, 'fast');			
				},	
				function(){
					$(this).stop().animate({bottom:'-' + (nameHeight / 2) + 'px'}, 'normal')
							.find('.txt_container').stop().animate({bottom:'' + (nameHeight / 2) + 'px'}, 'normal');
			});
			
		} 	publicFeature();
		
		
		$("#slideshow").SexySlider({
			width     : 708,
			height    : 300,
			delay     : 10000,
			strips    : 1,
			autopause : false,
			stripSpeed : 700,
			titleOpacity : 0, // 0.5, 
			navigation: '#navigation',
			control   : '#control',
			effect    : 'fade', 
			direction : 'alternate'
		});
		
		//console.log($('#slider').attr('id'));
		
		jQuery.fn.sliderContent = function() 
		{
			parent      = $(this).attr('id');
			slidesCount = $('#' + parent + ' ul li').get().length;
			
			if (slidesCount > 1)
			{
				$('#' + parent + '').easySlider({
					auto: true,
					speed: 700,
					continuous: true, 
					pause: 5000, 
					//numeric: true
				});
			}
		}	
		
		$('#slider').sliderContent();
	
	});
	
	
