/* Samples 
	// Get Page Cookie
	if(pid == '58'){
		alert(jQuery.browser.flash);
	}
*/


// Xcellimark:Ivan
$(document).ready(function(){
	// Get PageId
	var pid = $.cookie('page_id');
						   
	// Button Fade
	$(".fade").hover(
		function() {
			$(this).stop().animate({"opacity": "0"}, "fast");
		},
		function() {
			$(this).stop().animate({"opacity": "1"}, "fast");
		}
	);
	
	
	// Today In America Video 
	$("a[rel='tia']").prettyPhoto({
		hideflash: true, 
		show_title: false,
		callback: function(){
			// Video Closed Analytics
			_gaq.push(['_trackEvent', 'Video', 'Closed', 'Today In America']);
		}
	});
	$("a[rel='tia']").click(function() {
		// Video Opened Analytics
		_gaq.push(['_trackEvent', 'Video', 'Opened', 'Today In America']);
	});
	
	
	// Company Overview Video 
	$("a[rel='co']").prettyPhoto({
		hideflash: true, 
		show_title: false,
		callback: function(){
			// Video Closed Analytics
			_gaq.push(['_trackEvent', 'Video', 'Closed', 'Company Overview']);
		}
	});
	$("a[rel='co']").click(function() {
		// Video Opened Analytics
		_gaq.push(['_trackEvent', 'Video', 'Opened', 'Company Overview']);
	});
	
	
	
	/*    Newsletter   */
	$('#ccoptin').submit(function() {
		_gaq.push(['_trackEvent', 'Newsletter', 'Submission', 'Unconfirmed']);
	});
	// End Newsletter

	
	
	/*   Side Column Contact   */
	$("a.viewService3").prettyPhoto({
		iframe_markup: '<iframe src ="{path}" width="{width}" height="{height}" frameborder="no" scrolling="no"></iframe>',
		hideflash: true, 
		show_title: false,
		callback: function(){
			_gaq.push(['_trackEvent', 'Contact', 'Closed', 'Side Column Contact Form']);
		}
	});
	$("a.viewService3").bind({
		click: function() {
			// Opened Analytics
			_gaq.push(['_trackEvent', 'Contact', 'Opened', 'Side Column Contact Form']);	
		}
	});
/*
	$('form[action="/quick_contact.aspx"]').bind({
		mouseenter: function() {
			//_gaq.push(['_trackEvent', 'Contact', 'Submission', 'Side Column Contact Form']);
			alert("over");
		}
	});
*/
	// End Side Contact
	
	
	/*   testimonials   */
	if(pid == '58'){ // Home Page
		$.ajax({
			type: "GET",
			url: "images/sce/testimonials.xml",
			dataType: "xml",
			success: function(xml) {
				var randomNum = Math.floor(Math.random()*3);
				$(xml).find('testimonial').each(function(){
					var count = $(this).length;
					//var client = $(this).attr('id');
					var client = $(this).find('client').text();
					var comment = $(this).find('comment').text();
					//var url = $(this).find('url').text();
					//$('<div class="tmonial"></div>').html('<p>('+count+') '+comment+'</p>').appendTo('#tmonials');
					/*
					$(this).find('desc').each(function(){
						var brief = $(this).find('brief').text();
						var long = $(this).find('long').text();
						$('<div class="brief"></div>').html(brief).appendTo('#link_'+id);
						$('<div class="long"></div>').html(long).appendTo('#link_'+id);
					});
					*/
				});
				
		//$('<div class="tmonial"></div>').html('<p>('+count+') '+comment+'</p>').appendTo('#tmonials');
			}
		});
		
	}
	// End Testimonials





	
	// Home Page slider
	if(pid == '1' || pid == '58'){ // Home Page
		$('#slider1').s3Slider({timeOut: 6000});
	}
	
	
});

