
		


		
		


			jQuery().ready(function() {

		$("#specdata table").attr("class", "sortable");
		$('#sortable tr:odd,.sortable tr:odd').addClass('odd');
		$('#sortable tr:even,.sortable tr:even').addClass('even');
		
		//$('#newlinks').append( $('#oldlinks').html() );
		//$('#oldlinks').remove();
		
		$.ajaxSetup ({ cache: false });
		
		$('ul#slideshow').animatedinnerfade({
			speed: 1000,
			timeout: 5000,
			type: 'random',
			containerheight: '160px',
			containerwidth: '196px',
			animationSpeed: 5000,
			animationtype: 'fade',
			bgFrame: 'none',
			controlBox: 'none',
			displayTitle: 'none'
		});
	/*
		$('#otherEquip').append( $('#c630D94FD-5633-479B-8CA9-35D67B1E9733').html() );
		$('#c630D94FD-5633-479B-8CA9-35D67B1E9733').html('');
		
		$('#otherEquip').append( $('#cD34C6F27-2498-4069-AB5B-4565817CF7E1').html() );
		$('#cD34C6F27-2498-4069-AB5B-4565817CF7E1').html('');
		
		$('#otherEquip').append( $('#c319A3907-380B-4661-9E59-F3A3D7196EF0').html() );
		$('#c319A3907-380B-4661-9E59-F3A3D7196EF0').html('');
		
		$('#otherEquip').append( $('#cDF98299F-48B7-43A7-95F0-7BD3AB1EAD7F').html() );
		$('#cDF98299F-48B7-43A7-95F0-7BD3AB1EAD7F').html('')
	*/

		verifySerial = function(serial) {
			return $.ajax({ 
				type: "POST", 
				url: "/index.cfm/p/pages.customer-center/customerinfo/update.htm", 
				cache: false, 
				data: 'serial='+ serial,
				async: false	
			}).responseText;	
	  	}

		$("a.iframe").fancybox({
			'autoDimensions'		: false,
			'hideOnContentClick'	: false,
			'frameWidth'			: 1024,
			'frameHeight'			: 664,
			'width'					: 1024,
			'height'				: 664,
			'padding'				: 0,
			'margin'				: 0,
			'overlayShow'			: false,
			'zoomSpeedIn'			: 600,
			'zoomSpeedOut'			: 500,
			'easingIn'				: 'easeOutBack',
			'easingOut'				: 'easeInBack',
			'centerOnScroll'		: false,
			'callbackOnStart'		: function () { $.fn.fancybox.showLoading(); }			
		}); 

		scaleJobPics = function() {

			$('#viewport img').load(function() {

				$('#viewport img').each(function() {
					var maxWidth = 382; // Max width for the image
					var maxHeight = 360;    // Max height for the image
					var ratio = 1;  // Used for aspect ratio
					var width = $(this).width();    // Current image width
					var height = $(this).height();  // Current image height
			 
					// Check if the current width is larger than the max
					if(width > maxWidth){
						ratio = maxWidth / width;   // get ratio for scaling image
						$(this).css("width", maxWidth); // Set new width
						$(this).css("height", height * ratio);  // Scale height based on ratio
						height = height * ratio;    // Reset height to match scaled image
					}
			 
					// Check if current height is larger than max
					if(height > maxHeight){
						ratio = maxHeight / height; // get ratio for scaling image
						$(this).css("height", maxHeight);   // Set new height
						$(this).css("width", width * ratio);    // Scale width based on ratio
						width = width * ratio;    // Reset width to match scaled image
					}
				
				});
			
			});
	  	}
		
		$('#serialbtn').click(function () { 
			if ($('#newserial').val() == "") { alert('Please enter a serial number.'); return; }
			if (verifySerial( $('#newserial').val() ).indexOf('invalid') != -1) alert('The serial number you entered has not yet been registered with the website.');
			$('#seriallist').prepend( '<div class="serials"><input type="hidden" name="serials" value="' + $('#newserial').val() + '">' + $('#newserial').val() + '<a href="#" title="remove serial number" onclick="$(this).parent().remove(); return false;">&nbsp;</a></div>' );
		});
		
		$('#icemap a').cluetip({
			splitTitle: '|', showTitle:false, clickThrough:true, width:170, positionBy:'mouse'
		});
		
		$('.calevent').cluetip({
			sticky:true, closePosition: 'title', showTitle:false, width:200, positionBy:'mouse', ajaxSettings: { cache:false }
		});

		$("a.fancy").fancybox({
			'autoDimensions'		: false,
			'hideOnContentClick'	: false,
			'frameWidth'			: 660,
			'frameHeight'			: 500,
			'width'					: 660,
			'height'				: 500,
			'overlayShow'			: false,
			'zoomSpeedIn'			: 600,
			'zoomSpeedOut'			: 500,
			'easingIn'				: 'easeOutBack',
			'easingOut'				: 'easeInBack',
			'centerOnScroll'		: false,
			'callbackOnClose'		: function() { $('#viewport').html(''); }			
		}); 
		
		comVid = function(vid) {
			$('#comvid').media({ 
				width:     425, 
				height:    344, 
				autoplay:  false, 
				src:       vid,
				params:		{ showControls : 'true', scale: 'aspect', wmode: 'transparent', flashvars: '&file='+vid+'&autostart=true' },
				caption:   false 
			}); 
		}
		
		setNewsPop = function() {

			$('#webcredits').append('<a class="inline" id="newsPop" href="#xvidPop"></a>');		

			$("a.inline").fancybox({
				'autoDimensions'		: false,
				'hideOnContentClick'	: false,
				'frameWidth'			: 780,
				'frameHeight'			: 460,
				'width'					: 780,
				'height'				: 460,
				'overlayShow'			: true,
				'zoomSpeedIn'			: 600,
				'zoomSpeedOut'			: 500,
				'easingIn'				: 'easeOutBack',
				'easingOut'				: 'easeInBack',
				'centerOnScroll'		: false,
				'callbackOnShow'		: function() { $('#vidPop').appendTo('#fancy_div').show(); },
				'callbackOnClose'		: function() { $('#vidPop').html(''); }
			});
			
			$('#newsPop').trigger('click'); 
			return false;

		}


	});
	

	

	
