$(document).ready(function() 
{
	$("a[rel^='prettyPhoto']").prettyPhoto();
	
	$('#partnerLink').click(function() 
	{
		$('#partnerTabContent').show();
		$('#relatedTabContent').hide();
		$('#partnerLink').addClass('active');			
		$('#relatedLink').removeClass('active');
		
	});

	$('#relatedLinkClick').click(function() 
	{
		$('#partnerTabContent').hide();
		$('#relatedTabContent').show();
		$('#partnerLink').removeClass('active');			
		$('#relatedLink').addClass('active');
	});


	/** DROP DOWN FOR RELATED **/
	$('#relatedOpen').click(function()
	{
		if($('ul.relatedDetail').css('display') == 'block')
		{
			$('ul.relatedDetail').children('.seeMoreDetail').each(function(){
				$(this).fadeIn('slow');				
			});
			$('#relatedOpen').hide();
			$('#relatedClose').show();
		}		
		if($('ul.relatedThumb').css('display') == 'block')
		{
			$('ul.relatedThumb').children('.seeMoreThumb').each(function(){
				$(this).fadeIn('slow');				
			});
			$('#relatedOpen').hide();
			$('#relatedClose').show();
		}		
	});
	
	$('#relatedClose').click(function()
	{
		if($('ul.relatedDetail').css('display') == 'block')
		{
			$('ul.relatedDetail').children('.seeMoreDetail').each(function(){
				$(this).hide();				
			});
			$('#relatedOpen').show();
			$('#relatedClose').hide();
		}
		if($('ul.relatedThumb').css('display') == 'block')
		{
			$('ul.relatedThumb').children('.seeMoreThumb').each(function(){
				$(this).hide();				
			});
			$('#relatedOpen').show();
			$('#relatedClose').hide();
		}
	});
	
	$('#partnerOpen').click(function()
			{
		if($('ul.partnerDetail').css('display') == 'block')
		{
			$('ul.partnerDetail').children('.seeMoreDetail').each(function(){
				$(this).fadeIn('slow');				
			});
			$('#partnerOpen').hide();
			$('#partnerClose').show();
		}		
		if($('ul.partnerThumb').css('display') == 'block')
		{
			$('ul.partnerThumb').children('.seeMoreThumb').each(function(){
				$(this).fadeIn('slow');				
			});
			$('#partnerOpen').hide();
			$('#partnerClose').show();
		}		
	});
	
	$('#partnerClose').click(function()
			{
		if($('ul.partnerDetail').css('display') == 'block')
		{
			$('ul.partnerDetail').children('.seeMoreDetail').each(function(){
				$(this).hide();				
			});
			$('#partnerOpen').show();
			$('#partnerClose').hide();
		}
		if($('ul.partnerThumb').css('display') == 'block')
		{
			$('ul.partnerThumb').children('.seeMoreThumb').each(function(){
				$(this).hide();				
			});
			$('#partnerOpen').show();
			$('#partnerClose').hide();
		}
	});

	
	/** CENTERING THE VIDEO NAVIGATION **/
	if($('.videoNav').length > 0)
	{
		var totalWidth = parseInt($('.videoNav').css('width').replace('px', ''));
		
		var infoWidth = parseInt($('div.previous').css('width').replace('px', ''))
						+ parseInt($('div.next').css('width').replace('px', ''))
						+ parseInt($('div.middleBtn').css('width').replace('px', ''));
		
		var margins = Math.floor((totalWidth - infoWidth) / 2);

		$('.middleBtn').css('marginLeft', margins);
	}
	
	/*$('#applicIpadBtn').click(function(){
		text = $('#applicIpad').val();
		
		alert(text);
		$.copy(text);
	});*/
});

/** SELECT BOX SKINNING **/
jQuery(document).ready(function() {
    jQuery("#postAsUser").select_skin();
    jQuery("#AdminOfChannels").select_skin();
    jQuery("#replaceChannelVideo").select_skin();
    jQuery("#categorie").select_skin();
    $("#datetimepicker").datetimepicker();
});
